Commit 6f22105c authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

добавил функции для очистки а/ф(форматированной таблицы)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57579 954022d7-b5bf-4e40-9824-e11837661b57
parent 843e632a
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
this.styleName = null; this.styleName = null;
this.numFormatType = null; this.numFormatType = null;
this.angle = null; this.angle = null;
this.autoFilter = null; this.cleanFilter = null;
} }
asc_CCellInfo.prototype = { asc_CCellInfo.prototype = {
...@@ -187,7 +187,7 @@ ...@@ -187,7 +187,7 @@
asc_getStyleName: function () { return this.styleName; }, asc_getStyleName: function () { return this.styleName; },
asc_getNumFormatType: function(){ return this.numFormatType; }, asc_getNumFormatType: function(){ return this.numFormatType; },
asc_getAngle: function () { return this.angle; }, asc_getAngle: function () { return this.angle; },
asc_getAutoFilter: function () { return this.autoFilter; } asc_getCleanFilter: function () { return this.cleanFilter; }
}; };
window["Asc"].asc_CCellInfo = window["Asc"]["asc_CCellInfo"] = asc_CCellInfo; window["Asc"].asc_CCellInfo = window["Asc"]["asc_CCellInfo"] = asc_CCellInfo;
......
...@@ -95,6 +95,7 @@ var historyitem_AutoFilter_Empty = 3; ...@@ -95,6 +95,7 @@ var historyitem_AutoFilter_Empty = 3;
var historyitem_AutoFilter_ApplyDF = 4; var historyitem_AutoFilter_ApplyDF = 4;
var historyitem_AutoFilter_ApplyMF = 5; var historyitem_AutoFilter_ApplyMF = 5;
var historyitem_AutoFilter_Move = 6; var historyitem_AutoFilter_Move = 6;
var historyitem_AutoFilter_CleanAutoFilter = 7;
// Типы изменений в классе CDocumentContent // Типы изменений в классе CDocumentContent
......
...@@ -1605,7 +1605,8 @@ var gUndoInsDelCellsFlag = true; ...@@ -1605,7 +1605,8 @@ var gUndoInsDelCellsFlag = true;
History.TurnOff(); History.TurnOff();
}, },
isApplyAutoFilterInCell: function(activeCell) //второй параметр - чистим у найденного фильтра FilterColumns и SortState
isApplyAutoFilterInCell: function(activeCell, clean)
{ {
var aWs = this._getCurrentWS(); var aWs = this._getCurrentWS();
var tableRange; var tableRange;
...@@ -1620,18 +1621,27 @@ var gUndoInsDelCellsFlag = true; ...@@ -1620,18 +1621,27 @@ var gUndoInsDelCellsFlag = true;
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])))
{ {
if(tablePart.Ref.containsRange(activeCell)) if(tablePart.Ref.containsRange(activeCell))
{
if(clean)
this._cleanFilterColumnsAndSortState(tablePart, activeCell);
return true; return true;
} }
}
else else
{ {
if(tablePart.Ref.containsRange(activeCell)) if(tablePart.Ref.containsRange(activeCell, activeCell))
return false; return false;
}; };
}; };
}; };
if(aWs.AutoFilter && ((aWs.AutoFilter.FilterColumns && aWs.AutoFilter.FilterColumns.length) || (aWs.AutoFilter.SortState && aWs.AutoFilter.SortState.SortConditions && aWs.AutoFilter.SortState.SortConditions[0]))) if(aWs.AutoFilter && ((aWs.AutoFilter.FilterColumns && aWs.AutoFilter.FilterColumns.length) || (aWs.AutoFilter.SortState && aWs.AutoFilter.SortState.SortConditions && aWs.AutoFilter.SortState.SortConditions[0])))
{
if(clean)
this._cleanFilterColumnsAndSortState(aWs.AutoFilter);
return true; return true;
}
return false; return false;
}, },
...@@ -1760,6 +1770,9 @@ var gUndoInsDelCellsFlag = true; ...@@ -1760,6 +1770,9 @@ var gUndoInsDelCellsFlag = true;
case historyitem_AutoFilter_Move: case historyitem_AutoFilter_Move:
this._moveAutoFilters(data.moveTo, data.moveFrom); this._moveAutoFilters(data.moveTo, data.moveFrom);
break; break;
case historyitem_AutoFilter_CleanAutoFilter:
this.isApplyAutoFilterInCell(data.activeCells, true);
break;
} }
startRedo = false; startRedo = false;
History.TurnOn(); History.TurnOn();
...@@ -2030,27 +2043,46 @@ var gUndoInsDelCellsFlag = true; ...@@ -2030,27 +2043,46 @@ var gUndoInsDelCellsFlag = true;
{ {
if(aWs.TableParts[i].Ref) if(aWs.TableParts[i].Ref)
{ {
/*var ref = aWs.TableParts[i].Ref.split(":");
var startRange = this._idToRange(ref[0]);
var endRange = this._idToRange(ref[1]);
tableRange =
{
r1: startRange.r1,
r2: endRange.r1,
c1: startRange.c1,
c2: endRange.c1
}*/
tableRange = aWs.TableParts[i].Ref; tableRange = aWs.TableParts[i].Ref;
};
}
if(this._rangeHitInAnRange(range,tableRange)) if(this._rangeHitInAnRange(range,tableRange))
return tableRange; return {tableRange: tableRange, id: i};
} }
} }
return null; return null;
}, },
checkApplyFilterOrSort: function(tablePartId)
{
var aWs = this._getCurrentWS();
var result = false;
if(tablePartId !== undefined)
{
var tablePart = aWs.TablePart[tablePartId];
if(tablePart.Ref && ((tablePart.AutoFilter && tablePart.AutoFilter.FilterColumns && tablePart.AutoFilter.FilterColumns.length) || (tablePart && tablePart.SortState && tablePart.SortState.SortConditions && tablePart.SortState.SortConditions[0])))
result = true;
}
else
{
if(aWs.AutoFilter && ((aWs.AutoFilter.FilterColumns && aWs.AutoFilter.FilterColumns.length) || (aWs.AutoFilter.SortState && aWs.AutoFilter.SortState.SortConditions && aWs.AutoFilter.SortState.SortConditions[0])))
{
result = {isFilterColumns: true, isAutoFilter: true};
}
else if(aWs.AutoFilter)
{
result = {isFilterColumns: false, isAutoFilter: true}
}
else
{
result = {isFilterColumns: false, isAutoFilter: false}
};
};
return result;
},
getAddFormatTableOptions: function(activeCells) getAddFormatTableOptions: function(activeCells)
{ {
var ws = this.worksheet; var ws = this.worksheet;
...@@ -7142,6 +7174,30 @@ var gUndoInsDelCellsFlag = true; ...@@ -7142,6 +7174,30 @@ var gUndoInsDelCellsFlag = true;
}; };
}; };
}; };
},
_cleanFilterColumnsAndSortState: function(autoFilterElement, activeCells)
{
var ws = this.worksheet;
var aWs = this._getCurrentWS();
var oldFilter = autoFilterElement.clone(aWs);
if(autoFilterElement.SortState)
autoFilterElement.SortState = null;
if(autoFilterElement.AutoFilter && autoFilterElement.AutoFilter.FilterColumns)
{
autoFilterElement.AutoFilter.FilterColumns = null;
}
else if(autoFilterElement.FilterColumns)
{
autoFilterElement.FilterColumns = null;
};
this._addHistoryObj(oldFilter, historyitem_AutoFilter_CleanAutoFilter, {activeCells: activeCells});
ws.isChanged = true;
this._reDrawFilters();
} }
}; };
......
...@@ -6443,7 +6443,31 @@ ...@@ -6443,7 +6443,31 @@
cell_info.halign = c.getAlignHorizontalByValue().toLowerCase(); cell_info.halign = c.getAlignHorizontalByValue().toLowerCase();
cell_info.valign = c.getAlignVertical().toLowerCase(); cell_info.valign = c.getAlignVertical().toLowerCase();
cell_info.isFormatTable = (null !== this.autoFilters.searchRangeInTableParts(activeCell)); //null - disable, true - pressed button, false - unpressed button
var tablePartsOptions = this.autoFilters.searchRangeInTableParts(activeCell);
if(tablePartsOptions == null)
{
var checkApplyFilterOrSort = this.autoFilters.checkApplyFilterOrSort();
cell_info.isFormatTable = checkApplyFilterOrSort.isAutoFilter;
cell_info.cleanFilter = checkApplyFilterOrSort.isFilterColumns;
}
else
{
if(tablePartsOptions.tableRange.containsRange(activeCell))
{
cell_info.isFormatTable = true;
if(this.autoFilters.checkApplyFilterOrSort(tablePartsOptions.id))
cell_info.cleanFilter = true;
else
cell_info.cleanFilter = null;
}
else
{
cell_info.isFormatTable = null;
cell_info.cleanFilter = null;
};
};
cell_info.styleName = c.getStyleName(); cell_info.styleName = c.getStyleName();
cell_info.angle = c.getAngle(); cell_info.angle = c.getAngle();
...@@ -6508,9 +6532,6 @@ ...@@ -6508,9 +6532,6 @@
} }
} }
//применен ли а/ф к данной ячейке
cell_info.autoFilter = this.autoFilters.isApplyAutoFilterInCell(activeCell);
return cell_info; return cell_info;
}; };
......
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