diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 7aeb53e47..ea0e6deb8 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -194,7 +194,9 @@ define([ pgorient: undefined, lock_doc: undefined, cf_locked: [], - selectedCells: 0 + selectedCells: 0, + wsLock: false, + wsProps: {} }; this.binding = {}; @@ -1818,6 +1820,7 @@ define([ this.api.asc_registerCallback('asc_onUpdateDocumentProps', _.bind(this.onUpdateDocumentProps, this)); this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this)); this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this)); + Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this)); } if ( !this.appConfig.isEditMailMerge ) { @@ -2500,6 +2503,12 @@ define([ toolbar.btnImgAlign.menu.items[7].setDisabled(objcount<3); toolbar.btnImgAlign.menu.items[8].setDisabled(objcount<3); + // disable on protected sheet + need_disable = (selectionType === Asc.c_oAscSelectionType.RangeImage || selectionType === Asc.c_oAscSelectionType.RangeChart || selectionType === Asc.c_oAscSelectionType.RangeChartText || + selectionType === Asc.c_oAscSelectionType.RangeShape || selectionType === Asc.c_oAscSelectionType.RangeShapeText || selectionType === Asc.c_oAscSelectionType.RangeSlicer); + toolbar.lockToolbar(need_disable ? SSE.enumLock['Objects'] : SSE.enumLock['FormatCells'], need_disable ? this._state.wsProps['Objects'] : this._state.wsProps['FormatCells'], + { clear: [SSE.enumLock['FormatCells'], SSE.enumLock['Objects']]}); + if (editOptionsDisabled) return; /* read font params */ @@ -3709,8 +3718,10 @@ define([ var $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); if ($panel) { config.canProtect && $panel.append($('
')); - $panel.append(me.getApplication().getController('WBProtection').createToolbarPanel()); + var wbtab = me.getApplication().getController('WBProtection'); + $panel.append(wbtab.createToolbarPanel()); me.toolbar.addTab(tab, $panel, 7); + Array.prototype.push.apply(me.toolbar.lockControls, wbtab.getView('WBProtection').getButtons()); } var viewtab = me.getApplication().getController('ViewTab'); @@ -3981,6 +3992,11 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar); }, + onChangeProtectSheet: function(props) { + this._state.wsProps = props; + this.onApiSelectionChanged(this.api.asc_getCellInfo()); + }, + textEmptyImgUrl : 'You need to specify image URL.', warnMergeLostData : 'Operation can destroy data in the selected cells.
Continue?', textWarning : 'Warning', diff --git a/apps/spreadsheeteditor/main/app/controller/WBProtection.js b/apps/spreadsheeteditor/main/app/controller/WBProtection.js index 7edc649a7..c1c1a3226 100644 --- a/apps/spreadsheeteditor/main/app/controller/WBProtection.js +++ b/apps/spreadsheeteditor/main/app/controller/WBProtection.js @@ -68,7 +68,12 @@ define([ }); }, onLaunch: function () { - this._state = {}; + this._state = {wsLock: false}; + this.wsLockOptions = ['SelectLockedCells', 'SelectUnlockedCells', 'FormatCells', 'FormatColumns', 'FormatRows', 'InsertColumns', 'InsertRows', 'InsertHyperlinks', 'DeleteColumns', + 'DeleteRows', 'Sort', 'AutoFilter', 'PivotTables', 'Objects', 'Scenarios']; + SSE.enumLock && this.wsLockOptions.forEach(function(item){ + SSE.enumLock[item] = item; + }); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); @@ -86,6 +91,7 @@ define([ this.api.asc_registerCallback('asc_onChangeProtectWorkbook',_.bind(this.onChangeProtectWorkbook, this)); this.api.asc_registerCallback('asc_onChangeProtectWorksheet',_.bind(this.onChangeProtectSheet, this)); this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.onApiSheetChanged, this)); + this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChanged, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this)); } }, @@ -272,11 +278,32 @@ define([ }, onChangeProtectSheet: function() { + var wsProtected = this.api.asc_isProtectedSheet(); + if (this._state.wsLock===wsProtected && !wsProtected) return; + this.view.btnProtectSheet.toggle(this.api.asc_isProtectedSheet(), true); //current sheet + var arr = []; + if (wsProtected) { + var props = this.api.asc_getProtectedSheet(); + props && this.wsLockOptions.forEach(function(item){ + arr[item] = props['asc_get' + item] ? props['asc_get' + item]() : false; + }); + } + this._state.wsLock = wsProtected; + Common.NotificationCenter.trigger('protect:wslock', arr); }, onApiSheetChanged: function() { - this.view.btnProtectSheet.toggle(this.api.asc_isProtectedSheet(), true); //current sheet + this.onChangeProtectSheet(); //current sheet + }, + + onApiSelectionChanged: function(info) { + if ($('.asc-window.enable-key-events:visible').length>0) return; + + var selectionType = info.asc_getSelectionType(); + var need_disable = (selectionType === Asc.c_oAscSelectionType.RangeCells || selectionType === Asc.c_oAscSelectionType.RangeCol || + selectionType === Asc.c_oAscSelectionType.RangeRow || selectionType === Asc.c_oAscSelectionType.RangeMax); + Common.Utils.lockControls(SSE.enumLock.selRange, need_disable, { array: [this.view.chLockedText, this.view.chLockedShape]}); }, onCoAuthoringDisconnect: function() { diff --git a/apps/spreadsheeteditor/main/app/view/PivotTable.js b/apps/spreadsheeteditor/main/app/view/PivotTable.js index 0b6be6938..3cc33e902 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/view/PivotTable.js @@ -157,29 +157,29 @@ define([ var _set = SSE.enumLock; this.btnsAddPivot = Common.Utils.injectButtons(this.toolbar.$el.find('.btn-slot.slot-add-pivot'), '', 'toolbar__icon btn-pivot-sum', this.txtPivotTable, - [_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell]); + [_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell, _set.wsLock]); this.chRowHeader = new Common.UI.CheckBox({ labelText: this.textRowHeader, - lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock] + lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells']] }); this.lockedControls.push(this.chRowHeader); this.chColHeader = new Common.UI.CheckBox({ labelText: this.textColHeader, - lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock] + lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells']] }); this.lockedControls.push(this.chColHeader); this.chRowBanded = new Common.UI.CheckBox({ labelText: this.textRowBanded, - lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock] + lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells']] }); this.lockedControls.push(this.chRowBanded); this.chColBanded = new Common.UI.CheckBox({ labelText: this.textColBanded, - lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock] + lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells']] }); this.lockedControls.push(this.chColBanded); @@ -246,7 +246,7 @@ define([ itemWidth : 61, itemHeight : 49, menuMaxHeight : 300, - lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock], + lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells']], beforeOpenHandler: function(e) { var cmp = this, menu = cmp.openButton.menu; @@ -326,7 +326,7 @@ define([ var _set = SSE.enumLock; this.btnsAddPivot = this.btnsAddPivot.concat(Common.Utils.injectButtons(this.$el.find('.btn-slot.slot-add-pivot'), '', 'toolbar__icon btn-pivot-sum', this.txtCreate, - [_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell])); + [_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell, _set.wsLock])); this.chRowHeader.render(this.$el.find('#slot-chk-header-row')); this.chColHeader.render(this.$el.find('#slot-chk-header-column')); diff --git a/apps/spreadsheeteditor/main/app/view/ProtectDialog.js b/apps/spreadsheeteditor/main/app/view/ProtectDialog.js index fe3da91a0..76b5151c8 100644 --- a/apps/spreadsheeteditor/main/app/view/ProtectDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ProtectDialog.js @@ -299,6 +299,8 @@ define([ updateCellCheck: function (listView, record) { if (record && listView) { record.set('check', !record.get('check')); + if (record.get('optionName') == 'SelectLockedCells' && record.get('check')) + this.optionsList.store.findWhere({optionName: 'SelectUnlockedCells'}).set('check', true); // listView.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); } }, diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 9b7b68bee..4165621c0 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -99,7 +99,8 @@ define([ pivotLock: 'pivot-lock', tableHasSlicer: 'table-has-slicer', sheetView: 'sheet-view', - wbLock: 'workbook-lock' + wbLock: 'workbook-lock', + wsLock: 'worksheet-lock' }; SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({ @@ -405,21 +406,21 @@ define([ id : 'id-toolbar-btn-incfont', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-incfont', - lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect] + lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']] }); me.btnDecFontSize = new Common.UI.Button({ id : 'id-toolbar-btn-decfont', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-decfont', - lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect] + lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']] }); me.btnBold = new Common.UI.Button({ id : 'id-toolbar-btn-bold', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-bold', - lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect], + lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], enableToggle: true }); @@ -427,7 +428,7 @@ define([ id : 'id-toolbar-btn-italic', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-italic', - lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect], + lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], enableToggle: true }); @@ -435,7 +436,7 @@ define([ id : 'id-toolbar-btn-underline', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-underline', - lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect], + lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], enableToggle: true }); @@ -443,7 +444,7 @@ define([ id: 'id-toolbar-btn-strikeout', cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-strikeout', - lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect], + lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], enableToggle: true }); @@ -454,7 +455,7 @@ define([ icls : 'btn-subscript', split : true, enableToggle: true, - lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect], + lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], menu : new Common.UI.Menu({ items: [ { @@ -487,7 +488,7 @@ define([ cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-fontcolor', split : true, - lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect], + lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], menu : new Common.UI.Menu({ cls: 'shifted-left', items: [ @@ -509,7 +510,7 @@ define([ cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-paracolor', split : true, - lock : [_set.selImage, _set.editCell, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect], + lock : [_set.selImage, _set.editCell, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], menu : new Common.UI.Menu({ items: [ { template: _.template('
') }, @@ -525,7 +526,7 @@ define([ icls : 'btn-border-out', borderId : 'outer', borderswidth: Asc.c_oAscBorderStyles.Thin, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']], split : true, menu : true }); @@ -535,7 +536,7 @@ define([ cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-align-left', enableToggle: true, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], toggleGroup : 'alignGroup' }); @@ -544,7 +545,7 @@ define([ cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-align-center', enableToggle: true, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], toggleGroup : 'alignGroup' }); @@ -553,7 +554,7 @@ define([ cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-align-right', enableToggle: true, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], toggleGroup : 'alignGroup' }); @@ -562,7 +563,7 @@ define([ cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-align-just', enableToggle: true, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], toggleGroup: 'alignGroup' }); @@ -573,7 +574,7 @@ define([ enableToggle: true, allowDepress: true, split : true, - lock : [_set.editCell, _set.selShape, _set.selShapeText, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleMerge, _set.editPivot], + lock : [_set.editCell, _set.selShape, _set.selShapeText, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleMerge, _set.editPivot, _set.wsLock], menu : new Common.UI.Menu({ items: [ { @@ -604,7 +605,7 @@ define([ id : 'id-toolbar-rtn-valign-top', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-align-top', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], enableToggle: true, toggleGroup : 'vAlignGroup' }); @@ -614,7 +615,7 @@ define([ cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-align-middle', enableToggle: true, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], toggleGroup : 'vAlignGroup' }); @@ -622,7 +623,7 @@ define([ id : 'id-toolbar-rtn-valign-bottom', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-align-bottom', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], enableToggle: true, toggleGroup : 'vAlignGroup' }); @@ -631,7 +632,7 @@ define([ id : 'id-toolbar-rtn-wrap', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-wrap', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']], enableToggle: true, allowDepress: true }); @@ -640,7 +641,7 @@ define([ id : 'id-toolbar-rtn-textorient', cls : 'btn-toolbar', iconCls : 'toolbar__icon text-orient-ccw', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], menu : new Common.UI.Menu({ items: [ { @@ -715,7 +716,7 @@ define([ cls : 'btn-toolbar x-huge icon-top', iconCls : 'toolbar__icon btn-inserthyperlink', caption : me.capInsertHyperlink, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.cantHyperlink, _set.selSlicer, _set.multiselect, _set.lostConnect, _set.coAuth, _set.editPivot] + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.cantHyperlink, _set.selSlicer, _set.multiselect, _set.lostConnect, _set.coAuth, _set.editPivot, _set.wsLock] }); me.btnInsertChart = new Common.UI.Button({ @@ -731,7 +732,7 @@ define([ id : 'tlbtn-insertsparkline', cls : 'btn-toolbar x-huge icon-top', iconCls : 'toolbar__icon btn-sparkline', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.selSlicer, _set.multiselect, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.editPivot], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.selSlicer, _set.multiselect, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.editPivot, _set.wsLock], caption : me.capInsertSpark, menu : true }); @@ -784,7 +785,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon btn-symbol', caption: me.capBtnInsSymbol, - lock: [_set.selImage, _set.selChart, _set.selShape, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect] + lock: [_set.selImage, _set.selChart, _set.selShape, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLock] }); me.btnInsertSlicer = new Common.UI.Button({ @@ -799,7 +800,7 @@ define([ id : 'id-toolbar-btn-ttempl', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-menu-table', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set['FormatCells']], menu : new Common.UI.Menu({ items: [ { template: _.template('
') } @@ -812,7 +813,7 @@ define([ cls : 'btn-toolbar x-huge icon-top', iconCls : 'toolbar__icon btn-inserttable', caption : me.capInsertTable, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set.ruleMerge, _set.editPivot] + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set.ruleMerge, _set.editPivot, _set['FormatCells']] }); me.listStyles = new Common.UI.ComboDataView({ @@ -821,7 +822,7 @@ define([ itemWidth : 112, itemHeight : 38, menuMaxHeight : 226, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']], beforeOpenHandler: function(e) { var cmp = this, menu = cmp.openButton.menu, @@ -869,7 +870,7 @@ define([ cls : 'input-group-nr', menuStyle : 'min-width: 180px;', hint : me.tipNumFormat, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.selRangeEdit, _set.lostConnect, _set.coAuth], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set['FormatCells']], itemsTemplate: formatTemplate, editable : false, data : me.numFormatData @@ -879,7 +880,7 @@ define([ id : 'id-toolbar-btn-percent-style', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-percent-style', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']], styleName : 'Percent' }); @@ -887,7 +888,7 @@ define([ id : 'id-toolbar-btn-accounting-style', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-currency-style', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']], styleName : 'Currency', split : true, menu : new Common.UI.Menu({ @@ -925,14 +926,14 @@ define([ id : 'id-toolbar-btn-decdecimal', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-decdecimal', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth] + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']] }); me.btnIncDecimal = new Common.UI.Button({ id : 'id-toolbar-btn-incdecimal', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-incdecimal', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth] + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']] }); me.btnInsertFormula = new Common.UI.Button({ @@ -1088,7 +1089,7 @@ define([ id : 'id-toolbar-btn-condformat', cls : 'btn-toolbar', iconCls : 'toolbar__icon btn-cond-format', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth], + lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set['FormatCells']], menu : true }); diff --git a/apps/spreadsheeteditor/main/app/view/WBProtection.js b/apps/spreadsheeteditor/main/app/view/WBProtection.js index 554211db4..ad7e0e483 100644 --- a/apps/spreadsheeteditor/main/app/view/WBProtection.js +++ b/apps/spreadsheeteditor/main/app/view/WBProtection.js @@ -116,7 +116,7 @@ define([ iconCls: 'toolbar__icon protect-workbook', enableToggle: true, caption: this.txtProtectWB, - lock : [_set.lostConnect, _set.coAuth] + lock : [_set.selRangeEdit, _set.lostConnect, _set.coAuth] }); this.lockedControls.push(this.btnProtectWB); @@ -125,7 +125,7 @@ define([ iconCls: 'toolbar__icon protect-sheet', enableToggle: true, caption: this.txtProtectSheet, - lock : [_set.lostConnect, _set.coAuth] + lock : [_set.selRangeEdit, _set.lostConnect, _set.coAuth] }); this.lockedControls.push(this.btnProtectSheet); @@ -133,31 +133,31 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon allow-edit-ranges', caption: this.txtAllowRanges, - lock : [_set.lostConnect, _set.coAuth] + lock : [_set.selRangeEdit, _set.lostConnect, _set.coAuth] }); this.lockedControls.push(this.btnAllowRanges); this.chLockedCell = new Common.UI.CheckBox({ labelText: this.txtLockedCell, - lock : [_set.lostConnect, _set.coAuth] + lock : [_set.editCell, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.wsLock, _set.wbLock, _set.lostConnect, _set.coAuth] }); this.lockedControls.push(this.chLockedCell); this.chLockedShape = new Common.UI.CheckBox({ labelText: this.txtLockedShape, - lock : [_set.lostConnect, _set.coAuth] + lock : [_set.selRange, _set.selRangeEdit, _set.wsLock, _set.wbLock, _set.lostConnect, _set.coAuth] }); this.lockedControls.push(this.chLockedShape); this.chLockedText = new Common.UI.CheckBox({ labelText: this.txtLockedText, - lock : [_set.lostConnect, _set.coAuth] + lock : [_set.selRange, _set.selRangeEdit, _set.selRangeEdit, _set.wsLock, _set.wbLock, _set.lostConnect, _set.coAuth] }); this.lockedControls.push(this.chLockedText); this.chHiddenFormula = new Common.UI.CheckBox({ labelText: this.txtHiddenFormula, - lock : [_set.lostConnect, _set.coAuth] + lock : [_set.editCell, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.wsLock, _set.wbLock, _set.lostConnect, _set.coAuth] }); this.lockedControls.push(this.chHiddenFormula); @@ -195,6 +195,12 @@ define([ return this.$el; }, + getButtons: function(type) { + if (type===undefined) + return this.lockedControls; + return []; + }, + show: function () { Common.UI.BaseView.prototype.show.call(this); this.fireEvent('show', this);