diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index 22cc61454..13654877b 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -94,7 +94,7 @@ define([ }, this) }, 'Common.Views.Header': { - 'toolbar:hiderulers': _.bind(function (isChecked) { + 'rulers:hide': _.bind(function (isChecked) { this.view.chRulers.setValue(!isChecked, true); }, this) } diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index f6061b469..a0913cc1c 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -430,7 +430,7 @@ define([ Common.Utils.InternalSettings.set("de-hidden-rulers", item.isChecked()); Common.NotificationCenter.trigger('layout:changed', 'rulers'); Common.NotificationCenter.trigger('edit:complete', me.header); - me.header.fireEvent('toolbar:hiderulers', [item.isChecked()]); + me.header.fireEvent('rulers:hide', [item.isChecked()]); break; case 'zoom:page': item.isChecked() ? me.api.zoomFitToPage() : me.api.zoomCustomMode(); diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js index 99a7a675e..4836eaf3a 100644 --- a/apps/presentationeditor/main/app/controller/ViewTab.js +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -83,7 +83,9 @@ define([ 'ViewTab': { 'zoom:value': _.bind(this.onChangeZoomValue, this), 'zoom:toslide': _.bind(this.onBtnZoomTo, this, 'toslide'), - 'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth') + 'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth'), + 'rulers:change': _.bind(this.onChangeRulers, this), + 'notes:change': _.bind(this.onChangeNotes, this), }, 'Toolbar': { 'view:compact': _.bind(function (toolbar, state) { @@ -95,6 +97,14 @@ define([ this.view.chStatusbar.setValue(!state, true); }, this) }, + 'Common.Views.Header': { + 'rulers:hide': _.bind(function (isChecked) { + this.view.chRulers.setValue(!isChecked, true); + }, this), + 'notes:hide': _.bind(function (isChecked) { + this.view.chNotes.setValue(!isChecked, true); + }, this), + } }); }, @@ -147,6 +157,22 @@ define([ else this.api[type === 'toslide' ? 'zoomFitToPage' : 'zoomFitToWidth'](); Common.NotificationCenter.trigger('edit:complete', this.view); + }, + + onChangeRulers: function (btn, checked) { + this.api.asc_SetViewRulers(checked); + Common.localStorage.setBool('pe-hidden-rulers', !checked); + Common.Utils.InternalSettings.set("pe-hidden-rulers", !checked); + this.view.fireEvent('rulers:hide', [!checked]); + Common.NotificationCenter.trigger('layout:changed', 'rulers'); + Common.NotificationCenter.trigger('edit:complete', this.view); + }, + + onChangeNotes: function (btn, checked) { + this.api.asc_ShowNotes(checked); + Common.localStorage.setBool('pe-hidden-notes', !checked); + this.view.fireEvent('notes:hide', [!checked]); + Common.NotificationCenter.trigger('edit:complete', me.view); } }, PE.Controllers.ViewTab || {})); diff --git a/apps/presentationeditor/main/app/controller/Viewport.js b/apps/presentationeditor/main/app/controller/Viewport.js index 88026dff1..4cecb100f 100644 --- a/apps/presentationeditor/main/app/controller/Viewport.js +++ b/apps/presentationeditor/main/app/controller/Viewport.js @@ -113,6 +113,12 @@ define([ }, 'ViewTab': { + 'rulers:hide': function (state) { + me.header.mnuitemHideRulers.setChecked(state, true); + }, + 'notes:hide': function (state) { + me.header.mnuitemHideNotes.setChecked(state, true); + }, 'statusbar:hide': function (view, state) { me.header.mnuitemHideStatusBar.setChecked(state, true); } @@ -252,14 +258,14 @@ define([ if ( config.canBrandingExt && config.customization && config.customization.statusBar === false ) me.header.mnuitemHideStatusBar.hide(); - var mnuitemHideRulers = new Common.UI.MenuItem({ + me.header.mnuitemHideRulers = new Common.UI.MenuItem({ caption: me.header.textHideLines, checked: Common.Utils.InternalSettings.get("pe-hidden-rulers"), checkable: true, value: 'rulers' }); if (!config.isEdit) - mnuitemHideRulers.hide(); + me.header.mnuitemHideRulers.hide(); me.header.mnuitemHideNotes = new Common.UI.MenuItem({ caption: me.header.textHideNotes, @@ -304,7 +310,7 @@ define([ items: [ me.header.mnuitemCompactToolbar, me.header.mnuitemHideStatusBar, - mnuitemHideRulers, + me.header.mnuitemHideRulers, me.header.mnuitemHideNotes, {caption:'--'}, me.header.mnuitemFitPage, @@ -465,11 +471,13 @@ define([ Common.Utils.InternalSettings.set("pe-hidden-rulers", item.isChecked()); Common.NotificationCenter.trigger('layout:changed', 'rulers'); Common.NotificationCenter.trigger('edit:complete', me.header); + me.header.fireEvent('rulers:hide', [item.isChecked()]); break; case 'notes': me.api.asc_ShowNotes(!item.isChecked()); Common.localStorage.setBool('pe-hidden-notes', item.isChecked()); Common.NotificationCenter.trigger('edit:complete', me.header); + me.header.fireEvent('notes:hide', [item.isChecked()]); break; case 'zoom:page': item.isChecked() ? me.api.zoomFitToPage() : me.api.zoomCustomMode(); diff --git a/apps/presentationeditor/main/app/view/ViewTab.js b/apps/presentationeditor/main/app/view/ViewTab.js index f3d5183fe..43fa0b007 100644 --- a/apps/presentationeditor/main/app/view/ViewTab.js +++ b/apps/presentationeditor/main/app/view/ViewTab.js @@ -66,6 +66,12 @@ define([ me.chStatusbar && me.chStatusbar.on('change', _.bind(function (checkbox, state) { me.fireEvent('statusbar:hide', [me.chStatusbar, state !== 'checked']); }, me)); + me.chRulers && me.chRulers.on('change', _.bind(function (checkbox, state) { + me.fireEvent('rulers:change', [me.chRulers, state === 'checked']); + }, me)); + me.chNotes && me.chNotes.on('change', _.bind(function (checkbox, state) { + me.fireEvent('notes:change', [me.chNotes, state === 'checked']); + }, me)); }, initialize: function (options) { @@ -166,7 +172,7 @@ define([ this.chRulers = new Common.UI.CheckBox({ el: $host.findById('#slot-chk-rulers'), labelText: this.textRulers, - value: true, //!Common.localStorage.getBool(''), + value: !Common.Utils.InternalSettings.get("pe-hidden-rulers"), //lock: [_set.lostConnect, _set.coAuth, _set.editCell], dataHint: '1', dataHintDirection: 'left', @@ -177,7 +183,7 @@ define([ this.chNotes = new Common.UI.CheckBox({ el: $host.findById('#slot-chk-notes'), labelText: this.textNotes, - value: true, //!Common.localStorage.getBool(''), + value: !Common.localStorage.getBool('pe-hidden-notes', this.appConfig.customization && this.appConfig.customization.hideNotes===true), //lock: [_set.lostConnect, _set.coAuth, _set.editCell], dataHint: '1', dataHintDirection: 'left',