Commit e12000df authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov

fix: Bug 19679 - Теряются данные в строках после удаления вышестоящей строки и...

fix: Bug 19679 - Теряются данные в строках после удаления вышестоящей строки и восстановления с помощью Undo

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48995 954022d7-b5bf-4e40-9824-e11837661b57
parent 8f0a63bd
......@@ -2635,8 +2635,8 @@ Woorksheet.prototype._removeRows=function(start, stop){
helpFunction(this.workbook);
unLockDraw(this.workbook);
for(var id in res)
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
// for(var id in res)
// History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveRows, this.getId(), new Asc.Range(0, start, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(true, start, stop));
return true;
......@@ -2692,8 +2692,8 @@ Woorksheet.prototype._insertRowsBefore=function(index, count){
this.nRowsCount += count;
for(var id in res)
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
// for(var id in res)
// History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
History.TurnOn();
return true;
......@@ -2749,8 +2749,8 @@ Woorksheet.prototype._removeCols=function(start, stop){
this.aCols.splice(start, stop - start + 1);
for(var id in res)
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
// for(var id in res)
// History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCols, this.getId(), new Asc.Range(0, 0, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_FromToRowCol(false, start, stop));
return true;
......@@ -2809,8 +2809,8 @@ Woorksheet.prototype._insertColsBefore=function(index, count){
}
this.nColsCount += count;
for(var id in res)
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
// for(var id in res)
// History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
History.TurnOn();
return true;
......@@ -3551,8 +3551,8 @@ Woorksheet.prototype._shiftCellsLeft=function(oBBox){
//todo проверить не уменьшились ли границы таблицы
for(var id in res)
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
// for(var id in res)
// History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsLeft, this.getId(), new Asc.Range(0, oBBox.r1, gc_nMaxCol0, oBBox.r1), new UndoRedoData_BBox(oBBox));
};
......@@ -3597,8 +3597,8 @@ Woorksheet.prototype._shiftCellsUp=function(oBBox){
//todo проверить не уменьшились ли границы таблицы
for(var id in res)
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
// for(var id in res)
// History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsTop, this.getId(), new Asc.Range(0, oBBox.r1, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_BBox(oBBox));
};
......@@ -3638,8 +3638,8 @@ Woorksheet.prototype._shiftCellsRight=function(oBBox){
helpFunction(this.workbook);
unLockDraw(this.workbook);
for(var id in res)
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
// for(var id in res)
// History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
History.TurnOn();
};
......@@ -3677,8 +3677,8 @@ Woorksheet.prototype._shiftCellsBottom=function(oBBox){
helpFunction(this.workbook);
unLockDraw(this.workbook);
for(var id in res)
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
// for(var id in res)
// History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RemoveCell, this.getId(), new Asc.Range(0, res[id].nRow, gc_nMaxCol0, res[id].nRow), new UndoRedoData_CellSimpleData(res[id].nRow, res[id].nCol, res[id].data, null));
History.TurnOn();
};
......@@ -3799,21 +3799,21 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete
var n = objForRebuldFormula.move[id].node;
var _sn = n.getSlaveEdges2();
for( var _id in _sn ){
var cell = _sn[_id].returnCell();
var cell = _sn[_id].returnCell(), cellName = cell.getName();
if( undefined == cell ) { continue; }
if( cell.formulaParsed ){
var oUndoRedoData_CellData = new UndoRedoData_CellData(cell.getValueData(), null);
if(null != cell.xfs)
oUndoRedoData_CellData.style = cell.xfs.clone();
ret[cell.getName()] = {};
ret[cell.getName()].data = oUndoRedoData_CellData;
ret[cell.getName()].id = this.getId();
ret[cell.getName()].nRow = cell.getCellAddress().getRow0();
ret[cell.getName()].nCol = cell.getCellAddress().getCol0();
ret[cellName] = {};
ret[cellName].data = oUndoRedoData_CellData;
ret[cellName].id = this.getId();
ret[cellName].nRow = cell.getCellAddress().getRow0();
ret[cellName].nCol = cell.getCellAddress().getCol0();
cell.formulaParsed.shiftCells( objForRebuldFormula.move[id].offset, oBBox, n, this.Id, objForRebuldFormula.move[id].toDelete );
cell.setFormula(cell.formulaParsed.assemble());
c[cell.getName()] = cell;
c[cellName] = cell;
}
}
if( n.cellId.indexOf(":")<0){
......@@ -3833,22 +3833,21 @@ Woorksheet.prototype.renameDependencyNodes = function(offset,oBBox,rec, noDelete
}
}
for( var _id in _sn ){
var cell = _sn[_id].returnCell();
var cell = _sn[_id].returnCell(), cellName = cell.getName();
if( cell && cell.formulaParsed ){
if( !(cell.getName() in ret) ){
var oUndoRedoData_CellData = new UndoRedoData_CellData(cell.getValueData(), null);
if(null != cell.xfs)
oUndoRedoData_CellData.style = cell.xfs.clone();
ret[cell.getName()] = {};
ret[cell.getName()].data = oUndoRedoData_CellData;
ret[cell.getName()].id = this.getId();
ret[cell.getName()].nRow = cell.getCellAddress().getRow0();
ret[cell.getName()].nCol = cell.getCellAddress().getCol0();
ret[cellName] = {};
ret[cellName].data = oUndoRedoData_CellData;
ret[cellName].id = this.getId();
ret[cellName].nRow = cell.getCellAddress().getRow0();
ret[cellName].nCol = cell.getCellAddress().getCol0();
}
cell.formulaParsed.stretchArea( objForRebuldFormula.stretch[id].offset, oBBox, n, this.Id );
cell.setFormula(cell.formulaParsed.assemble());
c[cell.getName()] = cell;
c[cellName] = cell;
}
}
}
......
......@@ -1245,6 +1245,7 @@ function cBaseType( val ) {
this.type = null;
this.value = val;
this.ca = false;
this.node = undefined;
}
cBaseType.prototype = {
constructor:cBaseType,
......@@ -1256,7 +1257,8 @@ cBaseType.prototype = {
},
toString:function () {
return this.value.toString();
}
},
setNode:function(node){this.node = node;}
}
/* cFormulaOperators is container for holding all ECMA-376 operators, see chapter $18.17.2.2 in "ECMA-376, Second Edition, Part 1 - Fundamentals And Markup Language Reference" */
......@@ -3131,7 +3133,7 @@ parserFormula.prototype = {
this.outStack[i] = new cError( cErrorType.bad_reference )
continue;
}
if ( node.cellId == this.outStack[i]._cells.replace( /\$/ig, "" ) ) {
if ( node.cellId == this.outStack[i].node.cellId/*_cells.replace( /\$/ig, "" )*/ ) {
if ( this.outStack[i].isAbsolute ) {
this._changeOffsetHelper( this.outStack[i], offset );
}
......@@ -3148,7 +3150,7 @@ parserFormula.prototype = {
}
}
else if ( this.outStack[i] instanceof cRef3D ) {
if ( node.cellId == this.outStack[i]._cells.replace( /\$/ig, "" ) && this.outStack[i].ws == node.sheetId ) {
if ( node.nodeId == this.outStack[i].node.nodeId /*_cells.replace( /\$/ig, "" ) && this.outStack[i].ws == node.sheetId*/ ) {
if ( this.outStack[i].isAbsolute ) {
this._changeOffsetHelper( this.outStack[i], offset );
}
......@@ -3191,7 +3193,7 @@ parserFormula.prototype = {
continue;
}
if ( node.cellId == this.outStack[i]._cells.replace( /\$/ig, "" ) ) {
if ( node.cellId == this.outStack[i].node.cellId /*_cells.replace( /\$/ig, "" )*/ ) {
if ( this.outStack[i].isAbsolute ) {
this._changeOffsetHelper( this.outStack[i], offset );
......@@ -3406,7 +3408,12 @@ parserFormula.prototype = {
}
if ( (ref instanceof cRef || ref instanceof cRef3D || ref instanceof cArea) && ref.isValid() ) {
this.wb.dependencyFormulas.addEdge( this.ws.Id, this.cellId.replace( /\$/g, "" ), ref.getWsId(), ref._cells.replace( /\$/g, "" ) );
var nFrom = new Vertex( this.ws.Id, this.cellId.replace( /\$/g, "" ), this.wb ),
nTo = new Vertex( ref.getWsId(), ref._cells.replace( /\$/g, "" ), this.wb );
ref.setNode(nTo);
// this.wb.dependencyFormulas.addEdge( this.ws.Id, this.cellId.replace( /\$/g, "" ), ref.getWsId(), ref._cells.replace( /\$/g, "" ) );
this.wb.dependencyFormulas.addEdge2( nFrom, nTo );
}
else if ( ref instanceof cArea3D && ref.isValid() ) {
var wsR = ref.wsRange();
......
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