Commit 0eff975d authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

Bug 24564 - Undo удаления ячеек формулы вызывает смещение диапазона

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56525 954022d7-b5bf-4e40-9824-e11837661b57
parent e2a5fd8b
...@@ -3242,7 +3242,6 @@ Woorksheet.prototype._moveRange=function(oBBoxFrom, oBBoxTo, copyRange){ ...@@ -3242,7 +3242,6 @@ Woorksheet.prototype._moveRange=function(oBBoxFrom, oBBoxTo, copyRange){
return true; return true;
}; };
Woorksheet.prototype._shiftCellsLeft=function(oBBox){ Woorksheet.prototype._shiftCellsLeft=function(oBBox){
lockDraw(this.workbook);
//todo удаление когда есть замерженые ячейки //todo удаление когда есть замерженые ячейки
var nLeft = oBBox.c1; var nLeft = oBBox.c1;
var nRight = oBBox.c2; var nRight = oBBox.c2;
...@@ -3272,20 +3271,17 @@ Woorksheet.prototype._shiftCellsLeft=function(oBBox){ ...@@ -3272,20 +3271,17 @@ Woorksheet.prototype._shiftCellsLeft=function(oBBox){
} }
} }
} }
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsLeft, this.getId(), new Asc.Range(nLeft, oBBox.r1, gc_nMaxCol0, oBBox.r2), new UndoRedoData_BBox(oBBox));
var res = this.renameDependencyNodes( {offsetRow:0,offsetCol:dif}, oBBox ); var res = this.renameDependencyNodes( {offsetRow:0,offsetCol:dif}, oBBox );
buildRecalc(this.workbook);
unLockDraw(this.workbook);
//todo проверить не уменьшились ли границы таблицы //todo проверить не уменьшились ли границы таблицы
// for(var id in res) // 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_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(nLeft, oBBox.r1, gc_nMaxCol0, oBBox.r2), new UndoRedoData_BBox(oBBox));
}; };
Woorksheet.prototype._shiftCellsUp=function(oBBox){ Woorksheet.prototype._shiftCellsUp=function(oBBox){
lockDraw(this.workbook);
var nTop = oBBox.r1; var nTop = oBBox.r1;
var nBottom = oBBox.r2; var nBottom = oBBox.r2;
var dif = nTop - nBottom - 1; var dif = nTop - nBottom - 1;
...@@ -3319,20 +3315,16 @@ Woorksheet.prototype._shiftCellsUp=function(oBBox){ ...@@ -3319,20 +3315,16 @@ Woorksheet.prototype._shiftCellsUp=function(oBBox){
} }
} }
var res = this.renameDependencyNodes({offsetRow:dif,offsetCol:0}, oBBox ); History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsTop, this.getId(), new Asc.Range(oBBox.c1, oBBox.r1, oBBox.c2, gc_nMaxRow0), new UndoRedoData_BBox(oBBox));
buildRecalc(this.workbook);
unLockDraw(this.workbook);
var res = this.renameDependencyNodes({offsetRow:dif,offsetCol:0}, oBBox );
//todo проверить не уменьшились ли границы таблицы //todo проверить не уменьшились ли границы таблицы
// for(var id in res) // 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_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(oBBox.c1, oBBox.r1, oBBox.c2, gc_nMaxRow0), new UndoRedoData_BBox(oBBox));
}; };
Woorksheet.prototype._shiftCellsRight=function(oBBox){ Woorksheet.prototype._shiftCellsRight=function(oBBox){
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsRight, this.getId(), new Asc.Range(oBBox.c1, oBBox.r1, gc_nMaxCol0, oBBox.r2), new UndoRedoData_BBox(oBBox));
History.TurnOff();
var nLeft = oBBox.c1; var nLeft = oBBox.c1;
var nRight = oBBox.c2; var nRight = oBBox.c2;
var dif = nRight - nLeft + 1; var dif = nRight - nLeft + 1;
...@@ -3360,19 +3352,15 @@ Woorksheet.prototype._shiftCellsRight=function(oBBox){ ...@@ -3360,19 +3352,15 @@ Woorksheet.prototype._shiftCellsRight=function(oBBox){
} }
} }
} }
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsRight, this.getId(), new Asc.Range(oBBox.c1, oBBox.r1, gc_nMaxCol0, oBBox.r2), new UndoRedoData_BBox(oBBox));
var res = this.renameDependencyNodes({offsetRow:0,offsetCol:dif}, oBBox);; var res = this.renameDependencyNodes({offsetRow:0,offsetCol:dif}, oBBox);;
// for(var id in res) // 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_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();
}; };
Woorksheet.prototype._shiftCellsBottom=function(oBBox){ Woorksheet.prototype._shiftCellsBottom=function(oBBox){
lockDraw(this.workbook);
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsBottom, this.getId(), new Asc.Range(oBBox.c1, oBBox.r1, oBBox.c2, gc_nMaxRow0), new UndoRedoData_BBox(oBBox));
History.TurnOff();
var nTop = oBBox.r1; var nTop = oBBox.r1;
var nBottom = oBBox.r2; var nBottom = oBBox.r2;
var dif = nBottom - nTop + 1; var dif = nBottom - nTop + 1;
...@@ -3398,15 +3386,12 @@ Woorksheet.prototype._shiftCellsBottom=function(oBBox){ ...@@ -3398,15 +3386,12 @@ Woorksheet.prototype._shiftCellsBottom=function(oBBox){
} }
} }
} }
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsBottom, this.getId(), new Asc.Range(oBBox.c1, oBBox.r1, oBBox.c2, gc_nMaxRow0), new UndoRedoData_BBox(oBBox));
var res = this.renameDependencyNodes({offsetRow:dif,offsetCol:0}, oBBox); var res = this.renameDependencyNodes({offsetRow:dif,offsetCol:0}, oBBox);
buildRecalc(this.workbook);
unLockDraw(this.workbook);
// for(var id in res) // 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_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();
}; };
Woorksheet.prototype._setIndex=function(ind){ Woorksheet.prototype._setIndex=function(ind){
this.index = ind; this.index = ind;
...@@ -6484,13 +6469,13 @@ Range.prototype.deleteCellsShiftLeft=function(){ ...@@ -6484,13 +6469,13 @@ Range.prototype.deleteCellsShiftLeft=function(){
return this._shiftLeftRight(true); return this._shiftLeftRight(true);
}; };
Range.prototype._shiftLeftRight=function(bLeft){ Range.prototype._shiftLeftRight=function(bLeft){
lockDraw(this.worksheet.workbook);
var oBBox = this.bbox; var oBBox = this.bbox;
var nWidth = oBBox.c2 - oBBox.c1 + 1; var nWidth = oBBox.c2 - oBBox.c1 + 1;
var nRangeType = this._getRangeType(oBBox); var nRangeType = this._getRangeType(oBBox);
if(c_oRangeType.Range != nRangeType && c_oRangeType.Col != nRangeType) if(c_oRangeType.Range != nRangeType && c_oRangeType.Col != nRangeType)
return false; return false;
var mergeManager = this.worksheet.mergeManager; var mergeManager = this.worksheet.mergeManager;
lockDraw(this.worksheet.workbook);
//todo вставить предупреждение, что будет unmerge //todo вставить предупреждение, что будет unmerge
History.Create_NewPoint(); History.Create_NewPoint();
History.StartTransaction(); History.StartTransaction();
...@@ -6539,13 +6524,14 @@ Range.prototype._shiftLeftRight=function(bLeft){ ...@@ -6539,13 +6524,14 @@ Range.prototype._shiftLeftRight=function(bLeft){
unLockDraw(this.worksheet.workbook); unLockDraw(this.worksheet.workbook);
return true; return true;
}; };
Range.prototype._shiftUpDown=function(bUp){ Range.prototype._shiftUpDown = function (bUp) {
var oBBox = this.bbox; var oBBox = this.bbox;
var nHeight = oBBox.r2 - oBBox.r1 + 1; var nHeight = oBBox.r2 - oBBox.r1 + 1;
var nRangeType = this._getRangeType(oBBox); var nRangeType = this._getRangeType(oBBox);
if(c_oRangeType.Range != nRangeType && c_oRangeType.Row != nRangeType) if(c_oRangeType.Range != nRangeType && c_oRangeType.Row != nRangeType)
return false; return false;
var mergeManager = this.worksheet.mergeManager; var mergeManager = this.worksheet.mergeManager;
lockDraw(this.worksheet.workbook);
//todo вставить предупреждение, что будет unmerge //todo вставить предупреждение, что будет unmerge
History.Create_NewPoint(); History.Create_NewPoint();
History.StartTransaction(); History.StartTransaction();
...@@ -6590,6 +6576,8 @@ Range.prototype._shiftUpDown=function(bUp){ ...@@ -6590,6 +6576,8 @@ Range.prototype._shiftUpDown=function(bUp){
this.worksheet.hyperlinkManager.shift(this.bbox, !bUp, false); this.worksheet.hyperlinkManager.shift(this.bbox, !bUp, false);
} }
History.EndTransaction(); History.EndTransaction();
buildRecalc(this.worksheet.workbook);
unLockDraw(this.worksheet.workbook);
return true; return true;
}; };
Range.prototype.setOffset=function(offset){//offset = {offsetCol:intNumber, offsetRow:intNumber} Range.prototype.setOffset=function(offset){//offset = {offsetCol:intNumber, offsetRow:intNumber}
......
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