Commit 17be8c5d authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Переработал работу с гиперссылками:

1) Убрал _updateHyperlinksCache
2) Переработал asc_CHyperlink (теперь там хранится объект Hyperlink из модели
3) В следствии убрал onStartTriggerAction и onEndTriggerAction (которые нужны были для обновления гиперссылок), а также флаги nActionNested и bUpdateHyperlinks
4) Поправил в Hyperlink выставление Location (теперь при выставлении сразу генерируются Sheet и Range)
5) Поправил получение Location (можно выставить Sheet и Range, а потом получить Location)
6) Убрал лишние методы из asc_CHyperlink - asc_getHyperlinkRange, asc_setHyperlinkRange, asc_clone, asc_clear

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50186 954022d7-b5bf-4e40-9824-e11837661b57
parent 808b8b2a
......@@ -400,7 +400,6 @@
var api = new Asc.spreadsheet_api("wb-widget", "cv1");
//api.asc_setViewerMode(true);
var oTmpHyperlinkObj = null;
var aDialogNames = [];
var bIsUpdateChartProperties = false;
var bIsReopenDialog = false;
......@@ -867,7 +866,7 @@
case "td_add_hyperlink":
{
var oCellInfo = api.asc_getCellInfo();
oTmpHyperlinkObj = oCellInfo.asc_getHyperlink();
var oTmpHyperlinkObj = oCellInfo.asc_getHyperlink();
var oHyperText = $("#addHyperlink_text");
var oSelect = $("#addHyperlink_she");
......@@ -879,17 +878,18 @@
toggleHyperlinkDialog(true);
$("#addHyperlink_url").val("");
$("#addHyperlink_ran").val("A1");
}
else {
} else {
oHyperText.val(oTmpHyperlinkObj.asc_getText());
if (c_oAscHyperlinkType.WebLink === oTmpHyperlinkObj.asc_getType()) {
toggleHyperlinkDialog(true);
$("#addHyperlink_url").val(oTmpHyperlinkObj.asc_getHyperlinkUrl());
}
else if (c_oAscHyperlinkType.RangeLink === oTmpHyperlinkObj.asc_getType()) {
toggleHyperlinkDialog(false);
oSelect.val(oTmpHyperlinkObj.asc_getSheet());
$("#addHyperlink_ran").val(oTmpHyperlinkObj.asc_getRange());
switch (oTmpHyperlinkObj.asc_getType()) {
case c_oAscHyperlinkType.WebLink:
toggleHyperlinkDialog(true);
$("#addHyperlink_url").val(oTmpHyperlinkObj.asc_getHyperlinkUrl());
break;
case c_oAscHyperlinkType.RangeLink:
toggleHyperlinkDialog(false);
oSelect.val(oTmpHyperlinkObj.asc_getSheet());
$("#addHyperlink_ran").val(oTmpHyperlinkObj.asc_getRange());
break;
}
}
api.asc_enableKeyEvents(false);
......@@ -897,7 +897,7 @@
break;
}
case "td_auto_filter":{
api.asc_addAutoFilter()
api.asc_addAutoFilter();
break;
}
case "td_auto_filter_local":{
......@@ -1542,6 +1542,7 @@
var sUrl = $("#addHyperlink_url").val();
var sSheet = $("#addHyperlink_she").val();
var sRange = $("#addHyperlink_ran").val();
var oTmpHyperlinkObj = null;
var bHyp = false;
if( document.getElementById('selectTypeLink').selectedIndex == 0)
......@@ -1555,23 +1556,17 @@
$("#addHyperlink_err").text( "Error: Empty url" )
;$("#addHyperlink_err").hide();
$("#addHyperlink_err").show("slow");
}
else
{
} else {
$("#addHyperlink_err").hide();
$("#dialogAddHyperlink").dialog("close");
oTmpHyperlinkObj.asc_clear();
oTmpHyperlinkObj = new Asc.asc_CHyperlink();
oTmpHyperlinkObj.asc_setText (sText);
if( true == bHyp )
{
oTmpHyperlinkObj.asc_setType (c_oAscHyperlinkType.WebLink);
if( 0 != sUrl.indexOf("http://") )
if (true == bHyp) {
if (0 != sUrl.indexOf("http://"))
sUrl = "http://" + sUrl;
oTmpHyperlinkObj.asc_setHyperlinkUrl(sUrl);
}
else {
oTmpHyperlinkObj.asc_setType (c_oAscHyperlinkType.RangeLink);
} else {
oTmpHyperlinkObj.asc_setSheet(sSheet);
oTmpHyperlinkObj.asc_setRange(sRange);
}
......
......@@ -365,23 +365,14 @@ CHistory.prototype =
var oCurWorksheet = this.workbook.getWorksheet(this.workbook.getActive());
if(null != Point.nLastSheetId && Point.nLastSheetId != oCurWorksheet.getId())
this.workbook.handlers.trigger("showWorksheet", Point.nLastSheetId);
var aStartTriggerAction = new Object();
// Откатываем все действия в обратном порядке (относительно их выполенения)
for ( var Index = Point.Items.length - 1; Index >= 0; Index-- )
{
var Item = Point.Items[Index];
if(null != Item.SheetId && null == aStartTriggerAction[Item.SheetId])
{
var ws = this.workbook.getWorksheetById(Item.SheetId);
ws.onStartTriggerAction();
aStartTriggerAction[Item.SheetId] = ws;
}
Item.Class.Undo( Item.Type, Item.Data, Item.SheetId );
if (g_oUndoRedoWorksheet === Item.Class && historyitem_Worksheet_SetViewSettings === Item.Type)
isReInit = true;
}
for(var i in aStartTriggerAction)
aStartTriggerAction[i].onEndTriggerAction();
var oSelectRange = null;
if(null != Point.SelectRange)
oSelectRange = Point.SelectRange;
......@@ -434,12 +425,6 @@ CHistory.prototype =
this.Add(Class, Type, sheetid, range, Data, LocalChange);
if(bNeedOff)
this.TurnOff();
if(null != sheetid && null == oRedoObjectParam.aStartTriggerAction[sheetid])
{
var ws = this.workbook.getWorksheetById(sheetid);
ws.onStartTriggerAction();
oRedoObjectParam.aStartTriggerAction[sheetid] = ws;
}
Class.Redo( Type, Data, sheetid );
if (g_oUndoRedoWorksheet === Class && historyitem_Worksheet_SetViewSettings === Type)
oRedoObjectParam.bIsReInit = true;
......@@ -450,12 +435,6 @@ CHistory.prototype =
for ( var Index = 0; Index < Point.Items.length; Index++ )
{
var Item = Point.Items[Index];
if(null != Item.SheetId && null == oRedoObjectParam.aStartTriggerAction[Item.SheetId])
{
var ws = this.workbook.getWorksheetById(Item.SheetId);
ws.onStartTriggerAction();
oRedoObjectParam.aStartTriggerAction[Item.SheetId] = ws;
}
Item.Class.Redo( Item.Type, Item.Data, Item.SheetId );
if (g_oUndoRedoWorksheet === Item.Class && historyitem_Worksheet_SetViewSettings === Item.Type)
oRedoObjectParam.bIsReInit = true;
......@@ -472,8 +451,6 @@ CHistory.prototype =
}
if(null == Point)
return;
for(var i in oRedoObjectParam.aStartTriggerAction)
oRedoObjectParam.aStartTriggerAction[i].onEndTriggerAction();
for(var i in Point.Triggers)
this.workbook.handlers.trigger.apply(this.workbook.handlers, Point.Triggers[i]);
var oSelectRange = null;
......
......@@ -2597,25 +2597,20 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, oDrawings, aDxf
this.bs.WriteItem(c_oSerWorksheetsTypes.Hyperlink, function(){oThis.WriteHyperlink(elem.data);});
}
};
this.WriteHyperlink = function(oHyperlink)
{
if(null != oHyperlink.Ref)
{
this.WriteHyperlink = function (oHyperlink) {
if (null != oHyperlink.Ref) {
this.memory.WriteByte(c_oSerHyperlinkTypes.Ref);
this.memory.WriteString2(oHyperlink.Ref.getName());
}
if(null != oHyperlink.Hyperlink)
{
if (null != oHyperlink.Hyperlink) {
this.memory.WriteByte(c_oSerHyperlinkTypes.Hyperlink);
this.memory.WriteString2(oHyperlink.Hyperlink);
}
if(null != oHyperlink.Location)
{
if (null !== oHyperlink.getLocation()) {
this.memory.WriteByte(c_oSerHyperlinkTypes.Location);
this.memory.WriteString2(oHyperlink.Location);
this.memory.WriteString2(oHyperlink.getLocation());
}
if(null != oHyperlink.Tooltip)
{
if (null != oHyperlink.Tooltip) {
this.memory.WriteByte(c_oSerHyperlinkTypes.Tooltip);
this.memory.WriteString2(oHyperlink.Tooltip);
}
......@@ -5340,7 +5335,7 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
else if ( c_oSerHyperlinkTypes.Hyperlink == type )
oHyperlink.Hyperlink = this.stream.GetString2LE(length);
else if ( c_oSerHyperlinkTypes.Location == type )
oHyperlink.Location = this.stream.GetString2LE(length);
oHyperlink.setLocation(this.stream.GetString2LE(length));
else if ( c_oSerHyperlinkTypes.Tooltip == type )
oHyperlink.Tooltip = this.stream.GetString2LE(length);
else
......
......@@ -2194,7 +2194,6 @@ function Woorksheet(wb, _index, bAddUserId, sId){
//нужно добавлять в историю только когда обрезается с краев, потому что на undo будет произведена вставка и ячеек, а диапазон не расширится
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ChangeHyperlink, oThis.getId(), from, data);
}
oThis.addActionHyperlink(true);
}
});
this.hyperlinkManager.setDependenceManager(this.mergeManager);
......@@ -2203,9 +2202,6 @@ function Woorksheet(wb, _index, bAddUserId, sId){
this.aConditionalFormatting = [];
this.sheetPr = null;
this.nActionNested = 0;
this.bUpdateHyperlinks = false;
this.nMaxRowId = 1;
this.nMaxColId = 1;
};
......@@ -2438,25 +2434,6 @@ Woorksheet.prototype.initPostOpen = function(){
this.sheetViews[0] = new asc.asc_CSheetViewSettings();
}
};
Woorksheet.prototype.onStartTriggerAction=function(){
//начало действия, в конце которого могуть быть вызваны trigger(пока только hyperlink)
if(0 == this.nActionNested)
this.bUpdateHyperlinks = false;
this.nActionNested++;
};
Woorksheet.prototype.onEndTriggerAction=function(){
if(this.nActionNested > 0)
this.nActionNested--;
if(0 == this.nActionNested)
{
if(true == this.bUpdateHyperlinks)
this.workbook.handlers.trigger("updateHyperlinksCache", this.Id);
this.bUpdateHyperlinks = false;
}
};
Woorksheet.prototype.addActionHyperlink=function(bVal){
this.bUpdateHyperlinks = bVal;
}
Woorksheet.prototype._forEachCell=function(fAction){
for(var rowInd in this.aGCells){
var row = this.aGCells[rowInd];
......@@ -3628,7 +3605,6 @@ Woorksheet.prototype._moveRange=function(oBBoxFrom, oBBoxTo){
elem.data.Ref.setOffset(offset);
this.hyperlinkManager.add(elem.bbox, elem.data);
}
this.addActionHyperlink(true);
}
//расширяем границы
if(oBBoxFrom.r2 > this.nRowsCount)
......@@ -4015,8 +3991,9 @@ Woorksheet.prototype.getAllCol = function(){
return this.oAllCol;
}
Woorksheet.prototype.getHyperlinkByCell = function(row, col){
return this.hyperlinkManager.getByCell(row, col);
}
var oHyperlink = this.hyperlinkManager.getByCell(row, col);
return oHyperlink ? oHyperlink.data : null;
};
Woorksheet.prototype.getMergedByCell = function(row, col){
return this.mergeManager.getByCell(row, col);
}
......@@ -7233,7 +7210,6 @@ Range.prototype.setHyperlink=function(val, bWithoutStyle){
this.setFont(oHyperlinkFont);
}
this.worksheet.hyperlinkManager.add(val.Ref.getBBox0(), val);
this.worksheet.addActionHyperlink(true);
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_SetHyperlink, this.worksheet.getId(), this.bbox.clone(), val.clone());
History.EndTransaction();
}
......@@ -7755,7 +7731,6 @@ Range.prototype._sortByArray=function(oBBox, aSortData, bUndo){
var hyp = aSortedHyperlinks[i];
this.worksheet.hyperlinkManager.add(hyp.Ref.getBBox0(), hyp);
}
this.worksheet.addActionHyperlink(true);
}
};
Range.prototype.promote=function(bCtrl, bVertical, nIndex){
......
......@@ -1791,8 +1791,7 @@ StyleManager.prototype =
}
};
/** @constructor */
function Hyperlink()
{
function Hyperlink () {
this.Properties = {
Ref: 0,
Location: 1,
......@@ -1800,63 +1799,98 @@ function Hyperlink()
Tooltip: 3
};
this.Ref = null;
this.Location = null;
this.Hyperlink = null;
this.Tooltip = null;
// Составные части Location
this.Location = null;
this.LocationSheet = null;
this.LocationRange = null;
this.bUpdateLocation = false;
this.bVisited = false;
};
Hyperlink.prototype =
{
clone : function()
{
}
Hyperlink.prototype = {
clone : function () {
var oNewHyp = new Hyperlink();
if(null != this.Ref)
if (null !== this.Ref)
oNewHyp.Ref = this.Ref.clone();
if(null != this.Location)
oNewHyp.Location = this.Location;
if(null != this.Hyperlink)
if (null !== this.getLocation())
oNewHyp.Location = this.getLocation();
if (null !== this.LocationSheet)
oNewHyp.LocationSheet = this.LocationSheet;
if (null !== this.LocationRange)
oNewHyp.LocationRange = this.LocationRange;
if (null !== this.Hyperlink)
oNewHyp.Hyperlink = this.Hyperlink;
if(null != this.Tooltip)
if (null !== this.Tooltip)
oNewHyp.Tooltip = this.Tooltip;
return oNewHyp;
},
isEqual : function(obj)
{
var bRes = (this.Location == obj.Location && this.Hyperlink == obj.Hyperlink && this.Tooltip == obj.Tooltip);
if(bRes)
{
isEqual : function (obj) {
var bRes = (this.getLocation() == obj.getLocation() && this.Hyperlink == obj.Hyperlink && this.Tooltip == obj.Tooltip);
if (bRes) {
var oBBoxRef = this.Ref.getBBox0();
var oBBoxObj = obj.Ref.getBBox0();
bRes = (oBBoxRef.r1 == oBBoxObj.r1 && oBBoxRef.c1 == oBBoxObj.c1 && oBBoxRef.r2 == oBBoxObj.r2 && oBBoxRef.c2 == oBBoxObj.c2);
}
return bRes;
},
isValid : function()
{
return null != this.Ref && (null != this.Location || null != this.Hyperlink);
isValid : function () {
return null != this.Ref && (null != this.getLocation() || null != this.Hyperlink);
},
setVisited : function(bVisited)
{
setLocationSheet : function (LocationSheet) {
this.LocationSheet = LocationSheet;
this.bUpdateLocation = true;
},
setLocationRange : function (LocationRange) {
this.LocationRange = LocationRange;
this.bUpdateLocation = true;
},
setLocation : function (Location) {
this.bUpdateLocation = false;
this.Location = Location;
this.LocationSheet = this.LocationRange = null;
if (null != this.Location) {
var result = parserHelp.parse3DRef(this.Location);
if (null !== result) {
this.LocationSheet = result.sheet;
this.LocationRange = result.range;
}
}
},
getLocation : function () {
if (this.bUpdateLocation)
this._updateLocation();
return this.Location;
},
_updateLocation : function () {
this.bUpdateLocation = false;
if (null === this.LocationSheet || null === this.LocationRange)
this.Location = null;
else {
this.Location = (false == rx_test_ws_name.test(this.LocationSheet)) ? "'" + this.LocationSheet + "'" : this.LocationSheet;
this.Location += "!" + this.LocationRange;
}
},
setVisited : function (bVisited) {
this.bVisited = bVisited;
this.Ref.cleanCache();
},
getVisited : function(bVisited)
{
getVisited : function () {
return this.bVisited;
},
getType : function()
{
getHyperlinkType : function () {
return null !== this.Hyperlink ? c_oAscHyperlinkType.WebLink : c_oAscHyperlinkType.RangeLink;
},
getType : function () {
return UndoRedoDataTypes.Hyperlink;
},
getProperties : function()
{
getProperties : function () {
return this.Properties;
},
getProperty : function(nType)
{
switch(nType)
{
getProperty : function (nType) {
switch (nType) {
case this.Properties.Ref:
var sRes = this.Ref.worksheet.getName();
if(false == rx_test_ws_name.test(sRes))
......@@ -1864,32 +1898,29 @@ Hyperlink.prototype =
sRes += "!" + this.Ref.getName();
return sRes;
break;
case this.Properties.Location: return this.Location;break;
case this.Properties.Location: return this.getLocation();break;
case this.Properties.Hyperlink: return this.Hyperlink;break;
case this.Properties.Tooltip: return this.Tooltip;break;
}
},
setProperty : function(nType, value)
{
switch(nType)
{
setProperty : function (nType, value) {
switch (nType) {
case this.Properties.Ref:
//todo обработать нули
var oRefParsed = parserHelp.parse3DRef(value);
if (null !== oRefParsed) {
// Получаем sheet по имени
ws = window["Asc"]["editor"].wbModel.getWorksheetByName (oRefParsed.sheet);
var ws = window["Asc"]["editor"].wbModel.getWorksheetByName (oRefParsed.sheet);
if (ws)
this.Ref = ws.getRange2(oRefParsed.range);
}
break;
case this.Properties.Location: this.Location = value;break;
case this.Properties.Location: this.setLocation(value);break;
case this.Properties.Hyperlink: this.Hyperlink = value;break;
case this.Properties.Tooltip: this.Tooltip = value;break;
}
},
applyCollaborative : function(nSheetId, collaborativeEditing)
{
applyCollaborative : function (nSheetId, collaborativeEditing) {
var bbox = this.Ref.getBBox0();
var OffsetFirst = {offsetCol:0, offsetRow:0};
var OffsetLast = {offsetCol:0, offsetRow:0};
......
......@@ -1977,19 +1977,19 @@
}
var hyperlink;
if(cell)
hyperlink = cell.getHyperlink()
hyperlink = cell.getHyperlink();
for (res = [], i = 0; i < val.length; ++i) {
if(val[i] && val[i].format && val[i].format.skip)
continue;
if(cell == undefined || (cell != undefined && (hyperlink == null || (hyperlink != null && hyperlink.Location != null))))
if(cell == undefined || (cell != undefined && (hyperlink == null || (hyperlink != null && hyperlink.getLocation() != null))))
span = doc.createElement("SPAN");
else
{
span = doc.createElement("A");
if(hyperlink.Hyperlink != null)
span.href = hyperlink.Hyperlink;
else if(hyperlink.Location != null)
span.href = "#" + hyperlink.Location;
else if(hyperlink.getLocation() != null)
span.href = "#" + hyperlink.getLocation();
if(hyperlink.Tooltip != null)
span.title = hyperlink.Tooltip;
}
......
......@@ -482,65 +482,46 @@
};
// Гиперссылка
/** @constructor */
function asc_CHyperlink (obj) {
if ( !(this instanceof asc_CHyperlink) ) {
if (!(this instanceof asc_CHyperlink)) {
return new asc_CHyperlink(obj);
}
if (obj) {
this.type = obj.type;
this.hyperlinkUrl = obj.hyperlinkUrl;
this.tooltip = obj.tooltip;
this.location = obj.location;
this.sheet = obj.sheet;
this.range = obj.range;
this.hyperlinkRange = obj.hyperlinkRange;
this.text = obj.text;
this.col = obj.col;
this.row = obj.row;
}
else {
this.asc_clear();
}
// Класс Hyperlink из модели
this.hyperlinkModel = null != obj ? obj : new Hyperlink();
// Используется только для выдачи наружу и выставлении обратно
this.text = null;
return this;
}
asc_CHyperlink.prototype = {
constructor: asc_CHyperlink,
asc_getType: function () { return this.type; },
asc_getHyperlinkUrl: function () { return this.hyperlinkUrl; },
asc_getTooltip: function () { return this.tooltip; },
asc_getLocation: function () { return this.location; },
asc_getSheet: function () { return this.sheet; },
asc_getRange: function () { return this.range; },
asc_getHyperlinkRange: function () { return this.hyperlinkRange; },
asc_getType: function () { return this.hyperlinkModel.getHyperlinkType(); },
asc_getHyperlinkUrl: function () { return this.hyperlinkModel.Hyperlink; },
asc_getTooltip: function () { return this.hyperlinkModel.Tooltip; },
asc_getLocation: function () { return this.hyperlinkModel.getLocation(); },
asc_getSheet: function () { return this.hyperlinkModel.LocationSheet; },
asc_getRange: function () { return this.hyperlinkModel.LocationRange; },
asc_getText: function () { return this.text; },
asc_getHyperlinkCol: function () {return this.col;},
asc_getHyperlinkRow: function () {return this.row;},
asc_setType: function (val) { this.type = val; },
asc_setHyperlinkUrl: function (val) { this.hyperlinkUrl = val; },
asc_setTooltip: function (val) { this.tooltip = val; },
asc_setLocation: function (val) { this.location = val; },
asc_setSheet: function (val) { this.sheet = val; },
asc_setRange: function (val) { this.range = val; },
asc_setHyperlinkRange: function (val) { this.hyperlinkRange = val; },
asc_setText: function (val) { this.text = val; },
asc_setHyperlinkCol: function (val) {this.col = val;},
asc_setHyperlinkRow: function (val) {this.row = val;},
asc_clear: function () {
this.type = null;
this.hyperlinkUrl = null;
this.tooltip = null;
this.location = null;
this.sheet = null;
this.range = null;
this.hyperlinkRange = null;
this.text = null;
asc_setType: function (val) {
// В принципе эта функция избыточна
switch (val) {
case c_oAscHyperlinkType.WebLink:
this.hyperlinkModel.setLocation(null);
break;
case c_oAscHyperlinkType.RangeLink:
this.hyperlinkModel.Hyperlink = null;
break;
}
},
asc_clone: function () {
return new asc_CHyperlink(this);
}
asc_setHyperlinkUrl: function (val) { this.hyperlinkModel.Hyperlink = val; },
asc_setTooltip: function (val) { this.hyperlinkModel.Tooltip = val; },
asc_setLocation: function (val) { this.hyperlinkModel.setLocation(val); },
asc_setSheet: function (val) { this.hyperlinkModel.setLocationSheet(val); },
asc_setRange: function (val) { this.hyperlinkModel.setLocationRange(val); },
asc_setText: function (val) { this.text = val; }
};
function asc_CPageMargins (obj) {
......@@ -756,7 +737,6 @@
}
this.bIsOn = false;
this.aStartTriggerAction = {};
this.bIsReInit = false;
}
......@@ -1020,7 +1000,6 @@
prot["asc_getLocation"] = prot.asc_getLocation;
prot["asc_getSheet"] = prot.asc_getSheet;
prot["asc_getRange"] = prot.asc_getRange;
prot["asc_getHyperlinkRange"] = prot.asc_getHyperlinkRange;
prot["asc_getText"] = prot.asc_getText;
prot["asc_setType"] = prot.asc_setType;
prot["asc_setHyperlinkUrl"] = prot.asc_setHyperlinkUrl;
......@@ -1028,11 +1007,7 @@
prot["asc_setLocation"] = prot.asc_setLocation;
prot["asc_setSheet"] = prot.asc_setSheet;
prot["asc_setRange"] = prot.asc_setRange;
prot["asc_setHyperlinkRange"] = prot.asc_setHyperlinkRange;
prot["asc_setText"] = prot.asc_setText;
prot["asc_clear"] = prot.asc_clear;
prot["asc_clone"] = prot.asc_clone;
window["Asc"]["asc_CPageMargins"] = window["Asc"].asc_CPageMargins = asc_CPageMargins;
prot = asc_CPageMargins.prototype;
......
......@@ -238,9 +238,6 @@
this.model.handlers.add("deleteCell", function (wsId, val, range) {
self.getWorksheetById(wsId).changeWorksheet("delCell", {val: val, range: range});
});
this.model.handlers.add("updateHyperlinksCache", function (wsId) {
self.getWorksheetById(wsId)._updateHyperlinksCache();
});
this.model.handlers.add("showWorksheet", function (wsId) {
self.showWorksheetById(wsId);
var ws = self.getWorksheetById(wsId);
......@@ -514,22 +511,19 @@
isHyperlinkClick = true;
}
if (isHyperlinkClick) {
var oRangeHyperlink = ws.model.getCell3(ct.hyperlink.row, ct.hyperlink.col);
var hyp = oRangeHyperlink.getHyperlink();
if(null != hyp && false == hyp.getVisited())
{
hyp.setVisited(true);
ws.changeWorksheet("updateRange", {range: ct.hyperlink.hyperlinkRange, isLockDraw: false, canChangeColWidth: false});
}
var t = this;
if (c_oAscHyperlinkType.WebLink === ct.hyperlink.asc_getType()) {
// Это ссылка на Url. Отправляем не сразу, т.к. хочется dblClick обработать...
t.handlers.trigger("asc_onHyperlinkClick", ct.hyperlink.asc_getHyperlinkUrl());
if (ct.hyperlink.hyperlinkModel.getVisited()) {
ct.hyperlink.hyperlinkModel.setVisited(true);
ws.changeWorksheet("updateRange", {range: ct.hyperlink.hyperlinkModel.Ref.getBBox0(), isLockDraw: false, canChangeColWidth: false});
}
else if (c_oAscHyperlinkType.RangeLink === ct.hyperlink.asc_getType()) {
// ToDo надо поправить отрисовку комментария для данной ячейки (с которой уходим)
t.handlers.trigger("asc_onHideComment");
t.Api._asc_setWorksheetRange(ct.hyperlink);
switch (ct.hyperlink.asc_getType()) {
case c_oAscHyperlinkType.WebLink:
this.handlers.trigger("asc_onHyperlinkClick", ct.hyperlink.asc_getHyperlinkUrl());
break;
case c_oAscHyperlinkType.RangeLink:
// ToDo надо поправить отрисовку комментария для данной ячейки (с которой уходим)
this.handlers.trigger("asc_onHideComment");
this.Api._asc_setWorksheetRange(ct.hyperlink);
break;
}
}
}
......@@ -594,7 +588,7 @@
ct.cursor = ct.cellCursor.cursor;
}
arrMouseMoveObjects.push(asc_CMM({type: c_oAscMouseMoveType.Hyperlink, x: x, y: y,
hyperlink: ct.hyperlink.asc_clone()}));
hyperlink: ct.hyperlink}));
}
/* Проверяем, может мы на никаком объекте (такая схема оказалась приемлимой
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment