Commit 1a32370f authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

изменения в DependencyGraph для сдвигов и move

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53681 954022d7-b5bf-4e40-9824-e11837661b57
parent 6f96bc5c
......@@ -2778,9 +2778,17 @@ parserFormula.prototype = {
setRefError : function(wsId, cellId){
for ( var i = 0; i < this.outStack.length; i++ ) {
var node = this.outStack[i];
if ( node instanceof cRef || node instanceof cArea || node instanceof cRef3D || node instanceof cArea3D )
if ( node instanceof cRef || node instanceof cArea || node instanceof cRef3D)
{
if( wsId == node.ws.getId() && cellId == node._cells)
this.outStack[i] = new cError( cErrorType.bad_reference );
}
else if(node instanceof cArea3D)
{
if( node.wsFrom == node.wsTo && wsId == node.wsFrom.getId() && cellId == node._cells)
this.outStack[i] = new cError( cErrorType.bad_reference );
}
}
},
/*
Для изменения ссылок на конкретную ячейку.
......
......@@ -2979,12 +2979,11 @@ UndoRedoWoorksheet.prototype = {
{
var sFormula = Data.sFormula
var cell = ws._getCell(nRow, nCol);
ws.workbook.dependencyFormulas.deleteMasterNodes(ws.getId(), cell.getName());
cell.setFormula(sFormula);
cell.formulaParsed.setFormula(sFormula);
addToArrRecalc(ws.workbook, ws.getId(), cell.getName());
ws.workbook.needRecalc[ getVertexId(ws.getId(),cell.getName()) ] = [ ws.getId(),cell.getName() ];
if( ws.workbook.needRecalc.length < 0) ws.workbook.needRecalc.length = 0;
ws.workbook.needRecalc.length++;
ws.workbook.needRecalc2.nodes[ getVertexId(ws.getId(),cell.getName()) ] = [ ws.getId(),cell.getName() ];
ws.workbook.needRecalc2.nodesLength++;
}
}
else if(historyitem_Worksheet_ColProp == Type)
......
This diff is collapsed.
......@@ -3986,11 +3986,14 @@ RangeDataManager.prototype = {
else
aToChange.sort(function(a, b){return _this.shiftSort(a, b, true, true);});
}
if(null != this.fChange)
{
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);
}
}
//убираем fChange, чтобы потом послать его только на одну операцию, а не 2
var fOldChange = this.fChange;
this.fChange = null;
......@@ -4008,6 +4011,25 @@ RangeDataManager.prototype = {
if(null != item.to)
this.add(item.to, item.elem.data);
}
},
move : function(from, to)
{
//убираем fChange, чтобы потом послать его только на одну операцию, а не 2
var fOldChange = this.fChange;
this.fChange = null;
var nOffsetRow = to.r1 - from.r1;
var nOffsetCol = to.c1 - from.c1;
var oGetRes = this.get(from);
for(var i = 0, length = oGetRes.inner.length; i < length; 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);
if(null != fOldChange)
fOldChange.call(this, elem.data, elem.bbox, oNewBBox);
this.removeElement(elem);
this.add(oNewBBox, elem.data);
}
this.fChange = fOldChange;
},
getAll : function()
......@@ -4055,7 +4077,10 @@ CellArea.prototype = {
var oNewRow = oStoredNode.storedValue;
var oNewColNode = new TreeRBNode(col, null);
var oStoredColNode = oNewRow.insertOrGet(oNewColNode);
oNewColNode.storedValue = new RangeDataManagerElem(new Asc.Range(col, row, col, row), value);
var storedValue = new RangeDataManagerElem(new Asc.Range(col, row, col, row), value);
oNewColNode.storedValue = storedValue;
if(null != this.fChange)
this.fChange.call(this, storedValue.data, null, storedValue.bbox);
},
get : function(bbox)
{
......@@ -4078,7 +4103,11 @@ CellArea.prototype = {
var row = rowElem.storedValue;
var cellElem = row.getElem(elem.bbox.c1);
if(cellElem)
{
row.deleteNode(cellElem);
if(null != this.fChange)
this.fChange.call(this, cellElem.storedValue.data, cellElem.storedValue.bbox, null);
}
}
},
shiftGet : function(bbox, bHor)
......@@ -4151,11 +4180,14 @@ CellArea.prototype = {
else
aToChange.sort(function(a, b){return a.to.r1 - b.to.r1;});
}
if(null != this.fChange)
{
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);
}
}
//убираем fChange, чтобы потом послать его только на одну операцию, а не 2
var fOldChange = this.fChange;
this.fChange = null;
......@@ -4175,6 +4207,25 @@ CellArea.prototype = {
}
this.fChange = fOldChange;
},
move : function(from, to)
{
//убираем fChange, чтобы потом послать его только на одну операцию, а не 2
var fOldChange = this.fChange;
this.fChange = null;
var nOffsetRow = to.r1 - from.r1;
var nOffsetCol = to.c1 - from.c1;
var oGetRes = this.get(from);
for(var i = 0, length = oGetRes.length; i < length; i++)
{
var elem = oGetRes[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);
this.removeElement(elem);
this.add(oNewBBox.r1, oNewBBox.c1, elem.data);
}
this.fChange = fOldChange;
},
getAll : function(){
var aRes = [];
var oRows = this.rows.getNodeAll();
......
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