From bafbdf6c3f57b32f9d533dedea2c0d6f5d6b7e96 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 21 Jun 2017 12:47:22 +0300 Subject: [PATCH] [SSE] Disable filters, sort, merge, hyperlinks when in pivot table. --- .../main/app/controller/DocumentHolder.js | 9 ++++++-- .../main/app/controller/Toolbar.js | 3 +++ .../main/app/view/Toolbar.js | 23 ++++++++++--------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 713ae0c69..6026afb7b 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -1445,6 +1445,8 @@ define([ documentHolder.pmiInsertCells.menu.items[1].setDisabled(isApplyAutoFilter); documentHolder.pmiDeleteCells.menu.items[1].setDisabled(isApplyAutoFilter); + var inPivot = !!cellinfo.asc_getPivotTableInfo(); + _.each(documentHolder.ssMenu.items, function(item) { item.setDisabled(isCellLocked); }); @@ -1455,9 +1457,12 @@ define([ documentHolder.pmiDeleteEntire.setDisabled(isCellLocked || isTableLocked); documentHolder.pmiDeleteCells.setDisabled(isCellLocked || isTableLocked); documentHolder.pmiDeleteTable.setDisabled(isCellLocked || isTableLocked); - documentHolder.pmiFilterCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null)); - documentHolder.pmiSortCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null)); + documentHolder.pmiFilterCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null) || inPivot); + documentHolder.pmiSortCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null) || inPivot); documentHolder.pmiReapply.setDisabled(isCellLocked || isTableLocked|| (isApplyAutoFilter!==true)); + documentHolder.menuHyperlink.setDisabled(isCellLocked || inPivot); + documentHolder.menuAddHyperlink.setDisabled(isCellLocked || inPivot); + if (showMenu) this.showPopupMenu(documentHolder.ssMenu, {}, event); } else if (this.permissions.isEditDiagram && seltype == Asc.c_oAscSelectionType.RangeChartText) { if (!showMenu && !documentHolder.textInShapeMenu.isVisible()) return; diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 944350a84..fdefb84c9 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -2012,6 +2012,9 @@ define([ this._state.multiselect = info.asc_getFlags().asc_getMultiselect(); toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink]}); + + need_disable = !!info.asc_getPivotTableInfo(); + toolbar.lockToolbar(SSE.enumLock.editPivot, need_disable, { array: [toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnSetAutofilter, toolbar.btnClearAutofilter, toolbar.btnSortDown, toolbar.btnSortUp, toolbar.btnAutofilter]}); } val = info.asc_getNumFormatInfo(); diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 41461ee3e..0aa3852a1 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -61,6 +61,7 @@ define([ editCell: 'cell-editing', editFormula: 'is-formula', editText: 'is-text', + editPivot: 'is-pivot', selImage: 'sel-image', selShape: 'sel-shape', selShapeText: 'sel-shape-txt', @@ -289,21 +290,21 @@ define([ id : 'id-toolbar-btn-sort-down', cls : 'btn-toolbar', iconCls : 'btn-sort-down', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter] + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot] }); me.btnSortUp = new Common.UI.Button({ id : 'id-toolbar-btn-sort-up', cls : 'btn-toolbar', iconCls : 'btn-sort-up', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter] + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot] }); me.btnSetAutofilter = new Common.UI.Button({ id : 'id-toolbar-btn-setautofilter', cls : 'btn-toolbar', iconCls : 'btn-autofilter', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot], enableToggle: true }); @@ -311,7 +312,7 @@ define([ id : 'id-toolbar-btn-clearfilter', cls : 'btn-toolbar', iconCls : 'btn-clear-filter', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter] + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot] }); } else { Common.UI.Mixtbar.prototype.initialize.call(this, { @@ -493,7 +494,7 @@ define([ enableToggle: true, allowDepress: true, split : true, - lock : [_set.editCell, _set.selShape, _set.selShapeText, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleMerge], + lock : [_set.editCell, _set.selShape, _set.selShapeText, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleMerge, _set.editPivot], menu : new Common.UI.Menu({ items: [ { @@ -617,7 +618,7 @@ define([ cls : 'btn-toolbar x-huge icon-top', iconCls : 'btn-inserthyperlink', caption : me.capInsertHyperlink, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.cantHyperlink, _set.multiselect, _set.lostConnect, _set.coAuth] + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.cantHyperlink, _set.multiselect, _set.lostConnect, _set.coAuth, _set.editPivot] }); me.btnInsertChart = new Common.UI.Button({ @@ -684,21 +685,21 @@ define([ id : 'id-toolbar-btn-sort-down', cls : 'btn-toolbar', iconCls : 'btn-sort-down', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter] + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot] }); me.btnSortUp = new Common.UI.Button({ id : 'id-toolbar-btn-sort-up', cls : 'btn-toolbar', iconCls : 'btn-sort-up', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter] + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot] }); me.btnSetAutofilter = new Common.UI.Button({ id : 'id-toolbar-btn-setautofilter', cls : 'btn-toolbar', iconCls : 'btn-autofilter', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot], enableToggle: true }); @@ -706,7 +707,7 @@ define([ id : 'id-toolbar-btn-clearfilter', cls : 'btn-toolbar', iconCls : 'btn-clear-filter', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter] + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot] }); me.btnTableTemplate = new Common.UI.Button({ @@ -1151,7 +1152,7 @@ define([ id : 'id-toolbar-btn-autofilter', cls : 'btn-toolbar', iconCls : 'btn-autofilter', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot], menu : new Common.UI.Menu({ items : [ me.mnuitemSortAZ = new Common.UI.MenuItem({