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