diff --git a/apps/presentationeditor/main/app/controller/Animation.js b/apps/presentationeditor/main/app/controller/Animation.js index fdd552733..02ca8bcc2 100644 --- a/apps/presentationeditor/main/app/controller/Animation.js +++ b/apps/presentationeditor/main/app/controller/Animation.js @@ -112,7 +112,7 @@ define([ onApiCountPages: function (count) { if (this._state.no_slides !== (count<=0)) { this._state.no_slides = (count<=0); - this.lockToolbar(PE.enumLock.noSlides, this._state.no_slides); + this.lockToolbar(Common.enumLock.noSlides, this._state.no_slides); } }, @@ -413,19 +413,19 @@ define([ setLocked: function() { if (this._state.noGraphic != undefined) - this.lockToolbar(PE.enumLock.noGraphic, this._state.noGraphic); + this.lockToolbar(Common.enumLock.noGraphic, this._state.noGraphic); if (this._state.noAnimation != undefined) - this.lockToolbar(PE.enumLock.noAnimation, this._state.noAnimation); + this.lockToolbar(Common.enumLock.noAnimation, this._state.noAnimation); if (this._state.noAnimationParam != undefined) - this.lockToolbar(PE.enumLock.noAnimationParam, this._state.noAnimationParam); + this.lockToolbar(Common.enumLock.noAnimationParam, this._state.noAnimationParam); if (this._state.noTriggerObjects != undefined) - this.lockToolbar(PE.enumLock.noTriggerObjects, this._state.noTriggerObjects); + this.lockToolbar(Common.enumLock.noTriggerObjects, this._state.noTriggerObjects); if (this._state.noMoveAnimationLater != undefined) - this.lockToolbar(PE.enumLock.noMoveAnimationLater, this._state.noMoveAnimationLater); + this.lockToolbar(Common.enumLock.noMoveAnimationLater, this._state.noMoveAnimationLater); if (this._state.noMoveAnimationEarlier != undefined) - this.lockToolbar(PE.enumLock.noMoveAnimationEarlier, this._state.noMoveAnimationEarlier); - if (PE.enumLock.noAnimationPreview != undefined) - this.lockToolbar(PE.enumLock.noAnimationPreview, this._state.noAnimationPreview); + this.lockToolbar(Common.enumLock.noMoveAnimationEarlier, this._state.noMoveAnimationEarlier); + if (Common.enumLock.noAnimationPreview != undefined) + this.lockToolbar(Common.enumLock.noAnimationPreview, this._state.noAnimationPreview); } diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index a36e7b6ed..6a45df6f8 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -479,12 +479,12 @@ define([ onApiCanRevert: function(which, can) { if (which=='undo') { if (this._state.can_undo !== can) { - this.toolbar.lockToolbar(PE.enumLock.undoLock, !can, {array: [this.toolbar.btnUndo]}); + this.toolbar.lockToolbar(Common.enumLock.undoLock, !can, {array: [this.toolbar.btnUndo]}); if (this._state.activated) this._state.can_undo = can; } } else { if (this._state.can_redo !== can) { - this.toolbar.lockToolbar(PE.enumLock.redoLock, !can, {array: [this.toolbar.btnRedo]}); + this.toolbar.lockToolbar(Common.enumLock.redoLock, !can, {array: [this.toolbar.btnRedo]}); if (this._state.activated) this._state.can_redo = can; } } @@ -492,14 +492,14 @@ define([ onApiCanIncreaseIndent: function(value) { if (this._state.can_increase !== value) { - this.toolbar.lockToolbar(PE.enumLock.incIndentLock, !value, {array: [this.toolbar.btnIncLeftOffset]}); + this.toolbar.lockToolbar(Common.enumLock.incIndentLock, !value, {array: [this.toolbar.btnIncLeftOffset]}); if (this._state.activated) this._state.can_increase = value; } }, onApiCanDecreaseIndent: function(value) { if (this._state.can_decrease !== value) { - this.toolbar.lockToolbar(PE.enumLock.decIndentLock, !value, {array: [this.toolbar.btnDecLeftOffset]}); + this.toolbar.lockToolbar(Common.enumLock.decIndentLock, !value, {array: [this.toolbar.btnDecLeftOffset]}); if (this._state.activated) this._state.can_decrease = value; } }, @@ -636,7 +636,7 @@ define([ onApiCanAddHyperlink: function(value) { if (this._state.can_hyper !== value && this.editMode) { - this.toolbar.lockToolbar(PE.enumLock.hyperlinkLock, !value, {array: [this.toolbar.btnInsertHyperlink]}); + this.toolbar.lockToolbar(Common.enumLock.hyperlinkLock, !value, {array: [this.toolbar.btnInsertHyperlink]}); if (this._state.activated) this._state.can_hyper = value; } }, @@ -666,17 +666,17 @@ define([ onApiCountPages: function(count) { if (this._state.no_slides !== (count<=0)) { this._state.no_slides = (count<=0); - this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, {array: this.toolbar.paragraphControls}); - this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, {array: [ + this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, {array: this.toolbar.paragraphControls}); + this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, {array: [ this.toolbar.btnChangeSlide, this.toolbar.btnPreview, this.toolbar.btnPrint, this.toolbar.btnCopy, this.toolbar.btnPaste, this.toolbar.btnCopyStyle, this.toolbar.btnInsertTable, this.toolbar.btnInsertChart, this.toolbar.btnColorSchemas, this.toolbar.btnShapeAlign, this.toolbar.btnShapeArrange, this.toolbar.btnSlideSize, this.toolbar.listTheme, this.toolbar.btnEditHeader, this.toolbar.btnInsDateTime, this.toolbar.btnInsSlideNum ]}); - this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, + this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, { array: this.toolbar.btnsInsertImage.concat(this.toolbar.btnsInsertText, this.toolbar.btnsInsertShape, this.toolbar.btnInsertEquation, this.toolbar.btnInsertTextArt, this.toolbar.btnInsAudio, this.toolbar.btnInsVideo) }); if (this.btnsComment) - this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment }); + this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment }); } }, @@ -684,7 +684,7 @@ define([ if (this._state.no_slides !== (count<=0)) { this._state.no_slides = (count<=0); if (this.btnsComment) - this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment }); + this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment }); } }, @@ -760,49 +760,49 @@ define([ if (this._state.prcontrolsdisable !== paragraph_locked) { if (this._state.activated) this._state.prcontrolsdisable = paragraph_locked; if (paragraph_locked!==undefined) - this.toolbar.lockToolbar(PE.enumLock.paragraphLock, paragraph_locked, {array: me.toolbar.paragraphControls}); - this.toolbar.lockToolbar(PE.enumLock.paragraphLock, paragraph_locked===true, {array: [me.toolbar.btnInsDateTime, me.toolbar.btnInsSlideNum]}); + this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: me.toolbar.paragraphControls}); + this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked===true, {array: [me.toolbar.btnInsDateTime, me.toolbar.btnInsSlideNum]}); } if (this._state.no_paragraph !== no_paragraph) { if (this._state.activated) this._state.no_paragraph = no_paragraph; - this.toolbar.lockToolbar(PE.enumLock.noParagraphSelected, no_paragraph, {array: me.toolbar.paragraphControls}); - this.toolbar.lockToolbar(PE.enumLock.noParagraphSelected, no_paragraph, {array: [me.toolbar.btnCopyStyle]}); + this.toolbar.lockToolbar(Common.enumLock.noParagraphSelected, no_paragraph, {array: me.toolbar.paragraphControls}); + this.toolbar.lockToolbar(Common.enumLock.noParagraphSelected, no_paragraph, {array: [me.toolbar.btnCopyStyle]}); } if (this._state.no_text !== no_text) { if (this._state.activated) this._state.no_text = no_text; - this.toolbar.lockToolbar(PE.enumLock.noTextSelected, no_text, {array: me.toolbar.paragraphControls}); + this.toolbar.lockToolbar(Common.enumLock.noTextSelected, no_text, {array: me.toolbar.paragraphControls}); } if (shape_locked!==undefined && this._state.shapecontrolsdisable !== shape_locked) { if (this._state.activated) this._state.shapecontrolsdisable = shape_locked; - this.toolbar.lockToolbar(PE.enumLock.shapeLock, shape_locked, {array: me.toolbar.shapeControls.concat(me.toolbar.paragraphControls)}); + this.toolbar.lockToolbar(Common.enumLock.shapeLock, shape_locked, {array: me.toolbar.shapeControls.concat(me.toolbar.paragraphControls)}); } if (this._state.no_object !== no_object ) { if (this._state.activated) this._state.no_object = no_object; - this.toolbar.lockToolbar(PE.enumLock.noObjectSelected, no_object, {array: [me.toolbar.btnShapeAlign, me.toolbar.btnShapeArrange, me.toolbar.btnVerticalAlign ]}); + this.toolbar.lockToolbar(Common.enumLock.noObjectSelected, no_object, {array: [me.toolbar.btnShapeAlign, me.toolbar.btnShapeArrange, me.toolbar.btnVerticalAlign ]}); } if (slide_layout_lock !== undefined && this._state.slidelayoutdisable !== slide_layout_lock ) { if (this._state.activated) this._state.slidelayoutdisable = slide_layout_lock; - this.toolbar.lockToolbar(PE.enumLock.slideLock, slide_layout_lock, {array: [me.toolbar.btnChangeSlide]}); + this.toolbar.lockToolbar(Common.enumLock.slideLock, slide_layout_lock, {array: [me.toolbar.btnChangeSlide]}); } if (slide_deleted !== undefined && this._state.slidecontrolsdisable !== slide_deleted) { if (this._state.activated) this._state.slidecontrolsdisable = slide_deleted; - this.toolbar.lockToolbar(PE.enumLock.slideDeleted, slide_deleted, {array: me.toolbar.slideOnlyControls.concat(me.toolbar.paragraphControls)}); + this.toolbar.lockToolbar(Common.enumLock.slideDeleted, slide_deleted, {array: me.toolbar.slideOnlyControls.concat(me.toolbar.paragraphControls)}); } if (this._state.in_equation !== in_equation) { if (this._state.activated) this._state.in_equation = in_equation; - this.toolbar.lockToolbar(PE.enumLock.inEquation, in_equation, {array: [me.toolbar.btnSuperscript, me.toolbar.btnSubscript]}); + this.toolbar.lockToolbar(Common.enumLock.inEquation, in_equation, {array: [me.toolbar.btnSuperscript, me.toolbar.btnSubscript]}); } if (this._state.no_columns !== no_columns) { if (this._state.activated) this._state.no_columns = no_columns; - this.toolbar.lockToolbar(PE.enumLock.noColumns, no_columns, {array: [me.toolbar.btnColumns]}); + this.toolbar.lockToolbar(Common.enumLock.noColumns, no_columns, {array: [me.toolbar.btnColumns]}); } if (this.toolbar.btnChangeSlide) { @@ -813,12 +813,12 @@ define([ } if (this._state.in_smartart !== in_smartart) { - this.toolbar.lockToolbar(PE.enumLock.inSmartart, in_smartart, {array: me.toolbar.paragraphControls}); + this.toolbar.lockToolbar(Common.enumLock.inSmartart, in_smartart, {array: me.toolbar.paragraphControls}); this._state.in_smartart = in_smartart; } if (this._state.in_smartart_internal !== in_smartart_internal) { - this.toolbar.lockToolbar(PE.enumLock.inSmartartInternal, in_smartart_internal, {array: me.toolbar.paragraphControls}); + this.toolbar.lockToolbar(Common.enumLock.inSmartartInternal, in_smartart_internal, {array: me.toolbar.paragraphControls}); this._state.in_smartart_internal = in_smartart_internal; this.toolbar.mnuArrangeFront.setDisabled(in_smartart_internal); @@ -868,24 +868,24 @@ define([ onApiLockDocumentProps: function() { if (this._state.lock_doc!==true) { - this.toolbar.lockToolbar(PE.enumLock.docPropsLock, true, {array: [this.toolbar.btnSlideSize]}); + this.toolbar.lockToolbar(Common.enumLock.docPropsLock, true, {array: [this.toolbar.btnSlideSize]}); if (this._state.activated) this._state.lock_doc = true; } }, onApiUnLockDocumentProps: function() { if (this._state.lock_doc!==false) { - this.toolbar.lockToolbar(PE.enumLock.docPropsLock, false, {array: [this.toolbar.btnSlideSize]}); + this.toolbar.lockToolbar(Common.enumLock.docPropsLock, false, {array: [this.toolbar.btnSlideSize]}); if (this._state.activated) this._state.lock_doc = false; } }, onApiLockDocumentTheme: function() { - this.toolbar.lockToolbar(PE.enumLock.themeLock, true, {array: [this.toolbar.btnColorSchemas, this.toolbar.listTheme]}); + this.toolbar.lockToolbar(Common.enumLock.themeLock, true, {array: [this.toolbar.btnColorSchemas, this.toolbar.listTheme]}); }, onApiUnLockDocumentTheme: function() { - this.toolbar.lockToolbar(PE.enumLock.themeLock, false, {array: [this.toolbar.btnColorSchemas, this.toolbar.listTheme]}); + this.toolbar.lockToolbar(Common.enumLock.themeLock, false, {array: [this.toolbar.btnColorSchemas, this.toolbar.listTheme]}); }, onApiCoAuthoringDisconnect: function(enableDownload) { @@ -2442,7 +2442,7 @@ define([ activateControls: function() { this.onApiPageSize(this.api.get_PresentationWidth(), this.api.get_PresentationHeight()); - this.toolbar.lockToolbar(PE.enumLock.disableOnStart, false, {array: this.toolbar.slideOnlyControls.concat(this.toolbar.shapeControls)}); + this.toolbar.lockToolbar(Common.enumLock.disableOnStart, false, {array: this.toolbar.slideOnlyControls.concat(this.toolbar.shapeControls)}); this._state.activated = true; }, @@ -2457,7 +2457,7 @@ define([ toolbar.$el.find('.toolbar').toggleClass('masked', disable); if (toolbar.btnsAddSlide) // toolbar buttons are rendered - this.toolbar.lockToolbar(PE.enumLock.menuFileOpen, disable, {array: toolbar.btnsAddSlide.concat(toolbar.btnChangeSlide, toolbar.btnPreview)}); + this.toolbar.lockToolbar(Common.enumLock.menuFileOpen, disable, {array: toolbar.btnsAddSlide.concat(toolbar.btnChangeSlide, toolbar.btnPreview)}); if(disable) { mask = $("
").appendTo(toolbar.$el.find('.toolbar')); Common.util.Shortcuts.suspendEvents('command+k, ctrl+k, alt+h, command+f5, ctrl+f5'); @@ -2540,7 +2540,7 @@ define([ this.btnsComment = []; if ( config.canCoAuthoring && config.canComments ) { - var _set = PE.enumLock; + var _set = Common.enumLock; this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', me.toolbar.capBtnComment, [_set.lostConnect, _set.noSlides], undefined, undefined, undefined, '1', 'bottom', 'small'); if ( this.btnsComment.length ) { @@ -2555,7 +2555,7 @@ define([ btn.setCaption(me.toolbar.capBtnAddComment); }, this); - this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment }); + this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment }); } } }, diff --git a/apps/presentationeditor/main/app/controller/Transitions.js b/apps/presentationeditor/main/app/controller/Transitions.js index 6b8efb3b0..44e61ec87 100644 --- a/apps/presentationeditor/main/app/controller/Transitions.js +++ b/apps/presentationeditor/main/app/controller/Transitions.js @@ -102,7 +102,7 @@ define([ onApiCountPages: function (count) { if (this._state.no_slides !== (count<=0)) { this._state.no_slides = (count<=0); - this.lockToolbar(PE.enumLock.noSlides, this._state.no_slides); + this.lockToolbar(Common.enumLock.noSlides, this._state.no_slides); } }, @@ -259,7 +259,7 @@ define([ setLocked: function() { if (this._state.lockedtransition != undefined) - this.lockToolbar(PE.enumLock.transitLock, this._state.lockedtransition); + this.lockToolbar(Common.enumLock.transitLock, this._state.lockedtransition); }, setSettings: function () { diff --git a/apps/presentationeditor/main/app/view/Animation.js b/apps/presentationeditor/main/app/view/Animation.js index 6a9e273a3..8e9ce82f2 100644 --- a/apps/presentationeditor/main/app/view/Animation.js +++ b/apps/presentationeditor/main/app/view/Animation.js @@ -155,7 +155,7 @@ define([ this.toolbar = options.toolbar; this.appConfig = options.mode; this.$el = this.toolbar.toolbar.$el.find('#animation-panel'); - var _set = PE.enumLock; + var _set = Common.enumLock; this.lockedControls = []; this._arrEffectName = [{group:'none', value: AscFormat.ANIM_PRESET_NONE, iconCls: 'animation-none', displayValue: this.textNone}].concat(Common.define.effectData.getEffectData()); diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 87c83bc21..fa78bba4c 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -61,7 +61,10 @@ define([ ], function (Backbone, template, template_view) { 'use strict'; - PE.enumLock = { + if (!Common.enumLock) + Common.enumLock = {}; + + var enumLock = { paragraphLock: 'para-lock', shapeLock: 'shape-lock', slideLock: 'slide-lock', @@ -95,6 +98,11 @@ define([ noMoveAnimationLater: 'no-move-animation-later', noAnimationPreview: 'no-animation-preview' }; + for (var key in enumLock) { + if (enumLock.hasOwnProperty(key)) { + Common.enumLock[key] = enumLock[key]; + } + } PE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend((function(){ @@ -155,7 +163,7 @@ define([ /** * UI Components */ - var _set = PE.enumLock; + var _set = Common.enumLock; me.btnChangeSlide = new Common.UI.Button({ id: 'id-toolbar-button-change-slide', @@ -1078,7 +1086,7 @@ define([ menuMaxHeight: 640, menuWidth: 362, enableKeyEvents: true, - lock: [PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], + lock: [Common.enumLock.slideDeleted, Common.enumLock.lostConnect, Common.enumLock.noSlides, Common.enumLock.disableOnStart], dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: '-16, 0' @@ -1100,7 +1108,7 @@ define([ if (_.isFunction(cmp.setDisabled)) cmp.setDisabled(true); }); - this.lockToolbar(PE.enumLock.disableOnStart, true, {array: me.slideOnlyControls.concat(me.shapeControls)}); + this.lockToolbar(Common.enumLock.disableOnStart, true, {array: me.slideOnlyControls.concat(me.shapeControls)}); this.on('render:after', _.bind(this.onToolbarAfterRender, this)); } else { Common.UI.Mixtbar.prototype.initialize.call(this, { @@ -1235,16 +1243,16 @@ define([ } this.btnsInsertImage = Common.Utils.injectButtons($host.find('.slot-insertimg'), 'tlbtn-insertimage-', 'toolbar__icon btn-insertimage', this.capInsertImage, - [PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], false, true, undefined, '1', 'bottom', 'small'); + [Common.enumLock.slideDeleted, Common.enumLock.lostConnect, Common.enumLock.noSlides, Common.enumLock.disableOnStart], false, true, undefined, '1', 'bottom', 'small'); this.btnsInsertText = Common.Utils.injectButtons($host.find('.slot-instext'), 'tlbtn-inserttext-', 'toolbar__icon btn-text', this.capInsertText, - [PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], false, false, true, '1', 'bottom', 'small'); + [Common.enumLock.slideDeleted, Common.enumLock.lostConnect, Common.enumLock.noSlides, Common.enumLock.disableOnStart], false, false, true, '1', 'bottom', 'small'); this.btnsInsertShape = Common.Utils.injectButtons($host.find('.slot-insertshape'), 'tlbtn-insertshape-', 'toolbar__icon btn-insertshape', this.capInsertShape, - [PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], false, true, true, '1', 'bottom', 'small'); + [Common.enumLock.slideDeleted, Common.enumLock.lostConnect, Common.enumLock.noSlides, Common.enumLock.disableOnStart], false, true, true, '1', 'bottom', 'small'); this.btnsAddSlide = Common.Utils.injectButtons($host.find('.slot-addslide'), 'tlbtn-addslide-', 'toolbar__icon btn-addslide', this.capAddSlide, - [PE.enumLock.menuFileOpen, PE.enumLock.lostConnect, PE.enumLock.disableOnStart], true, true, undefined, '1', 'bottom', 'small'); + [Common.enumLock.menuFileOpen, Common.enumLock.lostConnect, Common.enumLock.disableOnStart], true, true, undefined, '1', 'bottom', 'small'); var created = this.btnsInsertImage.concat(this.btnsInsertText, this.btnsInsertShape, this.btnsAddSlide); - this.lockToolbar(PE.enumLock.disableOnStart, true, {array: created}); + this.lockToolbar(Common.enumLock.disableOnStart, true, {array: created}); Array.prototype.push.apply(this.slideOnlyControls, created); Array.prototype.push.apply(this.lockControls, created); @@ -1552,14 +1560,14 @@ define([ setMode: function (mode) { if (mode.isDisconnected) { - this.lockToolbar(PE.enumLock.lostConnect, true); - this.lockToolbar( PE.enumLock.lostConnect, true, {array:[this.btnUndo,this.btnRedo,this.btnSave]} ); + this.lockToolbar(Common.enumLock.lostConnect, true); + this.lockToolbar( Common.enumLock.lostConnect, true, {array:[this.btnUndo,this.btnRedo,this.btnSave]} ); if ( this.synchTooltip ) this.synchTooltip.hide(); if (!mode.enableDownload) - this.lockToolbar(PE.enumLock.cantPrint, true, {array: [this.btnPrint]}); + this.lockToolbar(Common.enumLock.cantPrint, true, {array: [this.btnPrint]}); } else - this.lockToolbar(PE.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]}); + this.lockToolbar(Common.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]}); this.mode = mode; }, diff --git a/apps/presentationeditor/main/app/view/Transitions.js b/apps/presentationeditor/main/app/view/Transitions.js index 400693162..778a5fab3 100644 --- a/apps/presentationeditor/main/app/view/Transitions.js +++ b/apps/presentationeditor/main/app/view/Transitions.js @@ -118,7 +118,7 @@ define([ this.toolbar = options.toolbar; this.appConfig = options.mode; this.$el = this.toolbar.toolbar.$el.find('#transitions-panel'); - var _set = PE.enumLock; + var _set = Common.enumLock; this.lockedControls = []; this._arrEffectName = [ @@ -268,7 +268,7 @@ define([ }); this.lockedControls.push(this.chDelay); - Common.Utils.lockControls(PE.enumLock.disableOnStart, true, {array: this.lockedControls}); + Common.Utils.lockControls(Common.enumLock.disableOnStart, true, {array: this.lockedControls}); this.$el.find('#transit-duration').text(this.strDuration); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); diff --git a/apps/presentationeditor/main/app/view/ViewTab.js b/apps/presentationeditor/main/app/view/ViewTab.js index f34bbe04b..0b181192e 100644 --- a/apps/presentationeditor/main/app/view/ViewTab.js +++ b/apps/presentationeditor/main/app/view/ViewTab.js @@ -77,7 +77,7 @@ define([ Common.UI.BaseView.prototype.initialize.call(this); this.toolbar = options.toolbar; this.appConfig = options.mode; - var _set = PE.enumLock; + var _set = Common.enumLock; this.lockedControls = []; diff --git a/apps/spreadsheeteditor/main/app/controller/DataTab.js b/apps/spreadsheeteditor/main/app/controller/DataTab.js index 5e965b1cc..dd21ed81c 100644 --- a/apps/spreadsheeteditor/main/app/controller/DataTab.js +++ b/apps/spreadsheeteditor/main/app/controller/DataTab.js @@ -123,8 +123,8 @@ define([ if (!this.toolbar.editMode || !this.view) return; // special disable conditions - Common.Utils.lockControls(SSE.enumLock.multiselectCols, info.asc_getSelectedColsCount()>1, {array: [this.view.btnTextToColumns]}); - Common.Utils.lockControls(SSE.enumLock.multiselect, info.asc_getMultiselect(), {array: [this.view.btnTextToColumns]}); + Common.Utils.lockControls(Common.enumLock.multiselectCols, info.asc_getSelectedColsCount()>1, {array: [this.view.btnTextToColumns]}); + Common.Utils.lockControls(Common.enumLock.multiselect, info.asc_getMultiselect(), {array: [this.view.btnTextToColumns]}); }, onUngroup: function(type) { @@ -431,12 +431,12 @@ define([ onWorksheetLocked: function(index,locked) { if (index == this.api.asc_getActiveWorksheetIndex()) { - Common.Utils.lockControls(SSE.enumLock.sheetLock, locked, {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort, this.view.btnGroup, this.view.btnUngroup)}); + Common.Utils.lockControls(Common.enumLock.sheetLock, locked, {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort, this.view.btnGroup, this.view.btnUngroup)}); } }, onChangeProtectWorkbook: function() { - Common.Utils.lockControls(SSE.enumLock.wbLock, this.api.asc_isProtectedWorkbook(), {array: [this.view.btnDataFromText]}); + Common.Utils.lockControls(Common.enumLock.wbLock, this.api.asc_isProtectedWorkbook(), {array: [this.view.btnDataFromText]}); }, onApiSheetChanged: function() { @@ -451,7 +451,7 @@ define([ var wbprotect = this.getApplication().getController('WBProtection'); props = wbprotect ? wbprotect.getWSProps() : null; } - props && props.wsProps && Common.Utils.lockControls(SSE.enumLock['Sort'], props.wsProps['Sort'], {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort)}); + props && props.wsProps && Common.Utils.lockControls(Common.enumLock['Sort'], props.wsProps['Sort'], {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort)}); }, onDocumentReady: function() { diff --git a/apps/spreadsheeteditor/main/app/controller/PivotTable.js b/apps/spreadsheeteditor/main/app/controller/PivotTable.js index 3b1cba876..23aeb279f 100644 --- a/apps/spreadsheeteditor/main/app/controller/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/controller/PivotTable.js @@ -397,9 +397,9 @@ define([ var pivotInfo = info.asc_getPivotTableInfo(); - Common.Utils.lockControls(SSE.enumLock.noPivot, !pivotInfo, {array: this.view.lockedControls}); - Common.Utils.lockControls(SSE.enumLock.pivotLock, pivotInfo && (info.asc_getLockedPivotTable()===true), {array: this.view.lockedControls}); - Common.Utils.lockControls(SSE.enumLock.editPivot, !!pivotInfo, {array: this.view.btnsAddPivot}); + Common.Utils.lockControls(Common.enumLock.noPivot, !pivotInfo, {array: this.view.lockedControls}); + Common.Utils.lockControls(Common.enumLock.pivotLock, pivotInfo && (info.asc_getLockedPivotTable()===true), {array: this.view.lockedControls}); + Common.Utils.lockControls(Common.enumLock.editPivot, !!pivotInfo, {array: this.view.btnsAddPivot}); if (pivotInfo) this.ChangeSettings(pivotInfo); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 9881ce9fb..8a5355990 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -2197,10 +2197,10 @@ define([ var toolbar = this.toolbar; if (toolbar.mode.isEditDiagram || toolbar.mode.isEditMailMerge) { is_cell_edited = (state == Asc.c_oAscCellEditorState.editStart); - toolbar.lockToolbar(SSE.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {array: [toolbar.btnDecDecimal,toolbar.btnIncDecimal,toolbar.cmbNumberFormat, toolbar.btnEditChartData, toolbar.btnEditChartType]}); + toolbar.lockToolbar(Common.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {array: [toolbar.btnDecDecimal,toolbar.btnIncDecimal,toolbar.cmbNumberFormat, toolbar.btnEditChartData, toolbar.btnEditChartType]}); } else if (state == Asc.c_oAscCellEditorState.editStart || state == Asc.c_oAscCellEditorState.editEnd) { - toolbar.lockToolbar(SSE.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, { + toolbar.lockToolbar(Common.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, { array: [ toolbar.btnClearStyle.menu.items[1], toolbar.btnClearStyle.menu.items[2], @@ -2210,7 +2210,7 @@ define([ toolbar.btnNamedRange.menu.items[1] ].concat(toolbar.itemsNamedRange), merge: true, - clear: [SSE.enumLock.editFormula, SSE.enumLock.editText] + clear: [Common.enumLock.editFormula, Common.enumLock.editText] }); var is_cell_edited = (state == Asc.c_oAscCellEditorState.editStart); @@ -2232,10 +2232,10 @@ define([ if (state == Asc.c_oAscCellEditorState.editFormula) is_text = !(is_formula = true); else if (state == Asc.c_oAscCellEditorState.editEmptyCell) is_text = is_formula = false; - toolbar.lockToolbar(SSE.enumLock.editFormula, is_formula, + toolbar.lockToolbar(Common.enumLock.editFormula, is_formula, { array: [toolbar.cmbFontName, toolbar.cmbFontSize, toolbar.btnIncFontSize, toolbar.btnDecFontSize, toolbar.btnBold, toolbar.btnItalic, toolbar.btnUnderline, toolbar.btnStrikeout, toolbar.btnSubscript, toolbar.btnTextColor]}); - toolbar.lockToolbar(SSE.enumLock.editText, is_text, {array: [toolbar.btnInsertFormula].concat(toolbar.btnsFormula)}); + toolbar.lockToolbar(Common.enumLock.editText, is_text, {array: [toolbar.btnInsertFormula].concat(toolbar.btnsFormula)}); } this._state.coauthdisable = undefined; this._state.selection_type = undefined; @@ -2260,7 +2260,7 @@ define([ this.onApiHeadings(props.asc_getHeadings()); this.api.asc_isLayoutLocked(currentSheet) ? this.onApiLockDocumentProps(currentSheet) : this.onApiUnLockDocumentProps(currentSheet); - this.toolbar.lockToolbar(SSE.enumLock.printAreaLock, this.api.asc_isPrintAreaLocked(currentSheet), {array: [this.toolbar.btnPrintArea]}); + this.toolbar.lockToolbar(Common.enumLock.printAreaLock, this.api.asc_isPrintAreaLocked(currentSheet), {array: [this.toolbar.btnPrintArea]}); }, onUpdateDocumentProps: function(nIndex) { @@ -2382,14 +2382,14 @@ define([ onApiLockDocumentProps: function(nIndex) { if (this._state.lock_doc!==true && nIndex == this.api.asc_getActiveWorksheetIndex()) { - this.toolbar.lockToolbar(SSE.enumLock.docPropsLock, true, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale, this.toolbar.btnPrintTitles]}); + this.toolbar.lockToolbar(Common.enumLock.docPropsLock, true, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale, this.toolbar.btnPrintTitles]}); this._state.lock_doc = true; } }, onApiUnLockDocumentProps: function(nIndex) { if (this._state.lock_doc!==false && nIndex == this.api.asc_getActiveWorksheetIndex()) { - this.toolbar.lockToolbar(SSE.enumLock.docPropsLock, false, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale, this.toolbar.btnPrintTitles]}); + this.toolbar.lockToolbar(Common.enumLock.docPropsLock, false, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale, this.toolbar.btnPrintTitles]}); this._state.lock_doc = false; } }, @@ -2531,7 +2531,7 @@ define([ this._state.fontsize = str_size; } - toolbar.lockToolbar(SSE.enumLock.cantHyperlink, (selectionType === Asc.c_oAscSelectionType.RangeShapeText) && (this.api.asc_canAddShapeHyperlink()===false), { array: [toolbar.btnInsertHyperlink]}); + toolbar.lockToolbar(Common.enumLock.cantHyperlink, (selectionType === Asc.c_oAscSelectionType.RangeShapeText) && (this.api.asc_canAddShapeHyperlink()===false), { array: [toolbar.btnInsertHyperlink]}); /* need_disable = selectionType != Asc.c_oAscSelectionType.RangeCells && selectionType != Asc.c_oAscSelectionType.RangeCol && @@ -2547,14 +2547,14 @@ define([ need_disable = (selectionType === Asc.c_oAscSelectionType.RangeCells || selectionType === Asc.c_oAscSelectionType.RangeCol || selectionType === Asc.c_oAscSelectionType.RangeRow || selectionType === Asc.c_oAscSelectionType.RangeMax); - toolbar.lockToolbar(SSE.enumLock.selRange, need_disable, { array: [toolbar.btnImgAlign, toolbar.btnImgBackward, toolbar.btnImgForward, toolbar.btnImgGroup]}); + toolbar.lockToolbar(Common.enumLock.selRange, need_disable, { array: [toolbar.btnImgAlign, toolbar.btnImgBackward, toolbar.btnImgForward, toolbar.btnImgGroup]}); var cangroup = this.api.asc_canGroupGraphicsObjects(), canungroup = this.api.asc_canUnGroupGraphicsObjects(); - toolbar.lockToolbar(SSE.enumLock.cantGroupUngroup, !cangroup && !canungroup, { array: [toolbar.btnImgGroup]}); + toolbar.lockToolbar(Common.enumLock.cantGroupUngroup, !cangroup && !canungroup, { array: [toolbar.btnImgGroup]}); toolbar.btnImgGroup.menu.items[0].setDisabled(!cangroup); toolbar.btnImgGroup.menu.items[1].setDisabled(!canungroup); - toolbar.lockToolbar(SSE.enumLock.cantGroup, !cangroup, { array: [toolbar.btnImgAlign]}); + toolbar.lockToolbar(Common.enumLock.cantGroup, !cangroup, { array: [toolbar.btnImgAlign]}); var objcount = this.api.asc_getSelectedDrawingObjectsCount(); toolbar.btnImgAlign.menu.items[7].setDisabled(objcount<3); @@ -2564,11 +2564,11 @@ define([ // lock formatting controls in cell with FormatCells protection or in shape and Objects protection 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(SSE.enumLock.wsLockFormat, need_disable && !!this._state.wsProps['Objects'] && !!this._state.is_lockText || !need_disable && !!this._state.wsProps['FormatCells']); - toolbar.lockToolbar(SSE.enumLock.wsLockFormatFill, need_disable && !!this._state.wsProps['Objects'] && !!this._state.is_lockShape || !need_disable && !!this._state.wsProps['FormatCells']); + toolbar.lockToolbar(Common.enumLock.wsLockFormat, need_disable && !!this._state.wsProps['Objects'] && !!this._state.is_lockText || !need_disable && !!this._state.wsProps['FormatCells']); + toolbar.lockToolbar(Common.enumLock.wsLockFormatFill, need_disable && !!this._state.wsProps['Objects'] && !!this._state.is_lockShape || !need_disable && !!this._state.wsProps['FormatCells']); - toolbar.lockToolbar(SSE.enumLock['Objects'], !!this._state.wsProps['Objects']); - toolbar.lockToolbar(SSE.enumLock['FormatCells'], !!this._state.wsProps['FormatCells']); + toolbar.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects']); + toolbar.lockToolbar(Common.enumLock['FormatCells'], !!this._state.wsProps['FormatCells']); if (editOptionsDisabled) return; @@ -2770,7 +2770,7 @@ define([ need_disable = this._state.controlsdisabled.filters || formatTableInfo!==null || filterInfo && filterInfo.asc_getIsAutoFilter()===null; // (need_disable !== toolbar.btnMerge.isDisabled()) && toolbar.btnMerge.setDisabled(need_disable); - toolbar.lockToolbar(SSE.enumLock.ruleMerge, need_disable, {array:[toolbar.btnMerge, toolbar.btnInsertTable]}); + toolbar.lockToolbar(Common.enumLock.ruleMerge, need_disable, {array:[toolbar.btnMerge, toolbar.btnInsertTable]}); val = info.asc_getMerge(); if (this._state.merge !== val) { @@ -2794,13 +2794,13 @@ define([ this._state.filter = val; } need_disable = this._state.controlsdisabled.filters || (val===null); - toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable, + toolbar.lockToolbar(Common.enumLock.ruleFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnCustomSort, toolbar.btnTableTemplate, toolbar.btnInsertTable, toolbar.btnRemoveDuplicates, toolbar.btnDataValidation) }); - toolbar.lockToolbar(SSE.enumLock.tableHasSlicer, filterInfo && filterInfo.asc_getIsSlicerAdded(), { array: toolbar.btnsSetAutofilter }); + toolbar.lockToolbar(Common.enumLock.tableHasSlicer, filterInfo && filterInfo.asc_getIsSlicerAdded(), { array: toolbar.btnsSetAutofilter }); need_disable = (selectionType !== Asc.c_oAscSelectionType.RangeSlicer) && (this._state.controlsdisabled.filters || (val===null)); - toolbar.lockToolbar(SSE.enumLock.cantSort, need_disable, { array: toolbar.btnsSortDown.concat(toolbar.btnsSortUp) }); + toolbar.lockToolbar(Common.enumLock.cantSort, need_disable, { array: toolbar.btnsSortDown.concat(toolbar.btnsSortUp) }); val = (formatTableInfo) ? formatTableInfo.asc_getTableStyleName() : null; if (this._state.tablestylename !== val && this.toolbar.mnuTableTemplatePicker) { @@ -2815,7 +2815,7 @@ define([ } need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true); - toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array: toolbar.btnsClearAutofilter}); + toolbar.lockToolbar(Common.enumLock.ruleDelFilter, need_disable, {array: toolbar.btnsClearAutofilter}); var old_name = this._state.tablename; this._state.tablename = (formatTableInfo) ? formatTableInfo.asc_getTableName() : undefined; @@ -2827,15 +2827,15 @@ define([ this.getApplication().getController('Statusbar').onApiFilterInfo(!need_disable); this._state.multiselect = info.asc_getMultiselect(); - toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink, toolbar.btnInsertTable]}); + toolbar.lockToolbar(Common.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink, toolbar.btnInsertTable]}); this._state.inpivot = !!info.asc_getPivotTableInfo(); - toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnCustomSort, + toolbar.lockToolbar(Common.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnCustomSort, toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable, toolbar.btnRemoveDuplicates, toolbar.btnDataValidation)}); - toolbar.lockToolbar(SSE.enumLock.noSlicerSource, !(this._state.inpivot || formatTableInfo), { array: [toolbar.btnInsertSlicer]}); + toolbar.lockToolbar(Common.enumLock.noSlicerSource, !(this._state.inpivot || formatTableInfo), { array: [toolbar.btnInsertSlicer]}); need_disable = !this.appConfig.canModifyFilter; - toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnTableTemplate, + toolbar.lockToolbar(Common.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnTableTemplate, toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2], toolbar.btnInsertTable, toolbar.btnRemoveDuplicates, toolbar.btnDataValidation)}); } @@ -2916,31 +2916,31 @@ define([ for (var i=0; i<4; i++) { !items[i].isDisabled() && (enabled = true); } - toolbar.lockToolbar(SSE.enumLock.itemsDisabled, !enabled, {array: [toolbar.btnAddCell]}); + toolbar.lockToolbar(Common.enumLock.itemsDisabled, !enabled, {array: [toolbar.btnAddCell]}); items = me.toolbar.btnDeleteCell.menu.items; enabled = false; for (var i=0; i<4; i++) { !items[i].isDisabled() && (enabled = true); } - toolbar.lockToolbar(SSE.enumLock.itemsDisabled, !enabled, {array: [toolbar.btnDeleteCell]}); + toolbar.lockToolbar(Common.enumLock.itemsDisabled, !enabled, {array: [toolbar.btnDeleteCell]}); // info.asc_getComments()===null - has comment, but no permissions to view it - toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) || + toolbar.lockToolbar(Common.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) || this.toolbar.mode.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells), { array: this.btnsComment }); - toolbar.lockToolbar(SSE.enumLock.headerLock, info.asc_getLockedHeaderFooter(), {array: this.toolbar.btnsEditHeader}); + toolbar.lockToolbar(Common.enumLock.headerLock, info.asc_getLockedHeaderFooter(), {array: this.toolbar.btnsEditHeader}); }, onApiSelectionChangedRestricted: function(info) { if (!this.appConfig.isRestrictedEdit) return; var selectionType = info.asc_getSelectionType(); - this.toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) || + this.toolbar.lockToolbar(Common.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) || this.appConfig && this.appConfig.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells), { array: this.btnsComment }); - this.toolbar.lockToolbar(SSE.enumLock['Objects'], !!this._state.wsProps['Objects'], { array: this.btnsComment }); + this.toolbar.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects'], { array: this.btnsComment }); }, onApiSelectionChanged_DiagramEditor: function(info) { @@ -2968,7 +2968,7 @@ define([ } ); } - var _set = SSE.enumLock; + var _set = Common.enumLock; var type = seltype; switch ( seltype ) { case Asc.c_oAscSelectionType.RangeSlicer: @@ -2983,7 +2983,7 @@ define([ clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.coAuth] }); - me.toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked); + me.toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked); return is_image; }; @@ -2996,7 +2996,7 @@ define([ var need_disable = (selectionType === Asc.c_oAscSelectionType.RangeCells || selectionType === Asc.c_oAscSelectionType.RangeCol || selectionType === Asc.c_oAscSelectionType.RangeRow || selectionType === Asc.c_oAscSelectionType.RangeMax); - this.toolbar.lockToolbar( SSE.enumLock.selRange, need_disable, {array:[this.toolbar.btnEditChartData, this.toolbar.btnEditChartType]} ); + this.toolbar.lockToolbar( Common.enumLock.selRange, need_disable, {array:[this.toolbar.btnEditChartData, this.toolbar.btnEditChartType]} ); if (selectionType == Asc.c_oAscSelectionType.RangeChart || selectionType == Asc.c_oAscSelectionType.RangeChartText) return; @@ -3038,7 +3038,7 @@ define([ }); } - me.toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked); + me.toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked); return is_image; }; @@ -3062,11 +3062,11 @@ define([ } need_disable = this._state.controlsdisabled.filters || (val===null); - me.toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable, + me.toolbar.lockToolbar(Common.enumLock.ruleFilter, need_disable, { array: [me.toolbar.btnSetAutofilter, me.toolbar.btnSortDown, me.toolbar.btnSortUp] }); need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true); - me.toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array: [me.toolbar.btnClearAutofilter]}); + me.toolbar.lockToolbar(Common.enumLock.ruleDelFilter, need_disable, {array: [me.toolbar.btnClearAutofilter]}); } }, @@ -3501,9 +3501,9 @@ define([ } if ( coauth_disable ) { - toolbar.lockToolbar(SSE.enumLock.coAuth, coauth_disable); + toolbar.lockToolbar(Common.enumLock.coAuth, coauth_disable); } else { - var _set = SSE.enumLock; + var _set = Common.enumLock; var type = seltype; switch (seltype) { case Asc.c_oAscSelectionType.RangeImage: type = _set.selImage; break; @@ -3526,9 +3526,9 @@ define([ clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selSlicer, _set.coAuth] }); - toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked); - toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked && (seltype==Asc.c_oAscSelectionType.RangeChart || seltype==Asc.c_oAscSelectionType.RangeChartText), { array: [toolbar.btnInsertChart] } ); - toolbar.lockToolbar(SSE.enumLock.inSmartartInternal, is_smartart_internal); + toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked); + toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked && (seltype==Asc.c_oAscSelectionType.RangeChart || seltype==Asc.c_oAscSelectionType.RangeChartText), { array: [toolbar.btnInsertChart] } ); + toolbar.lockToolbar(Common.enumLock.inSmartartInternal, is_smartart_internal); } this._state.controlsdisabled.filters = is_image || is_mode_2 || coauth_disable; @@ -3664,7 +3664,7 @@ define([ this.onApiEditCell(this.api.isRangeSelection ? Asc.c_oAscCellEditorState.editStart : Asc.c_oAscCellEditorState.editEnd); var toolbar = this.toolbar; - toolbar.lockToolbar(SSE.enumLock.selRangeEdit, this.api.isRangeSelection); + toolbar.lockToolbar(Common.enumLock.selRangeEdit, this.api.isRangeSelection); this.setDisabledComponents([toolbar.btnUndo], this.api.isRangeSelection || !this.api.asc_getCanUndo()); this.setDisabledComponents([toolbar.btnRedo], this.api.isRangeSelection || !this.api.asc_getCanRedo()); @@ -3675,8 +3675,8 @@ define([ onLockDefNameManager: function(state) { this._state.namedrange_locked = (state == Asc.c_oAscDefinedNameReason.LockDefNameManager); - this.toolbar.lockToolbar(SSE.enumLock.printAreaLock, this.api.asc_isPrintAreaLocked(this.api.asc_getActiveWorksheetIndex()), {array: [this.toolbar.btnPrintArea]}); - this.toolbar.lockToolbar(SSE.enumLock.namedRangeLock, this._state.namedrange_locked, {array: [this.toolbar.btnPrintArea.menu.items[0], this.toolbar.btnPrintArea.menu.items[2]]}); + this.toolbar.lockToolbar(Common.enumLock.printAreaLock, this.api.asc_isPrintAreaLocked(this.api.asc_getActiveWorksheetIndex()), {array: [this.toolbar.btnPrintArea]}); + this.toolbar.lockToolbar(Common.enumLock.namedRangeLock, this._state.namedrange_locked, {array: [this.toolbar.btnPrintArea.menu.items[0], this.toolbar.btnPrintArea.menu.items[2]]}); }, onLockCFManager: function(index) { @@ -3688,7 +3688,7 @@ define([ }, activateControls: function() { - this.toolbar.lockToolbar(SSE.enumLock.disableOnStart, false, {array: [this.toolbar.btnPrint]}); + this.toolbar.lockToolbar(Common.enumLock.disableOnStart, false, {array: [this.toolbar.btnPrint]}); this._state.activated = true; }, @@ -3702,7 +3702,7 @@ define([ var toolbar = this.toolbar; toolbar.$el.find('.toolbar').toggleClass('masked', disable); - this.toolbar.lockToolbar(SSE.enumLock.menuFileOpen, disable); + this.toolbar.lockToolbar(Common.enumLock.menuFileOpen, disable); if(disable) { mask = $("
").appendTo(toolbar.$el.find('.toolbar')); Common.util.Shortcuts.suspendEvents('command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h, command+1, ctrl+1'); @@ -3824,7 +3824,7 @@ define([ this.btnsComment = []; if ( config.canCoAuthoring && config.canComments ) { - var _set = SSE.enumLock; + var _set = Common.enumLock; this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', this.toolbar.capBtnComment, [_set.lostConnect, _set.commentLock, _set.editCell, _set['Objects']], undefined, undefined, undefined, '1', 'bottom', 'small'); @@ -4089,8 +4089,8 @@ define([ this._state.wsProps = props.wsProps; this._state.wsLock = props.wsLock; - this.toolbar.lockToolbar(SSE.enumLock.wsLock, this._state.wsLock); - this.toolbar.lockToolbar(SSE.enumLock['InsertHyperlinks'], this._state.wsProps['InsertHyperlinks'], {array: [this.toolbar.btnInsertHyperlink]}); + this.toolbar.lockToolbar(Common.enumLock.wsLock, this._state.wsLock); + this.toolbar.lockToolbar(Common.enumLock['InsertHyperlinks'], this._state.wsProps['InsertHyperlinks'], {array: [this.toolbar.btnInsertHyperlink]}); this.appConfig && this.appConfig.isEdit ? this.onApiSelectionChanged(this.api.asc_getCellInfo()) : this.onApiSelectionChangedRestricted(this.api.asc_getCellInfo()); } }, diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js index beaa8ce92..caf1d8640 100644 --- a/apps/spreadsheeteditor/main/app/controller/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js @@ -136,7 +136,7 @@ define([ onSelectionChanged: function(info) { if (!this.toolbar.editMode || !this.view) return; - Common.Utils.lockControls(SSE.enumLock.sheetView, this.api.asc_getActiveNamedSheetView && !this.api.asc_getActiveNamedSheetView(this.api.asc_getActiveWorksheetIndex()), + Common.Utils.lockControls(Common.enumLock.sheetView, this.api.asc_getActiveNamedSheetView && !this.api.asc_getActiveNamedSheetView(this.api.asc_getActiveWorksheetIndex()), {array: [this.view.btnCloseView]}); }, @@ -247,7 +247,7 @@ define([ onWorksheetLocked: function(index,locked) { if (index == this.api.asc_getActiveWorksheetIndex()) { - Common.Utils.lockControls(SSE.enumLock.sheetLock, locked, {array: [this.view.chHeadings, this.view.chGridlines, this.view.btnFreezePanes, this.view.chZeros]}); + Common.Utils.lockControls(Common.enumLock.sheetLock, locked, {array: [this.view.chHeadings, this.view.chGridlines, this.view.btnFreezePanes, this.view.chZeros]}); } }, diff --git a/apps/spreadsheeteditor/main/app/controller/WBProtection.js b/apps/spreadsheeteditor/main/app/controller/WBProtection.js index 09d663fd7..1cda5211a 100644 --- a/apps/spreadsheeteditor/main/app/controller/WBProtection.js +++ b/apps/spreadsheeteditor/main/app/controller/WBProtection.js @@ -71,8 +71,8 @@ define([ this._state = {}; 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.enumLock && this.wsLockOptions.forEach(function(item){ + Common.enumLock[item] = item; }); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); @@ -281,8 +281,8 @@ define([ var props = me.getWSProps(); me.view.btnProtectSheet.toggle(props.wsLock, true); //current sheet - Common.Utils.lockControls(SSE.enumLock['Objects'], props.wsProps['Objects'], { array: [me.view.chLockedText, me.view.chLockedShape]}); - Common.Utils.lockControls(SSE.enumLock.wsLock, props.wsLock, { array: [me.view.btnAllowRanges]}); + Common.Utils.lockControls(Common.enumLock['Objects'], props.wsProps['Objects'], { array: [me.view.chLockedText, me.view.chLockedShape]}); + Common.Utils.lockControls(Common.enumLock.wsLock, props.wsLock, { array: [me.view.btnAllowRanges]}); }); }, @@ -295,8 +295,8 @@ define([ if (this.view && props) { this.view.btnProtectSheet.toggle(props.wsLock, true); //current sheet - Common.Utils.lockControls(SSE.enumLock['Objects'], props.wsProps['Objects'], { array: [this.view.chLockedText, this.view.chLockedShape]}); - Common.Utils.lockControls(SSE.enumLock.wsLock, props.wsLock, { array: [this.view.btnAllowRanges]}); + Common.Utils.lockControls(Common.enumLock['Objects'], props.wsProps['Objects'], { array: [this.view.chLockedText, this.view.chLockedShape]}); + Common.Utils.lockControls(Common.enumLock.wsLock, props.wsLock, { array: [this.view.btnAllowRanges]}); } Common.NotificationCenter.trigger('protect:wslock', props); }, @@ -335,7 +335,7 @@ define([ 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]}); + Common.Utils.lockControls(Common.enumLock.selRange, need_disable, { array: [this.view.chLockedText, this.view.chLockedShape]}); var xfs = info.asc_getXfs(); this.view.chLockedCell.setValue(!!xfs.asc_getLocked(), true); @@ -352,8 +352,8 @@ define([ lock = elValue.asc_getProtectionLocked(); this.view.chLockedText.setValue(locktext!==undefined ? !!locktext : 'indeterminate', true); this.view.chLockedShape.setValue(lock!==undefined ? !!lock : 'indeterminate', true); - Common.Utils.lockControls(SSE.enumLock.wsLockText, locktext===null, { array: [this.view.chLockedText]}); - Common.Utils.lockControls(SSE.enumLock.wsLockShape, lock===null, { array: [this.view.chLockedShape]}); + Common.Utils.lockControls(Common.enumLock.wsLockText, locktext===null, { array: [this.view.chLockedText]}); + Common.Utils.lockControls(Common.enumLock.wsLockShape, lock===null, { array: [this.view.chLockedShape]}); break; } } diff --git a/apps/spreadsheeteditor/main/app/view/DataTab.js b/apps/spreadsheeteditor/main/app/view/DataTab.js index b5c4f8d0d..7c31722bd 100644 --- a/apps/spreadsheeteditor/main/app/view/DataTab.js +++ b/apps/spreadsheeteditor/main/app/view/DataTab.js @@ -121,7 +121,7 @@ define([ var me = this, $host = me.toolbar.$el, - _set = SSE.enumLock; + _set = Common.enumLock; this.btnDataFromText = new Common.UI.Button({ parentEl: $host.find('#slot-btn-data-from-text'), diff --git a/apps/spreadsheeteditor/main/app/view/FormulaTab.js b/apps/spreadsheeteditor/main/app/view/FormulaTab.js index a175becdd..9d5b26d81 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaTab.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaTab.js @@ -83,7 +83,7 @@ define([ var me = this, $host = me.toolbar.$el, - _set = SSE.enumLock; + _set = Common.enumLock; var formulaDialog = SSE.getController('FormulaDialog'); @@ -434,7 +434,7 @@ define([ btn.menu.setInnerMenu([{menu: menu, index: 0}]); } } - Common.Utils.lockControls(SSE.enumLock.noSubitems, arr.length<1, {array: [btn]}); + Common.Utils.lockControls(Common.enumLock.noSubitems, arr.length<1, {array: [btn]}); }, setMenuItemMenu: function(name) { @@ -552,7 +552,7 @@ define([ menu.cmpEl.attr({tabindex: "-1"}); }); } - Common.Utils.lockControls(SSE.enumLock.noSubitems, morearr.length<1, {array: [btn]}); + Common.Utils.lockControls(Common.enumLock.noSubitems, morearr.length<1, {array: [btn]}); } }, diff --git a/apps/spreadsheeteditor/main/app/view/PivotTable.js b/apps/spreadsheeteditor/main/app/view/PivotTable.js index 9043c9ba5..740910c79 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/view/PivotTable.js @@ -154,7 +154,7 @@ define([ this.toolbar = options.toolbar; this.lockedControls = []; - var _set = SSE.enumLock; + var _set = Common.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.wsLock], undefined, undefined, undefined, '1', 'bottom', 'small'); @@ -357,7 +357,7 @@ define([ getPanel: function () { this.$el = $(_.template(template)( {} )); - var _set = SSE.enumLock; + var _set = Common.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.wsLock], undefined, undefined, undefined, '1', 'bottom', 'small')); diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index cde3ed6f6..ce7e3b2ba 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -58,7 +58,10 @@ define([ ,'common/main/lib/component/Mixtbar' ], function (Backbone, template, simple, template_view) { 'use strict'; - SSE.enumLock = { + if (!Common.enumLock) + Common.enumLock = {}; + + var enumLock = { editCell: 'cell-editing', editFormula: 'is-formula', editText: 'is-text', @@ -108,6 +111,11 @@ define([ inSmartartInternal: 'in-smartart-internal', wsLockFormatFill: 'worksheet-lock-format-fill' }; + for (var key in enumLock) { + if (enumLock.hasOwnProperty(key)) { + Common.enumLock[key] = enumLock[key]; + } + } SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({ el: '#toolbar', @@ -182,7 +190,7 @@ define([ } } - var _set = SSE.enumLock; + var _set = Common.enumLock; me.btnCopy = new Common.UI.Button({ id : 'id-toolbar-btn-copy', @@ -1689,7 +1697,7 @@ define([ if (cmp && _.isFunction(cmp.setDisabled)) cmp.setDisabled(true); }); - this.lockToolbar(SSE.enumLock.disableOnStart, true, {array: [me.btnPrint]}); + this.lockToolbar(Common.enumLock.disableOnStart, true, {array: [me.btnPrint]}); this.on('render:after', _.bind(this.onToolbarAfterRender, this)); } @@ -1898,7 +1906,7 @@ define([ _injectComponent('#slot-btn-scale', this.btnScale); _injectComponent('#slot-btn-condformat', this.btnCondFormat); this.btnsEditHeader = Common.Utils.injectButtons($host.find('.slot-editheader'), 'tlbtn-editheader-', 'toolbar__icon btn-editheader', this.capBtnInsHeader, - [SSE.enumLock.editCell, SSE.enumLock.selRangeEdit, SSE.enumLock.headerLock, SSE.enumLock.lostConnect, SSE.enumLock.coAuth], undefined, undefined, undefined, '1', 'bottom', 'small'); + [Common.enumLock.editCell, Common.enumLock.selRangeEdit, Common.enumLock.headerLock, Common.enumLock.lostConnect, Common.enumLock.coAuth], undefined, undefined, undefined, '1', 'bottom', 'small'); Array.prototype.push.apply(this.lockControls, this.btnsEditHeader); return $host; @@ -2414,16 +2422,16 @@ define([ setMode: function(mode) { if (mode.isDisconnected) { - this.lockToolbar( SSE.enumLock.lostConnect, true ); - this.lockToolbar( SSE.enumLock.lostConnect, true, + this.lockToolbar( Common.enumLock.lostConnect, true ); + this.lockToolbar( Common.enumLock.lostConnect, true, {array:[this.btnEditChart, this.btnEditChartData, this.btnEditChartType, this.btnUndo,this.btnRedo,this.btnSave]} ); if ( this.synchTooltip ) this.synchTooltip.hide(); if (!mode.enableDownload) - this.lockToolbar(SSE.enumLock.cantPrint, true, {array: [this.btnPrint]}); + this.lockToolbar(Common.enumLock.cantPrint, true, {array: [this.btnPrint]}); } else { this.mode = mode; - this.lockToolbar(SSE.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]}); + this.lockToolbar(Common.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]}); } return this; diff --git a/apps/spreadsheeteditor/main/app/view/ViewTab.js b/apps/spreadsheeteditor/main/app/view/ViewTab.js index e6ad3cd1b..a1e4145d4 100644 --- a/apps/spreadsheeteditor/main/app/view/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/view/ViewTab.js @@ -106,7 +106,7 @@ define([ var me = this, $host = me.toolbar.$el, - _set = SSE.enumLock; + _set = Common.enumLock; if ( me.appConfig.canFeatureViews ) { this.btnSheetView = new Common.UI.Button({ diff --git a/apps/spreadsheeteditor/main/app/view/WBProtection.js b/apps/spreadsheeteditor/main/app/view/WBProtection.js index ff34620f1..de163aff6 100644 --- a/apps/spreadsheeteditor/main/app/view/WBProtection.js +++ b/apps/spreadsheeteditor/main/app/view/WBProtection.js @@ -107,7 +107,7 @@ define([ this.appConfig = options.mode; - var _set = SSE.enumLock; + var _set = Common.enumLock; this.lockedControls = []; this._state = {disabled: false};