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