Commit 2bfeac48 authored by GoshaZotov's avatar GoshaZotov

add rename total row changes into history

parent d504524c
......@@ -143,6 +143,7 @@ function (window, undefined) {
window['AscCH'].historyitem_AutoFilter_ChangeTableName = 14;
window['AscCH'].historyitem_AutoFilter_ClearFilterColumn = 15;
window['AscCH'].historyitem_AutoFilter_ChangeColumnName = 16;
window['AscCH'].historyitem_AutoFilter_ChangeTotalRow = 17;
function CHistory()
......
......@@ -1765,7 +1765,8 @@ var g_oUndoRedoData_AutoFilterProperties = {
color : 17,
tablePart : 18,
nCol : 19,
nRow : 20
nRow : 20,
formula : 21
};
function UndoRedoData_AutoFilter() {
this.Properties = g_oUndoRedoData_AutoFilterProperties;
......@@ -1795,6 +1796,7 @@ function UndoRedoData_AutoFilter() {
this.tablePart = null;
this.nCol = null;
this.nRow = null;
this.formula = null;
}
UndoRedoData_AutoFilter.prototype = {
getType : function ()
......@@ -1842,6 +1844,7 @@ UndoRedoData_AutoFilter.prototype = {
}
case this.Properties.nCol: return this.nCol; break;
case this.Properties.nRow: return this.nRow; break;
case this.Properties.formula: return this.formula; break;
}
return null;
......@@ -1905,6 +1908,7 @@ UndoRedoData_AutoFilter.prototype = {
}
case this.Properties.nCol: this.nCol = value;break;
case this.Properties.nRow: this.nRow = value;break;
case this.Properties.formula: this.formula = value;break;
}
return null;
},
......@@ -3884,7 +3888,7 @@ UndoRedoAutoFilters.prototype = {
}
else
{
if(AscCH.historyitem_AutoFilter_ChangeColumnName === Type)
if(AscCH.historyitem_AutoFilter_ChangeColumnName === Type || AscCH.historyitem_AutoFilter_ChangeTotalRow === Type)
{
if(false != this.wb.bCollaborativeChanges)
{
......
......@@ -899,6 +899,9 @@
case AscCH.historyitem_AutoFilter_ChangeColumnName:
this.renameTableColumn(null, null, data);
break;
case AscCH.historyitem_AutoFilter_ChangeTotalRow:
this.renameTableColumn(null, null, data);
break;
}
History.TurnOn();
},
......@@ -926,7 +929,7 @@
delete cloneData.insCells;
//TODO переделать undo, по типам
if(type === AscCH.historyitem_AutoFilter_ChangeColumnName)//перемещение
if(type === AscCH.historyitem_AutoFilter_ChangeColumnName || type === AscCH.historyitem_AutoFilter_ChangeTotalRow)//перемещение
{
this.renameTableColumn(null, null, undoData);
}
......@@ -2838,6 +2841,7 @@
oHistoryObject.tablePart = redoObject.tablePart;
oHistoryObject.nCol = redoObject.nCol;
oHistoryObject.nRow = redoObject.nRow;
oHistoryObject.formula = redoObject.formula;
}
else
{
......@@ -2955,13 +2959,13 @@
}
else
{
this._changeTotalsRowData(filter, range);
this._changeTotalsRowData(filter, range, props);
}
}
}
},
_changeTotalsRowData: function(tablePart, range)
_changeTotalsRowData: function(tablePart, range, props)
{
if(!tablePart || !range || !tablePart.TotalsRowCount)
{
......@@ -2981,16 +2985,44 @@
var cell = worksheet.getCell3(tableRange.r2, j);
var tableColumn = tablePart.TableColumns[j - tableRange.c1];
var formula = null;
var label = null;
if(props)
{
if(props.formula)
{
formula = props.formula;
}
else
{
label = props.val;
}
}
else
{
if(cell.isFormula())
{
var val = cell.getFormula();
tableColumn.setTotalsRowFormula(val, worksheet);
formula = cell.getFormula();
}
else
{
var val = cell.getValue();
tableColumn.setTotalsRowLabel(val);
label = cell.getValue();
}
}
var oldLabel = tableColumn.TotalsRowLabel;
var oldFormula = tableColumn.TotalsRowFormula ? tableColumn.TotalsRowFormula.Formula : null;
if(null !== formula)
{
tableColumn.setTotalsRowFormula(formula, worksheet);
}
else
{
tableColumn.setTotalsRowLabel(label);
}
this._addHistoryObj({nCol: cell.bbox.c1, nRow: cell.bbox.r1, formula: oldFormula, val: oldLabel}, AscCH.historyitem_AutoFilter_ChangeTotalRow, {activeCells: range, nCol: cell.bbox.c1, nRow: cell.bbox.r1, formula: formula, val: label});
}
}
},
......
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