Commit d979a8b4 authored by konovalovsergey's avatar konovalovsergey

cStrucTable refactoring to support transformation without full rebuild; change...

cStrucTable refactoring to support transformation without full rebuild; change formulas at add/remove columns/rows in table; formulas transformation without full rebuild;
parent 2fa2962a
This diff is collapsed.
......@@ -944,16 +944,6 @@ CHistory.prototype.GetSerializeArray = function()
}
return aRes;
};
//функция, которая перемещает последнее действие на первую позицию(в текущей точке)
CHistory.prototype.ChangeActionsEndToStart = function()
{
var curPoint = this.Points[this.Index];
if(curPoint && curPoint.Items.length > 0)
{
var endAction = curPoint.Items.pop();
curPoint.Items.unshift(endAction);
}
};
CHistory.prototype.loadFonts = function (fonts) {
for (var i = 0; i < fonts.length; ++i) {
this.LoadFonts[fonts[i].name] = 1;
......
This diff is collapsed.
......@@ -5897,11 +5897,11 @@ TablePart.prototype.deleteTableColumns = function(activeRange)
this.removeDependencies(deleted);
//todo undo
// var deletedMap = {};
// for (var i = 0; i < deleted.length; ++i) {
// deletedMap[deleted[i].Name] = 1;
// }
// this.handlers.trigger("deleteColumnTablePart", this.DisplayName, deletedMap);
var deletedMap = {};
for (var i = 0; i < deleted.length; ++i) {
deletedMap[deleted[i].Name] = 1;
}
this.handlers.trigger("deleteColumnTablePart", this.DisplayName, deletedMap);
}
};
......@@ -6360,15 +6360,6 @@ function TableColumn() {
return true;
} else if (AscCommon.c_oNotifyParentType.Change === type) {
this.TotalsRowFormula.setIsDirty(false);
} else if (AscCommon.c_oNotifyParentType.ChangeFormula === type) {
if (eventData.isRebuild) {
var ws = this.TotalsRowFormula.ws;
this.TotalsRowFormula = null;//to prevent removeDependencies in applyTotalRowFormula
this.applyTotalRowFormula(eventData.assemble, ws, true);
} else {
this.TotalsRowFormula.Formula = eventData.assemble;
this.TotalsRowFormula.buildDependencies();
}
}
};
TableColumn.prototype.renameSheetCopy = function(ws, renameParams) {
......
......@@ -919,14 +919,16 @@
case AscCH.historyitem_AutoFilter_Change:
if(data !== null && data.displayName)
{
var redrawTablesArr;
if(data.type === true)
{
this.insertLastTableColumn(data.displayName, data.activeCells);
redrawTablesArr = this.insertLastTableColumn(data.displayName, data.activeCells);
}
else if(data.type === false)
{
this.insertLastTableRow(data.displayName, data.activeCells);
redrawTablesArr = this.insertLastTableRow(data.displayName, data.activeCells);
}
this.redrawStylesTables(redrawTablesArr);
}
break;
case AscCH.historyitem_AutoFilter_ChangeTableInfo:
......@@ -1286,8 +1288,22 @@
}
return false;
},
insertColumn: function(type, activeRange, insertType, displayNameFormatTable)
_cleanStylesTables: function(redrawTablesArr) {
for(var i = 0; i < redrawTablesArr.length; i++) {
this._cleanStyleTable(redrawTablesArr[i].oldfilterRef);
}
},
_setStylesTables: function(redrawTablesArr) {
for(var i = 0; i < redrawTablesArr.length; i++) {
this._setColorStyleTable(redrawTablesArr[i].newFilter.Ref, redrawTablesArr[i].newFilter, null, true);
}
},
redrawStylesTables: function(redrawTablesArr) {
//set styles for tables
this._cleanStylesTables(redrawTablesArr);
this._setStylesTables(redrawTablesArr);
},
insertColumn: function(type, activeRange, insertType, displayNameFormatTable, bHistoryStyles)
{
var worksheet = this.worksheet;
var t = this;
......@@ -1306,25 +1322,6 @@
activeRange.r2 = AscCommon.gc_nMaxRow - 1;
}
History.StartTransaction();
History.Create_NewPoint();
var cleanStylesTables = function(redrawTablesArr)
{
for(var i = 0; i < redrawTablesArr.length; i++)
{
t._cleanStyleTable(redrawTablesArr[i].oldfilterRef);
}
};
var setStylesTables = function(redrawTablesArr)
{
for(var i = 0; i < redrawTablesArr.length; i++)
{
t._setColorStyleTable(redrawTablesArr[i].newFilter.Ref, redrawTablesArr[i].newFilter, null, true);
}
};
var changeFilter = function(filter, bTablePart)
{
var ref = filter.Ref;
......@@ -1435,14 +1432,9 @@
if(displayNameFormatTable && type == 'insCells')
{
this.insertLastTableColumn(displayNameFormatTable, activeRange);
redrawTablesArr = redrawTablesArr.concat(this.insertLastTableColumn(displayNameFormatTable, activeRange));
}
//set styles for tables
cleanStylesTables(redrawTablesArr);
setStylesTables(redrawTablesArr);
History.EndTransaction();
return redrawTablesArr;
},
insertLastTableColumn: function(displayNameFormatTable, activeRange)
......@@ -1454,25 +1446,6 @@
var redrawTablesArr = [];
History.StartTransaction();
History.Create_NewPoint();
var cleanStylesTables = function(redrawTablesArr)
{
for(var i = 0; i < redrawTablesArr.length; i++)
{
t._cleanStyleTable(redrawTablesArr[i].oldfilterRef);
}
};
var setStylesTables = function(redrawTablesArr)
{
for(var i = 0; i < redrawTablesArr.length; i++)
{
t._setColorStyleTable(redrawTablesArr[i].newFilter.Ref, redrawTablesArr[i].newFilter, null, true);
}
};
var changeFilter = function(filter)
{
var oldFilter = filter.clone(null);
......@@ -1499,14 +1472,10 @@
{
//change TableParts
changeFilter(tablePart);
//set styles for tables
cleanStylesTables(redrawTablesArr);
setStylesTables(redrawTablesArr);
}
History.EndTransaction();
return redrawTablesArr;
},
insertRows: function(type, activeRange, insertType, displayNameFormatTable)
......@@ -1529,25 +1498,6 @@
activeRange.c2 = AscCommon.gc_nMaxCol - 1;
}
History.StartTransaction();
History.Create_NewPoint();
var cleanStylesTables = function(redrawTablesArr)
{
for(var i = 0; i < redrawTablesArr.length; i++)
{
t._cleanStyleTable(redrawTablesArr[i].oldfilterRef);
}
};
var setStylesTables = function(redrawTablesArr)
{
for(var i = 0; i < redrawTablesArr.length; i++)
{
t._setColorStyleTable(redrawTablesArr[i].newFilter.Ref, redrawTablesArr[i].newFilter, null, true);
}
};
var changeFilter = function(filter, bTablePart)
{
var ref = filter.Ref;
......@@ -1611,14 +1561,10 @@
if(displayNameFormatTable && type == 'insCell')
{
this.insertLastTableRow(displayNameFormatTable, activeRange);
redrawTablesArr = redrawTablesArr.concat(this.insertLastTableRow(displayNameFormatTable, activeRange));
}
//set styles for tables
cleanStylesTables(redrawTablesArr);
setStylesTables(redrawTablesArr);
History.EndTransaction();
return redrawTablesArr;
},
insertLastTableRow: function(displayNameFormatTable, activeRange)
......@@ -1630,25 +1576,6 @@
var redrawTablesArr = [];
History.StartTransaction();
History.Create_NewPoint();
var cleanStylesTables = function(redrawTablesArr)
{
for(var i = 0; i < redrawTablesArr.length; i++)
{
t._cleanStyleTable(redrawTablesArr[i].oldfilterRef);
}
};
var setStylesTables = function(redrawTablesArr)
{
for(var i = 0; i < redrawTablesArr.length; i++)
{
t._setColorStyleTable(redrawTablesArr[i].newFilter.Ref, redrawTablesArr[i].newFilter, null, true);
}
};
var changeFilter = function(filter)
{
var oldFilter = filter.clone(null);
......@@ -1674,14 +1601,8 @@
{
//change TableParts
changeFilter(tablePart);
//set styles for tables
cleanStylesTables(redrawTablesArr);
setStylesTables(redrawTablesArr);
}
History.EndTransaction();
return redrawTablesArr;
},
sortColFilter: function(type, cellId, activeRange, sortProps, displayName, color) {
......@@ -2926,8 +2847,6 @@
activeHistoryRange = null;
History.Add(AscCommonExcel.g_oUndoRedoAutoFilters, type, ws.getId(), activeHistoryRange, oHistoryObject);
if(deleteFilterAfterDeleteColRow)
History.ChangeActionsEndToStart();
},
_getCurrentWS : function() {
......
......@@ -820,7 +820,7 @@
Shift: 1,
Move: 2,
Delete: 3,
Rebuild: 4,
RenameTableColumn: 4,
Changed: 5,
ChangeDefName: 6,
ChangeSheet: 7,
......
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