Commit cb05a5b4 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Поправил функцию searchRangeInTableParts

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58548 954022d7-b5bf-4e40-9824-e11837661b57
parent 24c1af56
...@@ -2123,43 +2123,27 @@ var gUndoInsDelCellsFlag = true; ...@@ -2123,43 +2123,27 @@ var gUndoInsDelCellsFlag = true;
searchRangeInTableParts: function(range) searchRangeInTableParts: function(range)
{ {
var aWs = this._getCurrentWS(); var aWs = this._getCurrentWS();
var isIntersect = false; var containRangeId = -1, tableRange;
var containRange, tableRange;
var tableParts = aWs.TableParts; var tableParts = aWs.TableParts;
if(tableParts) if(tableParts)
{ {
for(var i = 0; i < tableParts.length; i++) for(var i = 0; i < tableParts.length; ++i)
{ {
if(!tableParts[i].Ref) if (!(tableRange = tableParts[i].Ref))
continue; continue;
tableRange = tableParts[i].Ref; if (range.isIntersect(tableRange)) {
containRangeId = tableRange.containsRange(range) ? i : -2;
if(range.isIntersect(tableRange))
{
if(tableRange.containsRange(range))
{
containRange = {id: i};
break; break;
} }
else
{
isIntersect = true;
break;
}
}
} }
} }
if(isIntersect === true)//если выделена часть форматир. таблицы, то отправляем false //если выделена часть форматир. таблицы, то отправляем -2
return false; //если форматировання таблица входит в данный диапазон, то id
else if(containRange)//если форматировання таблица входит в данный диапазон //если диапазон не затрагивает форматированную таблицу, то -1
return containRange; return containRangeId;
else//если диапазон не затрагивает форматированную таблицу
return null;
}, },
checkApplyFilterOrSort: function(tablePartId) checkApplyFilterOrSort: function(tablePartId)
...@@ -2167,7 +2151,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -2167,7 +2151,7 @@ var gUndoInsDelCellsFlag = true;
var aWs = this._getCurrentWS(); var aWs = this._getCurrentWS();
var result = false; var result = false;
if(tablePartId !== undefined) if(-1 !== tablePartId)
{ {
var tablePart = aWs.TableParts[tablePartId]; var tablePart = aWs.TableParts[tablePartId];
if(tablePart.Ref && ((tablePart.AutoFilter && tablePart.AutoFilter.FilterColumns && tablePart.AutoFilter.FilterColumns.length) || (tablePart && tablePart.SortState && tablePart.SortState.SortConditions && tablePart.SortState.SortConditions[0]))) if(tablePart.Ref && ((tablePart.AutoFilter && tablePart.AutoFilter.FilterColumns && tablePart.AutoFilter.FilterColumns.length) || (tablePart && tablePart.SortState && tablePart.SortState.SortConditions && tablePart.SortState.SortConditions[0])))
......
...@@ -6405,24 +6405,14 @@ ...@@ -6405,24 +6405,14 @@
cell_info.halign = c.getAlignHorizontalByValue().toLowerCase(); cell_info.halign = c.getAlignHorizontalByValue().toLowerCase();
cell_info.valign = c.getAlignVertical().toLowerCase(); cell_info.valign = c.getAlignVertical().toLowerCase();
//null - disable, true - pressed button, false - unpressed button
var tablePartsOptions = this.autoFilters.searchRangeInTableParts(activeCell);
var checkApplyFilterOrSort; var checkApplyFilterOrSort;
cell_info.isFormatTable = (null !== tablePartsOptions); var tablePartsOptions = this.autoFilters.searchRangeInTableParts(activeCell);
if(tablePartsOptions === null) cell_info.isFormatTable = (-1 !== tablePartsOptions);
{ if (-2 === tablePartsOptions) {
checkApplyFilterOrSort = this.autoFilters.checkApplyFilterOrSort();
cell_info.isAutoFilter = checkApplyFilterOrSort.isAutoFilter;
cell_info.clearFilter = checkApplyFilterOrSort.isFilterColumns;
}
else if(tablePartsOptions === false)
{
cell_info.isAutoFilter = null; cell_info.isAutoFilter = null;
cell_info.clearFilter = false; cell_info.clearFilter = false;
} } else {
else checkApplyFilterOrSort = this.autoFilters.checkApplyFilterOrSort(tablePartsOptions);
{
checkApplyFilterOrSort = this.autoFilters.checkApplyFilterOrSort(tablePartsOptions.id);
cell_info.isAutoFilter = checkApplyFilterOrSort.isAutoFilter; cell_info.isAutoFilter = checkApplyFilterOrSort.isAutoFilter;
cell_info.clearFilter = checkApplyFilterOrSort.isFilterColumns; cell_info.clearFilter = checkApplyFilterOrSort.isFilterColumns;
} }
......
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