Commit 75df0e30 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

рефакторинг(History.Add)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58779 954022d7-b5bf-4e40-9824-e11837661b57
parent 06b490a5
...@@ -347,7 +347,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -347,7 +347,7 @@ var gUndoInsDelCellsFlag = true;
// Смена стиля // Смена стиля
t._addHistoryObj(cloneFilterOld, historyitem_AutoFilter_Add, t._addHistoryObj(cloneFilterOld, historyitem_AutoFilter_Add,
{activeCells: activeCells, lTable: lTable}); {activeCells: activeCells, lTable: lTable}, null, rangeFilter);
break; break;
} }
...@@ -391,7 +391,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -391,7 +391,7 @@ var gUndoInsDelCellsFlag = true;
t._showButtonFlag(newRes.result); t._showButtonFlag(newRes.result);
t._addHistoryObj(changesElemHistory, historyitem_AutoFilter_Add, t._addHistoryObj(changesElemHistory, historyitem_AutoFilter_Add,
{activeCells: activeCells, lTable: lTable}); {activeCells: activeCells, lTable: lTable}, null, activeCells);
//открываем скрытые строки //открываем скрытые строки
var isHidden; var isHidden;
var isInsert = false; var isInsert = false;
...@@ -494,11 +494,12 @@ var gUndoInsDelCellsFlag = true; ...@@ -494,11 +494,12 @@ var gUndoInsDelCellsFlag = true;
result: result, result: result,
isVis: true isVis: true
}; };
changesElemHistory.refTable = Asc.g_oRangeCache.getAscRange(result[0].id + ':' + result[result.length -1].idNext); changesElemHistory.refTable = Asc.g_oRangeCache.getAscRange(result[0].id + ':' + result[result.length -1].idNext);
if(addNameColumn) if(addNameColumn)
changesElemHistory.addColumn = true; changesElemHistory.addColumn = true;
t._addHistoryObj(changesElemHistory, historyitem_AutoFilter_Add, t._addHistoryObj(changesElemHistory, historyitem_AutoFilter_Add,
{activeCells: cloneAC, lTable: lTable, addFormatTableOptionsObj: addFormatTableOptionsObj}); {activeCells: cloneAC, lTable: lTable, addFormatTableOptionsObj: addFormatTableOptionsObj}, null, changesElemHistory.refTable);
if(isInsertButton){ if(isInsertButton){
if (bIsActiveSheet) if (bIsActiveSheet)
...@@ -537,7 +538,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -537,7 +538,7 @@ var gUndoInsDelCellsFlag = true;
t._setColorStyleTable(rangeFilter, filterChange); t._setColorStyleTable(rangeFilter, filterChange);
t._addHistoryObj(changesElemHistory, historyitem_AutoFilter_Add, t._addHistoryObj(changesElemHistory, historyitem_AutoFilter_Add,
{activeCells: activeCells, lTable: lTable}); {activeCells: activeCells, lTable: lTable}, rangeFilter);
isUpdateRange = rangeFilter; isUpdateRange = rangeFilter;
...@@ -565,9 +566,6 @@ var gUndoInsDelCellsFlag = true; ...@@ -565,9 +566,6 @@ var gUndoInsDelCellsFlag = true;
if(paramsForCallBack == "setStyleTableForAutoFilter1" || paramsForCallBack == "setStyleTableForAutoFilter") if(paramsForCallBack == "setStyleTableForAutoFilter1" || paramsForCallBack == "setStyleTableForAutoFilter")
{ {
t._addHistoryObj(changesElemHistory, historyitem_AutoFilter_Add,
{activeCells: activeCells, lTable: lTable});
if (bIsActiveSheet) if (bIsActiveSheet)
t._addButtonAF(newRes, true); t._addButtonAF(newRes, true);
...@@ -580,7 +578,9 @@ var gUndoInsDelCellsFlag = true; ...@@ -580,7 +578,9 @@ var gUndoInsDelCellsFlag = true;
//isUpdateRange = rangeFilter; //isUpdateRange = rangeFilter;
//recalc = true; //recalc = true;
t._addHistoryObj(changesElemHistory, historyitem_AutoFilter_Add,
{activeCells: activeCells, lTable: lTable}, null, rangeFilter);
} }
} }
else if(paramsForCallBackAdd)//добавляем а/ф else if(paramsForCallBackAdd)//добавляем а/ф
...@@ -679,7 +679,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -679,7 +679,7 @@ var gUndoInsDelCellsFlag = true;
if(addNameColumn && addFormatTableOptionsObj) if(addNameColumn && addFormatTableOptionsObj)
addFormatTableOptionsObj.range = ref; addFormatTableOptionsObj.range = ref;
t._addHistoryObj(ref, historyitem_AutoFilter_Add, t._addHistoryObj(ref, historyitem_AutoFilter_Add,
{activeCells: activeCells, lTable: lTable, addFormatTableOptionsObj: addFormatTableOptionsObj}); {activeCells: activeCells, lTable: lTable, addFormatTableOptionsObj: addFormatTableOptionsObj}, null, ref);
if(isInsertButton){ if(isInsertButton){
t._addButtonAF(newRes, true); t._addButtonAF(newRes, true);
...@@ -1372,7 +1372,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -1372,7 +1372,7 @@ var gUndoInsDelCellsFlag = true;
if(currentFilter.TableStyleInfo) if(currentFilter.TableStyleInfo)
t._setColorStyleTable(currentFilter.Ref, currentFilter); t._setColorStyleTable(currentFilter.Ref, currentFilter);
t._addHistoryObj(oldFilter, historyitem_AutoFilter_Sort, t._addHistoryObj(oldFilter, historyitem_AutoFilter_Sort,
{activeCells: activeCells, type: type, cellId: cellId}); {activeCells: activeCells, type: type, cellId: cellId}, null, currentFilter.Ref);
History.EndTransaction(); History.EndTransaction();
// ToDo может хватит просто почистить selectionRange или нужно делать полный "update" ? // ToDo может хватит просто почистить selectionRange или нужно делать полный "update" ?
ws._cleanCache(selectionRange); ws._cleanCache(selectionRange);
...@@ -1570,7 +1570,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -1570,7 +1570,7 @@ var gUndoInsDelCellsFlag = true;
oldFilter.insCells = true; oldFilter.insCells = true;
//заносим в историю //заносим в историю
this._addHistoryObj(oldFilter, historyitem_AutoFilter_Empty, {activeCells: activeCells}); this._addHistoryObj(oldFilter, historyitem_AutoFilter_Empty, {activeCells: activeCells}, null, oldFilter.Ref);
this._isEmptyButtons(oldFilter.Ref); this._isEmptyButtons(oldFilter.Ref);
} }
...@@ -1594,7 +1594,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -1594,7 +1594,7 @@ var gUndoInsDelCellsFlag = true;
//открываем скрытые строки //открываем скрытые строки
aWs.setRowHidden(false, bbox.r1, bbox.r2); aWs.setRowHidden(false, bbox.r1, bbox.r2);
//заносим в историю //заносим в историю
this._addHistoryObj(oCurFilter, historyitem_AutoFilter_Empty, {activeCells: activeCells},deleteFilterAfterDeleteColRow); this._addHistoryObj(oCurFilter, historyitem_AutoFilter_Empty, {activeCells: activeCells}, deleteFilterAfterDeleteColRow, oRange);
this._isEmptyButtons(oCurFilter.Ref); this._isEmptyButtons(oCurFilter.Ref);
} }
...@@ -1638,7 +1638,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -1638,7 +1638,7 @@ var gUndoInsDelCellsFlag = true;
aWs.setRowHidden(false, bbox.r1, bbox.r2); aWs.setRowHidden(false, bbox.r1, bbox.r2);
//заносим в историю //заносим в историю
this._addHistoryObj(oldFilter, historyitem_AutoFilter_Empty, {activeCells: activeCells}); this._addHistoryObj(oldFilter, historyitem_AutoFilter_Empty, {activeCells: activeCells}, null, aWs.AutoFilter.Ref);
} }
if(activeCells) if(activeCells)
...@@ -5332,7 +5332,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -5332,7 +5332,7 @@ var gUndoInsDelCellsFlag = true;
{ {
oldFilter: oldFilter oldFilter: oldFilter
}; };
this._addHistoryObj(changeElement, null, null, true); this._addHistoryObj(changeElement, null, null, true, oldFilter.Ref);
History.EndTransaction(); History.EndTransaction();
} }
} }
...@@ -6182,7 +6182,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -6182,7 +6182,7 @@ var gUndoInsDelCellsFlag = true;
}, },
_addHistoryObj: function (oldObj, type, redoObject, deleteFilterAfterDeleteColRow) { _addHistoryObj: function (oldObj, type, redoObject, deleteFilterAfterDeleteColRow, activeHistoryRange) {
var ws = this.worksheet; var ws = this.worksheet;
var oHistoryObject = new UndoRedoData_AutoFilter(); var oHistoryObject = new UndoRedoData_AutoFilter();
oHistoryObject.undo = oldObj; oHistoryObject.undo = oldObj;
...@@ -6204,7 +6204,10 @@ var gUndoInsDelCellsFlag = true; ...@@ -6204,7 +6204,10 @@ var gUndoInsDelCellsFlag = true;
type = null; type = null;
} }
History.Add(g_oUndoRedoAutoFilters, type, ws.model.getId(), null, oHistoryObject); if(!activeHistoryRange)
activeHistoryRange = null;
History.Add(g_oUndoRedoAutoFilters, type, ws.model.getId(), activeHistoryRange, oHistoryObject);
if(deleteFilterAfterDeleteColRow) if(deleteFilterAfterDeleteColRow)
History.ChangeActionsEndToStart(); History.ChangeActionsEndToStart();
}, },
...@@ -7320,7 +7323,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -7320,7 +7323,7 @@ var gUndoInsDelCellsFlag = true;
autoFilterElement.FilterColumns = null; autoFilterElement.FilterColumns = null;
}; };
this._addHistoryObj(oldFilter, historyitem_AutoFilter_CleanAutoFilter, {activeCells: activeCells}); this._addHistoryObj(oldFilter, historyitem_AutoFilter_CleanAutoFilter, {activeCells: activeCells}, null, activeCells);
ws.isChanged = true; ws.isChanged = true;
this._reDrawFilters(); this._reDrawFilters();
......
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