Commit 51d6464a authored by GoshaZotov's avatar GoshaZotov

add functions for change format table (Insert Row Below и Insert Column Right options)

parent e018f763
...@@ -4816,7 +4816,7 @@ Woorksheet.prototype._shiftCellsUp=function(oBBox){ ...@@ -4816,7 +4816,7 @@ Woorksheet.prototype._shiftCellsUp=function(oBBox){
this.autoFilters.insertRows( "delCell", oBBox, c_oAscDeleteOptions.DeleteCellsAndShiftTop ); this.autoFilters.insertRows( "delCell", oBBox, c_oAscDeleteOptions.DeleteCellsAndShiftTop );
//todo проверить не уменьшились ли границы таблицы //todo проверить не уменьшились ли границы таблицы
}; };
Woorksheet.prototype._shiftCellsRight=function(oBBox){ Woorksheet.prototype._shiftCellsRight=function(oBBox, displayNameFormatTable){
//до перемещения ячеек, перед функцией, в которой используются nodesSheetArea/nodesSheetCell move/shift нужно обязательно вызвать force buildRecalc //до перемещения ячеек, перед функцией, в которой используются nodesSheetArea/nodesSheetCell move/shift нужно обязательно вызвать force buildRecalc
//чтобы формулы, которые копим попали в струкруры nodesSheet, иначе формулы не сдвинутся //чтобы формулы, которые копим попали в струкруры nodesSheet, иначе формулы не сдвинутся
//например принимаем изменения: добавление формул, сдвиг с помощью _removeRows. результат формулы указывают на теже ячейки, что и до _removeRows //например принимаем изменения: добавление формул, сдвиг с помощью _removeRows. результат формулы указывают на теже ячейки, что и до _removeRows
...@@ -4851,9 +4851,9 @@ Woorksheet.prototype._shiftCellsRight=function(oBBox){ ...@@ -4851,9 +4851,9 @@ 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)); History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsRight, this.getId(), new Asc.Range(oBBox.c1, oBBox.r1, gc_nMaxCol0, oBBox.r2), new UndoRedoData_BBox(oBBox));
this.autoFilters.insertColumn( "insCells", oBBox, c_oAscInsertOptions.InsertCellsAndShiftRight ); this.autoFilters.insertColumn( "insCells", oBBox, c_oAscInsertOptions.InsertCellsAndShiftRight, displayNameFormatTable );
}; };
Woorksheet.prototype._shiftCellsBottom=function(oBBox){ Woorksheet.prototype._shiftCellsBottom=function(oBBox, displayNameFormatTable){
//до перемещения ячеек, перед функцией, в которой используются nodesSheetArea/nodesSheetCell move/shift нужно обязательно вызвать force buildRecalc //до перемещения ячеек, перед функцией, в которой используются nodesSheetArea/nodesSheetCell move/shift нужно обязательно вызвать force buildRecalc
//чтобы формулы, которые копим попали в струкруры nodesSheet, иначе формулы не сдвинутся //чтобы формулы, которые копим попали в струкруры nodesSheet, иначе формулы не сдвинутся
//например принимаем изменения: добавление формул, сдвиг с помощью _removeRows. результат формулы указывают на теже ячейки, что и до _removeRows //например принимаем изменения: добавление формул, сдвиг с помощью _removeRows. результат формулы указывают на теже ячейки, что и до _removeRows
...@@ -4886,7 +4886,7 @@ Woorksheet.prototype._shiftCellsBottom=function(oBBox){ ...@@ -4886,7 +4886,7 @@ Woorksheet.prototype._shiftCellsBottom=function(oBBox){
} }
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsBottom, this.getId(), new Asc.Range(oBBox.c1, oBBox.r1, oBBox.c2, gc_nMaxRow0), new UndoRedoData_BBox(oBBox)); History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ShiftCellsBottom, this.getId(), new Asc.Range(oBBox.c1, oBBox.r1, oBBox.c2, gc_nMaxRow0), new UndoRedoData_BBox(oBBox));
this.autoFilters.insertRows( "insCell", oBBox, c_oAscInsertOptions.InsertCellsAndShiftDown ); this.autoFilters.insertRows( "insCell", oBBox, c_oAscInsertOptions.InsertCellsAndShiftDown, displayNameFormatTable );
}; };
Woorksheet.prototype._setIndex=function(ind){ Woorksheet.prototype._setIndex=function(ind){
this.index = ind; this.index = ind;
...@@ -7929,11 +7929,11 @@ Range.prototype.removeHyperlink = function (val, removeStyle) { ...@@ -7929,11 +7929,11 @@ Range.prototype.removeHyperlink = function (val, removeStyle) {
Range.prototype.deleteCellsShiftUp=function(preDeleteAction){ Range.prototype.deleteCellsShiftUp=function(preDeleteAction){
return this._shiftUpDown(true, preDeleteAction); return this._shiftUpDown(true, preDeleteAction);
}; };
Range.prototype.addCellsShiftBottom=function(){ Range.prototype.addCellsShiftBottom=function(displayNameFormatTable){
return this._shiftUpDown(false); return this._shiftUpDown(false, null, displayNameFormatTable);
}; };
Range.prototype.addCellsShiftRight=function(){ Range.prototype.addCellsShiftRight=function(displayNameFormatTable){
return this._shiftLeftRight(false); return this._shiftLeftRight(false, null,displayNameFormatTable);
}; };
Range.prototype.deleteCellsShiftLeft=function(preDeleteAction){ Range.prototype.deleteCellsShiftLeft=function(preDeleteAction){
return this._shiftLeftRight(true, preDeleteAction); return this._shiftLeftRight(true, preDeleteAction);
...@@ -7975,7 +7975,7 @@ Range.prototype._canShiftLeftRight=function(bLeft){ ...@@ -7975,7 +7975,7 @@ Range.prototype._canShiftLeftRight=function(bLeft){
} }
return {aColsToDelete: aColsToDelete, aCellsToDelete: aCellsToDelete}; return {aColsToDelete: aColsToDelete, aCellsToDelete: aCellsToDelete};
}; };
Range.prototype._shiftLeftRight=function(bLeft, preDeleteAction){ Range.prototype._shiftLeftRight=function(bLeft, preDeleteAction, displayNameFormatTable){
var canShiftRes = this._canShiftLeftRight(bLeft); var canShiftRes = this._canShiftLeftRight(bLeft);
if(null === canShiftRes) if(null === canShiftRes)
return false; return false;
...@@ -8034,7 +8034,7 @@ Range.prototype._shiftLeftRight=function(bLeft, preDeleteAction){ ...@@ -8034,7 +8034,7 @@ Range.prototype._shiftLeftRight=function(bLeft, preDeleteAction){
else else
{ {
if(c_oRangeType.Range == nRangeType) if(c_oRangeType.Range == nRangeType)
this.worksheet._shiftCellsRight(oBBox); this.worksheet._shiftCellsRight(oBBox, displayNameFormatTable);
else else
this.worksheet._insertColsBefore(oBBox.c1, nWidth); this.worksheet._insertColsBefore(oBBox.c1, nWidth);
} }
...@@ -8087,7 +8087,7 @@ Range.prototype._canShiftUpDown=function(bUp){ ...@@ -8087,7 +8087,7 @@ Range.prototype._canShiftUpDown=function(bUp){
} }
return {aRowsToDelete: aRowsToDelete, aCellsToDelete: aCellsToDelete}; return {aRowsToDelete: aRowsToDelete, aCellsToDelete: aCellsToDelete};
}; };
Range.prototype._shiftUpDown = function (bUp, preDeleteAction) { Range.prototype._shiftUpDown = function (bUp, preDeleteAction, displayNameFormatTable) {
var canShiftRes = this._canShiftUpDown(bUp); var canShiftRes = this._canShiftUpDown(bUp);
if(null === canShiftRes) if(null === canShiftRes)
return false; return false;
...@@ -8146,7 +8146,7 @@ Range.prototype._shiftUpDown = function (bUp, preDeleteAction) { ...@@ -8146,7 +8146,7 @@ Range.prototype._shiftUpDown = function (bUp, preDeleteAction) {
else else
{ {
if(c_oRangeType.Range == nRangeType) if(c_oRangeType.Range == nRangeType)
this.worksheet._shiftCellsBottom(oBBox); this.worksheet._shiftCellsBottom(oBBox, displayNameFormatTable);
else else
this.worksheet._insertRowsBefore(oBBox.r1, nHeight); this.worksheet._insertRowsBefore(oBBox.r1, nHeight);
} }
......
...@@ -4550,7 +4550,7 @@ TablePart.prototype.deleteTableColumns = function(activeRange) ...@@ -4550,7 +4550,7 @@ TablePart.prototype.deleteTableColumns = function(activeRange)
this.TableColumns.splice(startCol, diff); this.TableColumns.splice(startCol, diff);
}; };
TablePart.prototype.addTableColumns = function(activeRange, aF) TablePart.prototype.addTableColumns = function(activeRange, autoFilters)
{ {
var newTableColumns = [], num = 0; var newTableColumns = [], num = 0;
...@@ -4573,12 +4573,21 @@ TablePart.prototype.addTableColumns = function(activeRange, aF) ...@@ -4573,12 +4573,21 @@ TablePart.prototype.addTableColumns = function(activeRange, aF)
for(var j = 0; j < newTableColumns.length; j++) for(var j = 0; j < newTableColumns.length; j++)
{ {
if(newTableColumns[j].Name === null) if(newTableColumns[j].Name === null)
newTableColumns[j].Name = aF._generateColumnName2(newTableColumns, newTableColumns[j - 1].Name); newTableColumns[j].Name = autoFilters._generateColumnName2(newTableColumns, newTableColumns[j - 1].Name);
} }
this.TableColumns = newTableColumns; this.TableColumns = newTableColumns;
}; };
TablePart.prototype.addTableLastColumn = function(activeRange, autoFilters, isAddLastColumn)
{
var newTableColumns = this.TableColumns;
newTableColumns.push(new TableColumn());
newTableColumns[newTableColumns.length - 1].Name = autoFilters._generateColumnName2(newTableColumns, newTableColumns[newTableColumns.length - 2].Name);
this.TableColumns = newTableColumns;
};
TablePart.prototype.getType = function(F) TablePart.prototype.getType = function(F)
{ {
return g_nFiltersType.tablePart; return g_nFiltersType.tablePart;
......
...@@ -728,6 +728,19 @@ var maxIndividualValues = 10000; ...@@ -728,6 +728,19 @@ var maxIndividualValues = 10000;
case historyitem_AutoFilter_CleanFormat: case historyitem_AutoFilter_CleanFormat:
this.cleanFormat(data.activeCells, true); this.cleanFormat(data.activeCells, true);
break; break;
case historyitem_AutoFilter_Change:
if(data !== null && data.displayName)
{
if(data.type === true)
{
this.insertLastTableColumn(data.displayName, data.activeCells);
}
else if(data.type === false)
{
this.insertLastTableRow(data.displayName, data.activeCells);
}
}
break;
} }
History.TurnOn(); History.TurnOn();
}, },
...@@ -1069,7 +1082,7 @@ var maxIndividualValues = 10000; ...@@ -1069,7 +1082,7 @@ var maxIndividualValues = 10000;
return false; return false;
}, },
insertColumn: function(type, activeRange, insertType) insertColumn: function(type, activeRange, insertType, displayNameFormatTable)
{ {
var worksheet = this.worksheet; var worksheet = this.worksheet;
var t = this; var t = this;
...@@ -1215,6 +1228,10 @@ var maxIndividualValues = 10000; ...@@ -1215,6 +1228,10 @@ var maxIndividualValues = 10000;
for(var i = 0; i < tableParts.length; i++) for(var i = 0; i < tableParts.length; i++)
changeFilter(tableParts[i], true); changeFilter(tableParts[i], true);
if(displayNameFormatTable && type == 'insCells')
{
this.insertLastTableColumn(displayNameFormatTable, activeRange);
}
//set styles for tables //set styles for tables
cleanStylesTables(redrawTablesArr); cleanStylesTables(redrawTablesArr);
...@@ -1223,7 +1240,71 @@ var maxIndividualValues = 10000; ...@@ -1223,7 +1240,71 @@ var maxIndividualValues = 10000;
History.EndTransaction(); History.EndTransaction();
}, },
insertRows: function(type, activeRange, insertType) insertLastTableColumn: function(displayNameFormatTable, activeRange)
{
var worksheet = this.worksheet;
var t = this;
var bUndoChanges = worksheet.workbook.bUndoChanges;
var bRedoChanges = worksheet.workbook.bRedoChanges;
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);
filter.addTableLastColumn(null, t);
filter.changeRef(1);
//History
if(!bUndoChanges && !bRedoChanges /*&& !notAddToHistory*/ && oldFilter)
{
var changeElement =
{
oldFilter: oldFilter,
newFilterRef: filter.Ref.clone()
};
t._addHistoryObj(changeElement, historyitem_AutoFilter_Change, {displayName: displayNameFormatTable, activeCells: activeRange, type: true}, false, oldFilter.Ref, null, activeRange);
}
redrawTablesArr.push({oldfilterRef: oldFilter.Ref, newFilter: filter});
};
var tablePart = t._getFilterByDisplayName(displayNameFormatTable);
if(tablePart)
{
//change TableParts
changeFilter(tablePart);
//set styles for tables
cleanStylesTables(redrawTablesArr);
setStylesTables(redrawTablesArr);
}
History.EndTransaction();
},
insertRows: function(type, activeRange, insertType, displayNameFormatTable)
{ {
var worksheet = this.worksheet; var worksheet = this.worksheet;
var t = this; var t = this;
...@@ -1312,6 +1393,11 @@ var maxIndividualValues = 10000; ...@@ -1312,6 +1393,11 @@ var maxIndividualValues = 10000;
for(var i = 0; i < tableParts.length; i++) for(var i = 0; i < tableParts.length; i++)
changeFilter(tableParts[i], true); changeFilter(tableParts[i], true);
if(displayNameFormatTable && type == 'insCell')
{
this.insertLastTableRow(displayNameFormatTable, activeRange);
}
//set styles for tables //set styles for tables
cleanStylesTables(redrawTablesArr); cleanStylesTables(redrawTablesArr);
setStylesTables(redrawTablesArr); setStylesTables(redrawTablesArr);
...@@ -1319,6 +1405,69 @@ var maxIndividualValues = 10000; ...@@ -1319,6 +1405,69 @@ var maxIndividualValues = 10000;
History.EndTransaction(); History.EndTransaction();
}, },
insertLastTableRow: function(displayNameFormatTable, activeRange)
{
var worksheet = this.worksheet;
var t = this;
var bUndoChanges = worksheet.workbook.bUndoChanges;
var bRedoChanges = worksheet.workbook.bRedoChanges;
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);
filter.changeRef(null, 1);
//History
if(!bUndoChanges && !bRedoChanges /*&& !notAddToHistory*/ && oldFilter)
{
var changeElement =
{
oldFilter: oldFilter,
newFilterRef: filter.Ref.clone()
};
t._addHistoryObj(changeElement, historyitem_AutoFilter_Change, {displayName: displayNameFormatTable, activeCells: activeRange, type: false}, false, oldFilter.Ref, null, activeRange);
}
redrawTablesArr.push({oldfilterRef: oldFilter.Ref, newFilter: filter});
};
var tablePart = t._getFilterByDisplayName(displayNameFormatTable);
if(tablePart)
{
//change TableParts
changeFilter(tablePart);
//set styles for tables
cleanStylesTables(redrawTablesArr);
setStylesTables(redrawTablesArr);
}
History.EndTransaction();
},
sortColFilter: function(type, cellId, activeRange, sortProps, displayName) { sortColFilter: function(type, cellId, activeRange, sortProps, displayName) {
var curFilter, sortRange, filterRef, startCol, maxFilterRow; var curFilter, sortRange, filterRef, startCol, maxFilterRow;
var resType = type == 'ascending'; var resType = type == 'ascending';
...@@ -1971,26 +2120,21 @@ var maxIndividualValues = 10000; ...@@ -1971,26 +2120,21 @@ var maxIndividualValues = 10000;
tablePart.TableStyleInfo.ShowRowStripes = !tablePart.TableStyleInfo.ShowRowStripes; tablePart.TableStyleInfo.ShowRowStripes = !tablePart.TableStyleInfo.ShowRowStripes;
break; break;
} }
case c_oAscChangeTableStyleInfo.rowHeader: case c_oAscChangeTableStyleInfo.rowTotal:
{ {
tablePart.TableStyleInfo.ShowRowStripes = !tablePart.TableStyleInfo.ShowRowStripes; tablePart.TotalsRowCount = tablePart.TotalsRowCount === null ? 1 : null;
break;
}
/*case c_oAscChangeTableStyleInfo.rowTotal:
{
tablePart.TableStyleInfo.ShowRowStripes = !tablePart.TableStyleInfo.ShowRowStripes;
break; break;
} }
case c_oAscChangeTableStyleInfo.rowHeader: case c_oAscChangeTableStyleInfo.rowHeader:
{ {
tablePart.TableStyleInfo.ShowRowStripes = !tablePart.TableStyleInfo.ShowRowStripes; tablePart.HeaderRowCount = tablePart.HeaderRowCount === null ? 0 : null;
break; break;
} }
case c_oAscChangeTableStyleInfo.filterButton: case c_oAscChangeTableStyleInfo.filterButton:
{ {
tablePart.TableStyleInfo.ShowRowStripes = !tablePart.TableStyleInfo.ShowRowStripes; tablePart.TableStyleInfo.ShowRowStripes = !tablePart.TableStyleInfo.ShowRowStripes;
break; break;
}*/ }
} }
this._cleanStyleTable(tablePart.Ref); this._cleanStyleTable(tablePart.Ref);
...@@ -4036,7 +4180,7 @@ var maxIndividualValues = 10000; ...@@ -4036,7 +4180,7 @@ var maxIndividualValues = 10000;
isPartTablePartsRightRange: function(range) isPartTablePartsRightRange: function(range)
{ {
var worksheet = this.worksheet; var worksheet = this.worksheet;
var res = false; var result = false;
if(worksheet.TableParts && worksheet.TableParts.length) if(worksheet.TableParts && worksheet.TableParts.length)
{ {
...@@ -4065,7 +4209,7 @@ var maxIndividualValues = 10000; ...@@ -4065,7 +4209,7 @@ var maxIndividualValues = 10000;
} }
} }
return res; return result;
}, },
_isPartAutoFilterUnderRange: function(range) _isPartAutoFilterUnderRange: function(range)
......
...@@ -10187,7 +10187,7 @@ ...@@ -10187,7 +10187,7 @@
return true; return true;
}; };
WorksheetView.prototype.changeWorksheet = function ( prop, val ) { WorksheetView.prototype.changeWorksheet = function ( prop, val, displayNameFormatTable ) {
// Проверка глобального лока // Проверка глобального лока
if ( this.collaborativeEditing.getGlobalLock() ) { if ( this.collaborativeEditing.getGlobalLock() ) {
return; return;
...@@ -10321,7 +10321,7 @@ ...@@ -10321,7 +10321,7 @@
functionModelAction = function () { functionModelAction = function () {
History.Create_NewPoint(); History.Create_NewPoint();
History.StartTransaction(); History.StartTransaction();
if ( range.addCellsShiftRight() ) { if ( range.addCellsShiftRight(displayNameFormatTable) ) {
fullRecalc = true; fullRecalc = true;
reinitRanges = true; reinitRanges = true;
t.cellCommentator.updateCommentsDependencies( true, val, arn ); t.cellCommentator.updateCommentsDependencies( true, val, arn );
...@@ -10342,7 +10342,7 @@ ...@@ -10342,7 +10342,7 @@
functionModelAction = function () { functionModelAction = function () {
History.Create_NewPoint(); History.Create_NewPoint();
History.StartTransaction(); History.StartTransaction();
if ( range.addCellsShiftBottom() ) { if ( range.addCellsShiftBottom(displayNameFormatTable) ) {
fullRecalc = true; fullRecalc = true;
reinitRanges = true; reinitRanges = true;
t.cellCommentator.updateCommentsDependencies( true, val, arn ); t.cellCommentator.updateCommentsDependencies( true, val, arn );
...@@ -12810,7 +12810,7 @@ ...@@ -12810,7 +12810,7 @@
{ {
var t = this; var t = this;
var ws = this.model; var ws = this.model;
var acitveRange = this.activeRange; var activeRange = this.activeRange;
var tablePart = ws.autoFilters._getFilterByDisplayName(tableName); var tablePart = ws.autoFilters._getFilterByDisplayName(tableName);
...@@ -12840,16 +12840,14 @@ ...@@ -12840,16 +12840,14 @@
{ {
newActiveRange.c1 = tablePart.Ref.c1; newActiveRange.c1 = tablePart.Ref.c1;
newActiveRange.c2 = tablePart.Ref.c2; newActiveRange.c2 = tablePart.Ref.c2;
newActiveRange.r1 = startRow + (endRow - startRow) + 1; newActiveRange.r1 = tablePart.Ref.r2 + 1;
newActiveRange.r2 = endRow + (endRow - startRow) + 1; newActiveRange.r2 = tablePart.Ref.r2 + 1;
val = c_oAscInsertOptions.InsertCellsAndShiftDown; val = c_oAscInsertOptions.InsertCellsAndShiftDown;
break; break;
} }
case c_oAscInsertOptions.InsertTableColLeft: case c_oAscInsertOptions.InsertTableColLeft:
{ {
newActiveRange.c1 = startCol - 1;
newActiveRange.c2 = endCol - 1;
newActiveRange.r1 = tablePart.Ref.r1; newActiveRange.r1 = tablePart.Ref.r1;
newActiveRange.r2 = tablePart.Ref.r2; newActiveRange.r2 = tablePart.Ref.r2;
...@@ -12858,8 +12856,8 @@ ...@@ -12858,8 +12856,8 @@
} }
case c_oAscInsertOptions.InsertTableColRight: case c_oAscInsertOptions.InsertTableColRight:
{ {
newActiveRange = new Asc.Range(startCol, tablePart.Ref.r1, endCol, tablePart.Ref.r2); newActiveRange.c1 = tablePart.Ref.c2 + 1;
newActiveRange.c2 = tablePart.Ref.c2 + 1;
newActiveRange.r1 = tablePart.Ref.r1; newActiveRange.r1 = tablePart.Ref.r1;
newActiveRange.r2 = tablePart.Ref.r2; newActiveRange.r2 = tablePart.Ref.r2;
...@@ -12871,8 +12869,15 @@ ...@@ -12871,8 +12869,15 @@
if(val !== null) if(val !== null)
{ {
t.activeRange = newActiveRange; t.activeRange = newActiveRange;
t.changeWorksheet("insCell", val); if(optionType === c_oAscInsertOptions.InsertTableColRight || optionType === c_oAscInsertOptions.InsertTableRowBelow)
t.activeRange = acitveRange; {
t.changeWorksheet("insCell", val, tableName);
}
else
{
t.changeWorksheet("insCell", val);
}
t.activeRange = activeRange;
} }
}; };
...@@ -12880,7 +12885,7 @@ ...@@ -12880,7 +12885,7 @@
{ {
var t = this; var t = this;
var ws = this.model; var ws = this.model;
var acitveRange = this.activeRange.clone(); var acitveRange = this.activeRange;
var tablePart = ws.autoFilters._getFilterByDisplayName(tableName); var tablePart = ws.autoFilters._getFilterByDisplayName(tableName);
...@@ -12894,19 +12899,23 @@ ...@@ -12894,19 +12899,23 @@
var startRow = this.activeRange.r1; var startRow = this.activeRange.r1;
var endRow = this.activeRange.r2; var endRow = this.activeRange.r2;
var newActiveRange = null; var newActiveRange = this.activeRange.clone();
var val; var val = null;
switch(optionType) switch(optionType)
{ {
case c_oAscDeleteOptions.DeleteColumns: case c_oAscDeleteOptions.DeleteColumns:
{ {
newActiveRange = new Asc.Range(startCol, tablePart.Ref.r1, endCol, tablePart.Ref.r2); newActiveRange.r1 = tablePart.Ref.r1;
newActiveRange.r2 = tablePart.Ref.r2;
val = c_oAscDeleteOptions.DeleteCellsAndShiftLeft; val = c_oAscDeleteOptions.DeleteCellsAndShiftLeft;
break; break;
} }
case c_oAscDeleteOptions.DeleteRows: case c_oAscDeleteOptions.DeleteRows:
{ {
newActiveRange = new Asc.Range(tablePart.Ref.c1, startRow, tablePart.Ref.c2, endRow); newActiveRange.c1 = tablePart.Ref.c1;
newActiveRange.c2 = tablePart.Ref.c2;
val = c_oAscDeleteOptions.DeleteCellsAndShiftTop; val = c_oAscDeleteOptions.DeleteCellsAndShiftTop;
break; break;
} }
...@@ -12917,7 +12926,7 @@ ...@@ -12917,7 +12926,7 @@
} }
} }
if(newActiveRange !== null) if(val !== null)
{ {
t.activeRange = newActiveRange; t.activeRange = newActiveRange;
t.changeWorksheet("delCell", val); t.changeWorksheet("delCell", val);
...@@ -12939,6 +12948,7 @@ ...@@ -12939,6 +12948,7 @@
} }
//TODO тестовый вариант. нужно сделать методы и добавлять в историю //TODO тестовый вариант. нужно сделать методы и добавлять в историю
//ws.workbook.dependencyFormulas.changeDefName( tableName, newName );
tablePart.DisplayName = newName; tablePart.DisplayName = newName;
}; };
......
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