Commit 0ff76650 authored by GoshaZotov's avatar GoshaZotov

add functions - asc_changeTableRange and asc_getTablePictures

parent df81b0c7
...@@ -692,6 +692,16 @@ var editor; ...@@ -692,6 +692,16 @@ var editor;
var ws = this.wb.getWorksheet(); var ws = this.wb.getWorksheet();
return ws.af_changeDisplayNameTable(tableName, newName); 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;
...@@ -3379,6 +3389,9 @@ var editor; ...@@ -3379,6 +3389,9 @@ var editor;
prot["asc_changeFormatTableInfo"] = prot.asc_changeFormatTableInfo; prot["asc_changeFormatTableInfo"] = prot.asc_changeFormatTableInfo;
prot["asc_insertCellsInTable"] = prot.asc_insertCellsInTable; prot["asc_insertCellsInTable"] = prot.asc_insertCellsInTable;
prot["asc_deleteCellsInTable"] = prot.asc_deleteCellsInTable; prot["asc_deleteCellsInTable"] = prot.asc_deleteCellsInTable;
prot["asc_changeDisplayNameTable"] = prot.asc_changeDisplayNameTable;
prot["af_changeTableRange"] = prot.af_changeTableRange;
prot["asc_getTablePictures"] = prot.asc_getTablePictures;
// Drawing objects interface // Drawing objects interface
......
...@@ -12994,7 +12994,7 @@ ...@@ -12994,7 +12994,7 @@
val = c_oAscDeleteOptions.DeleteCellsAndShiftTop; val = c_oAscDeleteOptions.DeleteCellsAndShiftTop;
break; break;
} }
case c_oAscInsertOptions.DeleteTable: case c_oAscDeleteOptions.DeleteTable:
{ {
t.model.autoFilters.isEmptyAutoFilters(tablePart.Ref); t.model.autoFilters.isEmptyAutoFilters(tablePart.Ref);
break; break;
...@@ -13157,6 +13157,59 @@ ...@@ -13157,6 +13157,59 @@
return {insertRowAbove: insertRowAbove, insertRowBelow: insertRowBelow, insertColumnLeft: insertColumnLeft, insertColumnRight: insertColumnRight, deleteRow: deleteRow, deleteColumn: deleteColumn, deleteTable: deleteTable}; return {insertRowAbove: insertRowAbove, insertRowBelow: insertRowBelow, insertColumnLeft: insertColumnLeft, insertColumnRight: insertColumnRight, deleteRow: deleteRow, deleteColumn: deleteColumn, deleteTable: deleteTable};
}; };
WorksheetView.prototype.af_changeTableRange = function(tableName, range)
{
var tablePart = this.model.autoFilters._getFilterByDisplayName(tableName);
if(!tablePart || (tablePart && !tablePart.TableStyleInfo))
{
return false;
}
var isChangeRange = this.af_checkChangeRange(tablePart, range);
if(isChangeRange !== false)
{
History.Create_NewPoint();
History.StartTransaction();
this.model.autoFilters.changeTableRange(tablePart, range);
this._onUpdateFormatTable(isChangeRange, false, true);
//TODO добавить перерисовку таблицы и перерисовку шаблонов
History.EndTransaction();
}
};
WorksheetView.prototype.af_checkChangeRange = function(tableName, range)
{
var tablePart = this.model.autoFilters._getFilterByDisplayName(tableName);
if(!tablePart || (tablePart && !tablePart.TableStyleInfo))
{
return false;
}
var res = true;
var ws = this.model;
if(range.r1 !== tablePart.Ref.r1)
{
ws.workbook.handlers.trigger("asc_onError", c_oAscError.ID.AutoFilterMoveToHiddenRangeError, c_oAscError.Level.NoCritical);
res = false;
}
else
{
var intersectionTables = this.model.autoFilters.getTableIntersectionRange(range);
if(intersectionTables && intersectionTables.length > 1)
{
ws.workbook.handlers.trigger("asc_onError", c_oAscError.ID.AutoFilterMoveToHiddenRangeError, c_oAscError.Level.NoCritical);
res = false;
}
}
return res;
};
/* /*
* Export * Export
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------
......
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