From 107a2b377e34e41c00c06a0c898ed6999e7d5922 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 20 Mar 2018 15:35:17 +0300 Subject: [PATCH] [SSE] Fix Bug 36982 + disable cut/paste/insert function from context menu in the pivot table. --- .../main/app/controller/DocumentHolder.js | 3 +++ apps/spreadsheeteditor/main/app/controller/PivotTable.js | 4 +--- apps/spreadsheeteditor/main/app/controller/RightMenu.js | 9 +++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 88e92f623..d5b8d9929 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -1475,6 +1475,8 @@ define([ item.setDisabled(isCellLocked); }); documentHolder.pmiCopy.setDisabled(false); + documentHolder.pmiCut.setDisabled(isCellLocked || inPivot); // can't edit pivot cells + documentHolder.pmiPaste.setDisabled(isCellLocked || inPivot); documentHolder.pmiInsertEntire.setDisabled(isCellLocked || isTableLocked); documentHolder.pmiInsertCells.setDisabled(isCellLocked || isTableLocked || inPivot); documentHolder.pmiInsertTable.setDisabled(isCellLocked || isTableLocked); @@ -1487,6 +1489,7 @@ define([ documentHolder.pmiReapply.setDisabled(isCellLocked || isTableLocked|| (isApplyAutoFilter!==true)); documentHolder.menuHyperlink.setDisabled(isCellLocked || inPivot); documentHolder.menuAddHyperlink.setDisabled(isCellLocked || inPivot); + documentHolder.pmiInsFunction.setDisabled(isCellLocked || inPivot); if (showMenu) this.showPopupMenu(documentHolder.ssMenu, {}, event); } else if (this.permissions.isEditDiagram && seltype == Asc.c_oAscSelectionType.RangeChartText) { diff --git a/apps/spreadsheeteditor/main/app/controller/PivotTable.js b/apps/spreadsheeteditor/main/app/controller/PivotTable.js index 1724d8bb5..f78882bfb 100644 --- a/apps/spreadsheeteditor/main/app/controller/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/controller/PivotTable.js @@ -328,9 +328,7 @@ define([ var selectType = info.asc_getFlags().asc_getSelectionType(), pivotInfo = info.asc_getPivotTableInfo(); - var need_disable = info.asc_getLocked(); - - this.view.SetDisabled(!pivotInfo); + this.view.SetDisabled(!pivotInfo || info.asc_getLockedPivotTable()); if (pivotInfo) this.ChangeSettings(pivotInfo); }, diff --git a/apps/spreadsheeteditor/main/app/controller/RightMenu.js b/apps/spreadsheeteditor/main/app/controller/RightMenu.js index 3c4f24e07..87b177591 100644 --- a/apps/spreadsheeteditor/main/app/controller/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/RightMenu.js @@ -133,12 +133,13 @@ define([ var need_disable = info.asc_getLocked(), need_disable_table = (info.asc_getLockedTable()===true || !this.rightmenu.mode.canModifyFilter), - need_disable_spark = (info.asc_getLockedSparkline()===true); + need_disable_spark = (info.asc_getLockedSparkline()===true), + need_disable_pivot = (info.asc_getLockedPivotTable()===true); - this.onFocusObject(SelectedObjects, formatTableInfo, sparkLineInfo, pivotInfo, need_disable, need_disable_table, need_disable_spark); + this.onFocusObject(SelectedObjects, formatTableInfo, sparkLineInfo, pivotInfo, need_disable, need_disable_table, need_disable_spark, need_disable_pivot); }, - onFocusObject: function(SelectedObjects, formatTableInfo, sparkLineInfo, pivotInfo, isCellLocked, isTableLocked, isSparkLocked) { + onFocusObject: function(SelectedObjects, formatTableInfo, sparkLineInfo, pivotInfo, isCellLocked, isTableLocked, isSparkLocked, isPivotLocked) { if (!this.editMode) return; @@ -199,7 +200,7 @@ define([ // if (pivotInfo) { // settingsType = Common.Utils.documentSettingsType.Pivot; // this._settings[settingsType].props = pivotInfo; - // this._settings[settingsType].locked = isCellLocked || true; // disable pivot settings + // this._settings[settingsType].locked = isPivotLocked || true; // disable pivot settings // this._settings[settingsType].hidden = 0; // }