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