Commit 21f36367 authored by Alexander Trofimov's avatar Alexander Trofimov

Merge pull request #6 from ONLYOFFICE/feature/cell-formatastable

Feature/cell formatastable
parents 3a679599 4eca915f
...@@ -685,6 +685,41 @@ var editor; ...@@ -685,6 +685,41 @@ var editor;
var ws = this.wb.getWorksheet(); var ws = this.wb.getWorksheet();
return ws.clearFilter(); return ws.clearFilter();
}; };
spreadsheet_api.prototype.asc_changeSelectionFormatTable = function(tableName, optionType) {
var ws = this.wb.getWorksheet();
return ws.af_changeSelectionFormatTable(tableName, optionType);
};
spreadsheet_api.prototype.asc_changeFormatTableInfo = function(tableName, optionType, val) {
var ws = this.wb.getWorksheet();
return ws.af_changeFormatTableInfo(tableName, optionType, val);
};
spreadsheet_api.prototype.asc_insertCellsInTable = function(tableName, optionType) {
var ws = this.wb.getWorksheet();
return ws.af_insertCellsInTable(tableName, optionType);
};
spreadsheet_api.prototype.asc_deleteCellsInTable = function(tableName, optionType) {
var ws = this.wb.getWorksheet();
return ws.af_deleteCellsInTable(tableName, optionType);
};
spreadsheet_api.prototype.asc_changeDisplayNameTable = function(tableName, newName) {
var ws = this.wb.getWorksheet();
return ws.af_changeDisplayNameTable(tableName, newName);
};
spreadsheet_api.prototype.asc_changeTableRange = function(tableName, range) {
var ws = this.wb.getWorksheet();
return ws.af_changeTableRange(tableName, range);
};
spreadsheet_api.prototype.asc_getTablePictures = function (props)
{
return this.wb.getTablePictures(props);
};
spreadsheet_api.prototype.asc_setMobileVersion = function(isMobile) { spreadsheet_api.prototype.asc_setMobileVersion = function(isMobile) {
this.isMobileVersion = isMobile; this.isMobileVersion = isMobile;
...@@ -3378,13 +3413,20 @@ var editor; ...@@ -3378,13 +3413,20 @@ var editor;
prot["asc_getDefaultDefinedName"] = prot.asc_getDefaultDefinedName; prot["asc_getDefaultDefinedName"] = prot.asc_getDefaultDefinedName;
prot["asc_checkDefinedName"] = prot.asc_checkDefinedName; prot["asc_checkDefinedName"] = prot.asc_checkDefinedName;
// Auto filters interface // Auto filters interface + format as table
prot["asc_addAutoFilter"] = prot.asc_addAutoFilter; prot["asc_addAutoFilter"] = prot.asc_addAutoFilter;
prot["asc_changeAutoFilter"] = prot.asc_changeAutoFilter; prot["asc_changeAutoFilter"] = prot.asc_changeAutoFilter;
prot["asc_applyAutoFilter"] = prot.asc_applyAutoFilter; prot["asc_applyAutoFilter"] = prot.asc_applyAutoFilter;
prot["asc_sortColFilter"] = prot.asc_sortColFilter; prot["asc_sortColFilter"] = prot.asc_sortColFilter;
prot["asc_getAddFormatTableOptions"] = prot.asc_getAddFormatTableOptions; prot["asc_getAddFormatTableOptions"] = prot.asc_getAddFormatTableOptions;
prot["asc_clearFilter"] = prot.asc_clearFilter; prot["asc_clearFilter"] = prot.asc_clearFilter;
prot["asc_changeSelectionFormatTable"] = prot.asc_changeSelectionFormatTable;
prot["asc_changeFormatTableInfo"] = prot.asc_changeFormatTableInfo;
prot["asc_insertCellsInTable"] = prot.asc_insertCellsInTable;
prot["asc_deleteCellsInTable"] = prot.asc_deleteCellsInTable;
prot["asc_changeDisplayNameTable"] = prot.asc_changeDisplayNameTable;
prot["asc_changeTableRange"] = prot.asc_changeTableRange;
prot["asc_getTablePictures"] = prot.asc_getTablePictures;
// Drawing objects interface // Drawing objects interface
......
...@@ -33,6 +33,7 @@ function (window, undefined) { ...@@ -33,6 +33,7 @@ function (window, undefined) {
// Используем [] вместо new Array() для ускорения (http://jsperf.com/creation-array) // Используем [] вместо new Array() для ускорения (http://jsperf.com/creation-array)
// Используем {} вместо new Object() для ускорения (http://jsperf.com/creation-object) // Используем {} вместо new Object() для ускорения (http://jsperf.com/creation-object)
// Import // Import
var CColor = AscCommon.CColor; var CColor = AscCommon.CColor;
...@@ -67,14 +68,19 @@ var c_oAscInsertOptions = { ...@@ -67,14 +68,19 @@ var c_oAscInsertOptions = {
InsertCellsAndShiftRight: 1, InsertCellsAndShiftRight: 1,
InsertCellsAndShiftDown: 2, InsertCellsAndShiftDown: 2,
InsertColumns: 3, InsertColumns: 3,
InsertRows: 4 InsertRows: 4,
InsertTableRowAbove: 5,
InsertTableRowBelow: 6,
InsertTableColLeft: 7,
InsertTableColRight: 8
}; };
var c_oAscDeleteOptions = { var c_oAscDeleteOptions = {
DeleteCellsAndShiftLeft: 1, DeleteCellsAndShiftLeft: 1,
DeleteCellsAndShiftTop: 2, DeleteCellsAndShiftTop: 2,
DeleteColumns: 3, DeleteColumns: 3,
DeleteRows: 4 DeleteRows: 4,
DeleteTable: 5
}; };
var c_oAscBorderOptions = { var c_oAscBorderOptions = {
...@@ -200,6 +206,23 @@ var c_oAscChangeFilterOptions = { ...@@ -200,6 +206,23 @@ var c_oAscChangeFilterOptions = {
style: 2 style: 2
}; };
var c_oAscChangeSelectionFormatTable = {
all: 1,
data: 2,
row: 3,
column: 4
};
var c_oAscChangeTableStyleInfo = {
columnFirst: 1,
columnLast: 2,
columnBanded: 3,
rowHeader: 4,
rowTotal: 5,
rowBanded: 6,
filterButton: 7
};
// Состояние редактора ячейки // Состояние редактора ячейки
var c_oAscCellEditorState = { var c_oAscCellEditorState = {
editEnd: 0, // Окончание редактирования editEnd: 0, // Окончание редактирования
...@@ -300,6 +323,7 @@ var c_oAscPopUpSelectorType = { ...@@ -300,6 +323,7 @@ var c_oAscPopUpSelectorType = {
Range: 2, Range: 2,
Table: 3 Table: 3
}; };
//----------------------------------------------------------export---------------------------------------------------- //----------------------------------------------------------export----------------------------------------------------
window['AscCommonExcel'] = window['AscCommonExcel'] || {}; window['AscCommonExcel'] = window['AscCommonExcel'] || {};
window['AscCommonExcel'].c_oAscAlignType = c_oAscAlignType; window['AscCommonExcel'].c_oAscAlignType = c_oAscAlignType;
...@@ -338,6 +362,8 @@ var c_oAscPopUpSelectorType = { ...@@ -338,6 +362,8 @@ var c_oAscPopUpSelectorType = {
window['Asc']['c_oAscCustomAutoFilter'] = window['Asc'].c_oAscCustomAutoFilter = c_oAscCustomAutoFilter; window['Asc']['c_oAscCustomAutoFilter'] = window['Asc'].c_oAscCustomAutoFilter = c_oAscCustomAutoFilter;
window['Asc']['c_oAscChangeFilterOptions'] = window['Asc'].c_oAscChangeFilterOptions = c_oAscChangeFilterOptions; window['Asc']['c_oAscChangeFilterOptions'] = window['Asc'].c_oAscChangeFilterOptions = c_oAscChangeFilterOptions;
window['Asc']['c_oAscCellEditorState'] = window['Asc'].c_oAscCellEditorState = c_oAscCellEditorState; window['Asc']['c_oAscCellEditorState'] = window['Asc'].c_oAscCellEditorState = c_oAscCellEditorState;
window['Asc']['c_oAscChangeSelectionFormatTable'] = window['Asc'].c_oAscChangeSelectionFormatTable = c_oAscChangeSelectionFormatTable;
window['Asc']['c_oAscChangeTableStyleInfo'] = window['Asc'].c_oAscChangeTableStyleInfo = c_oAscChangeTableStyleInfo;
window['Asc']['c_oAscAutoFilterTypes'] = window['Asc'].c_oAscAutoFilterTypes = c_oAscAutoFilterTypes; window['Asc']['c_oAscAutoFilterTypes'] = window['Asc'].c_oAscAutoFilterTypes = c_oAscAutoFilterTypes;
window['Asc']['c_oAscFindLookIn'] = window['Asc'].c_oAscFindLookIn = c_oAscFindLookIn; window['Asc']['c_oAscFindLookIn'] = window['Asc'].c_oAscFindLookIn = c_oAscFindLookIn;
window['Asc']['c_oAscGetDefinedNamesList'] = window['Asc'].c_oAscGetDefinedNamesList = c_oAscGetDefinedNamesList; window['Asc']['c_oAscGetDefinedNamesList'] = window['Asc'].c_oAscGetDefinedNamesList = c_oAscGetDefinedNamesList;
......
...@@ -196,6 +196,76 @@ ...@@ -196,6 +196,76 @@
prot["asc_getIsAutoFilter"] = prot.asc_getIsAutoFilter; prot["asc_getIsAutoFilter"] = prot.asc_getIsAutoFilter;
prot["asc_getIsApplyAutoFilter"] = prot.asc_getIsApplyAutoFilter; prot["asc_getIsApplyAutoFilter"] = prot.asc_getIsApplyAutoFilter;
/** @constructor */
function asc_CFormatTableInfo() {
this.tableStyleName = null;
this.tableName = null;
this.isShowColumnStripes = null;
this.isShowFirstColumn = null;
this.isShowLastColumn = null;
this.isShowRowStripes = null;
this.isShowTotalRow = null;
this.isShowHeaderRow = null;
this.tableRange = null;
this.isInsertRowAbove = null;
this.isInsertRowBelow = null;
this.isInsertColumnLeft = null;
this.isInsertColumnRight = null;
this.isDeleteRow = null;
this.isDeleteColumn = null;
this.isDeleteTable = null;
}
asc_CFormatTableInfo.prototype = {
asc_getTableStyleName: function () { return this.tableStyleName; },
asc_getTableName: function () { return this.tableName; },
asc_getFirstRow: function () { return this.firstRow; },
asc_getLastRow: function () { return this.lastRow; },
asc_getBandHor: function () { return this.bandHor; },
asc_getFirstCol: function () { return this.firstCol; },
asc_getLastCol: function () { return this.lastCol; },
asc_getBandVer: function () { return this.bandVer; },
asc_getFilterButton: function () { return this.filterButton; },
asc_getTableRange: function () { return this.tableRange; },
asc_getIsInsertRowAbove: function () { return this.isInsertRowAbove; },
asc_getIsInsertRowBelow: function () { return this.isInsertRowBelow; },
asc_getIsInsertColumnLeft: function () { return this.isInsertColumnLeft; },
asc_getIsInsertColumnRight: function () { return this.isInsertColumnRight; },
asc_getIsDeleteRow: function () { return this.isDeleteRow; },
asc_getIsDeleteColumn: function () { return this.isDeleteColumn; },
asc_getIsDeleteTable: function () { return this.isDeleteTable; }
};
window["Asc"].asc_CFormatTableInfo = window["Asc"]["asc_CFormatTableInfo"] = asc_CFormatTableInfo;
prot = asc_CFormatTableInfo.prototype;
prot["asc_getTableStyleName"] = prot.asc_getTableStyleName;
prot["asc_getTableName"] = prot.asc_getTableName;
prot["asc_getFirstRow"] = prot.asc_getFirstRow;
prot["asc_getLastRow"] = prot.asc_getLastRow;
prot["asc_getBandHor"] = prot.asc_getBandHor;
prot["asc_getFirstCol"] = prot.asc_getFirstCol;
prot["asc_getLastCol"] = prot.asc_getLastCol;
prot["asc_getBandVer"] = prot.asc_getBandVer;
prot["asc_getFilterButton"] = prot.asc_getFilterButton;
prot["asc_getTableRange"] = prot.asc_getTableRange;
prot["asc_getIsInsertRowAbove"] = prot.asc_getIsInsertRowAbove;
prot["asc_getIsInsertRowBelow"] = prot.asc_getIsInsertRowBelow;
prot["asc_getIsInsertColumnLeft"] = prot.asc_getIsInsertColumnLeft;
prot["asc_getIsInsertColumnRight"] = prot.asc_getIsInsertColumnRight;
prot["asc_getIsDeleteRow"] = prot.asc_getIsDeleteRow;
prot["asc_getIsDeleteColumn"] = prot.asc_getIsDeleteColumn;
prot["asc_getIsDeleteTable"] = prot.asc_getIsDeleteTable;
/** @constructor */ /** @constructor */
function asc_CCellInfo() { function asc_CCellInfo() {
...@@ -216,7 +286,8 @@ ...@@ -216,7 +286,8 @@
this.styleName = null; this.styleName = null;
this.numFormatType = null; this.numFormatType = null;
this.angle = null; this.angle = null;
this.autoFilterInfo = null; this.autoFilterInfo = null;
this.formatTableInfo = null;
} }
asc_CCellInfo.prototype = { asc_CCellInfo.prototype = {
...@@ -237,7 +308,8 @@ ...@@ -237,7 +308,8 @@
asc_getStyleName: function () { return this.styleName; }, asc_getStyleName: function () { return this.styleName; },
asc_getNumFormatType: function(){ return this.numFormatType; }, asc_getNumFormatType: function(){ return this.numFormatType; },
asc_getAngle: function () { return this.angle; }, asc_getAngle: function () { return this.angle; },
asc_getAutoFilterInfo: function () { return this.autoFilterInfo; }, asc_getAutoFilterInfo: function () { return this.autoFilterInfo; },
asc_getFormatTableInfo: function () { return this.formatTableInfo; },
asc_getIsFormatTable: function() {return null},//TODO DELETE asc_getIsFormatTable: function() {return null},//TODO DELETE
asc_getIsAutoFilter: function() {return null},//TODO DELETE asc_getIsAutoFilter: function() {return null},//TODO DELETE
asc_getTableStyleName: function() {return null},//TODO DELETE asc_getTableStyleName: function() {return null},//TODO DELETE
...@@ -264,7 +336,8 @@ ...@@ -264,7 +336,8 @@
prot["asc_getStyleName"] = prot.asc_getStyleName; prot["asc_getStyleName"] = prot.asc_getStyleName;
prot["asc_getNumFormatType"] = prot.asc_getNumFormatType; prot["asc_getNumFormatType"] = prot.asc_getNumFormatType;
prot["asc_getAngle"] = prot.asc_getAngle; prot["asc_getAngle"] = prot.asc_getAngle;
prot["asc_getAutoFilterInfo"] = prot.asc_getAutoFilterInfo; prot["asc_getAutoFilterInfo"] = prot.asc_getAutoFilterInfo;
prot["asc_getFormatTableInfo"] = prot.asc_getFormatTableInfo;
prot["asc_getIsFormatTable"] = prot.asc_getIsFormatTable;//TODO DELETE prot["asc_getIsFormatTable"] = prot.asc_getIsFormatTable;//TODO DELETE
prot["asc_getIsAutoFilter"] = prot.asc_getIsAutoFilter;//TODO DELETE prot["asc_getIsAutoFilter"] = prot.asc_getIsAutoFilter;//TODO DELETE
prot["asc_getTableStyleName"] = prot.asc_getTableStyleName;//TODO DELETE prot["asc_getTableStyleName"] = prot.asc_getTableStyleName;//TODO DELETE
......
...@@ -127,6 +127,9 @@ var historyitem_AutoFilter_Delete = 8; ...@@ -127,6 +127,9 @@ var historyitem_AutoFilter_Delete = 8;
var historyitem_AutoFilter_ChangeTableStyle = 9; var historyitem_AutoFilter_ChangeTableStyle = 9;
var historyitem_AutoFilter_Change = 10; var historyitem_AutoFilter_Change = 10;
var historyitem_AutoFilter_CleanFormat = 11; var historyitem_AutoFilter_CleanFormat = 11;
var historyitem_AutoFilter_ChangeTableInfo = 12;
var historyitem_AutoFilter_ChangeTableRef = 13;
var historyitem_AutoFilter_ChangeTableName = 14;
function CHistory(workbook) function CHistory(workbook)
...@@ -466,6 +469,9 @@ CHistory.prototype._addRedoObjectParam = function (oRedoObjectParam, Point) { ...@@ -466,6 +469,9 @@ CHistory.prototype._addRedoObjectParam = function (oRedoObjectParam, Point) {
oRedoObjectParam.oOnUpdateSheetViewSettings[Point.SheetId] = Point.SheetId; oRedoObjectParam.oOnUpdateSheetViewSettings[Point.SheetId] = Point.SheetId;
else if (AscCommonExcel.g_oUndoRedoWorksheet === Point.Class && (historyitem_Worksheet_RemoveRows === Point.Type || historyitem_Worksheet_RemoveCols === Point.Type || historyitem_Worksheet_AddRows === Point.Type || historyitem_Worksheet_AddCols === Point.Type)) else if (AscCommonExcel.g_oUndoRedoWorksheet === Point.Class && (historyitem_Worksheet_RemoveRows === Point.Type || historyitem_Worksheet_RemoveCols === Point.Type || historyitem_Worksheet_AddRows === Point.Type || historyitem_Worksheet_AddCols === Point.Type))
oRedoObjectParam.bAddRemoveRowCol = true; oRedoObjectParam.bAddRemoveRowCol = true;
else if(g_oUndoRedoAutoFilters === Point.Class && historyitem_AutoFilter_ChangeTableInfo === Point.Type)
oRedoObjectParam.oChangeWorksheetUpdate[Point.SheetId] = Point.SheetId;
}; };
CHistory.prototype.Get_RecalcData = function(Point2) CHistory.prototype.Get_RecalcData = function(Point2)
{ {
......
...@@ -7059,16 +7059,16 @@ ...@@ -7059,16 +7059,16 @@
if(0 == (rowIndex - headerRowCount) % 2) if(0 == (rowIndex - headerRowCount) % 2)
{ {
if(0 == colIndex % 2) if(0 == colIndex % 2)
res = styles.rightRowBand1ColBand1LC; res = styles.rightBottomRowBand1ColBand1LC;
else else
res = styles.rightRowBand1ColBand2LC; res = styles.rightBottomRowBand1ColBand2LC;
} }
else else
{ {
if(0 == colIndex % 2) if(0 == colIndex % 2)
res = styles.rightRowBand2ColBand1LC; res = styles.rightBottomRowBand2ColBand1LC;
else else
res = styles.rightRowBand2ColBand2LC; res = styles.rightBottomRowBand2ColBand2LC;
} }
} }
else else
...@@ -7076,16 +7076,16 @@ ...@@ -7076,16 +7076,16 @@
if(0 == (rowIndex - headerRowCount) % 2) if(0 == (rowIndex - headerRowCount) % 2)
{ {
if(0 == colIndex % 2) if(0 == colIndex % 2)
res = styles.rightBottomRowBand1ColBand1LC; res = styles.rightRowBand1ColBand1LC;
else else
res = styles.rightBottomRowBand1ColBand2LC; res = styles.rightRowBand1ColBand2LC;
} }
else else
{ {
if(0 == colIndex % 2) if(0 == colIndex % 2)
res = styles.rightBottomRowBand2ColBand1LC; res = styles.rightRowBand2ColBand1LC;
else else
res = styles.rightBottomRowBand2ColBand2LC; res = styles.rightRowBand2ColBand2LC;
} }
} }
} }
......
...@@ -1730,7 +1730,8 @@ var g_oUndoRedoData_AutoFilterProperties = { ...@@ -1730,7 +1730,8 @@ var g_oUndoRedoData_AutoFilterProperties = {
moveFrom : 6, moveFrom : 6,
moveTo : 7, moveTo : 7,
bWithoutFilter : 8, bWithoutFilter : 8,
displayName : 9 displayName : 9,
val : 10
}; };
function UndoRedoData_AutoFilter() { function UndoRedoData_AutoFilter() {
this.Properties = g_oUndoRedoData_AutoFilterProperties; this.Properties = g_oUndoRedoData_AutoFilterProperties;
...@@ -1747,6 +1748,7 @@ function UndoRedoData_AutoFilter() { ...@@ -1747,6 +1748,7 @@ function UndoRedoData_AutoFilter() {
this.moveTo = null; this.moveTo = null;
this.bWithoutFilter = null; this.bWithoutFilter = null;
this.displayName = null; this.displayName = null;
this.val = null;
} }
UndoRedoData_AutoFilter.prototype = { UndoRedoData_AutoFilter.prototype = {
getType : function () getType : function ()
...@@ -1771,6 +1773,7 @@ UndoRedoData_AutoFilter.prototype = { ...@@ -1771,6 +1773,7 @@ UndoRedoData_AutoFilter.prototype = {
case this.Properties.moveTo: return new UndoRedoData_BBox(this.moveTo); break; case this.Properties.moveTo: return new UndoRedoData_BBox(this.moveTo); break;
case this.Properties.bWithoutFilter: return this.bWithoutFilter; break; case this.Properties.bWithoutFilter: return this.bWithoutFilter; break;
case this.Properties.displayName: return this.displayName; break; case this.Properties.displayName: return this.displayName; break;
case this.Properties.val: return this.val; break;
} }
return null; return null;
...@@ -1789,6 +1792,7 @@ UndoRedoData_AutoFilter.prototype = { ...@@ -1789,6 +1792,7 @@ UndoRedoData_AutoFilter.prototype = {
case this.Properties.moveTo: this.moveTo = value;break; case this.Properties.moveTo: this.moveTo = value;break;
case this.Properties.bWithoutFilter: this.bWithoutFilter = value;break; case this.Properties.bWithoutFilter: this.bWithoutFilter = value;break;
case this.Properties.displayName: this.displayName = value;break; case this.Properties.displayName: this.displayName = value;break;
case this.Properties.val: this.val = value;break;
} }
return null; return null;
}, },
......
This diff is collapsed.
...@@ -4511,6 +4511,47 @@ TablePart.prototype.changeRef = function(col, row, bIsFirst) { ...@@ -4511,6 +4511,47 @@ TablePart.prototype.changeRef = function(col, row, bIsFirst) {
if(this.AutoFilter) if(this.AutoFilter)
this.AutoFilter.changeRef(col, row, bIsFirst); this.AutoFilter.changeRef(col, row, bIsFirst);
}; };
TablePart.prototype.changeRefOnRange = function(range, autoFilters, generateNewTableColumns) {
if(!range)
return;
//add table columns
if(generateNewTableColumns)
{
var newTableColumns = [];
var intersectionRanges = this.Ref.intersection(range);
for(var i = range.c1; i <= range.c2; i++)
{
var tableColumn;
if(i >= intersectionRanges.c1 && i <= intersectionRanges.c2)
{
var tableIndex = i - this.Ref.c1;
tableColumn = this.TableColumns[tableIndex];
}
else
{
tableColumn = new TableColumn();
}
newTableColumns.push(tableColumn);
}
for(var j = 0; j < newTableColumns.length; j++)
{
if(newTableColumns[j].Name === null)
newTableColumns[j].Name = autoFilters._generateColumnName2(newTableColumns);
}
this.TableColumns = newTableColumns;
}
this.Ref = Asc.Range(range.c1, range.r1, range.c2, range.r2);
//event
this.handlers.trigger("changeRefTablePart", this.DisplayName, this.Ref);
if(this.AutoFilter)
this.AutoFilter.changeRefOnRange(range);
};
TablePart.prototype.isApplyAutoFilter = function() { TablePart.prototype.isApplyAutoFilter = function() {
var res = false; var res = false;
...@@ -4559,7 +4600,7 @@ TablePart.prototype.deleteTableColumns = function(activeRange) ...@@ -4559,7 +4600,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;
...@@ -4582,12 +4623,21 @@ TablePart.prototype.addTableColumns = function(activeRange, aF) ...@@ -4582,12 +4623,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);
} }
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);
this.TableColumns = newTableColumns;
};
TablePart.prototype.getType = function(F) TablePart.prototype.getType = function(F)
{ {
return g_nFiltersType.tablePart; return g_nFiltersType.tablePart;
...@@ -4688,6 +4738,54 @@ TablePart.prototype.getTableNameColumnByIndex = function(index) ...@@ -4688,6 +4738,54 @@ TablePart.prototype.getTableNameColumnByIndex = function(index)
return res; return res;
}; };
TablePart.prototype.showButton = function(val)
{
if(val === false)
{
if(!this.AutoFilter)
{
this.AutoFilter = new AutoFilter();
this.AutoFilter.Ref = this.Ref;
}
this.AutoFilter.showButton(val);
}
else
{
if(this.AutoFilter && this.AutoFilter.FilterColumns && this.AutoFilter.FilterColumns.length)
{
this.AutoFilter.showButton(val);
}
}
};
TablePart.prototype.isShowButton = function()
{
var res = true;
if(this.AutoFilter)
{
res = this.AutoFilter.isShowButton();
}
return res;
};
TablePart.prototype.generateTotalsRowLabel = function()
{
if(!this.TableColumns)
{
return;
}
this.TableColumns[0].generateTotalsRowLabel();
};
TablePart.prototype.changeDisplayName = function(newName)
{
this.DisplayName = newName;
};
/** @constructor */ /** @constructor */
function AutoFilter() { function AutoFilter() {
this.Ref = null; this.Ref = null;
...@@ -4742,6 +4840,15 @@ AutoFilter.prototype.changeRef = function(col, row, bIsFirst) { ...@@ -4742,6 +4840,15 @@ AutoFilter.prototype.changeRef = function(col, row, bIsFirst) {
this.Ref = ref; this.Ref = ref;
}; };
AutoFilter.prototype.changeRefOnRange = function(range) {
if(!range)
return;
this.Ref = Asc.Range(range.c1, range.r1, range.c2, range.r2);
if(this.AutoFilter)
this.AutoFilter.changeRefOnRange(range);
};
AutoFilter.prototype.isApplyAutoFilter = function() { AutoFilter.prototype.isApplyAutoFilter = function() {
var res = false; var res = false;
...@@ -4790,6 +4897,55 @@ AutoFilter.prototype.cleanFilters = function() { ...@@ -4790,6 +4897,55 @@ AutoFilter.prototype.cleanFilters = function() {
} }
}; };
AutoFilter.prototype.showButton = function(val) {
if(val === false)
{
if(this.FilterColumns === null)
{
this.FilterColumns = [];
}
var columnsLength = this.Ref.c2 - this.Ref.c1 + 1;
for(var i = 0; i < columnsLength; i++)
{
this.FilterColumns[i] = new FilterColumn();
this.FilterColumns[i].ColId = i;
this.FilterColumns[i].ShowButton = false;
}
}
else
{
if(this.FilterColumns && this.FilterColumns.length)
{
for(var i = 0; i < this.FilterColumns.length; i++)
{
this.FilterColumns[i].ShowButton = true;
}
}
}
};
AutoFilter.prototype.isShowButton = function()
{
var res = true;
if(this.FilterColumns && this.FilterColumns.length)
{
for(var i = 0; i < this.FilterColumns.length; i++)
{
if(this.FilterColumns[i].ShowButton === false)
{
res = false;
break;
}
}
}
return res;
};
function FilterColumns() { function FilterColumns() {
this.ColId = null; this.ColId = null;
this.CustomFiltersObj = null; this.CustomFiltersObj = null;
...@@ -4840,6 +4996,14 @@ TableColumn.prototype.clone = function() { ...@@ -4840,6 +4996,14 @@ TableColumn.prototype.clone = function() {
res.CalculatedColumnFormula = this.CalculatedColumnFormula; res.CalculatedColumnFormula = this.CalculatedColumnFormula;
return res; return res;
}; };
TableColumn.prototype.generateTotalsRowLabel = function(){
//TODO добавить в перевод
if(this.TotalsRowLabel === null)
{
this.TotalsRowLabel = "Summary";
}
};
/** @constructor */ /** @constructor */
function TableStyleInfo() { function TableStyleInfo() {
this.Name = null; this.Name = null;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -1631,7 +1631,12 @@ parserHelper.prototype.checkDataRange = function (model, wb, dialogType, dataRan ...@@ -1631,7 +1631,12 @@ parserHelper.prototype.checkDataRange = function (model, wb, dialogType, dataRan
} else if (Asc.c_oAscSelectionDialogType.FormatTable === dialogType) { } else if (Asc.c_oAscSelectionDialogType.FormatTable === dialogType) {
// ToDo убрать эту проверку, заменить на более грамотную после правки функции _searchFilters // ToDo убрать эту проверку, заменить на более грамотную после правки функции _searchFilters
if (true === wb.getWorksheet().model.autoFilters.isRangeIntersectionTableOrFilter(dataRange)) if (true === wb.getWorksheet().model.autoFilters.isRangeIntersectionTableOrFilter(dataRange))
return Asc.c_oAscError.ID.AutoFilterDataRangeError; return c_oAscError.ID.AutoFilterDataRangeError;
} else if (Asc.c_oAscSelectionDialogType.FormatTableChangeRange === dialogType) {
// ToDo убрать эту проверку, заменить на более грамотную после правки функции _searchFilters
var checkChangeRange = wb.getWorksheet().af_checkChangeRange(dataRange);
if (null !== checkChangeRange)
return checkChangeRange;
} }
} }
return Asc.c_oAscError.ID.No; return Asc.c_oAscError.ID.No;
......
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