Commit 7a1534ce authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

Bug 22162 - Невозможно убрать ссылку из ячейки.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56058 954022d7-b5bf-4e40-9824-e11837661b57
parent 318f3d70
...@@ -1722,7 +1722,7 @@ function Woorksheet(wb, _index, sId){ ...@@ -1722,7 +1722,7 @@ function Woorksheet(wb, _index, sId){
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ChangeMerge, oThis.getId(), oHistoryRange, new UndoRedoData_FromTo(new UndoRedoData_BBox(from), new UndoRedoData_BBox(to))); History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ChangeMerge, oThis.getId(), oHistoryRange, new UndoRedoData_FromTo(new UndoRedoData_BBox(from), new UndoRedoData_BBox(to)));
} }
}); });
this.hyperlinkManager = new RangeDataManager(function(data, from, to){ this.hyperlinkManager = new RangeDataManager(function(data, from, to, oChangeParam){
if(History.Is_On() && (null != from || null != to)) if(History.Is_On() && (null != from || null != to))
{ {
if(null != from) if(null != from)
...@@ -1737,8 +1737,10 @@ function Woorksheet(wb, _index, sId){ ...@@ -1737,8 +1737,10 @@ function Woorksheet(wb, _index, sId){
oHistoryData = data.clone(); oHistoryData = data.clone();
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ChangeHyperlink, oThis.getId(), oHistoryRange, new UndoRedoData_FromToHyperlink(from, to, oHistoryData)); History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ChangeHyperlink, oThis.getId(), oHistoryRange, new UndoRedoData_FromToHyperlink(from, to, oHistoryData));
} }
if(null != to) if (null != to)
data.Ref = oThis.getRange3(to.r1, to.c1, to.r2, to.c2); data.Ref = oThis.getRange3(to.r1, to.c1, to.r2, to.c2);
else if (oChangeParam && oChangeParam.removeStyle && null != data.Ref)
data.Ref.cleanFormat();
}); });
this.hyperlinkManager.setDependenceManager(this.mergeManager); this.hyperlinkManager.setDependenceManager(this.mergeManager);
...@@ -6457,7 +6459,7 @@ Range.prototype.setHyperlink=function(val, bWithoutStyle){ ...@@ -6457,7 +6459,7 @@ Range.prototype.setHyperlink=function(val, bWithoutStyle){
History.EndTransaction(); History.EndTransaction();
} }
}; };
Range.prototype.removeHyperlink=function(val){ Range.prototype.removeHyperlink = function (val, removeStyle) {
var bbox = this.bbox; var bbox = this.bbox;
var elem = null; var elem = null;
if(null != val) if(null != val)
...@@ -6465,16 +6467,17 @@ Range.prototype.removeHyperlink=function(val){ ...@@ -6465,16 +6467,17 @@ Range.prototype.removeHyperlink=function(val){
bbox = val.Ref.getBBox0(); bbox = val.Ref.getBBox0();
elem = new RangeDataManagerElem(bbox, val); elem = new RangeDataManagerElem(bbox, val);
} }
History.Create_NewPoint();
History.StartTransaction();
if(false == this.worksheet.workbook.bUndoChanges && false == this.worksheet.workbook.bRedoChanges) if(false == this.worksheet.workbook.bUndoChanges && false == this.worksheet.workbook.bRedoChanges)
{ {
History.Create_NewPoint();
History.StartTransaction();
var oChangeParam = { removeStyle: removeStyle };
if(null != elem) if(null != elem)
this.worksheet.hyperlinkManager.removeElement(elem); this.worksheet.hyperlinkManager.removeElement(elem, oChangeParam);
else else
this.worksheet.hyperlinkManager.remove(bbox); this.worksheet.hyperlinkManager.remove(bbox, !bbox.isOneCell(), oChangeParam);
History.EndTransaction();
} }
History.EndTransaction();
}; };
Range.prototype.deleteCellsShiftUp=function(){ Range.prototype.deleteCellsShiftUp=function(){
return this._shiftUpDown(true); return this._shiftUpDown(true);
......
...@@ -3858,7 +3858,7 @@ function RangeDataManager(fChange) ...@@ -3858,7 +3858,7 @@ function RangeDataManager(fChange)
this.fChange = fChange; this.fChange = fChange;
} }
RangeDataManager.prototype = { RangeDataManager.prototype = {
add : function(bbox, data) add: function (bbox, data, oChangeParam)
{ {
var oNewNode = new IntervalTreeRBNode(bbox.r1, bbox.r2, null); var oNewNode = new IntervalTreeRBNode(bbox.r1, bbox.r2, null);
var oStoredNode = this.oIntervalTreeRB.insertOrGet(oNewNode); var oStoredNode = this.oIntervalTreeRB.insertOrGet(oNewNode);
...@@ -3867,7 +3867,7 @@ RangeDataManager.prototype = { ...@@ -3867,7 +3867,7 @@ RangeDataManager.prototype = {
var oNewElem = new RangeDataManagerElem(new Asc.Range(bbox.c1, bbox.r1, bbox.c2, bbox.r2), data); var oNewElem = new RangeDataManagerElem(new Asc.Range(bbox.c1, bbox.r1, bbox.c2, bbox.r2), data);
oStoredNode.storedValue.push(oNewElem); oStoredNode.storedValue.push(oNewElem);
if(null != this.fChange) if(null != this.fChange)
this.fChange.call(this, oNewElem.data, null, oNewElem.bbox); this.fChange.call(this, oNewElem.data, null, oNewElem.bbox, oChangeParam);
}, },
get : function(bbox) get : function(bbox)
{ {
...@@ -3933,16 +3933,21 @@ RangeDataManager.prototype = { ...@@ -3933,16 +3933,21 @@ RangeDataManager.prototype = {
} }
return oRes; return oRes;
}, },
remove : function(bbox) remove: function (bbox, bInnerOnly, oChangeParam)
{ {
var aElems = this.get(bbox); var aElems = this.get(bbox);
for(var i = 0, length = aElems.all.length; i < length; ++i) var aTargetArray;
if (bInnerOnly)
aTargetArray = aElems.inner;
else
aTargetArray = aElems.all;
for (var i = 0, length = aTargetArray.length; i < length; ++i)
{ {
var elem = aElems.all[i]; var elem = aTargetArray[i];
this.removeElement(elem); this.removeElement(elem, oChangeParam);
} }
}, },
removeElement : function(elemToDelete) removeElement: function (elemToDelete, oChangeParam)
{ {
if(null != elemToDelete) if(null != elemToDelete)
{ {
...@@ -3967,12 +3972,12 @@ RangeDataManager.prototype = { ...@@ -3967,12 +3972,12 @@ RangeDataManager.prototype = {
} }
} }
if(null != this.fChange) if(null != this.fChange)
this.fChange.call(this, elemToDelete.data, elemToDelete.bbox, null); this.fChange.call(this, elemToDelete.data, elemToDelete.bbox, null, oChangeParam);
} }
}, },
removeAll : function() removeAll : function(oChangeParam)
{ {
this.remove(new Asc.Range(0, 0, gc_nMaxCol0, gc_nMaxRow0)); this.remove(new Asc.Range(0, 0, gc_nMaxCol0, gc_nMaxRow0), null, oChangeParam);
//todo //todo
this.oIntervalTreeRB = new IntervalTreeRB(); this.oIntervalTreeRB = new IntervalTreeRB();
}, },
...@@ -3981,7 +3986,7 @@ RangeDataManager.prototype = { ...@@ -3981,7 +3986,7 @@ RangeDataManager.prototype = {
var bboxGet = shiftGetBBox(bbox, bHor); var bboxGet = shiftGetBBox(bbox, bHor);
return {bbox: bboxGet, elems: this.get(bboxGet)}; return {bbox: bboxGet, elems: this.get(bboxGet)};
}, },
shift : function(bbox, bAdd, bHor, oGetRes) shift: function (bbox, bAdd, bHor, oGetRes, oChangeParam)
{ {
var _this = this; var _this = this;
if(null == oGetRes) if(null == oGetRes)
...@@ -4101,7 +4106,7 @@ RangeDataManager.prototype = { ...@@ -4101,7 +4106,7 @@ RangeDataManager.prototype = {
for(var i = 0, length = aToChange.length; i < length; ++i) for(var i = 0, length = aToChange.length; i < length; ++i)
{ {
var item = aToChange[i]; var item = aToChange[i];
this.fChange.call(this, item.elem.data, item.elem.bbox, item.to); this.fChange.call(this, item.elem.data, item.elem.bbox, item.to, oChangeParam);
} }
} }
//убираем fChange, чтобы потом послать его только на одну операцию, а не 2 //убираем fChange, чтобы потом послать его только на одну операцию, а не 2
...@@ -4112,18 +4117,18 @@ RangeDataManager.prototype = { ...@@ -4112,18 +4117,18 @@ RangeDataManager.prototype = {
{ {
var item = aToChange[i]; var item = aToChange[i];
var elem = item.elem; var elem = item.elem;
this.removeElement(elem); this.removeElement(elem, oChangeParam);
} }
//добавляем измененные ячейки //добавляем измененные ячейки
for(var i = 0, length = aToChange.length; i < length; ++i) for(var i = 0, length = aToChange.length; i < length; ++i)
{ {
var item = aToChange[i]; var item = aToChange[i];
if(null != item.to) if(null != item.to)
this.add(item.to, item.elem.data); this.add(item.to, item.elem.data, oChangeParam);
} }
this.fChange = fOldChange; this.fChange = fOldChange;
}, },
move : function(from, to) move: function (from, to, oChangeParam)
{ {
var fOldChange = this.fChange; var fOldChange = this.fChange;
var nOffsetRow = to.r1 - from.r1; var nOffsetRow = to.r1 - from.r1;
...@@ -4134,11 +4139,11 @@ RangeDataManager.prototype = { ...@@ -4134,11 +4139,11 @@ RangeDataManager.prototype = {
var elem = oGetRes.inner[i]; var elem = oGetRes.inner[i];
var oNewBBox = new Asc.Range(elem.bbox.c1 + nOffsetCol, elem.bbox.r1 + nOffsetRow, elem.bbox.c2 + nOffsetCol, elem.bbox.r2 + nOffsetRow); var oNewBBox = new Asc.Range(elem.bbox.c1 + nOffsetCol, elem.bbox.r1 + nOffsetRow, elem.bbox.c2 + nOffsetCol, elem.bbox.r2 + nOffsetRow);
if(null != fOldChange) if(null != fOldChange)
fOldChange.call(this, elem.data, elem.bbox, oNewBBox); fOldChange.call(this, elem.data, elem.bbox, oNewBBox, oChangeParam);
//убираем fChange, чтобы потом послать его только на одну операцию, а не 2 //убираем fChange, чтобы потом послать его только на одну операцию, а не 2
this.fChange = null; this.fChange = null;
this.removeElement(elem); this.removeElement(elem, oChangeParam);
this.add(oNewBBox, elem.data); this.add(oNewBBox, elem.data, oChangeParam);
this.fChange = fOldChange; this.fChange = fOldChange;
} }
......
...@@ -7638,8 +7638,7 @@ ...@@ -7638,8 +7638,7 @@
case "value": range.setValue(val); break; case "value": range.setValue(val); break;
case "format": range.setNumFormat(val); canChangeColWidth = c_oAscCanChangeColWidth.numbers; break; case "format": range.setNumFormat(val); canChangeColWidth = c_oAscCanChangeColWidth.numbers; break;
case "angle": range.setAngle(val); break; case "angle": range.setAngle(val); break;
case "rh": /*ToDo удаление гиперссылки из range*/ break; case "rh": range.removeHyperlink(null, true); break;
case "border": case "border":
if (isLargeRange) { callTrigger = true; t.handlers.trigger("slowOperation", true); } if (isLargeRange) { callTrigger = true; t.handlers.trigger("slowOperation", true); }
// None // None
......
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