Commit a0b7405c authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Переделал сдвиг ячеек вправо и вниз, удаление ячеек влево и вверх для...

Переделал сдвиг ячеек вправо и вниз, удаление ячеек влево и вверх для undo/redo. Теперь они делаются через модель без обращения к wsView.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59305 954022d7-b5bf-4e40-9824-e11837661b57
parent 5477f975
This diff is collapsed.
......@@ -271,11 +271,6 @@ CHistory.prototype.UndoRedoEnd = function (Point, oRedoObjectParam, bUndo) {
wsViews[i].objectRender.controller.recalculate2(true);
}
}
//var wsView = window["Asc"]["editor"].wb.getWorksheet();
//if(wsView && wsView.objectRender && wsView.objectRender.controller)
//{
// wsView.objectRender.controller.updateOverlay();
//}
}
}
......
......@@ -94,9 +94,6 @@ UndoRedoItemSerializable.prototype = {
oBinaryWriter.WriteBool(false);
oBinaryWriter.WriteString2(this.oClass.Get_Id());
/*var api = window["Asc"]["editor"];
var userId =
oBinaryWriter.WriteLong() */
this.oClass.Save_Changes(this.oData, oBinaryWriter);
}
},
......@@ -2896,6 +2893,7 @@ UndoRedoWoorksheet.prototype = {
UndoRedo : function(Type, Data, nSheetId, bUndo)
{
var worksheetView, nRow, nCol, oLockInfo, cell, index, from, to, range, r1, c1, r2, c2, temp, i, length, data;
var bInsert, operType; // ToDo избавиться от этого
var ws = this.wb.getWorksheetById(nSheetId);
if(null == ws)
return;
......@@ -2944,7 +2942,6 @@ UndoRedoWoorksheet.prototype = {
index = Data.index;
if(false != this.wb.bCollaborativeChanges)
{
var range;
if (g_nAllColIndex == index) {
range = new Asc.Range(0, 0, gc_nMaxCol0, gc_nMaxRow0);
}
......@@ -3058,10 +3055,23 @@ UndoRedoWoorksheet.prototype = {
this.wb.aCollaborativeChangeElements.push(oLockInfo);
}
}
if((true == bUndo && historyitem_Worksheet_ShiftCellsLeft == Type) || (false == bUndo && historyitem_Worksheet_ShiftCellsRight == Type))
ws.workbook.handlers.trigger("insertCell", nSheetId, c_oAscInsertOptions.InsertCellsAndShiftRight, Asc.Range(c1, r1, c2, r2));
else
ws.workbook.handlers.trigger("deleteCell", nSheetId, c_oAscDeleteOptions.DeleteCellsAndShiftLeft, Asc.Range(c1, r1, c2, r2));
range = ws.getRange3(r1, c1, r2, c2);
if((true == bUndo && historyitem_Worksheet_ShiftCellsLeft == Type) || (false == bUndo && historyitem_Worksheet_ShiftCellsRight == Type)) {
range.addCellsShiftRight();
bInsert = true;
operType = c_oAscInsertOptions.InsertCellsAndShiftRight;
} else {
range.deleteCellsShiftLeft();
bInsert = false;
operType = c_oAscDeleteOptions.DeleteCellsAndShiftLeft;
}
// ToDo Так делать неправильно, нужно поправить (перенести логику в model, а отрисовку отделить)
worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
worksheetView.autoFilters.insertColumn(bInsert ? "insCell" : "delCell", range.bbox, operType);
worksheetView.cellCommentator.updateCommentsDependencies(bInsert, operType, range.bbox);
worksheetView.objectRender.updateDrawingObject(bInsert, operType, range.bbox);
}
else if(historyitem_Worksheet_ShiftCellsTop == Type || historyitem_Worksheet_ShiftCellsBottom == Type)
{
......@@ -3084,10 +3094,23 @@ UndoRedoWoorksheet.prototype = {
this.wb.aCollaborativeChangeElements.push(oLockInfo);
}
}
if((true == bUndo && historyitem_Worksheet_ShiftCellsTop == Type) || (false == bUndo && historyitem_Worksheet_ShiftCellsBottom == Type))
ws.workbook.handlers.trigger("insertCell", nSheetId, c_oAscInsertOptions.InsertCellsAndShiftDown, Asc.Range(c1, r1, c2, r2));
else
ws.workbook.handlers.trigger("deleteCell", nSheetId, c_oAscDeleteOptions.DeleteCellsAndShiftTop, Asc.Range(c1, r1, c2, r2));
range = ws.getRange3(r1, c1, r2, c2);
if((true == bUndo && historyitem_Worksheet_ShiftCellsTop == Type) || (false == bUndo && historyitem_Worksheet_ShiftCellsBottom == Type)) {
range.addCellsShiftBottom();
bInsert = true;
operType = c_oAscInsertOptions.InsertCellsAndShiftDown;
} else {
range.deleteCellsShiftUp();
bInsert = false;
operType = c_oAscDeleteOptions.DeleteCellsAndShiftTop;
}
// ToDo Так делать неправильно, нужно поправить (перенести логику в model, а отрисовку отделить)
worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
worksheetView.autoFilters.insertRows(bInsert ? "insCell" : "delCell",range.bbox, operType);
worksheetView.cellCommentator.updateCommentsDependencies(bInsert, operType, range.bbox);
worksheetView.objectRender.updateDrawingObject(bInsert, operType, range.bbox);
}
else if(historyitem_Worksheet_Sort == Type)
{
......@@ -3111,7 +3134,7 @@ UndoRedoWoorksheet.prototype = {
this.wb.aCollaborativeChangeElements.push(oLockInfo);
}
}
range = ws.getRange(new CellAddress(bbox.r1, bbox.c1, 0), new CellAddress(bbox.r2, bbox.c2, 0));
range = ws.getRange3(bbox.r1, bbox.c1, bbox.r2, bbox.c2);
range._sortByArray(bbox, places);
}
else if(historyitem_Worksheet_MoveRange == Type)
......
......@@ -2647,7 +2647,7 @@ Woorksheet.prototype._removeCols=function(start, stop){
return true;
};
Woorksheet.prototype.insertColsBefore=function(index, count){
var oRange = this.getRange(new CellAddress(0, index, 0), new CellAddress(gc_nMaxRow0, index + count - 1, 0));
var oRange = this.getRange3(0, index, gc_nMaxRow0, index + count - 1);
oRange.addCellsShiftRight();
};
Woorksheet.prototype._insertColsBefore=function(index, count){
......@@ -3665,7 +3665,7 @@ 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)
......
......@@ -3075,8 +3075,6 @@
for(var i = 0; i < data.Drawings.length; i++)
{
//if(i == 0)
// window["Asc"]["editor"].isStartAddShape = true;
data.Drawings[i].graphicObject = data.Drawings[i].graphicObject.copy();
drawingObject = data.Drawings[i];
......@@ -3204,10 +3202,6 @@
}
}
};
//if(i == 0)
// window["Asc"]["editor"].isStartAddShape = true;
CheckSpPrXfrm(drawingObject.graphicObject);
xfrm = drawingObject.graphicObject.spPr.xfrm;
......
......@@ -7799,7 +7799,7 @@
WorksheetView.prototype.applyMoveResizeRangeHandle = function (target){
if( -1 == target.targetArr && !this.startCellMoveResizeRange.isEqual(this.moveRangeDrawingObjectTo) ) {
this.objectRender.moveRangeDrawingObject( this.startCellMoveResizeRange, this.moveRangeDrawingObjectTo, true );
this.objectRender.moveRangeDrawingObject( this.startCellMoveResizeRange, this.moveRangeDrawingObjectTo);
}
this.startCellMoveResizeRange = null;
......@@ -7827,7 +7827,7 @@
t.autoFilters._preMoveAutoFilters(arnFrom, arnTo);
t.model._moveRange(arnFrom, arnTo, copyRange);
t.cellCommentator.moveRangeComments(arnFrom, arnTo);
t.objectRender.moveRangeDrawingObject(arnFrom, arnTo, false);
t.objectRender.moveRangeDrawingObject(arnFrom, arnTo);
if (!copyRange) {
t.autoFilters._moveAutoFilters(arnTo, arnFrom);
// Вызываем функцию пересчета для заголовков форматированной таблицы
......@@ -9380,7 +9380,6 @@
var reinitRanges = false;
var cw;
var isUpdateCols = false, isUpdateRows = false;
var cleanCacheCols = false, cleanCacheRows = false;
var _updateRangeIns, _updateRangeDel, bUndoRedo;
var functionModelAction = null;
var lockDraw = false; // Параметр, при котором не будет отрисовки (т.к. мы просто обновляем информацию на неактивном листе)
......@@ -9393,12 +9392,8 @@
asc_applyFunction(functionModelAction);
t._initCellsArea(fullRecalc);
if (fullRecalc) {
if (fullRecalc)
t.cache.reset();
} else {
if (cleanCacheCols) { t._cleanCache(new asc_Range(arn.c1, 0, arn.c2, t.rows.length - 1)); }
if (cleanCacheRows) { t._cleanCache(new asc_Range(0, arn.r1, t.cols.length - 1, arn.r2)); }
}
t._cleanCellsTextMetricsCache();
t._prepareCellTextMetricsCache();
if (reinitRanges)
......@@ -9542,24 +9537,21 @@
return;
functionModelAction = function () {
History.Create_NewPoint();
History.StartTransaction();
if (range.addCellsShiftRight()) {
fullRecalc = true;
t._cleanCache(oChangeData.changedRange);
if(isCheckChangeAutoFilter === true)
{
t.autoFilters.insertColumn(prop, _updateRangeIns);
}
t.cellCommentator.updateCommentsDependencies(true, val, _updateRangeIns);
t.objectRender.updateDrawingObject(true, val, _updateRangeIns);
}
History.EndTransaction();
};
if(bUndoRedo)
onChangeWorksheetCallback(true);
else {
oChangeData.changedRange = new asc_Range(_updateRangeIns.c1, _updateRangeIns.r1,
gc_nMaxCol0, _updateRangeIns.r2);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
}
oChangeData.changedRange = new asc_Range(_updateRangeIns.c1, _updateRangeIns.r1,
gc_nMaxCol0, _updateRangeIns.r2);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
break;
case c_oAscInsertOptions.InsertCellsAndShiftDown:
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(_updateRangeIns, c_oAscInsertOptions.InsertCellsAndShiftDown, prop);
......@@ -9567,24 +9559,21 @@
return;
functionModelAction = function () {
History.Create_NewPoint();
History.StartTransaction();
if (range.addCellsShiftBottom()) {
fullRecalc = true;
t._cleanCache(oChangeData.changedRange);
if(isCheckChangeAutoFilter === true)
{
t.autoFilters.insertRows(prop,_updateRangeIns);
}
t.cellCommentator.updateCommentsDependencies(true, val, _updateRangeIns);
t.objectRender.updateDrawingObject(true, val, _updateRangeIns);
}
History.EndTransaction();
};
if(bUndoRedo)
onChangeWorksheetCallback(true);
else {
oChangeData.changedRange = new asc_Range(_updateRangeIns.c1, _updateRangeIns.r1,
_updateRangeIns.c2, gc_nMaxRow0);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
}
oChangeData.changedRange = new asc_Range(_updateRangeIns.c1, _updateRangeIns.r1,
_updateRangeIns.c2, gc_nMaxRow0);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
break;
case c_oAscInsertOptions.InsertColumns:
functionModelAction = function () {
......@@ -9646,9 +9635,8 @@
functionModelAction = function () {
History.Create_NewPoint();
History.StartTransaction();
//t.autoFilters.isEmptyAutoFilters(arn);
if (range.deleteCellsShiftLeft()) {
fullRecalc = true;
t._cleanCache(oChangeData.changedRange);
if(isCheckChangeAutoFilter === true)
t.autoFilters.insertColumn(prop, _updateRangeDel, c_oAscDeleteOptions.DeleteCellsAndShiftLeft);
t.cellCommentator.updateCommentsDependencies(false, val, _updateRangeDel);
......@@ -9657,13 +9645,9 @@
History.EndTransaction();
};
if(bUndoRedo)
onChangeWorksheetCallback(true);
else {
oChangeData.changedRange = new asc_Range(_updateRangeDel.c1, _updateRangeDel.r1,
gc_nMaxCol0, _updateRangeDel.r2);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
}
oChangeData.changedRange = new asc_Range(_updateRangeDel.c1, _updateRangeDel.r1,
gc_nMaxCol0, _updateRangeDel.r2);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
break;
case c_oAscDeleteOptions.DeleteCellsAndShiftTop:
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(_updateRangeDel, c_oAscDeleteOptions.DeleteCellsAndShiftTop, prop);
......@@ -9673,9 +9657,8 @@
functionModelAction = function () {
History.Create_NewPoint();
History.StartTransaction();
//t.autoFilters.isEmptyAutoFilters(arn);
if (range.deleteCellsShiftUp()) {
fullRecalc = true;
t._cleanCache(oChangeData.changedRange);
if(isCheckChangeAutoFilter === true)
t.autoFilters.insertRows(prop, _updateRangeDel, c_oAscDeleteOptions.DeleteCellsAndShiftTop);
t.cellCommentator.updateCommentsDependencies(false, val, _updateRangeDel);
......@@ -9684,13 +9667,9 @@
History.EndTransaction();
};
if(bUndoRedo)
onChangeWorksheetCallback(true);
else {
oChangeData.changedRange = new asc_Range(_updateRangeDel.c1, _updateRangeDel.r1,
_updateRangeDel.c2, gc_nMaxRow0);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
}
oChangeData.changedRange = new asc_Range(_updateRangeDel.c1, _updateRangeDel.r1,
_updateRangeDel.c2, gc_nMaxRow0);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
break;
case c_oAscDeleteOptions.DeleteColumns:
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(_updateRangeDel, c_oAscDeleteOptions.DeleteColumns, prop);
......@@ -9703,10 +9682,9 @@
History.StartTransaction();
t.model.removeCols(_updateRangeDel.c1, _updateRangeDel.c2);
t.autoFilters.insertColumn(prop,_updateRangeDel, c_oAscDeleteOptions.DeleteColumns);
History.EndTransaction();
t.objectRender.updateDrawingObject(false, val, _updateRangeDel);
t.cellCommentator.updateCommentsDependencies(false, val, _updateRangeDel);
History.EndTransaction();
};
if(bUndoRedo)
onChangeWorksheetCallback(true);
......@@ -9728,10 +9706,9 @@
History.StartTransaction();
t.model.removeRows(_updateRangeDel.r1, _updateRangeDel.r2);
t.autoFilters.insertRows(prop,_updateRangeDel, c_oAscDeleteOptions.DeleteRows);
History.EndTransaction();
t.objectRender.updateDrawingObject(false, val, _updateRangeDel);
t.cellCommentator.updateCommentsDependencies(false, val, _updateRangeDel);
History.EndTransaction();
};
if(bUndoRedo)
onChangeWorksheetCallback(true);
......
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