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

for check range before change format table range

parent faf10bd5
......@@ -3395,7 +3395,7 @@ var editor;
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_changeTableRange"] = prot.asc_changeTableRange;
prot["asc_getTablePictures"] = prot.asc_getTablePictures;
// Drawing objects interface
......
......@@ -102,7 +102,8 @@ var c_oAscSelectionDialogType = {
None: 0,
FormatTable: 1,
Chart: 2,
DefinedName: 3
DefinedName: 3,
FormatTableChangeRange: 4
};
var c_oAscGraphicOption = {
......
......@@ -2215,6 +2215,11 @@
History.EndTransaction();
},
changeTableRange: function(tableName, range)
{
},
_clearRange: function(range, isClearText)
{
range.setTableStyle(null);
......
......@@ -2659,8 +2659,8 @@
ShowFirstColumn: false,
ShowLastColumn: false,
ShowRowStripes: true,
HeaderRowCount: null,
TotalsRowCount: 0
HeaderRowCount: true,
TotalsRowCount: false
};
}
......
......@@ -13178,53 +13178,29 @@
};
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.model.autoFilters.changeTableRange(tableName, range);
this._onUpdateFormatTable(isChangeRange, false, true);
//TODO добавить перерисовку таблицы и перерисовку шаблонов
History.EndTransaction();
}
};
WorksheetView.prototype.af_checkChangeRange = function(tableName, range)
WorksheetView.prototype.af_checkChangeRange = function(range)
{
var tablePart = this.model.autoFilters._getFilterByDisplayName(tableName);
if(!tablePart || (tablePart && !tablePart.TableStyleInfo))
{
return false;
}
var res = true;
var res = null;
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)
if(!intersectionTables || (intersectionTables && intersectionTables.length !== 1))
{
ws.workbook.handlers.trigger("asc_onError", c_oAscError.ID.AutoFilterMoveToHiddenRangeError, c_oAscError.Level.NoCritical);
res = false;
res = c_oAscError.ID.AutoFilterMoveToHiddenRangeError;
}
else if(range.r1 !== tablePart.Ref.r1)
{
res = c_oAscError.ID.AutoFilterMoveToHiddenRangeError;
}
return res;
......
......@@ -1583,6 +1583,11 @@ parserHelper.prototype.checkDataRange = function (model, wb, dialogType, dataRan
// ToDo убрать эту проверку, заменить на более грамотную после правки функции _searchFilters
if (true === wb.getWorksheet().model.autoFilters.isRangeIntersectionTableOrFilter(dataRange))
return Asc.c_oAscError.ID.AutoFilterDataRangeError;
} else if (c_oAscSelectionDialogType.FormatTableChangeRange === dialogType) {
// ToDo убрать эту проверку, заменить на более грамотную после правки функции _searchFilters
var checkChangeRange = wb.getWorksheet().af_checkChangeRange(dataRange);
if (null !== checkChangeRange)
return checkChangeRange;
}
}
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