Commit 4d9bde5d authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Для удаления/добавления строк/колонок убрал вызовы на undo/redo через wsView....

Для удаления/добавления строк/колонок убрал вызовы на undo/redo через wsView. Сделал вызовы через model

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59307 954022d7-b5bf-4e40-9824-e11837661b57
parent 8fba758c
......@@ -2997,14 +2997,25 @@ UndoRedoWoorksheet.prototype = {
}
}
range = Asc.Range(0, from, gc_nMaxCol0, to);
if((true == bUndo && historyitem_Worksheet_AddRows == Type) || (false == bUndo && historyitem_Worksheet_RemoveRows == Type))
ws.workbook.handlers.trigger("deleteCell", nSheetId, c_oAscDeleteOptions.DeleteRows, range);
else
ws.workbook.handlers.trigger("insertCell", nSheetId, c_oAscInsertOptions.InsertRows, range);
if((true == bUndo && historyitem_Worksheet_AddRows == Type) || (false == bUndo && historyitem_Worksheet_RemoveRows == Type)) {
ws.removeRows(from, to);
bInsert = false;
operType = c_oAscDeleteOptions.DeleteRows;
} else {
ws.insertRowsBefore(from, to - from + 1);
bInsert = true;
operType = c_oAscInsertOptions.InsertRows;
}
// Нужно поменять пересчетные индексы для совместного редактирования (lock-элементы), но только если это не изменения от другого пользователя
if (true !== this.wb.bCollaborativeChanges)
ws.workbook.handlers.trigger("undoRedoAddRemoveRowCols", nSheetId, Type, range, bUndo);
// ToDo Так делать неправильно, нужно поправить (перенести логику в model, а отрисовку отделить)
worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
worksheetView.autoFilters.insertRows(bInsert ? "insCell" : "delCell", range, operType);
worksheetView.objectRender.updateDrawingObject(bInsert, operType, range);
worksheetView.cellCommentator.updateCommentsDependencies(bInsert, operType, range);
}
else if(historyitem_Worksheet_AddCols == Type || historyitem_Worksheet_RemoveCols == Type)
{
......@@ -3025,14 +3036,25 @@ UndoRedoWoorksheet.prototype = {
}
range = Asc.Range(from, 0, to, gc_nMaxRow0);
if((true == bUndo && historyitem_Worksheet_AddCols == Type) || (false == bUndo && historyitem_Worksheet_RemoveCols == Type))
ws.workbook.handlers.trigger("deleteCell", nSheetId, c_oAscDeleteOptions.DeleteColumns, range);
else
ws.workbook.handlers.trigger("insertCell", nSheetId, c_oAscInsertOptions.InsertColumns, range);
if((true == bUndo && historyitem_Worksheet_AddCols == Type) || (false == bUndo && historyitem_Worksheet_RemoveCols == Type)) {
ws.removeCols(from, to);
bInsert = false;
operType = c_oAscDeleteOptions.DeleteColumns;
} else {
ws.insertColsBefore(from, to - from + 1);
bInsert = true;
operType = c_oAscInsertOptions.InsertColumns;
}
// Нужно поменять пересчетные индексы для совместного редактирования (lock-элементы), но только если это не изменения от другого пользователя
if (true !== this.wb.bCollaborativeChanges)
ws.workbook.handlers.trigger("undoRedoAddRemoveRowCols", nSheetId, Type, range, bUndo);
// ToDo Так делать неправильно, нужно поправить (перенести логику в model, а отрисовку отделить)
worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
worksheetView.autoFilters.insertColumn(bInsert ? "insCell" : "delCell", range, operType);
worksheetView.objectRender.updateDrawingObject(bInsert, operType, range);
worksheetView.cellCommentator.updateCommentsDependencies(bInsert, operType, range);
}
else if(historyitem_Worksheet_ShiftCellsLeft == Type || historyitem_Worksheet_ShiftCellsRight == Type)
{
......
......@@ -438,12 +438,6 @@
if (ws)
ws.changeWorksheet("update", val);
});
this.model.handlers.add("insertCell", function (wsId, val, range) {
self.getWorksheetById(wsId).changeWorksheet("insCell", {val: val, range: range});
});
this.model.handlers.add("deleteCell", function (wsId, val, range) {
self.getWorksheetById(wsId).changeWorksheet("delCell", {val: val, range: range});
});
this.model.handlers.add("showWorksheet", function (wsId) {
var wsModel = self.model.getWorksheetById(wsId), index;
if (wsModel) {
......
......@@ -9380,7 +9380,7 @@
var reinitRanges = false;
var cw;
var isUpdateCols = false, isUpdateRows = false;
var _updateRangeIns, _updateRangeDel, bUndoRedo;
var isCheckChangeAutoFilter;
var functionModelAction = null;
var lockDraw = false; // Параметр, при котором не будет отрисовки (т.к. мы просто обновляем информацию на неактивном листе)
var oChangeData = new CChangeTableData(null, null, null, null); // Обновление для диаграмм
......@@ -9522,17 +9522,10 @@
this._isLockedAll(onChangeWorksheetCallback);
break;
case "insCell":
bUndoRedo = val.range != undefined;
if (val && val.range) {
_updateRangeIns = val.range;
val = val.val;
} else {
_updateRangeIns = arn;
}
range = t.model.getRange3(_updateRangeIns.r1, _updateRangeIns.c1, _updateRangeIns.r2, _updateRangeIns.c2);
range = t.model.getRange3(arn.r1, arn.c1, arn.r2, arn.c2);
switch (val) {
case c_oAscInsertOptions.InsertCellsAndShiftRight:
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(_updateRangeIns, c_oAscInsertOptions.InsertCellsAndShiftRight, prop);
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(arn, c_oAscInsertOptions.InsertCellsAndShiftRight, prop);
if(isCheckChangeAutoFilter === false)
return;
......@@ -9542,19 +9535,18 @@
if (range.addCellsShiftRight()) {
t._cleanCache(oChangeData.changedRange);
if(isCheckChangeAutoFilter === true)
t.autoFilters.insertColumn(prop, _updateRangeIns);
t.cellCommentator.updateCommentsDependencies(true, val, _updateRangeIns);
t.objectRender.updateDrawingObject(true, val, _updateRangeIns);
t.autoFilters.insertColumn(prop, arn);
t.cellCommentator.updateCommentsDependencies(true, val, arn);
t.objectRender.updateDrawingObject(true, val, arn);
}
History.EndTransaction();
};
oChangeData.changedRange = new asc_Range(_updateRangeIns.c1, _updateRangeIns.r1,
gc_nMaxCol0, _updateRangeIns.r2);
oChangeData.changedRange = new asc_Range(arn.c1, arn.r1, gc_nMaxCol0, arn.r2);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
break;
case c_oAscInsertOptions.InsertCellsAndShiftDown:
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(_updateRangeIns, c_oAscInsertOptions.InsertCellsAndShiftDown, prop);
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(arn, c_oAscInsertOptions.InsertCellsAndShiftDown, prop);
if(isCheckChangeAutoFilter === false)
return;
......@@ -9564,71 +9556,52 @@
if (range.addCellsShiftBottom()) {
t._cleanCache(oChangeData.changedRange);
if(isCheckChangeAutoFilter === true)
t.autoFilters.insertRows(prop,_updateRangeIns);
t.cellCommentator.updateCommentsDependencies(true, val, _updateRangeIns);
t.objectRender.updateDrawingObject(true, val, _updateRangeIns);
t.autoFilters.insertRows(prop,arn);
t.cellCommentator.updateCommentsDependencies(true, val, arn);
t.objectRender.updateDrawingObject(true, val, arn);
}
History.EndTransaction();
};
oChangeData.changedRange = new asc_Range(_updateRangeIns.c1, _updateRangeIns.r1,
_updateRangeIns.c2, gc_nMaxRow0);
oChangeData.changedRange = new asc_Range(arn.c1, arn.r1, arn.c2, gc_nMaxRow0);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
break;
case c_oAscInsertOptions.InsertColumns:
functionModelAction = function () {
History.Create_NewPoint();
History.StartTransaction();
fullRecalc = true;
t.model.insertColsBefore(_updateRangeIns.c1, _updateRangeIns.c2 - _updateRangeIns.c1 + 1);
t.autoFilters.insertColumn(prop, _updateRangeIns, c_oAscInsertOptions.InsertColumns);
t.objectRender.updateDrawingObject(true, val, _updateRangeIns);
t.cellCommentator.updateCommentsDependencies(true, val, _updateRangeIns);
t.model.insertColsBefore(arn.c1, arn.c2 - arn.c1 + 1);
t.autoFilters.insertColumn(prop, arn, c_oAscInsertOptions.InsertColumns);
t.objectRender.updateDrawingObject(true, val, arn);
t.cellCommentator.updateCommentsDependencies(true, val, arn);
History.EndTransaction();
};
if(bUndoRedo)
onChangeWorksheetCallback(true);
else {
oChangeData.added = new asc_Range(_updateRangeIns.c1, 0, _updateRangeIns.c2,
gc_nMaxRow0);
this._isLockedCells(oChangeData.added, c_oAscLockTypeElemSubType.InsertColumns,
onChangeWorksheetCallback);
}
oChangeData.added = new asc_Range(arn.c1, 0, arn.c2, gc_nMaxRow0);
this._isLockedCells(oChangeData.added, c_oAscLockTypeElemSubType.InsertColumns,
onChangeWorksheetCallback);
break;
case c_oAscInsertOptions.InsertRows:
functionModelAction = function () {
fullRecalc = true;
t.model.insertRowsBefore(_updateRangeIns.r1, _updateRangeIns.r2 - _updateRangeIns.r1 + 1);
t.autoFilters.insertRows(prop,_updateRangeIns, c_oAscInsertOptions.InsertRows);
t.objectRender.updateDrawingObject(true, val, _updateRangeIns);
t.cellCommentator.updateCommentsDependencies(true, val, _updateRangeIns);
t.model.insertRowsBefore(arn.r1, arn.r2 - arn.r1 + 1);
t.autoFilters.insertRows(prop, arn, c_oAscInsertOptions.InsertRows);
t.objectRender.updateDrawingObject(true, val, arn);
t.cellCommentator.updateCommentsDependencies(true, val, arn);
};
if(bUndoRedo)
onChangeWorksheetCallback(true);
else {
oChangeData.added = new asc_Range(0, _updateRangeIns.r1, gc_nMaxCol0, _updateRangeIns.r2);
this._isLockedCells(oChangeData.added, c_oAscLockTypeElemSubType.InsertRows,
onChangeWorksheetCallback);
}
oChangeData.added = new asc_Range(0, arn.r1, gc_nMaxCol0, arn.r2);
this._isLockedCells(oChangeData.added, c_oAscLockTypeElemSubType.InsertRows,
onChangeWorksheetCallback);
break;
}
break;
case "delCell":
var isCheckChangeAutoFilter;
bUndoRedo = val.range != undefined;
if (val && val.range) {
_updateRangeDel = val.range;
val = val.val;
} else {
_updateRangeDel = arn;
}
range = t.model.getRange3(_updateRangeDel.r1, _updateRangeDel.c1, _updateRangeDel.r2, _updateRangeDel.c2);
range = t.model.getRange3(arn.r1, arn.c1, arn.r2, arn.c2);
switch (val) {
case c_oAscDeleteOptions.DeleteCellsAndShiftLeft:
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(_updateRangeDel, c_oAscDeleteOptions.DeleteCellsAndShiftLeft, prop);
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(arn, c_oAscDeleteOptions.DeleteCellsAndShiftLeft, prop);
if(isCheckChangeAutoFilter === false)
return;
......@@ -9638,19 +9611,18 @@
if (range.deleteCellsShiftLeft()) {
t._cleanCache(oChangeData.changedRange);
if(isCheckChangeAutoFilter === true)
t.autoFilters.insertColumn(prop, _updateRangeDel, c_oAscDeleteOptions.DeleteCellsAndShiftLeft);
t.cellCommentator.updateCommentsDependencies(false, val, _updateRangeDel);
t.objectRender.updateDrawingObject(false, val, _updateRangeDel);
t.autoFilters.insertColumn(prop, arn, c_oAscDeleteOptions.DeleteCellsAndShiftLeft);
t.cellCommentator.updateCommentsDependencies(false, val, arn);
t.objectRender.updateDrawingObject(false, val, arn);
}
History.EndTransaction();
};
oChangeData.changedRange = new asc_Range(_updateRangeDel.c1, _updateRangeDel.r1,
gc_nMaxCol0, _updateRangeDel.r2);
oChangeData.changedRange = new asc_Range(arn.c1, arn.r1, gc_nMaxCol0, arn.r2);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
break;
case c_oAscDeleteOptions.DeleteCellsAndShiftTop:
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(_updateRangeDel, c_oAscDeleteOptions.DeleteCellsAndShiftTop, prop);
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(arn, c_oAscDeleteOptions.DeleteCellsAndShiftTop, prop);
if(isCheckChangeAutoFilter === false)
return;
......@@ -9660,19 +9632,18 @@
if (range.deleteCellsShiftUp()) {
t._cleanCache(oChangeData.changedRange);
if(isCheckChangeAutoFilter === true)
t.autoFilters.insertRows(prop, _updateRangeDel, c_oAscDeleteOptions.DeleteCellsAndShiftTop);
t.cellCommentator.updateCommentsDependencies(false, val, _updateRangeDel);
t.objectRender.updateDrawingObject(false, val, _updateRangeDel);
t.autoFilters.insertRows(prop, arn, c_oAscDeleteOptions.DeleteCellsAndShiftTop);
t.cellCommentator.updateCommentsDependencies(false, val, arn);
t.objectRender.updateDrawingObject(false, val, arn);
}
History.EndTransaction();
};
oChangeData.changedRange = new asc_Range(_updateRangeDel.c1, _updateRangeDel.r1,
_updateRangeDel.c2, gc_nMaxRow0);
oChangeData.changedRange = new asc_Range(arn.c1, arn.r1, arn.c2, gc_nMaxRow0);
this._isLockedCells(oChangeData.changedRange, null, onChangeWorksheetCallback);
break;
case c_oAscDeleteOptions.DeleteColumns:
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(_updateRangeDel, c_oAscDeleteOptions.DeleteColumns, prop);
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(arn, c_oAscDeleteOptions.DeleteColumns, prop);
if(isCheckChangeAutoFilter === false)
return;
......@@ -9680,23 +9651,19 @@
fullRecalc = true;
History.Create_NewPoint();
History.StartTransaction();
t.model.removeCols(_updateRangeDel.c1, _updateRangeDel.c2);
t.autoFilters.insertColumn(prop,_updateRangeDel, c_oAscDeleteOptions.DeleteColumns);
t.objectRender.updateDrawingObject(false, val, _updateRangeDel);
t.cellCommentator.updateCommentsDependencies(false, val, _updateRangeDel);
t.model.removeCols(arn.c1, arn.c2);
t.autoFilters.insertColumn(prop, arn, c_oAscDeleteOptions.DeleteColumns);
t.objectRender.updateDrawingObject(false, val, arn);
t.cellCommentator.updateCommentsDependencies(false, val, arn);
History.EndTransaction();
};
if(bUndoRedo)
onChangeWorksheetCallback(true);
else {
oChangeData.removed = new asc_Range(_updateRangeDel.c1, 0, _updateRangeDel.c2,
gc_nMaxRow0);
this._isLockedCells(oChangeData.removed, c_oAscLockTypeElemSubType.DeleteColumns,
onChangeWorksheetCallback);
}
oChangeData.removed = new asc_Range(arn.c1, 0, arn.c2, gc_nMaxRow0);
this._isLockedCells(oChangeData.removed, c_oAscLockTypeElemSubType.DeleteColumns,
onChangeWorksheetCallback);
break;
case c_oAscDeleteOptions.DeleteRows:
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(_updateRangeDel, c_oAscDeleteOptions.DeleteRows, prop);
isCheckChangeAutoFilter = t.autoFilters.isActiveCellsCrossHalfFTable(arn, c_oAscDeleteOptions.DeleteRows, prop);
if(isCheckChangeAutoFilter === false)
return;
......@@ -9704,19 +9671,16 @@
fullRecalc = true;
History.Create_NewPoint();
History.StartTransaction();
t.model.removeRows(_updateRangeDel.r1, _updateRangeDel.r2);
t.autoFilters.insertRows(prop,_updateRangeDel, c_oAscDeleteOptions.DeleteRows);
t.objectRender.updateDrawingObject(false, val, _updateRangeDel);
t.cellCommentator.updateCommentsDependencies(false, val, _updateRangeDel);
t.model.removeRows(arn.r1, arn.r2);
t.autoFilters.insertRows(prop, arn, c_oAscDeleteOptions.DeleteRows);
t.objectRender.updateDrawingObject(false, val, arn);
t.cellCommentator.updateCommentsDependencies(false, val, arn);
History.EndTransaction();
};
if(bUndoRedo)
onChangeWorksheetCallback(true);
else {
oChangeData.removed = new asc_Range(0, _updateRangeDel.r1, gc_nMaxCol0, _updateRangeDel.r2);
this._isLockedCells(oChangeData.removed, c_oAscLockTypeElemSubType.DeleteRows,
onChangeWorksheetCallback);
}
oChangeData.removed = new asc_Range(0, arn.r1, gc_nMaxCol0, arn.r2);
this._isLockedCells(oChangeData.removed, c_oAscLockTypeElemSubType.DeleteRows,
onChangeWorksheetCallback);
break;
}
break;
......
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