Commit cba40401 authored by GoshaZotov's avatar GoshaZotov Committed by Alexander.Trofimov

add functions - asc_changeTableRange and asc_getTablePictures

parent 6fcb5e62
......@@ -680,6 +680,16 @@ var editor;
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) {
this.isMobileVersion = isMobile;
......@@ -3384,6 +3394,9 @@ var editor;
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["af_changeTableRange"] = prot.af_changeTableRange;
prot["asc_getTablePictures"] = prot.asc_getTablePictures;
// Drawing objects interface
......
......@@ -13013,7 +13013,7 @@
val = c_oAscDeleteOptions.DeleteCellsAndShiftTop;
break;
}
case c_oAscInsertOptions.DeleteTable:
case c_oAscDeleteOptions.DeleteTable:
{
t.model.autoFilters.isEmptyAutoFilters(tablePart.Ref);
break;
......@@ -13176,6 +13176,59 @@
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
* -----------------------------------------------------------------------------
......
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