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;
searchRangeInTableParts: function(range)
{
var aWs = this._getCurrentWS();
var isIntersect = false;
var containRange, tableRange;
var containRangeId = -1, tableRange;
var tableParts = aWs.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;
tableRange = tableParts[i].Ref;
if(range.isIntersect(tableRange))
{
if(tableRange.containsRange(range))
{
containRange = {id: i};
break;
}
else
{
isIntersect = true;
break;
}
if (range.isIntersect(tableRange)) {
containRangeId = tableRange.containsRange(range) ? i : -2;
break;
}
}
}
if(isIntersect === true)//если выделена часть форматир. таблицы, то отправляем false
return false;
else if(containRange)//если форматировання таблица входит в данный диапазон
return containRange;
else//если диапазон не затрагивает форматированную таблицу
return null;
//если выделена часть форматир. таблицы, то отправляем -2
//если форматировання таблица входит в данный диапазон, то id
//если диапазон не затрагивает форматированную таблицу, то -1
return containRangeId;
},
checkApplyFilterOrSort: function(tablePartId)
......@@ -2167,7 +2151,7 @@ var gUndoInsDelCellsFlag = true;
var aWs = this._getCurrentWS();
var result = false;
if(tablePartId !== undefined)
if(-1 !== 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])))
......
......@@ -6404,25 +6404,15 @@
cell_info.halign = c.getAlignHorizontalByValue().toLowerCase();
cell_info.valign = c.getAlignVertical().toLowerCase();
//null - disable, true - pressed button, false - unpressed button
var tablePartsOptions = this.autoFilters.searchRangeInTableParts(activeCell);
var checkApplyFilterOrSort;
cell_info.isFormatTable = (null !== tablePartsOptions);
if(tablePartsOptions === null)
{
checkApplyFilterOrSort = this.autoFilters.checkApplyFilterOrSort();
cell_info.isAutoFilter = checkApplyFilterOrSort.isAutoFilter;
cell_info.clearFilter = checkApplyFilterOrSort.isFilterColumns;
}
else if(tablePartsOptions === false)
{
var tablePartsOptions = this.autoFilters.searchRangeInTableParts(activeCell);
cell_info.isFormatTable = (-1 !== tablePartsOptions);
if (-2 === tablePartsOptions) {
cell_info.isAutoFilter = null;
cell_info.clearFilter = false;
}
else
{
checkApplyFilterOrSort = this.autoFilters.checkApplyFilterOrSort(tablePartsOptions.id);
} else {
checkApplyFilterOrSort = this.autoFilters.checkApplyFilterOrSort(tablePartsOptions);
cell_info.isAutoFilter = checkApplyFilterOrSort.isAutoFilter;
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