Commit 9c38daa4 authored by Igor.Zotov's avatar Igor.Zotov

измененея в добавлении и изменении а/ф(ф/т)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63742 954022d7-b5bf-4e40-9824-e11837661b57
parent d3d3f58a
......@@ -770,9 +770,14 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.resize();
};
spreadsheet_api.prototype.asc_addAutoFilter = function(lTable, addFormatTableOptionsObj){
spreadsheet_api.prototype.asc_addAutoFilter = function(styleName, addFormatTableOptionsObj){
var ws = this.wb.getWorksheet();
return ws.addAutoFilter(lTable, addFormatTableOptionsObj);
return ws.addAutoFilter(styleName, addFormatTableOptionsObj);
};
spreadsheet_api.prototype.asc_changeAutoFilter = function(tableName, optionType, val){
var ws = this.wb.getWorksheet();
return ws.changeAutoFilter(tableName, optionType, val);
};
spreadsheet_api.prototype.asc_applyAutoFilter = function(type,autoFilterObject){
......@@ -3837,6 +3842,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Auto filters interface
prot["asc_addAutoFilter"] = prot.asc_addAutoFilter;
prot["asc_changeAutoFilter"] = prot.asc_changeAutoFilter;
prot["asc_applyAutoFilter"] = prot.asc_applyAutoFilter;
prot["asc_sortColFilter"] = prot.asc_sortColFilter;
prot["asc_getAddFormatTableOptions"] = prot.asc_getAddFormatTableOptions;
......
......@@ -249,6 +249,11 @@ var c_oAscCustomAutoFilter = {
doesNotContain: 12
};
var c_oAscChangeFilterOptions = {
filter: 1,
style: 2
};
// Состояние редактора ячейки
var c_oAscCellEditorState = {
editEnd: 0, // Окончание редактирования
......
......@@ -144,7 +144,33 @@
prot["asc_getBottom"] = prot.asc_getBottom;
prot["asc_getDiagDown"] = prot.asc_getDiagDown;
prot["asc_getDiagUp"] = prot.asc_getDiagUp;
/** @constructor */
function asc_CAutoFilterInfo() {
this.tableStyleName = null;
this.tableName = null;
this.isApplyAutoFilter = false; // Кнопка очистить фильтр: false - disable, true - pressed button
this.isAutoFilter = false; // Кнопка автофильтр (также влияет на formatTable и Sort). Возможные состояния:
// - null - мы в пересечении с таблицой (но не полностью в ней)
// - true/false - когда мы полностью в таблице или вне ее (true/false в зависимости от того применен фильтр или нет)
}
asc_CAutoFilterInfo.prototype = {
asc_getTableStyleName: function () { return this.tableStyleName; },
asc_getTableName: function () { return this.tableName; },
asc_getIsAutoFilter: function () { return this.isAutoFilter; },
asc_getIsApplyAutoFilter: function () { return this.isApplyAutoFilter; }
};
window["Asc"].asc_CAutoFilterInfo = window["Asc"]["asc_CAutoFilterInfo"] = asc_CAutoFilterInfo;
prot = asc_CAutoFilterInfo.prototype;
prot["asc_getTableStyleName"] = prot.asc_getTableStyleName;
prot["asc_getTableName"] = prot.asc_getTableName;
prot["asc_getIsAutoFilter"] = prot.asc_getIsAutoFilter;
prot["asc_getIsApplyAutoFilter"] = prot.asc_getIsApplyAutoFilter;
/** @constructor */
function asc_CCellInfo() {
this.name = null;
......@@ -161,15 +187,10 @@
this.hyperlink = null;
this.comments = [];
this.isLocked = false;
this.isFormatTable = false; // Нужен для disable возможности делать merge
this.tableStyleName = null;
this.styleName = null;
this.numFormatType = null;
this.angle = null;
this.clearFilter = false; // Кнопка очистить фильтр: false - disable, true - pressed button
this.isAutoFilter = false; // Кнопка автофильтр (также влияет на formatTable и Sort). Возможные состояния:
// - null - мы в пересечении с таблицой (но не полностью в ней)
// - true/false - когда мы полностью в таблице или вне ее (true/false в зависимости от того применен фильтр или нет)
this.autoFilterInfo = null;
}
asc_CCellInfo.prototype = {
......@@ -187,13 +208,14 @@
asc_getHyperlink: function(){ return this.hyperlink; },
asc_getComments: function(){ return this.comments; },
asc_getLocked: function(){ return this.isLocked; },
asc_getIsFormatTable: function () { return this.isFormatTable; },
asc_getTableStyleName: function () { return this.tableStyleName; },
asc_getStyleName: function () { return this.styleName; },
asc_getNumFormatType: function(){ return this.numFormatType; },
asc_getAngle: function () { return this.angle; },
asc_getClearFilter: function () { return this.clearFilter; },
asc_getIsAutoFilter: function () { return this.isAutoFilter; }
asc_getAutoFilterInfo: function () { return this.autoFilterInfo; },
asc_getIsFormatTable: function() {return null},//TODO DELETE
asc_getIsAutoFilter: function() {return null},//TODO DELETE
asc_getTableStyleName: function() {return null},//TODO DELETE
asc_getClearFilter: function() {return null}//TODO DELETE
};
window["Asc"].asc_CCellInfo = window["Asc"]["asc_CCellInfo"] = asc_CCellInfo;
......@@ -213,13 +235,14 @@
prot["asc_getHyperlink"] = prot.asc_getHyperlink;
prot["asc_getComments"] = prot.asc_getComments;
prot["asc_getLocked"] = prot.asc_getLocked;
prot["asc_getIsFormatTable"] = prot.asc_getIsFormatTable;
prot["asc_getTableStyleName"] = prot.asc_getTableStyleName;
prot["asc_getStyleName"] = prot.asc_getStyleName;
prot["asc_getNumFormatType"] = prot.asc_getNumFormatType;
prot["asc_getAngle"] = prot.asc_getAngle;
prot["asc_getClearFilter"] = prot.asc_getClearFilter;
prot["asc_getIsAutoFilter"] = prot.asc_getIsAutoFilter;
prot["asc_getAutoFilterInfo"] = prot.asc_getAutoFilterInfo;
prot["asc_getIsFormatTable"] = prot.asc_getIsFormatTable;//TODO DELETE
prot["asc_getIsAutoFilter"] = prot.asc_getIsAutoFilter;//TODO DELETE
prot["asc_getTableStyleName"] = prot.asc_getTableStyleName;//TODO DELETE
prot["asc_getClearFilter"] = prot.asc_getClearFilter;//TODO DELETE
/** @constructor */
function asc_CDefName(n, r, s, t) {
......
......@@ -43,6 +43,7 @@
var asc_CPageMargins = asc.asc_CPageMargins;
var asc_CPagePrint = asc.CPagePrint;
var asc_CSelectionMathInfo = asc.asc_CSelectionMathInfo;
var asc_CAutoFilterInfo = asc.asc_CAutoFilterInfo;
/*
* Constants
......@@ -6553,18 +6554,20 @@
cell_info.halign = c.getAlignHorizontalByValue().toLowerCase();
cell_info.valign = c.getAlignVertical().toLowerCase();
var checkApplyFilterOrSort;
var tablePartsOptions = this.autoFilters.searchRangeInTableParts(activeCell);
cell_info.tableStyleName = tablePartsOptions !== -1 && tablePartsOptions !== -2 && this.model.TableParts && this.model.TableParts[tablePartsOptions].TableStyleInfo ? this.model.TableParts[tablePartsOptions].TableStyleInfo.Name : null;
cell_info.isFormatTable = (-1 !== tablePartsOptions);
var curTablePart = tablePartsOptions !== -1 && tablePartsOptions !== -2 && this.model.TableParts && this.model.TableParts[tablePartsOptions].TableStyleInfo ? this.model.TableParts[tablePartsOptions] : null;
cell_info.autoFilterInfo = new asc_CAutoFilterInfo();
cell_info.autoFilterInfo.tableStyleName = curTablePart ? curTablePart.TableStyleInfo.Name : null;
cell_info.autoFilterInfo.tableName = curTablePart ? curTablePart.Name : null;
if (-2 === tablePartsOptions) {
cell_info.isAutoFilter = null;
cell_info.clearFilter = false;
cell_info.autoFilterInfo.isAutoFilter = null;
cell_info.autoFilterInfo.isApplyAutoFilter = false;
} else {
checkApplyFilterOrSort = this.autoFilters.checkApplyFilterOrSort(tablePartsOptions);
cell_info.isAutoFilter = checkApplyFilterOrSort.isAutoFilter;
cell_info.clearFilter = checkApplyFilterOrSort.isFilterColumns;
var checkApplyFilterOrSort = this.autoFilters.checkApplyFilterOrSort(tablePartsOptions);
cell_info.autoFilterInfo.isAutoFilter = checkApplyFilterOrSort.isAutoFilter;
cell_info.autoFilterInfo.isApplyAutoFilter = checkApplyFilterOrSort.isFilterColumns;
}
cell_info.styleName = c.getStyleName();
......@@ -10984,13 +10987,14 @@
this.arrActiveFormulaRanges = [];
};
WorksheetView.prototype.addAutoFilter = function (lTable, addFormatTableOptionsObj, isApplyAutoFilter, isApplyFormatTable) {
WorksheetView.prototype.addAutoFilter = function (styleName, addFormatTableOptionsObj) {
// Проверка глобального лока
if (this.collaborativeEditing.getGlobalLock())
return;
var t = this;
var ar = t.activeRange.clone(true);
var onChangeAutoFilterCallback = function (isSuccess) {
if (false === isSuccess)
{
......@@ -10998,31 +11002,47 @@
return;
}
//TODO брать info из меню
var info = t._getSelectionInfoCell();
isApplyAutoFilter = info.isAutoFilter;
isApplyFormatTable = info.tableStyleName;
var isActiveRangeIntersectionAutoFilter = null;
if(lTable && addFormatTableOptionsObj && isApplyAutoFilter)
isActiveRangeIntersectionAutoFilter = t.autoFilters.isActiveRangeIntersectionAutoFilter(addFormatTableOptionsObj);
if(!lTable && isApplyAutoFilter)//delete filter in AutoFilter or TablePart
t.autoFilters.deleteAutoFilter(ar);
else if(!lTable && !isApplyAutoFilter)//add autoFilter
t.autoFilters.addAutoFilter(lTable, ar);
else if(lTable && !isApplyFormatTable && (!isApplyAutoFilter || (isApplyAutoFilter && !isActiveRangeIntersectionAutoFilter)))//add TablePart
t.autoFilters.addAutoFilter(lTable, ar, addFormatTableOptionsObj);
else if(lTable && isApplyFormatTable)//change TablePart
t.autoFilters.changeTableStyleInfo(lTable, ar);
else if(lTable && !isApplyFormatTable && isApplyAutoFilter)//change AutoFilter to TablePart
t.autoFilters.changeAutoFilterToTablePart(lTable, ar, addFormatTableOptionsObj);
if(t.autoFilters.iaChangeAutoFilterToTablePart(addFormatTableOptionsObj) === true)
t.autoFilters.changeAutoFilterToTablePart(styleName, ar, addFormatTableOptionsObj);
else
t.autoFilters.addAutoFilter(styleName, ar, addFormatTableOptionsObj);
};
if(t.autoFilters.checkAddAutoFilter(ar, lTable) === true)
if(t.autoFilters.checkAddAutoFilter(ar, styleName, addFormatTableOptionsObj) === true)
this._isLockedAll (onChangeAutoFilterCallback);
};
WorksheetView.prototype.changeAutoFilter = function (tableName, optionType, val) {
// Проверка глобального лока
if (this.collaborativeEditing.getGlobalLock())
return;
var t = this;
var ar = t.activeRange.clone(true);
var onChangeAutoFilterCallback = function (isSuccess) {
if (false === isSuccess)
{
t.handlers.trigger("selectionChanged", t.getSelectionInfo());
return;
}
switch (optionType) {
case c_oAscChangeFilterOptions.filter:
{
t.autoFilters.deleteAutoFilter(ar, tableName);
break;
}
case c_oAscChangeFilterOptions.style:
{
t.autoFilters.changeTableStyleInfo(val, ar, tableName);
break;
}
}
};
this._isLockedAll (onChangeAutoFilterCallback);
};
WorksheetView.prototype.applyAutoFilter = function (type, autoFilterObject) {
var t = this;
......
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