From 73cb10bf9e77774790af39bd42833bc176fca5dc Mon Sep 17 00:00:00 2001 From: "Julia.Svinareva" Date: Mon, 22 Apr 2024 21:09:06 +0300 Subject: [PATCH] [PE] Add slide master mode --- .../main/app/controller/ViewTab.js | 18 ++++++- .../main/app/template/Toolbar.template | 18 ++++++- .../main/app/view/Toolbar.js | 32 +++++++++++- .../main/app/view/ViewTab.js | 50 ++++++++++++++++++- apps/presentationeditor/main/locale/en.json | 10 +++- 5 files changed, 122 insertions(+), 6 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js index cd3a27d4de..834115855c 100644 --- a/apps/presentationeditor/main/app/controller/ViewTab.js +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -91,6 +91,8 @@ define([ }); this.addListeners({ 'ViewTab': { + 'mode:normal': _.bind(this.onChangePresentationViewMode, this, 'normal'), + 'mode:master': _.bind(this.onChangePresentationViewMode, this, 'master'), 'zoom:selected': _.bind(this.onSelectedZoomValue, this), 'zoom:changedbefore': _.bind(this.onZoomChanged, this), 'zoom:changedafter': _.bind(this.onZoomChanged, this), @@ -390,7 +392,21 @@ define([ unitsChanged: function(m) { this._state.unitsChanged = true; - } + }, + + onChangePresentationViewMode: function (m, state) { + var mode; + if (m === 'master') { + mode = Asc.c_oAscPresentationViewMode.masterSlide; + this.view.btnSlideMaster.toggle(state, true); + this.view.btnNormal.toggle(!state, true); + } else { + mode = Asc.c_oAscPresentationViewMode.normal; + this.view.btnSlideMaster.toggle(!state, true); + this.view.btnNormal.toggle(state, true); + } // Asc.c_oAscPresentationViewMode.sorter; + this.api.asc_changePresentationViewMode(mode); + }, }, PE.Controllers.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/template/Toolbar.template b/apps/presentationeditor/main/app/template/Toolbar.template index 23238d2477..bd3833fa76 100644 --- a/apps/presentationeditor/main/app/template/Toolbar.template +++ b/apps/presentationeditor/main/app/template/Toolbar.template @@ -120,7 +120,23 @@
-
+
+ + +
+
+
+ +
+
+
+ +
+
+ +
+
+
diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index ecba752b6e..bdc8cd9b4d 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -749,6 +749,30 @@ define([ }); me.paragraphControls.push(me.btnColumns); + me.btnInsertSlideMaster = new Common.UI.Button({ + id: 'tlbtn-insertslidemaster', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-add-slide-master', + caption: me.capAddSlideMaster, + lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.slideOnlyControls.push(me.btnInsertSlideMaster); + + me.btnInsertLayout = new Common.UI.Button({ + id: 'tlbtn-insertlayout', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-add-layout', + caption: me.capAddLayout, + lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + me.slideOnlyControls.push(me.btnInsertLayout); + me.btnInsertTable = new Common.UI.Button({ id: 'tlbtn-inserttable', cls: 'btn-toolbar x-huge icon-top', @@ -1492,6 +1516,8 @@ define([ this.btnIncLeftOffset.updateHint(this.tipIncPrLeft); this.btnLineSpace.updateHint(this.tipLineSpace); this.btnColumns.updateHint(this.tipColumns); + this.btnInsertSlideMaster.updateHint(this.tipAddSlideMaster); + this.btnInsertLayout.updateHint(this.tipAddLayout); this.btnInsertTable.updateHint(this.tipInsertTable); this.btnInsertChart.updateHint(this.tipInsertChart); this.btnInsertSmartArt.updateHint(this.tipInsertSmartArt); @@ -2396,7 +2422,11 @@ define([ capBtnInsHeaderFooter: 'Header & Footer', tipEditHeaderFooter: 'Edit header or footer', tipReplace: 'Replace', - textLineSpaceOptions: 'Line spacing options' + textLineSpaceOptions: 'Line spacing options', + capAddSlideMaster: 'Add Slide Master', + capAddLayout: 'Add Layout', + tipAddSlideMaster: 'Add slide master', + tipAddLayout: 'Add layout' } }()), PE.Views.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/view/ViewTab.js b/apps/presentationeditor/main/app/view/ViewTab.js index 23142c2d16..f92328ef16 100644 --- a/apps/presentationeditor/main/app/view/ViewTab.js +++ b/apps/presentationeditor/main/app/view/ViewTab.js @@ -47,6 +47,11 @@ define([ PE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){ var template = '
' + + '
' + + '' + + '' + + '
' + + '
' + '
' + '
' + '' + @@ -103,6 +108,12 @@ define([ setEvents: function () { var me = this; + me.btnNormal.on('toggle', _.bind(function(btn, state) { + me.fireEvent('mode:normal', [state]); + }, me)); + me.btnSlideMaster.on('toggle', _.bind(function(btn, state) { + me.fireEvent('mode:master', [state]); + }, me)); me.btnFitToSlide && me.btnFitToSlide.on('click', function () { me.fireEvent('zoom:toslide', [me.btnFitToSlide]); }); @@ -184,6 +195,34 @@ define([ var me = this; + this.btnNormal = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-normal', + caption: this.textNormal, + lock: [_set.disableOnStart], + enableToggle: true, + allowDepress: true, + pressed: true, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.btnNormal); + + this.btnSlideMaster = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-slide-master', + caption: this.textSlideMaster, + lock: [_set.disableOnStart], + enableToggle: true, + allowDepress: true, + pressed: false, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.btnSlideMaster); + this.cmbZoom = new Common.UI.ComboBox({ cls: 'input-group-nr', menuStyle: 'min-width: 55px;', @@ -349,6 +388,8 @@ define([ this.$el = $(_.template(template)( {} )); var $host = this.$el; + this.btnNormal.render($host.find('#slot-btn-normal')); + this.btnSlideMaster.render($host.find('#slot-btn-slide-master')); this.cmbZoom.render($host.find('#slot-field-zoom')); $host.find('#slot-lbl-zoom').text(this.textZoom); this.btnFitToSlide.render($host.find('#slot-btn-fts')); @@ -370,6 +411,8 @@ define([ (new Promise(function (accept, reject) { accept(); })).then(function () { + me.btnNormal.updateHint(me.tipNormal); + me.btnSlideMaster.updateHint(me.tipSlideMaster); me.btnFitToSlide.updateHint(me.tipFitToSlide); me.btnFitToWidth.updateHint(me.tipFitToWidth); me.btnInterfaceTheme.updateHint(me.tipInterfaceTheme); @@ -531,8 +574,11 @@ define([ textCm: 'cm', textCustom: 'Custom', textLeftMenu: 'Left panel', - textRightMenu: 'Right panel' - + textRightMenu: 'Right panel', + textNormal: 'Normal', + textSlideMaster: 'Slide Master', + tipNormal: 'Normal', + tipSlideMaster: 'Slide master' } }()), PE.Views.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index 0b18957faf..6fae92ba93 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -2739,6 +2739,10 @@ "PE.Views.Toolbar.txtSlideAlign": "Align to Slide", "PE.Views.Toolbar.txtUngroup": "Ungroup", "PE.Views.Toolbar.textLineSpaceOptions": "Line spacing options", + "PE.Views.Toolbar.capAddSlideMaster": "Add Slide Master", + "PE.Views.Toolbar.capAddLayout": "Add Layout", + "PE.Views.Toolbar.tipAddSlideMaster": "Add slide master", + "PE.Views.Toolbar.tipAddLayout": "Add layout", "PE.Views.Transitions.strDelay": "Delay", "PE.Views.Transitions.strDuration": "Duration", "PE.Views.Transitions.strStartOnClick": "Start On Click", @@ -2804,5 +2808,9 @@ "PE.Views.ViewTab.tipFitToWidth": "Fit to width", "PE.Views.ViewTab.tipGridlines": "Show gridlines", "PE.Views.ViewTab.tipGuides": "Show guides", - "PE.Views.ViewTab.tipInterfaceTheme": "Interface theme" + "PE.Views.ViewTab.tipInterfaceTheme": "Interface theme", + "PE.Views.ViewTab.textNormal": "Normal", + "PE.Views.ViewTab.textSlideMaster": "Slide Master", + "PE.Views.ViewTab.tipNormal": "Normal", + "PE.Views.ViewTab.tipSlideMaster": "Slide master" } \ No newline at end of file