From 4d1a46487546d553deb381441746f2f9c5aa5ec0 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Tue, 7 Dec 2021 21:18:48 +0300 Subject: [PATCH 01/19] [DE] Add view tab --- apps/documenteditor/main/app.js | 2 + .../main/app/controller/Toolbar.js | 4 + .../main/app/controller/ViewTab.js | 101 +++++++++ .../main/app/template/Toolbar.template | 42 ++++ apps/documenteditor/main/app/view/Toolbar.js | 6 +- apps/documenteditor/main/app/view/ViewTab.js | 203 ++++++++++++++++++ apps/documenteditor/main/app_dev.js | 2 + .../main/resources/less/toolbar.less | 5 + 8 files changed, 363 insertions(+), 2 deletions(-) create mode 100644 apps/documenteditor/main/app/controller/ViewTab.js create mode 100644 apps/documenteditor/main/app/view/ViewTab.js diff --git a/apps/documenteditor/main/app.js b/apps/documenteditor/main/app.js index a96a1f750..3e2a27386 100644 --- a/apps/documenteditor/main/app.js +++ b/apps/documenteditor/main/app.js @@ -157,6 +157,7 @@ require([ 'RightMenu', 'LeftMenu', 'Main', + 'ViewTab', 'Common.Controllers.Fonts', 'Common.Controllers.History' /** coauthoring begin **/ @@ -185,6 +186,7 @@ require([ 'documenteditor/main/app/controller/RightMenu', 'documenteditor/main/app/controller/LeftMenu', 'documenteditor/main/app/controller/Main', + 'documenteditor/main/app/controller/ViewTab', 'documenteditor/main/app/view/FileMenuPanels', 'documenteditor/main/app/view/ParagraphSettings', 'documenteditor/main/app/view/HeaderFooterSettings', diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 112104760..0b8c6dfec 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -3228,6 +3228,10 @@ define([ var links = me.getApplication().getController('Links'); links.setApi(me.api).setConfig({toolbar: me}); Array.prototype.push.apply(me.toolbar.toolbarControls, links.getView('Links').getButtons()); + + var viewtab = me.getApplication().getController('ViewTab'); + viewtab.setApi(me.api).setConfig({toolbar: me, mode: config}); + Array.prototype.push.apply(me.toolbar.toolbarControls, viewtab.getView('ViewTab').getButtons()); } if ( config.isEdit && config.canFeatureContentControl || config.isRestrictedEdit && config.canFillForms ) { if (config.canFeatureForms) { diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js new file mode 100644 index 000000000..887118a8c --- /dev/null +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -0,0 +1,101 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2020 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +/** + * ViewTab.js + * + * Created by Julia Svinareva on 06.12.2021 + * Copyright (c) 2021 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'core', + 'documenteditor/main/app/view/ViewTab' +], function () { + 'use strict'; + + DE.Controllers.ViewTab = Backbone.Controller.extend(_.extend({ + models : [], + collections : [ + ], + views : [ + 'ViewTab' + ], + sdkViewName : '#id_main', + + initialize: function () { + }, + onLaunch: function () { + this._state = {}; + }, + + setApi: function (api) { + if (api) { + this.api = api; + + } + return this; + }, + + setConfig: function(config) { + this.toolbar = config.toolbar; + this.view = this.createView('ViewTab', { + toolbar: this.toolbar.toolbar, + mode: config.mode + }); + this.addListeners({ + 'ViewTab': { + + }, + 'Statusbar': { + + } + }); + }, + + SetDisabled: function(state) { + this.view && this.view.SetDisabled(state); + }, + + getView: function(name) { + return !name && this.view ? + this.view : Backbone.Controller.prototype.getView.call(this, name); + }, + + onCoAuthoringDisconnect: function() { + this.SetDisabled(true); + }, + + }, DE.Controllers.ViewTab || {})); +}); \ No newline at end of file diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template index ac80362c1..e53c53322 100644 --- a/apps/documenteditor/main/app/template/Toolbar.template +++ b/apps/documenteditor/main/app/template/Toolbar.template @@ -174,6 +174,48 @@ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+
\ No newline at end of file diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 5c91c58cd..e0e43324f 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -113,7 +113,8 @@ define([ {caption: me.textTabHome, action: 'home', extcls: 'canedit', dataHintTitle: 'H'}, {caption: me.textTabInsert, action: 'ins', extcls: 'canedit', dataHintTitle: 'I'}, {caption: me.textTabLayout, action: 'layout', extcls: 'canedit', layoutname: 'toolbar-layout', dataHintTitle: 'L'}, - {caption: me.textTabLinks, action: 'links', extcls: 'canedit', layoutname: 'toolbar-references', dataHintTitle: 'R'} + {caption: me.textTabLinks, action: 'links', extcls: 'canedit', layoutname: 'toolbar-references', dataHintTitle: 'R'}, + {caption: me.textTabView, action: 'view', extcls: 'canedit', dataHintTitle: 'W'} ] } ); @@ -2653,7 +2654,8 @@ define([ tipMarkersArrow: 'Arrow bullets', tipMarkersCheckmark: 'Checkmark bullets', tipMarkersFRhombus: 'Filled rhombus bullets', - tipMarkersDash: 'Dash bullets' + tipMarkersDash: 'Dash bullets', + textTabView: 'View' } })(), DE.Views.Toolbar || {})); }); diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js new file mode 100644 index 000000000..5a00b2c14 --- /dev/null +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -0,0 +1,203 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2020 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * ViewTab.js + * + * Created by Julia Svinareva on 06.12.2021 + * Copyright (c) 2021 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'common/main/lib/util/utils', + 'common/main/lib/component/BaseView', + 'common/main/lib/component/Layout' +], function () { + 'use strict'; + + DE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){ + function setEvents() { + var me = this; + } + + return { + options: {}, + + initialize: function (options) { + Common.UI.BaseView.prototype.initialize.call(this); + this.toolbar = options.toolbar; + this.appConfig = options.mode; + + this.lockedControls = []; + + var me = this, + $host = me.toolbar.$el; + + this.btnNavigation = new Common.UI.Button({ + parentEl: $host.find('#slot-btn-navigation'), + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-navigation', + caption: this.textNavigation, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.btnNavigation); + + this.cmbZoom = new Common.UI.ComboBox({ + el: $host.find('#slot-field-zoom'), + cls: 'input-group-nr', + menuStyle: 'min-width: 55px;', + editable: false, + //lock: [_set.coAuth, _set.lostConnect, _set.editCell], + data: [ + { displayValue: "50%", value: 50 }, + { displayValue: "75%", value: 75 }, + { displayValue: "100%", value: 100 }, + { displayValue: "125%", value: 125 }, + { displayValue: "150%", value: 150 }, + { displayValue: "175%", value: 175 }, + { displayValue: "200%", value: 200 } + ], + dataHint : '1', + dataHintDirection: 'top', + dataHintOffset: 'small' + }); + this.cmbZoom.setValue(100); + this.lockedControls.push(this.cmbZoom); + + $host.find('#slot-lbl-zoom').text(this.textZoom); + + this.btnFitToPage = new Common.UI.Button({ + parentEl: $host.find('#slot-btn-ftp'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-ic-zoomtopage', + caption: this.textFitToPage, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'medium' + }); + this.lockedControls.push(this.btnFitToPage); + + this.btnFitToWidth = new Common.UI.Button({ + parentEl: $host.find('#slot-btn-ftw'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-ic-zoomtowidth', + caption: this.textFitToWidth, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'medium' + }); + this.lockedControls.push(this.btnFitToWidth); + + this.btnInterfaceTheme = new Common.UI.Button({ + parentEl: $host.find('#slot-btn-interface-theme'), + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon', + caption: this.textInterfaceTheme, + split: true, + menu: true, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.btnInterfaceTheme); + + this.chStatusbar = new Common.UI.CheckBox({ + el: $host.findById('#slot-chk-statusbar'), + labelText: this.textStatusBar, + value: true, //!Common.localStorage.getBool(''), + //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chStatusbar); + + this.chToolbar = new Common.UI.CheckBox({ + el: $host.findById('#slot-chk-toolbar'), + labelText: this.textAlwaysShowToolbar, + value: true, //!Common.localStorage.getBool(''), + //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chToolbar); + + this.chRulers = new Common.UI.CheckBox({ + el: $host.findById('#slot-chk-rulers'), + labelText: this.textRulers, + value: true, //!Common.localStorage.getBool(''), + //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chRulers); + }, + + render: function (el) { + return this; + }, + + show: function () { + Common.UI.BaseView.prototype.show.call(this); + this.fireEvent('show', this); + }, + + getButtons: function(type) { + if (type===undefined) + return this.lockedControls; + return []; + }, + + SetDisabled: function (state) { + this.lockedControls && this.lockedControls.forEach(function(button) { + if ( button ) { + button.setDisabled(state); + } + }, this); + }, + + textNavigation: 'Navigation', + textZoom: 'Zoom', + textFitToPage: 'Fit To Page', + textFitToWidth: 'Fit To Width', + textInterfaceTheme: 'Interface theme', + textStatusBar: 'Status Bar', + textAlwaysShowToolbar: 'Always show toolbar', + textRulers: 'Rulers' + } + }()), DE.Views.ViewTab || {})); +}); \ No newline at end of file diff --git a/apps/documenteditor/main/app_dev.js b/apps/documenteditor/main/app_dev.js index 038fa76c3..cb8cdd5a4 100644 --- a/apps/documenteditor/main/app_dev.js +++ b/apps/documenteditor/main/app_dev.js @@ -147,6 +147,7 @@ require([ 'RightMenu', 'LeftMenu', 'Main', + 'ViewTab', 'Common.Controllers.Fonts', 'Common.Controllers.History' /** coauthoring begin **/ @@ -175,6 +176,7 @@ require([ 'documenteditor/main/app/controller/RightMenu', 'documenteditor/main/app/controller/LeftMenu', 'documenteditor/main/app/controller/Main', + 'documenteditor/main/app/controller/ViewTab', 'documenteditor/main/app/view/FileMenuPanels', 'documenteditor/main/app/view/ParagraphSettings', 'documenteditor/main/app/view/HeaderFooterSettings', diff --git a/apps/documenteditor/main/resources/less/toolbar.less b/apps/documenteditor/main/resources/less/toolbar.less index ffd289f93..b1323de55 100644 --- a/apps/documenteditor/main/resources/less/toolbar.less +++ b/apps/documenteditor/main/resources/less/toolbar.less @@ -201,3 +201,8 @@ } } } + +#slot-field-zoom { + float: left; + min-width: 46px; +} From b69e53982e8a752259af942b155905d8910f2ef6 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Wed, 8 Dec 2021 14:31:11 +0300 Subject: [PATCH 02/19] [PE] Add view tab --- apps/common/main/resources/less/toolbar.less | 5 + .../main/resources/less/toolbar.less | 5 - apps/presentationeditor/main/app.js | 2 + .../main/app/controller/Toolbar.js | 4 + .../main/app/controller/ViewTab.js | 101 +++++++++ .../main/app/template/Toolbar.template | 40 ++++ .../main/app/view/Toolbar.js | 7 +- .../main/app/view/ViewTab.js | 203 ++++++++++++++++++ apps/presentationeditor/main/app_dev.js | 2 + .../main/resources/less/toolbar.less | 5 - 10 files changed, 362 insertions(+), 12 deletions(-) create mode 100644 apps/presentationeditor/main/app/controller/ViewTab.js create mode 100644 apps/presentationeditor/main/app/view/ViewTab.js diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index 06d6dd6e8..8f915506c 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -759,3 +759,8 @@ } } +#slot-field-zoom { + float: left; + min-width: 46px; +} + diff --git a/apps/documenteditor/main/resources/less/toolbar.less b/apps/documenteditor/main/resources/less/toolbar.less index b1323de55..ffd289f93 100644 --- a/apps/documenteditor/main/resources/less/toolbar.less +++ b/apps/documenteditor/main/resources/less/toolbar.less @@ -201,8 +201,3 @@ } } } - -#slot-field-zoom { - float: left; - min-width: 46px; -} diff --git a/apps/presentationeditor/main/app.js b/apps/presentationeditor/main/app.js index b28e2da91..d294b794d 100644 --- a/apps/presentationeditor/main/app.js +++ b/apps/presentationeditor/main/app.js @@ -152,6 +152,7 @@ require([ 'RightMenu', 'LeftMenu', 'Main', + 'ViewTab', 'Common.Controllers.Fonts', 'Common.Controllers.History' /** coauthoring begin **/ @@ -175,6 +176,7 @@ require([ 'presentationeditor/main/app/controller/RightMenu', 'presentationeditor/main/app/controller/LeftMenu', 'presentationeditor/main/app/controller/Main', + 'presentationeditor/main/app/controller/ViewTab', 'presentationeditor/main/app/view/FileMenuPanels', 'presentationeditor/main/app/view/ParagraphSettings', 'presentationeditor/main/app/view/ImageSettings', diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index d362793a2..c75035224 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -2494,6 +2494,10 @@ define([ Array.prototype.push.apply(me.toolbar.lockControls,transitController.getView().getButtons()); Array.prototype.push.apply(me.toolbar.slideOnlyControls,transitController.getView().getButtons()); + var viewtab = me.getApplication().getController('ViewTab'); + viewtab.setApi(me.api).setConfig({toolbar: me, mode: config}); + Array.prototype.push.apply(me.toolbar.lockControls, viewtab.getView('ViewTab').getButtons()); + me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled')); if (!(config.customization && config.customization.compactHeader)) { diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js new file mode 100644 index 000000000..f3770d650 --- /dev/null +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -0,0 +1,101 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2020 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ + +/** + * ViewTab.js + * + * Created by Julia Svinareva on 07.12.2021 + * Copyright (c) 2021 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'core', + 'presentationeditor/main/app/view/ViewTab' +], function () { + 'use strict'; + + PE.Controllers.ViewTab = Backbone.Controller.extend(_.extend({ + models : [], + collections : [ + ], + views : [ + 'ViewTab' + ], + sdkViewName : '#id_main', + + initialize: function () { + }, + onLaunch: function () { + this._state = {}; + }, + + setApi: function (api) { + if (api) { + this.api = api; + + } + return this; + }, + + setConfig: function(config) { + this.toolbar = config.toolbar; + this.view = this.createView('ViewTab', { + toolbar: this.toolbar.toolbar, + mode: config.mode + }); + this.addListeners({ + 'ViewTab': { + + }, + 'Statusbar': { + + } + }); + }, + + SetDisabled: function(state) { + this.view && this.view.SetDisabled(state); + }, + + getView: function(name) { + return !name && this.view ? + this.view : Backbone.Controller.prototype.getView.call(this, name); + }, + + onCoAuthoringDisconnect: function() { + this.SetDisabled(true); + }, + + }, 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 dbe7e200e..1ac447e7c 100644 --- a/apps/presentationeditor/main/app/template/Toolbar.template +++ b/apps/presentationeditor/main/app/template/Toolbar.template @@ -178,6 +178,46 @@ +
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
+ +
+
+
\ No newline at end of file diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 7ddb05a46..983d4f278 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -134,7 +134,9 @@ define([ {caption: me.textTabFile, action: 'file', extcls: 'canedit', layoutname: 'toolbar-file', haspanel:false, dataHintTitle: 'F'}, {caption: me.textTabHome, action: 'home', extcls: 'canedit', dataHintTitle: 'H'}, {caption: me.textTabInsert, action: 'ins', extcls: 'canedit', dataHintTitle: 'I'}, - {caption: me.textTabTransitions, action: 'transit', extcls: 'canedit', dataHintTitle: 'N'} + {caption: me.textTabTransitions, action: 'transit', extcls: 'canedit', dataHintTitle: 'N'}, + undefined, + {caption: me.textTabView, action: 'view', extcls: 'canedit', dataHintTitle: 'W'} ] } ); @@ -1993,7 +1995,8 @@ define([ tipMarkersCheckmark: 'Checkmark bullets', tipMarkersFRhombus: 'Filled rhombus bullets', tipMarkersDash: 'Dash bullets', - tipNone: 'None' + tipNone: 'None', + textTabView: 'View' } }()), 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 new file mode 100644 index 000000000..892709e36 --- /dev/null +++ b/apps/presentationeditor/main/app/view/ViewTab.js @@ -0,0 +1,203 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2020 + * + * This program is a free software product. You can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License (AGPL) + * version 3 as published by the Free Software Foundation. In accordance with + * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect + * that Ascensio System SIA expressly excludes the warranty of non-infringement + * of any third-party rights. + * + * This program is distributed WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For + * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html + * + * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * The interactive user interfaces in modified source and object code versions + * of the Program must display Appropriate Legal Notices, as required under + * Section 5 of the GNU AGPL version 3. + * + * Pursuant to Section 7(b) of the License you must retain the original Product + * logo when distributing the program. Pursuant to Section 7(e) we decline to + * grant you any rights under trademark law for use of our trademarks. + * + * All the Product's GUI elements, including illustrations and icon sets, as + * well as technical writing content are licensed under the terms of the + * Creative Commons Attribution-ShareAlike 4.0 International. See the License + * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + * + */ +/** + * ViewTab.js + * + * Created by Julia Svinareva on 07.12.2021 + * Copyright (c) 2021 Ascensio System SIA. All rights reserved. + * + */ + +define([ + 'common/main/lib/util/utils', + 'common/main/lib/component/BaseView', + 'common/main/lib/component/Layout' +], function () { + 'use strict'; + + PE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){ + function setEvents() { + var me = this; + } + + return { + options: {}, + + initialize: function (options) { + Common.UI.BaseView.prototype.initialize.call(this); + this.toolbar = options.toolbar; + this.appConfig = options.mode; + + this.lockedControls = []; + + var me = this, + $host = me.toolbar.$el; + + this.cmbZoom = new Common.UI.ComboBox({ + el: $host.find('#slot-field-zoom'), + cls: 'input-group-nr', + menuStyle: 'min-width: 55px;', + editable: false, + //lock: [_set.coAuth, _set.lostConnect, _set.editCell], + data: [ + { displayValue: "50%", value: 50 }, + { displayValue: "75%", value: 75 }, + { displayValue: "100%", value: 100 }, + { displayValue: "125%", value: 125 }, + { displayValue: "150%", value: 150 }, + { displayValue: "175%", value: 175 }, + { displayValue: "200%", value: 200 } + ], + dataHint : '1', + dataHintDirection: 'top', + dataHintOffset: 'small' + }); + this.cmbZoom.setValue(100); + this.lockedControls.push(this.cmbZoom); + + $host.find('#slot-lbl-zoom').text(this.textZoom); + + this.btnFitToSlide = new Common.UI.Button({ + parentEl: $host.find('#slot-btn-fts'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-ic-zoomtoslide', + caption: this.textFitToSlide, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'medium' + }); + this.lockedControls.push(this.btnFitToPage); + + this.btnFitToWidth = new Common.UI.Button({ + parentEl: $host.find('#slot-btn-ftw'), + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-ic-zoomtowidth', + caption: this.textFitToWidth, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'medium' + }); + this.lockedControls.push(this.btnFitToWidth); + + this.btnInterfaceTheme = new Common.UI.Button({ + parentEl: $host.find('#slot-btn-interface-theme'), + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon', + caption: this.textInterfaceTheme, + split: true, + menu: true, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.btnInterfaceTheme); + + this.chStatusbar = new Common.UI.CheckBox({ + el: $host.findById('#slot-chk-statusbar'), + labelText: this.textStatusBar, + value: true, //!Common.localStorage.getBool(''), + //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chStatusbar); + + this.chToolbar = new Common.UI.CheckBox({ + el: $host.findById('#slot-chk-toolbar'), + labelText: this.textAlwaysShowToolbar, + value: true, //!Common.localStorage.getBool(''), + //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chToolbar); + + this.chRulers = new Common.UI.CheckBox({ + el: $host.findById('#slot-chk-rulers'), + labelText: this.textRulers, + value: true, //!Common.localStorage.getBool(''), + //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chRulers); + + this.chNotes = new Common.UI.CheckBox({ + el: $host.findById('#slot-chk-notes'), + labelText: this.textNotes, + value: true, //!Common.localStorage.getBool(''), + //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chNotes); + }, + + render: function (el) { + return this; + }, + + show: function () { + Common.UI.BaseView.prototype.show.call(this); + this.fireEvent('show', this); + }, + + getButtons: function(type) { + if (type===undefined) + return this.lockedControls; + return []; + }, + + SetDisabled: function (state) { + this.lockedControls && this.lockedControls.forEach(function(button) { + if ( button ) { + button.setDisabled(state); + } + }, this); + }, + + textZoom: 'Zoom', + textFitToSlide: 'Fit To Slide', + textFitToWidth: 'Fit To Width', + textInterfaceTheme: 'Interface theme', + textStatusBar: 'Status Bar', + textAlwaysShowToolbar: 'Always show toolbar', + textRulers: 'Rulers', + textNotes: 'Notes' + } + }()), PE.Views.ViewTab || {})); +}); \ No newline at end of file diff --git a/apps/presentationeditor/main/app_dev.js b/apps/presentationeditor/main/app_dev.js index 8fa452dae..7af9c35b5 100644 --- a/apps/presentationeditor/main/app_dev.js +++ b/apps/presentationeditor/main/app_dev.js @@ -143,6 +143,7 @@ require([ 'RightMenu', 'LeftMenu', 'Main', + 'ViewTab', 'Common.Controllers.Fonts', 'Common.Controllers.History' /** coauthoring begin **/ @@ -166,6 +167,7 @@ require([ 'presentationeditor/main/app/controller/RightMenu', 'presentationeditor/main/app/controller/LeftMenu', 'presentationeditor/main/app/controller/Main', + 'presentationeditor/main/app/controller/ViewTab', 'presentationeditor/main/app/view/FileMenuPanels', 'presentationeditor/main/app/view/ParagraphSettings', 'presentationeditor/main/app/view/ImageSettings', diff --git a/apps/spreadsheeteditor/main/resources/less/toolbar.less b/apps/spreadsheeteditor/main/resources/less/toolbar.less index 2c9e35bf7..7cab7037c 100644 --- a/apps/spreadsheeteditor/main/resources/less/toolbar.less +++ b/apps/spreadsheeteditor/main/resources/less/toolbar.less @@ -146,8 +146,3 @@ margin-right: 2px; } } - -#slot-field-zoom { - float: left; - min-width: 46px; -} From 63e898335964c09808085ed01fa134073824bb5b Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Wed, 8 Dec 2021 14:52:15 +0300 Subject: [PATCH 03/19] [SSE] Add buttons in view tab --- .../main/app/template/Toolbar.template | 13 ++++++ .../main/app/view/ViewTab.js | 40 ++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 5602630d1..79469b15a 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -267,6 +267,10 @@
+
+ +
+
@@ -287,6 +291,15 @@ +
+
+
+ +
+
+ +
+
diff --git a/apps/spreadsheeteditor/main/app/view/ViewTab.js b/apps/spreadsheeteditor/main/app/view/ViewTab.js index a73c5b608..8ed8aaba5 100644 --- a/apps/spreadsheeteditor/main/app/view/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/view/ViewTab.js @@ -209,6 +209,41 @@ define([ }); this.lockedControls.push(this.chZeros); + this.btnInterfaceTheme = new Common.UI.Button({ + parentEl: $host.find('#slot-btn-interface-theme'), + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon', + caption: this.textInterfaceTheme, + split: true, + menu: true, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.btnInterfaceTheme); + + this.chStatusbar = new Common.UI.CheckBox({ + el: $host.findById('#slot-chk-statusbar'), + labelText: this.textCombineSheetAndStatusBars, + value : true, + lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell], + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chStatusbar); + + this.chToolbar = new Common.UI.CheckBox({ + el: $host.findById('#slot-chk-toolbar'), + labelText: this.textAlwaysShowToolbar, + value : true, + lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell], + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.chToolbar); + $host.find('#slot-lbl-zoom').text(this.textZoom); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); @@ -339,7 +374,10 @@ define([ textFreezeRow: 'Freeze Top Row', textFreezeCol: 'Freeze First Column', textUnFreeze: 'Unfreeze Panes', - textZeros: 'Show zeros' + textZeros: 'Show zeros', + textCombineSheetAndStatusBars: 'Combine sheet and status bars', + textAlwaysShowToolbar: 'Always show toolbar', + textInterfaceTheme: 'Interface theme', } }()), SSE.Views.ViewTab || {})); }); From 4583e2014c3179102ae933e7958098d85df82eb5 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Wed, 8 Dec 2021 18:01:00 +0300 Subject: [PATCH 04/19] [DE] Add handler for navigation button in view tab --- .../main/app/controller/LeftMenu.js | 19 +++++++++++++++++-- .../main/app/controller/ViewTab.js | 16 ++++++++++++++++ apps/documenteditor/main/app/view/LeftMenu.js | 7 +++++++ apps/documenteditor/main/app/view/ViewTab.js | 16 ++++++++++++---- 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index d312959c5..adaa0b7a9 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -45,14 +45,16 @@ define([ 'common/main/lib/util/Shortcuts', 'common/main/lib/view/SaveAsDlg', 'documenteditor/main/app/view/LeftMenu', - 'documenteditor/main/app/view/FileMenu' + 'documenteditor/main/app/view/FileMenu', + 'documenteditor/main/app/view/ViewTab', ], function () { 'use strict'; DE.Controllers.LeftMenu = Backbone.Controller.extend(_.extend({ views: [ 'LeftMenu', - 'FileMenu' + 'FileMenu', + 'ViewTab' ], initialize: function() { @@ -106,6 +108,9 @@ define([ }, 'Common.Views.ReviewChanges': { 'collaboration:chat': _.bind(this.onShowHideChat, this) + }, + 'ViewTab': { + 'viewtab:navigation': _.bind(this.onShowHideNavigation, this) } }); @@ -914,6 +919,16 @@ define([ } }, + onShowHideNavigation: function(state) { + if (state) { + Common.UI.Menu.Manager.hideAll(); + this.leftMenu.showMenu('navigation'); + } else { + this.leftMenu.btnNavigation.toggle(false, true); + this.leftMenu.onBtnMenuClick(this.leftMenu.btnNavigation); + } + }, + isCommentsVisible: function() { return this.leftMenu && this.leftMenu.panelComments && this.leftMenu.panelComments.isVisible(); }, diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index 887118a8c..38864b0f0 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -58,6 +58,7 @@ define([ }, onLaunch: function () { this._state = {}; + Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); }, setApi: function (api) { @@ -97,5 +98,20 @@ define([ this.SetDisabled(true); }, + onAppReady: function (config) { + var me = this; + (new Promise(function (accept, reject) { + accept(); + })).then(function(){ + me.view.setEvents(); + }); + if (me.view.btnNavigation) { + me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function(btn, state){ + if (state !== me.view.btnNavigation.pressed) + me.view.turnNavigation(state); + }); + } + }, + }, DE.Controllers.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/LeftMenu.js b/apps/documenteditor/main/app/view/LeftMenu.js index f222b4403..69ef3d49f 100644 --- a/apps/documenteditor/main/app/view/LeftMenu.js +++ b/apps/documenteditor/main/app/view/LeftMenu.js @@ -378,6 +378,13 @@ define([ this.onBtnMenuClick(this.btnComments); this.onCoauthOptions(); } + } else if (menu == 'navigation') { + if (this.btnNavigation.isVisible() && + !this.btnNavigation.isDisabled() && !this.btnNavigation.pressed) { + this.btnNavigation.toggle(true); + this.onBtnMenuClick(this.btnNavigation); + this.onCoauthOptions(); + } } /** coauthoring end **/ } diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js index 5a00b2c14..cc94834b5 100644 --- a/apps/documenteditor/main/app/view/ViewTab.js +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -46,13 +46,16 @@ define([ 'use strict'; DE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){ - function setEvents() { - var me = this; - } - return { options: {}, + setEvents() { + var me = this; + me.btnNavigation && me.btnNavigation.on('click', function (btn, e) { + me.fireEvent('viewtab:navigation', [btn.pressed]); + }); + }, + initialize: function (options) { Common.UI.BaseView.prototype.initialize.call(this); this.toolbar = options.toolbar; @@ -68,6 +71,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon btn-navigation', caption: this.textNavigation, + enableToggle: true, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' @@ -190,6 +194,10 @@ define([ }, this); }, + turnNavigation: function (state) { + this.btnNavigation && this.btnNavigation.toggle(state, true); + }, + textNavigation: 'Navigation', textZoom: 'Zoom', textFitToPage: 'Fit To Page', From 4b29c97952770c3ddbd1a5ebfaa78f51e4b40557 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Wed, 8 Dec 2021 23:54:07 +0300 Subject: [PATCH 05/19] [DE] Add menu to interface theme button and dark document button in view tab --- .../main/app/controller/ViewTab.js | 21 +++++++++++++++++++ .../main/app/template/Toolbar.template | 1 + apps/documenteditor/main/app/view/ViewTab.js | 14 ++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index 38864b0f0..aa9afdb7f 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -111,6 +111,27 @@ define([ me.view.turnNavigation(state); }); } + + var menuItems = [], + currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(); + for (var t in Common.UI.Themes.map()) { + menuItems.push({ + value: t, + caption: Common.UI.Themes.get(t).text, + checked: t === currentTheme, + checkable: true, + toggleGroup: 'interface-theme' + }); + } + + if ( menuItems.length ) { + this.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems})); + this.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { + var value = item.value; + Common.UI.Themes.setTheme(value); + this.view.btnDarkDocument.setDisabled(value !== 'theme-dark'); + }, this)); + } }, }, DE.Controllers.ViewTab || {})); diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template index e53c53322..a00ce3b84 100644 --- a/apps/documenteditor/main/app/template/Toolbar.template +++ b/apps/documenteditor/main/app/template/Toolbar.template @@ -198,6 +198,7 @@
+
diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js index cc94834b5..a5a40be8e 100644 --- a/apps/documenteditor/main/app/view/ViewTab.js +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -137,6 +137,17 @@ define([ }); this.lockedControls.push(this.btnInterfaceTheme); + this.btnDarkDocument = new Common.UI.Button({ + parentEl: $host.find('#slot-btn-dark-document'), + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon night', + caption: this.textDarkDocument, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.btnDarkDocument); + this.chStatusbar = new Common.UI.CheckBox({ el: $host.findById('#slot-chk-statusbar'), labelText: this.textStatusBar, @@ -205,7 +216,8 @@ define([ textInterfaceTheme: 'Interface theme', textStatusBar: 'Status Bar', textAlwaysShowToolbar: 'Always show toolbar', - textRulers: 'Rulers' + textRulers: 'Rulers', + textDarkDocument: 'Dark document' } }()), DE.Views.ViewTab || {})); }); \ No newline at end of file From cd1f2105f26cc210a6f6e4efef393aa79d80a0e9 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 9 Dec 2021 16:06:11 +0300 Subject: [PATCH 06/19] [DE] Add handler to zoom buttons in view tab --- .../main/app/controller/ViewTab.js | 34 +++++++++++++++++-- apps/documenteditor/main/app/view/ViewTab.js | 13 +++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index aa9afdb7f..d447d7456 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -64,7 +64,7 @@ define([ setApi: function (api) { if (api) { this.api = api; - + this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onZoomChange, this)); } return this; }, @@ -77,7 +77,9 @@ define([ }); this.addListeners({ 'ViewTab': { - + 'zoom:value': _.bind(this.onChangeZoomValue, this), + 'zoom:topage': _.bind(this.onBtnZoomTo, this, 'topage'), + 'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth') }, 'Statusbar': { @@ -134,5 +136,33 @@ define([ } }, + onZoomChange: function (percent, type) { + this.view.btnFitToPage.toggle(type == 2, true); + this.view.btnFitToWidth.toggle(type == 1, true); + + this.view.cmbZoom.setValue(percent, percent + '%'); + }, + + onChangeZoomValue: function (value) { + this.api.zoom(value); + Common.NotificationCenter.trigger('edit:complete', this.view); + }, + + onBtnZoomTo: function(type) { + var btn, func; + if ( type === 'topage' ) { + btn = 'btnFitToPage'; + func = 'zoomFitToPage'; + } else { + btn = 'btnFitToWidth'; + func = 'zoomFitToWidth'; + } + if ( !this.view[btn].pressed ) + this.api.zoomCustomMode(); + else + this.api[func](); + Common.NotificationCenter.trigger('edit:complete', this.view); + }, + }, DE.Controllers.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js index a5a40be8e..1e558f107 100644 --- a/apps/documenteditor/main/app/view/ViewTab.js +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -54,6 +54,15 @@ define([ me.btnNavigation && me.btnNavigation.on('click', function (btn, e) { me.fireEvent('viewtab:navigation', [btn.pressed]); }); + me.cmbZoom && me.cmbZoom.on('selected', function (combo, record) { + me.fireEvent('zoom:value', [record.value]); + }); + me.btnFitToPage && me.btnFitToPage.on('click', function () { + me.fireEvent('zoom:topage'); + }); + me.btnFitToWidth && me.btnFitToWidth.on('click', function () { + me.fireEvent('zoom:towidth'); + }); }, initialize: function (options) { @@ -107,6 +116,8 @@ define([ cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-ic-zoomtopage', caption: this.textFitToPage, + toggleGroup: 'view-zoom', + enableToggle: true, dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'medium' @@ -118,6 +129,8 @@ define([ cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-ic-zoomtowidth', caption: this.textFitToWidth, + toggleGroup: 'view-zoom', + enableToggle: true, dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'medium' From 66f0444bd0abca531cdb0d5e7221dfe2f4ec5e72 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 9 Dec 2021 17:31:12 +0300 Subject: [PATCH 07/19] [PE] Add handler to zoom buttons in view tab --- .../main/app/controller/ViewTab.js | 50 +++++++++++++++++-- .../main/app/view/ViewTab.js | 23 +++++++-- 2 files changed, 65 insertions(+), 8 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js index f3770d650..4c99d90fc 100644 --- a/apps/presentationeditor/main/app/controller/ViewTab.js +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -57,13 +57,17 @@ define([ initialize: function () { }, onLaunch: function () { - this._state = {}; + this._state = { + zoom_type: undefined, + zoom_percent: undefined + }; + Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); }, setApi: function (api) { if (api) { this.api = api; - + this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onZoomChange, this)); } return this; }, @@ -76,7 +80,9 @@ define([ }); this.addListeners({ 'ViewTab': { - + 'zoom:value': _.bind(this.onChangeZoomValue, this), + 'zoom:toslide': _.bind(this.onBtnZoomTo, this, 'toslide'), + 'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth') }, 'Statusbar': { @@ -97,5 +103,43 @@ define([ this.SetDisabled(true); }, + onZoomChange: function (percent, type) { + if (this._state.zoom_type !== type) { + this.view.btnFitToSlide.toggle(type == 2, true); + this.view.btnFitToWidth.toggle(type == 1, true); + this._state.zoom_type = type; + } + if (this._state.zoom_percent !== percent) { + this.view.cmbZoom.setValue(percent, percent + '%'); + this._state.zoom_percent = percent; + } + }, + + onAppReady: function (config) { + var me = this; + (new Promise(function (accept, reject) { + accept(); + })).then(function(){ + me.view.setEvents(); + }); + }, + + onChangeZoomValue: function (value) { + this._state.zoom_type = undefined; + this._state.zoom_percent = undefined; + this.api.zoom(value); + Common.NotificationCenter.trigger('edit:complete', this.view); + }, + + onBtnZoomTo: function (type, btn) { + this._state.zoom_type = undefined; + this._state.zoom_percent = undefined; + if (!btn.pressed) + this.api.zoomCustomMode(); + else + this.api[type === 'toslide' ? 'zoomFitToPage' : 'zoomFitToWidth'](); + Common.NotificationCenter.trigger('edit:complete', this.view); + } + }, PE.Controllers.ViewTab || {})); }); \ 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 892709e36..37aaa690a 100644 --- a/apps/presentationeditor/main/app/view/ViewTab.js +++ b/apps/presentationeditor/main/app/view/ViewTab.js @@ -46,13 +46,22 @@ define([ 'use strict'; PE.Views.ViewTab = Common.UI.BaseView.extend(_.extend((function(){ - function setEvents() { - var me = this; - } - return { options: {}, + setEvents: function () { + var me = this; + me.cmbZoom && me.cmbZoom.on('selected', function (combo, record) { + me.fireEvent('zoom:value', [record.value]); + }); + me.btnFitToSlide && me.btnFitToSlide.on('click', function () { + me.fireEvent('zoom:toslide', [me.btnFitToSlide]); + }); + me.btnFitToWidth && me.btnFitToWidth.on('click', function () { + me.fireEvent('zoom:towidth', [me.btnFitToWidth]); + }); + }, + initialize: function (options) { Common.UI.BaseView.prototype.initialize.call(this); this.toolbar = options.toolbar; @@ -92,17 +101,21 @@ define([ cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-ic-zoomtoslide', caption: this.textFitToSlide, + toggleGroup: 'view-zoom', + enableToggle: true, dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'medium' }); - this.lockedControls.push(this.btnFitToPage); + this.lockedControls.push(this.btnFitToSlide); this.btnFitToWidth = new Common.UI.Button({ parentEl: $host.find('#slot-btn-ftw'), cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-ic-zoomtowidth', caption: this.textFitToWidth, + toggleGroup: 'view-zoom', + enableToggle: true, dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'medium' From d4b08a16ed1bf7ea40ef54925eb7cea654394938 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 10 Dec 2021 15:24:58 +0300 Subject: [PATCH 08/19] [DE] Add handlers to show toolbar, statusbar, rulers buttons in view tab --- .../main/app/controller/Statusbar.js | 23 ++++++++++----- .../main/app/controller/Toolbar.js | 3 ++ .../main/app/controller/ViewTab.js | 29 +++++++++++++++++-- .../main/app/controller/Viewport.js | 21 ++++++++++---- apps/documenteditor/main/app/view/ViewTab.js | 15 ++++++++-- 5 files changed, 72 insertions(+), 19 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Statusbar.js b/apps/documenteditor/main/app/controller/Statusbar.js index d46eaefee..e09d34c1a 100644 --- a/apps/documenteditor/main/app/controller/Statusbar.js +++ b/apps/documenteditor/main/app/controller/Statusbar.js @@ -65,13 +65,10 @@ define([ }.bind(this) }, 'Common.Views.Header': { - 'statusbar:hide': function (view, status) { - me.statusbar.setVisible(!status); - Common.localStorage.setBool('de-hidden-status', status); - - Common.NotificationCenter.trigger('layout:changed', 'status'); - Common.NotificationCenter.trigger('edit:complete', me.statusbar); - } + 'statusbar:hide': _.bind(me.onChangeCompactView, me) + }, + 'ViewTab': { + 'statusbar:hide': _.bind(me.onChangeCompactView, me) } }); }, @@ -174,6 +171,18 @@ define([ }); }, + onChangeCompactView: function (view, status) { + this.statusbar.setVisible(!status); + Common.localStorage.setBool('de-hidden-status', status); + + if ($(view).parent().prop('id') !== 'slot-btn-options') { + this.statusbar.fireEvent('view:hide', [this, status]); + } + + Common.NotificationCenter.trigger('layout:changed', 'status'); + Common.NotificationCenter.trigger('edit:complete', this.statusbar); + }, + onApiTrackRevisionsChange: function(localFlag, globalFlag, userId) { var global = (localFlag===null), state = global ? globalFlag : localFlag; diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 0b8c6dfec..786848685 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -172,6 +172,9 @@ define([ 'go:editor': function() { Common.Gateway.requestEditRights(); } + }, + 'ViewTab': { + 'toolbar:setcompact': this.onChangeCompactView.bind(this) } }); diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index d447d7456..22cc61454 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -73,16 +73,30 @@ define([ this.toolbar = config.toolbar; this.view = this.createView('ViewTab', { toolbar: this.toolbar.toolbar, - mode: config.mode + mode: config.mode, + compactToolbar: this.toolbar.toolbar.isCompactView }); this.addListeners({ 'ViewTab': { 'zoom:value': _.bind(this.onChangeZoomValue, this), 'zoom:topage': _.bind(this.onBtnZoomTo, this, 'topage'), - 'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth') + 'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth'), + 'rulers:change': _.bind(this.onChangeRulers, this) + }, + 'Toolbar': { + 'view:compact': _.bind(function (toolbar, state) { + this.view.chToolbar.setValue(!state, true); + }, this) }, 'Statusbar': { - + 'view:hide': _.bind(function (statusbar, state) { + this.view.chStatusbar.setValue(!state, true); + }, this) + }, + 'Common.Views.Header': { + 'toolbar:hiderulers': _.bind(function (isChecked) { + this.view.chRulers.setValue(!isChecked, true); + }, this) } }); }, @@ -164,5 +178,14 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.view); }, + onChangeRulers: function (btn, checked) { + this.api.asc_SetViewRulers(checked); + Common.localStorage.setBool('de-hidden-rulers', !checked); + Common.Utils.InternalSettings.set("de-hidden-rulers", !checked); + this.view.fireEvent('rulers:hide', [!checked]); + Common.NotificationCenter.trigger('layout:changed', 'rulers'); + Common.NotificationCenter.trigger('edit:complete', this.view); + }, + }, DE.Controllers.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index 8a229dc0b..f6061b469 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -105,6 +105,14 @@ define([ if ( me.header.btnSave ) me.header.btnSave.setDisabled(state); } + }, + 'ViewTab': { + 'rulers:hide': function (state) { + me.header.mnuitemHideRulers.setChecked(state, true); + }, + 'statusbar:hide': function (view, state) { + me.header.mnuitemHideStatusBar.setChecked(state, true); + } } }); }, @@ -231,7 +239,7 @@ define([ }, this)); } - var mnuitemHideStatusBar = new Common.UI.MenuItem({ + me.header.mnuitemHideStatusBar = new Common.UI.MenuItem({ caption: me.header.textHideStatusBar, checked: Common.localStorage.getBool("de-hidden-status"), checkable: true, @@ -239,16 +247,16 @@ define([ }); if ( config.canBrandingExt && config.customization && config.customization.statusBar === false ) - mnuitemHideStatusBar.hide(); + 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("de-hidden-rulers"), checkable: true, value: 'rulers' }); if (!config.isEdit) - mnuitemHideRulers.hide(); + me.header.mnuitemHideRulers.hide(); me.header.menuItemsDarkMode = new Common.UI.MenuItem({ caption: me.txtDarkMode, @@ -292,8 +300,8 @@ define([ style: 'min-width: 180px;', items: [ me.header.mnuitemCompactToolbar, - mnuitemHideStatusBar, - mnuitemHideRulers, + me.header.mnuitemHideStatusBar, + me.header.mnuitemHideRulers, {caption:'--'}, me.header.menuItemsDarkMode, {caption:'--'}, @@ -422,6 +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()]); break; case 'zoom:page': item.isChecked() ? me.api.zoomFitToPage() : me.api.zoomCustomMode(); diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js index 1e558f107..082188553 100644 --- a/apps/documenteditor/main/app/view/ViewTab.js +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -63,6 +63,15 @@ define([ me.btnFitToWidth && me.btnFitToWidth.on('click', function () { me.fireEvent('zoom:towidth'); }); + me.chToolbar && me.chToolbar.on('change', _.bind(function(checkbox, state) { + me.fireEvent('toolbar:setcompact', [me.chToolbar, state !== 'checked']); + }, me)); + 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)); }, initialize: function (options) { @@ -164,7 +173,7 @@ define([ this.chStatusbar = new Common.UI.CheckBox({ el: $host.findById('#slot-chk-statusbar'), labelText: this.textStatusBar, - value: true, //!Common.localStorage.getBool(''), + value: !Common.localStorage.getBool("de-hidden-status"), //lock: [_set.lostConnect, _set.coAuth, _set.editCell], dataHint: '1', dataHintDirection: 'left', @@ -175,7 +184,7 @@ define([ this.chToolbar = new Common.UI.CheckBox({ el: $host.findById('#slot-chk-toolbar'), labelText: this.textAlwaysShowToolbar, - value: true, //!Common.localStorage.getBool(''), + value: !options.compactToolbar, //lock: [_set.lostConnect, _set.coAuth, _set.editCell], dataHint : '1', dataHintDirection: 'left', @@ -186,7 +195,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("de-hidden-rulers"), //lock: [_set.lostConnect, _set.coAuth, _set.editCell], dataHint: '1', dataHintDirection: 'left', From 55cd0c22e5ed3e80266f4715e7c9a948cb709a70 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 10 Dec 2021 19:35:03 +0300 Subject: [PATCH 09/19] [PE] Add handlers to show toolbar, statusbar buttons in view tab --- .../main/app/controller/Statusbar.js | 23 +++++++++++++------ .../main/app/controller/Toolbar.js | 3 +++ .../main/app/controller/ViewTab.js | 14 ++++++++--- .../main/app/controller/Viewport.js | 11 ++++++--- .../main/app/view/ViewTab.js | 10 ++++++-- 5 files changed, 46 insertions(+), 15 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/Statusbar.js b/apps/presentationeditor/main/app/controller/Statusbar.js index 592aa85ec..87ef9a162 100644 --- a/apps/presentationeditor/main/app/controller/Statusbar.js +++ b/apps/presentationeditor/main/app/controller/Statusbar.js @@ -62,13 +62,10 @@ define([ 'langchanged': this.onLangMenu }, 'Common.Views.Header': { - 'statusbar:hide': function (view, status) { - me.statusbar.setVisible(!status); - Common.localStorage.setBool('pe-hidden-status', status); - - Common.NotificationCenter.trigger('layout:changed', 'status'); - Common.NotificationCenter.trigger('edit:complete', this.statusbar); - } + 'statusbar:hide': _.bind(me.onChangeCompactView, me) + }, + 'ViewTab': { + 'statusbar:hide': _.bind(me.onChangeCompactView, me) } }); this._state = { @@ -226,6 +223,18 @@ define([ this.api.put_TextPrLang(langid); }, + onChangeCompactView: function (view, status) { + this.statusbar.setVisible(!status); + Common.localStorage.setBool('pe-hidden-status', status); + + if ($(view).parent().prop('id') !== 'slot-btn-options') { + this.statusbar.fireEvent('view:hide', [this, status]); + } + + Common.NotificationCenter.trigger('layout:changed', 'status'); + Common.NotificationCenter.trigger('edit:complete', this.statusbar); + }, + zoomText : 'Zoom {0}%' }, PE.Controllers.Statusbar || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index c75035224..b12f0b791 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -177,6 +177,9 @@ define([ 'go:editor': function() { Common.Gateway.requestEditRights(); } + }, + 'ViewTab': { + 'toolbar:setcompact': this.onChangeCompactView.bind(this) } }); diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js index 4c99d90fc..99a7a675e 100644 --- a/apps/presentationeditor/main/app/controller/ViewTab.js +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -76,7 +76,8 @@ define([ this.toolbar = config.toolbar; this.view = this.createView('ViewTab', { toolbar: this.toolbar.toolbar, - mode: config.mode + mode: config.mode, + compactToolbar: this.toolbar.toolbar.isCompactView }); this.addListeners({ 'ViewTab': { @@ -84,9 +85,16 @@ define([ 'zoom:toslide': _.bind(this.onBtnZoomTo, this, 'toslide'), 'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth') }, + 'Toolbar': { + 'view:compact': _.bind(function (toolbar, state) { + this.view.chToolbar.setValue(!state, true); + }, this) + }, 'Statusbar': { - - } + 'view:hide': _.bind(function (statusbar, state) { + this.view.chStatusbar.setValue(!state, true); + }, this) + }, }); }, diff --git a/apps/presentationeditor/main/app/controller/Viewport.js b/apps/presentationeditor/main/app/controller/Viewport.js index 895bfb9a1..88026dff1 100644 --- a/apps/presentationeditor/main/app/controller/Viewport.js +++ b/apps/presentationeditor/main/app/controller/Viewport.js @@ -111,6 +111,11 @@ define([ // Events generated by main view 'Viewport': { + }, + 'ViewTab': { + 'statusbar:hide': function (view, state) { + me.header.mnuitemHideStatusBar.setChecked(state, true); + } } }); Common.NotificationCenter.on('preview:start', this.onPreviewStart.bind(this)); @@ -237,7 +242,7 @@ define([ }, this)); } - var mnuitemHideStatusBar = new Common.UI.MenuItem({ + me.header.mnuitemHideStatusBar = new Common.UI.MenuItem({ caption: me.header.textHideStatusBar, checked: Common.localStorage.getBool("pe-hidden-status"), checkable: true, @@ -245,7 +250,7 @@ define([ }); if ( config.canBrandingExt && config.customization && config.customization.statusBar === false ) - mnuitemHideStatusBar.hide(); + me.header.mnuitemHideStatusBar.hide(); var mnuitemHideRulers = new Common.UI.MenuItem({ caption: me.header.textHideLines, @@ -298,7 +303,7 @@ define([ style: 'min-width: 180px;', items: [ me.header.mnuitemCompactToolbar, - mnuitemHideStatusBar, + me.header.mnuitemHideStatusBar, mnuitemHideRulers, me.header.mnuitemHideNotes, {caption:'--'}, diff --git a/apps/presentationeditor/main/app/view/ViewTab.js b/apps/presentationeditor/main/app/view/ViewTab.js index 37aaa690a..f3d5183fe 100644 --- a/apps/presentationeditor/main/app/view/ViewTab.js +++ b/apps/presentationeditor/main/app/view/ViewTab.js @@ -60,6 +60,12 @@ define([ me.btnFitToWidth && me.btnFitToWidth.on('click', function () { me.fireEvent('zoom:towidth', [me.btnFitToWidth]); }); + me.chToolbar && me.chToolbar.on('change', _.bind(function(checkbox, state) { + me.fireEvent('toolbar:setcompact', [me.chToolbar, state !== 'checked']); + }, me)); + me.chStatusbar && me.chStatusbar.on('change', _.bind(function (checkbox, state) { + me.fireEvent('statusbar:hide', [me.chStatusbar, state !== 'checked']); + }, me)); }, initialize: function (options) { @@ -138,7 +144,7 @@ define([ this.chStatusbar = new Common.UI.CheckBox({ el: $host.findById('#slot-chk-statusbar'), labelText: this.textStatusBar, - value: true, //!Common.localStorage.getBool(''), + value: !Common.localStorage.getBool("pe-hidden-status"), //lock: [_set.lostConnect, _set.coAuth, _set.editCell], dataHint: '1', dataHintDirection: 'left', @@ -149,7 +155,7 @@ define([ this.chToolbar = new Common.UI.CheckBox({ el: $host.findById('#slot-chk-toolbar'), labelText: this.textAlwaysShowToolbar, - value: true, //!Common.localStorage.getBool(''), + value: !options.compactToolbar, //lock: [_set.lostConnect, _set.coAuth, _set.editCell], dataHint : '1', dataHintDirection: 'left', From be3619a3404ac788cf00d2bf088dde4b3b24ffd1 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 10 Dec 2021 20:09:53 +0300 Subject: [PATCH 10/19] [PE] Add handlers to notes, rulers buttons in view tab --- .../main/app/controller/ViewTab.js | 2 +- .../main/app/controller/Viewport.js | 2 +- .../main/app/controller/ViewTab.js | 28 ++++++++++++++++++- .../main/app/controller/Viewport.js | 14 ++++++++-- .../main/app/view/ViewTab.js | 10 +++++-- 5 files changed, 48 insertions(+), 8 deletions(-) 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', From 0e75d15d5748b0bf642e7da7932e1eaecdf3ca1f Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Sun, 12 Dec 2021 16:46:42 +0300 Subject: [PATCH 11/19] [DE PE] Fix view tab --- .../main/app/controller/ViewTab.js | 53 ++++++++++--------- .../main/app/controller/ViewTab.js | 14 ++--- 2 files changed, 35 insertions(+), 32 deletions(-) diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index 13654877b..ec69b21ac 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -116,37 +116,38 @@ define([ onAppReady: function (config) { var me = this; - (new Promise(function (accept, reject) { - accept(); - })).then(function(){ - me.view.setEvents(); - }); - if (me.view.btnNavigation) { - me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function(btn, state){ + if (me.view) { + (new Promise(function (accept, reject) { + accept(); + })).then(function(){ + me.view.setEvents(); + }); + + me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function (btn, state) { if (state !== me.view.btnNavigation.pressed) me.view.turnNavigation(state); }); - } - var menuItems = [], - currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(); - for (var t in Common.UI.Themes.map()) { - menuItems.push({ - value: t, - caption: Common.UI.Themes.get(t).text, - checked: t === currentTheme, - checkable: true, - toggleGroup: 'interface-theme' - }); - } + var menuItems = [], + currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(); + for (var t in Common.UI.Themes.map()) { + menuItems.push({ + value: t, + caption: Common.UI.Themes.get(t).text, + checked: t === currentTheme, + checkable: true, + toggleGroup: 'interface-theme' + }); + } - if ( menuItems.length ) { - this.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems})); - this.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { - var value = item.value; - Common.UI.Themes.setTheme(value); - this.view.btnDarkDocument.setDisabled(value !== 'theme-dark'); - }, this)); + if (menuItems.length) { + this.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems})); + this.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { + var value = item.value; + Common.UI.Themes.setTheme(value); + this.view.btnDarkDocument.setDisabled(value !== 'theme-dark'); + }, this)); + } } }, diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js index 4836eaf3a..b6be8dd51 100644 --- a/apps/presentationeditor/main/app/controller/ViewTab.js +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -135,11 +135,13 @@ define([ onAppReady: function (config) { var me = this; - (new Promise(function (accept, reject) { - accept(); - })).then(function(){ - me.view.setEvents(); - }); + if (me.view) { + (new Promise(function (accept, reject) { + accept(); + })).then(function () { + me.view.setEvents(); + }); + } }, onChangeZoomValue: function (value) { @@ -172,7 +174,7 @@ define([ 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); + Common.NotificationCenter.trigger('edit:complete', this.view); } }, PE.Controllers.ViewTab || {})); From b68e5b68f54242d4a27f50b34e3bea4c94ae663c Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Sun, 12 Dec 2021 17:49:49 +0300 Subject: [PATCH 12/19] [SSE] Add handlers for show toolbar, combine statusbar buttons in view tab --- .../documenteditor/main/app/controller/Statusbar.js | 2 +- .../main/app/controller/Statusbar.js | 2 +- .../main/app/controller/Statusbar.js | 3 +++ .../main/app/controller/Toolbar.js | 3 +++ .../main/app/controller/ViewTab.js | 13 +++++++++++-- apps/spreadsheeteditor/main/app/view/ViewTab.js | 10 ++++++++-- 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Statusbar.js b/apps/documenteditor/main/app/controller/Statusbar.js index e09d34c1a..1beb2a86b 100644 --- a/apps/documenteditor/main/app/controller/Statusbar.js +++ b/apps/documenteditor/main/app/controller/Statusbar.js @@ -175,7 +175,7 @@ define([ this.statusbar.setVisible(!status); Common.localStorage.setBool('de-hidden-status', status); - if ($(view).parent().prop('id') !== 'slot-btn-options') { + if (view.$el.closest('.btn-slot').prop('id') === 'slot-btn-options') { this.statusbar.fireEvent('view:hide', [this, status]); } diff --git a/apps/presentationeditor/main/app/controller/Statusbar.js b/apps/presentationeditor/main/app/controller/Statusbar.js index 87ef9a162..60c55cc43 100644 --- a/apps/presentationeditor/main/app/controller/Statusbar.js +++ b/apps/presentationeditor/main/app/controller/Statusbar.js @@ -227,7 +227,7 @@ define([ this.statusbar.setVisible(!status); Common.localStorage.setBool('pe-hidden-status', status); - if ($(view).parent().prop('id') !== 'slot-btn-options') { + if (view.$el.closest('.btn-slot').prop('id') === 'slot-btn-options') { this.statusbar.fireEvent('view:hide', [this, status]); } diff --git a/apps/spreadsheeteditor/main/app/controller/Statusbar.js b/apps/spreadsheeteditor/main/app/controller/Statusbar.js index aeb0f0679..bb11dd582 100644 --- a/apps/spreadsheeteditor/main/app/controller/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Statusbar.js @@ -70,6 +70,9 @@ define([ }, 'Common.Views.Header': { 'statusbar:setcompact': _.bind(this.onChangeViewMode, this) + }, + 'ViewTab': { + 'statusbar:setcompact': _.bind(this.onChangeViewMode, this) } }); }, diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 5d238ee34..c6e2a730e 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -145,6 +145,9 @@ define([ }, 'CellSettings': { 'cf:init': this.onShowBeforeCondFormat + }, + 'ViewTab': { + 'viewtab:showtoolbar': this.onChangeViewMode.bind(this) } }); Common.NotificationCenter.on('page:settings', _.bind(this.onApiSheetChanged, this)); diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js index 8aeffa90a..d2c6886bf 100644 --- a/apps/spreadsheeteditor/main/app/controller/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js @@ -79,7 +79,8 @@ define([ this.toolbar = config.toolbar; this.view = this.createView('ViewTab', { toolbar: this.toolbar.toolbar, - mode: config.mode + mode: config.mode, + compactToolbar: this.toolbar.toolbar.isCompactView }); this.addListeners({ 'ViewTab': { @@ -95,7 +96,15 @@ define([ 'viewtab:manager': this.onOpenManager }, 'Statusbar': { - 'sheet:changed': this.onApiSheetChanged.bind(this) + 'sheet:changed': this.onApiSheetChanged.bind(this), + 'view:compact': _.bind(function (statusbar, state) { + this.view.chStatusbar.setValue(state, true); + }, this) + }, + 'Toolbar': { + 'view:compact': _.bind(function (toolbar, state) { + this.view.chToolbar.setValue(!state, true); + }, this) } }); Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this)); diff --git a/apps/spreadsheeteditor/main/app/view/ViewTab.js b/apps/spreadsheeteditor/main/app/view/ViewTab.js index 8ed8aaba5..ead56e3eb 100644 --- a/apps/spreadsheeteditor/main/app/view/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/view/ViewTab.js @@ -75,6 +75,12 @@ define([ this.cmbZoom.on('selected', function(combo, record) { me.fireEvent('viewtab:zoom', [record.value]); }); + this.chToolbar.on('change', function (field, value) { + me.fireEvent('viewtab:showtoolbar', [field, value !== 'checked']); + }); + this.chStatusbar.on('change', function (field, value) { + me.fireEvent('statusbar:setcompact', [field, value === 'checked']); + }); } return { @@ -225,7 +231,7 @@ define([ this.chStatusbar = new Common.UI.CheckBox({ el: $host.findById('#slot-chk-statusbar'), labelText: this.textCombineSheetAndStatusBars, - value : true, + value : Common.localStorage.getBool('sse-compact-statusbar', true), lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell], dataHint : '1', dataHintDirection: 'left', @@ -236,7 +242,7 @@ define([ this.chToolbar = new Common.UI.CheckBox({ el: $host.findById('#slot-chk-toolbar'), labelText: this.textAlwaysShowToolbar, - value : true, + value : !options.compactToolbar, lock : [_set.sheetLock, _set.lostConnect, _set.coAuth, _set.editCell], dataHint : '1', dataHintDirection: 'left', From 980cfb73f92f1cc7881cb7139e8cd6dfe846170f Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Sun, 12 Dec 2021 19:33:44 +0300 Subject: [PATCH 13/19] [DE] Add handler to dark mode button in view tab, change icons --- .../main/app/controller/ViewTab.js | 12 +++++++++- apps/documenteditor/main/app/view/ViewTab.js | 23 +++++++++++-------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index ec69b21ac..65e68a115 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -59,6 +59,7 @@ define([ onLaunch: function () { this._state = {}; Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); + Common.NotificationCenter.on('contenttheme:dark', this.onContentThemeChangedToDark.bind(this)); }, setApi: function (api) { @@ -81,7 +82,8 @@ define([ 'zoom:value': _.bind(this.onChangeZoomValue, this), 'zoom:topage': _.bind(this.onBtnZoomTo, this, 'topage'), 'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth'), - 'rulers:change': _.bind(this.onChangeRulers, this) + 'rulers:change': _.bind(this.onChangeRulers, this), + 'darkmode:change': _.bind(this.onChangeDarkMode, this) }, 'Toolbar': { 'view:compact': _.bind(function (toolbar, state) { @@ -188,5 +190,13 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.view); }, + onChangeDarkMode: function () { + Common.UI.Themes.toggleContentTheme(); + }, + + onContentThemeChangedToDark: function (isdark) { + this.view && this.view.btnDarkDocument.toggle(isdark, true); + }, + }, DE.Controllers.ViewTab || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js index 082188553..f311f00ae 100644 --- a/apps/documenteditor/main/app/view/ViewTab.js +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -51,27 +51,30 @@ define([ setEvents() { var me = this; - me.btnNavigation && me.btnNavigation.on('click', function (btn, e) { + me.btnNavigation.on('click', function (btn, e) { me.fireEvent('viewtab:navigation', [btn.pressed]); }); - me.cmbZoom && me.cmbZoom.on('selected', function (combo, record) { + me.cmbZoom.on('selected', function (combo, record) { me.fireEvent('zoom:value', [record.value]); }); - me.btnFitToPage && me.btnFitToPage.on('click', function () { + me.btnFitToPage.on('click', function () { me.fireEvent('zoom:topage'); }); - me.btnFitToWidth && me.btnFitToWidth.on('click', function () { + me.btnFitToWidth.on('click', function () { me.fireEvent('zoom:towidth'); }); - me.chToolbar && me.chToolbar.on('change', _.bind(function(checkbox, state) { + me.chToolbar.on('change', _.bind(function(checkbox, state) { me.fireEvent('toolbar:setcompact', [me.chToolbar, state !== 'checked']); }, me)); - me.chStatusbar && me.chStatusbar.on('change', _.bind(function (checkbox, state) { + 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.chRulers.on('change', _.bind(function (checkbox, state) { me.fireEvent('rulers:change', [me.chRulers, state === 'checked']); }, me)); + me.btnDarkDocument.on('click', _.bind(function () { + me.fireEvent('darkmode:change'); + }, me)); }, initialize: function (options) { @@ -87,7 +90,7 @@ define([ this.btnNavigation = new Common.UI.Button({ parentEl: $host.find('#slot-btn-navigation'), cls: 'btn-toolbar x-huge icon-top', - iconCls: 'toolbar__icon btn-navigation', + iconCls: 'toolbar__icon btn-menu-navigation', caption: this.textNavigation, enableToggle: true, dataHint: '1', @@ -149,9 +152,8 @@ define([ this.btnInterfaceTheme = new Common.UI.Button({ parentEl: $host.find('#slot-btn-interface-theme'), cls: 'btn-toolbar x-huge icon-top', - iconCls: 'toolbar__icon', + iconCls: 'toolbar__icon day', caption: this.textInterfaceTheme, - split: true, menu: true, dataHint: '1', dataHintDirection: 'bottom', @@ -164,6 +166,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon night', caption: this.textDarkDocument, + enableToggle: true, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' From 6633548659a9406f479f8c28b4865576f285b6e0 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Sun, 12 Dec 2021 20:44:54 +0300 Subject: [PATCH 14/19] [PE SSE] Add handlers to interface theme buttons in view tab --- .../main/app/controller/ViewTab.js | 20 ++++++++++++++++ .../main/app/view/ViewTab.js | 3 +-- .../main/app/view/ViewTab.js | 23 +++++++++++++++++-- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js index b6be8dd51..124e05aff 100644 --- a/apps/presentationeditor/main/app/controller/ViewTab.js +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -141,6 +141,26 @@ define([ })).then(function () { me.view.setEvents(); }); + + var menuItems = [], + currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(); + for (var t in Common.UI.Themes.map()) { + menuItems.push({ + value: t, + caption: Common.UI.Themes.get(t).text, + checked: t === currentTheme, + checkable: true, + toggleGroup: 'interface-theme' + }); + } + + if (menuItems.length) { + this.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems})); + this.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { + var value = item.value; + Common.UI.Themes.setTheme(value); + }, this)); + } } }, diff --git a/apps/presentationeditor/main/app/view/ViewTab.js b/apps/presentationeditor/main/app/view/ViewTab.js index 43fa0b007..8fc9cd868 100644 --- a/apps/presentationeditor/main/app/view/ViewTab.js +++ b/apps/presentationeditor/main/app/view/ViewTab.js @@ -137,9 +137,8 @@ define([ this.btnInterfaceTheme = new Common.UI.Button({ parentEl: $host.find('#slot-btn-interface-theme'), cls: 'btn-toolbar x-huge icon-top', - iconCls: 'toolbar__icon', + iconCls: 'toolbar__icon day', caption: this.textInterfaceTheme, - split: true, menu: true, dataHint: '1', dataHintDirection: 'bottom', diff --git a/apps/spreadsheeteditor/main/app/view/ViewTab.js b/apps/spreadsheeteditor/main/app/view/ViewTab.js index ead56e3eb..67ee28bb2 100644 --- a/apps/spreadsheeteditor/main/app/view/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/view/ViewTab.js @@ -218,9 +218,8 @@ define([ this.btnInterfaceTheme = new Common.UI.Button({ parentEl: $host.find('#slot-btn-interface-theme'), cls: 'btn-toolbar x-huge icon-top', - iconCls: 'toolbar__icon', + iconCls: 'toolbar__icon day', caption: this.textInterfaceTheme, - split: true, menu: true, dataHint: '1', dataHintDirection: 'bottom', @@ -292,6 +291,26 @@ define([ })); me.btnFreezePanes.updateHint(me.tipFreeze); + var menuItems = [], + currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(); + for (var t in Common.UI.Themes.map()) { + menuItems.push({ + value: t, + caption: Common.UI.Themes.get(t).text, + checked: t === currentTheme, + checkable: true, + toggleGroup: 'interface-theme' + }); + } + + if (menuItems.length) { + me.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems})); + me.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { + var value = item.value; + Common.UI.Themes.setTheme(value); + }, me)); + } + setEvents.call(me); }); }, From b20b3ceff5cfb6ec1f4bcf576cfbe04576e8c793 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Mon, 13 Dec 2021 16:50:36 +0300 Subject: [PATCH 15/19] [DE] Fix disable buttons in view tab --- .../main/app/controller/ViewTab.js | 53 ++++++++++--------- apps/documenteditor/main/app/view/ViewTab.js | 13 +++-- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index 65e68a115..36bed734a 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -123,33 +123,38 @@ define([ accept(); })).then(function(){ me.view.setEvents(); - }); - me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function (btn, state) { - if (state !== me.view.btnNavigation.pressed) - me.view.turnNavigation(state); - }); - - var menuItems = [], - currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(); - for (var t in Common.UI.Themes.map()) { - menuItems.push({ - value: t, - caption: Common.UI.Themes.get(t).text, - checked: t === currentTheme, - checkable: true, - toggleGroup: 'interface-theme' + me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function (btn, state) { + if (state !== me.view.btnNavigation.pressed) + me.view.turnNavigation(state); }); - } - if (menuItems.length) { - this.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems})); - this.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { - var value = item.value; - Common.UI.Themes.setTheme(value); - this.view.btnDarkDocument.setDisabled(value !== 'theme-dark'); - }, this)); - } + var menuItems = [], + currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId(); + for (var t in Common.UI.Themes.map()) { + menuItems.push({ + value: t, + caption: Common.UI.Themes.get(t).text, + checked: t === currentTheme, + checkable: true, + toggleGroup: 'interface-theme' + }); + } + + if (menuItems.length) { + me.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems})); + me.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) { + var value = item.value; + Common.UI.Themes.setTheme(value); + me.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme()); + }, me)); + + setTimeout(function () { + me.onContentThemeChangedToDark(Common.UI.Themes.isContentThemeDark()); + me.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme()); + }, 0); + } + }); } }, diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js index f311f00ae..49c5d9202 100644 --- a/apps/documenteditor/main/app/view/ViewTab.js +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -93,6 +93,7 @@ define([ iconCls: 'toolbar__icon btn-menu-navigation', caption: this.textNavigation, enableToggle: true, + disabled: true, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' @@ -104,7 +105,7 @@ define([ cls: 'input-group-nr', menuStyle: 'min-width: 55px;', editable: false, - //lock: [_set.coAuth, _set.lostConnect, _set.editCell], + disabled: true, data: [ { displayValue: "50%", value: 50 }, { displayValue: "75%", value: 75 }, @@ -130,6 +131,7 @@ define([ caption: this.textFitToPage, toggleGroup: 'view-zoom', enableToggle: true, + disabled: true, dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'medium' @@ -143,6 +145,7 @@ define([ caption: this.textFitToWidth, toggleGroup: 'view-zoom', enableToggle: true, + disabled: true, dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'medium' @@ -155,6 +158,7 @@ define([ iconCls: 'toolbar__icon day', caption: this.textInterfaceTheme, menu: true, + disabled: true, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' @@ -167,6 +171,7 @@ define([ iconCls: 'toolbar__icon night', caption: this.textDarkDocument, enableToggle: true, + disabled: true, dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' @@ -177,7 +182,7 @@ define([ el: $host.findById('#slot-chk-statusbar'), labelText: this.textStatusBar, value: !Common.localStorage.getBool("de-hidden-status"), - //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + disabled: true, dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'small' @@ -188,7 +193,7 @@ define([ el: $host.findById('#slot-chk-toolbar'), labelText: this.textAlwaysShowToolbar, value: !options.compactToolbar, - //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + disabled: true, dataHint : '1', dataHintDirection: 'left', dataHintOffset: 'small' @@ -199,7 +204,7 @@ define([ el: $host.findById('#slot-chk-rulers'), labelText: this.textRulers, value: !Common.Utils.InternalSettings.get("de-hidden-rulers"), - //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + disabled: true, dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'small' From d1d6d2eea6842623f556cc936a6bff2a920a4e7f Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Mon, 13 Dec 2021 20:13:34 +0300 Subject: [PATCH 16/19] [PE] Fix view tab --- apps/presentationeditor/main/app/view/ViewTab.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/presentationeditor/main/app/view/ViewTab.js b/apps/presentationeditor/main/app/view/ViewTab.js index 8fc9cd868..ce9eca1fa 100644 --- a/apps/presentationeditor/main/app/view/ViewTab.js +++ b/apps/presentationeditor/main/app/view/ViewTab.js @@ -78,6 +78,7 @@ define([ Common.UI.BaseView.prototype.initialize.call(this); this.toolbar = options.toolbar; this.appConfig = options.mode; + var _set = PE.enumLock; this.lockedControls = []; @@ -89,7 +90,7 @@ define([ cls: 'input-group-nr', menuStyle: 'min-width: 55px;', editable: false, - //lock: [_set.coAuth, _set.lostConnect, _set.editCell], + lock: [_set.disableOnStart], data: [ { displayValue: "50%", value: 50 }, { displayValue: "75%", value: 75 }, @@ -113,6 +114,7 @@ define([ cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-ic-zoomtoslide', caption: this.textFitToSlide, + lock: [_set.disableOnStart], toggleGroup: 'view-zoom', enableToggle: true, dataHint: '1', @@ -126,6 +128,7 @@ define([ cls: 'btn-toolbar', iconCls: 'toolbar__icon btn-ic-zoomtowidth', caption: this.textFitToWidth, + lock: [_set.disableOnStart], toggleGroup: 'view-zoom', enableToggle: true, dataHint: '1', @@ -139,6 +142,7 @@ define([ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon day', caption: this.textInterfaceTheme, + lock: [_set.disableOnStart], menu: true, dataHint: '1', dataHintDirection: 'bottom', @@ -150,7 +154,7 @@ define([ el: $host.findById('#slot-chk-statusbar'), labelText: this.textStatusBar, value: !Common.localStorage.getBool("pe-hidden-status"), - //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + lock: [_set.disableOnStart], dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'small' @@ -161,7 +165,7 @@ define([ el: $host.findById('#slot-chk-toolbar'), labelText: this.textAlwaysShowToolbar, value: !options.compactToolbar, - //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + lock: [_set.disableOnStart], dataHint : '1', dataHintDirection: 'left', dataHintOffset: 'small' @@ -172,7 +176,7 @@ define([ el: $host.findById('#slot-chk-rulers'), labelText: this.textRulers, value: !Common.Utils.InternalSettings.get("pe-hidden-rulers"), - //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + lock: [_set.disableOnStart], dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'small' @@ -183,7 +187,7 @@ define([ el: $host.findById('#slot-chk-notes'), labelText: this.textNotes, value: !Common.localStorage.getBool('pe-hidden-notes', this.appConfig.customization && this.appConfig.customization.hideNotes===true), - //lock: [_set.lostConnect, _set.coAuth, _set.editCell], + lock: [_set.disableOnStart], dataHint: '1', dataHintDirection: 'left', dataHintOffset: 'small' From db7ba9e448e00b6a1fd55ab147405a9951fc6ab9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 14 Dec 2021 12:06:29 +0300 Subject: [PATCH 17/19] Use customization config for hiding view tab and navigation button in the toolbar --- apps/api/documents/api.js | 3 +++ apps/documenteditor/main/app/template/Toolbar.template | 4 ++-- apps/documenteditor/main/app/view/Toolbar.js | 2 +- apps/presentationeditor/main/app/view/Toolbar.js | 2 +- apps/spreadsheeteditor/main/app/view/Toolbar.js | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 9e7b1db92..e9bb0b2d8 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -161,6 +161,9 @@ collaboration: false / true // collaboration tab protect: false / true, // protect tab plugins: false / true // plugins tab + view: { + navigation: false/true // navigation button in de + } / false / true, // view tab save: false/true // save button on toolbar in }, header: { diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template index a00ce3b84..a20d3042e 100644 --- a/apps/documenteditor/main/app/template/Toolbar.template +++ b/apps/documenteditor/main/app/template/Toolbar.template @@ -175,10 +175,10 @@
-
+
-
+
diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index e0e43324f..414d11f7b 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -114,7 +114,7 @@ define([ {caption: me.textTabInsert, action: 'ins', extcls: 'canedit', dataHintTitle: 'I'}, {caption: me.textTabLayout, action: 'layout', extcls: 'canedit', layoutname: 'toolbar-layout', dataHintTitle: 'L'}, {caption: me.textTabLinks, action: 'links', extcls: 'canedit', layoutname: 'toolbar-references', dataHintTitle: 'R'}, - {caption: me.textTabView, action: 'view', extcls: 'canedit', dataHintTitle: 'W'} + {caption: me.textTabView, action: 'view', extcls: 'canedit', layoutname: 'toolbar-view', dataHintTitle: 'W'} ] } ); diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index 983d4f278..ea3b44441 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -136,7 +136,7 @@ define([ {caption: me.textTabInsert, action: 'ins', extcls: 'canedit', dataHintTitle: 'I'}, {caption: me.textTabTransitions, action: 'transit', extcls: 'canedit', dataHintTitle: 'N'}, undefined, - {caption: me.textTabView, action: 'view', extcls: 'canedit', dataHintTitle: 'W'} + {caption: me.textTabView, action: 'view', extcls: 'canedit', layoutname: 'toolbar-view', dataHintTitle: 'W'} ] } ); diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 38c59bb55..7306237e6 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -366,7 +366,7 @@ define([ {caption: me.textTabFormula, action: 'formula', extcls: 'canedit', dataHintTitle: 'O'}, {caption: me.textTabData, action: 'data', extcls: 'canedit', dataHintTitle: 'D'}, undefined, undefined, undefined, - {caption: me.textTabView, action: 'view', extcls: 'canedit', dataHintTitle: 'W'} + {caption: me.textTabView, action: 'view', extcls: 'canedit', layoutname: 'toolbar-view', dataHintTitle: 'W'} ]} ); From 25c5b79697a8521f0dff9a9ed03665354dddc027 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 14 Dec 2021 12:53:14 +0300 Subject: [PATCH 18/19] [DE][PE] Fix tabs order --- apps/documenteditor/main/app/view/Toolbar.js | 1 + apps/presentationeditor/main/app/controller/Toolbar.js | 2 +- apps/presentationeditor/main/app/view/Toolbar.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index 414d11f7b..682611aa4 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -114,6 +114,7 @@ define([ {caption: me.textTabInsert, action: 'ins', extcls: 'canedit', dataHintTitle: 'I'}, {caption: me.textTabLayout, action: 'layout', extcls: 'canedit', layoutname: 'toolbar-layout', dataHintTitle: 'L'}, {caption: me.textTabLinks, action: 'links', extcls: 'canedit', layoutname: 'toolbar-references', dataHintTitle: 'R'}, + undefined, undefined, undefined, {caption: me.textTabView, action: 'view', extcls: 'canedit', layoutname: 'toolbar-view', dataHintTitle: 'W'} ] } diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index b12f0b791..1d8ba4abc 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -2485,7 +2485,7 @@ define([ var tab = {action: 'review', caption: me.toolbar.textTabCollaboration, layoutname: 'toolbar-collaboration', dataHintTitle: 'U'}; var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel(); if ( $panel ) { - me.toolbar.addTab(tab, $panel, 4); + me.toolbar.addTab(tab, $panel, 3); me.toolbar.setVisible('review', (config.isEdit || config.canViewReview || config.canCoAuthoring && config.canComments) && Common.UI.LayoutManager.isElementVisible('toolbar-collaboration')); } diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index ea3b44441..425d237cb 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -135,7 +135,7 @@ define([ {caption: me.textTabHome, action: 'home', extcls: 'canedit', dataHintTitle: 'H'}, {caption: me.textTabInsert, action: 'ins', extcls: 'canedit', dataHintTitle: 'I'}, {caption: me.textTabTransitions, action: 'transit', extcls: 'canedit', dataHintTitle: 'N'}, - undefined, + undefined, undefined, {caption: me.textTabView, action: 'view', extcls: 'canedit', layoutname: 'toolbar-view', dataHintTitle: 'W'} ] } From e91a68a1609501cc07bfce3aba2ab16cc28b2033 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Tue, 14 Dec 2021 13:10:32 +0300 Subject: [PATCH 19/19] [DE PE SSE] View tab: fix zoom, add Show frozen panes shadow --- apps/documenteditor/main/app/view/ViewTab.js | 5 ++++- apps/presentationeditor/main/app/view/ViewTab.js | 5 ++++- .../main/app/controller/ViewTab.js | 13 +++++++++++++ .../main/app/controller/Viewport.js | 6 ++++++ apps/spreadsheeteditor/main/app/view/ViewTab.js | 14 +++++++++++++- 5 files changed, 40 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/main/app/view/ViewTab.js b/apps/documenteditor/main/app/view/ViewTab.js index 49c5d9202..5b58ab1d0 100644 --- a/apps/documenteditor/main/app/view/ViewTab.js +++ b/apps/documenteditor/main/app/view/ViewTab.js @@ -113,7 +113,10 @@ define([ { displayValue: "125%", value: 125 }, { displayValue: "150%", value: 150 }, { displayValue: "175%", value: 175 }, - { displayValue: "200%", value: 200 } + { displayValue: "200%", value: 200 }, + { displayValue: "300%", value: 300 }, + { displayValue: "400%", value: 400 }, + { displayValue: "500%", value: 500 } ], dataHint : '1', dataHintDirection: 'top', diff --git a/apps/presentationeditor/main/app/view/ViewTab.js b/apps/presentationeditor/main/app/view/ViewTab.js index ce9eca1fa..e493256c6 100644 --- a/apps/presentationeditor/main/app/view/ViewTab.js +++ b/apps/presentationeditor/main/app/view/ViewTab.js @@ -98,7 +98,10 @@ define([ { displayValue: "125%", value: 125 }, { displayValue: "150%", value: 150 }, { displayValue: "175%", value: 175 }, - { displayValue: "200%", value: 200 } + { displayValue: "200%", value: 200 }, + { displayValue: "300%", value: 300 }, + { displayValue: "400%", value: 400 }, + { displayValue: "500%", value: 500 } ], dataHint : '1', dataHintDirection: 'top', diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js index d2c6886bf..033dcab23 100644 --- a/apps/spreadsheeteditor/main/app/controller/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js @@ -85,6 +85,7 @@ define([ this.addListeners({ 'ViewTab': { 'viewtab:freeze': this.onFreeze, + 'viewtab:freezeshadow': this.onFreezeShadow, 'viewtab:formula': this.onViewSettings, 'viewtab:headings': this.onViewSettings, 'viewtab:gridlines': this.onViewSettings, @@ -105,6 +106,11 @@ define([ 'view:compact': _.bind(function (toolbar, state) { this.view.chToolbar.setValue(!state, true); }, this) + }, + 'Common.Views.Header': { + 'toolbar:freezeshadow': _.bind(function (isChecked) { + this.view.btnFreezePanes.menu.items[4].setChecked(isChecked, true); + }, this) } }); Common.NotificationCenter.on('layout:changed', _.bind(this.onLayoutChanged, this)); @@ -137,6 +143,13 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.view); }, + onFreezeShadow: function (checked) { + this.api.asc_setFrozenPaneBorderType(checked ? Asc.c_oAscFrozenPaneBorderType.shadow : Asc.c_oAscFrozenPaneBorderType.line); + Common.localStorage.setBool('sse-freeze-shadow', checked); + this.view.fireEvent('freeze:shadow', [checked]); + Common.NotificationCenter.trigger('edit:complete', this.view); + }, + onZoom: function(zoom) { if (this.api) { this.api.asc_setZoom(zoom/100); diff --git a/apps/spreadsheeteditor/main/app/controller/Viewport.js b/apps/spreadsheeteditor/main/app/controller/Viewport.js index fdbb71c78..581ef51df 100644 --- a/apps/spreadsheeteditor/main/app/controller/Viewport.js +++ b/apps/spreadsheeteditor/main/app/controller/Viewport.js @@ -118,6 +118,11 @@ define([ if ( me.header.btnSave ) me.header.btnSave.setDisabled(state); } + }, + 'ViewTab': { + 'freeze:shadow': function (checked) { + me.header.mnuitemFreezePanesShadow.setChecked(checked, true); + } } }); @@ -511,6 +516,7 @@ define([ case 'freezepanesshadow': me.api.asc_setFrozenPaneBorderType(item.isChecked() ? Asc.c_oAscFrozenPaneBorderType.shadow : Asc.c_oAscFrozenPaneBorderType.line); Common.localStorage.setBool('sse-freeze-shadow', item.isChecked()); + me.header.fireEvent('toolbar:freezeshadow', [item.isChecked()]); break; case 'advanced': me.header.fireEvent('file:settings', me.header); break; } diff --git a/apps/spreadsheeteditor/main/app/view/ViewTab.js b/apps/spreadsheeteditor/main/app/view/ViewTab.js index 67ee28bb2..4f0392cb6 100644 --- a/apps/spreadsheeteditor/main/app/view/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/view/ViewTab.js @@ -58,7 +58,11 @@ define([ } me.btnFreezePanes.menu.on('item:click', function (menu, item, e) { - me.fireEvent('viewtab:freeze', [item.value]); + if (item.value === 'shadow') { + me.fireEvent('viewtab:freezeshadow', [item.checked]); + } else { + me.fireEvent('viewtab:freeze', [item.value]); + } }); this.chFormula.on('change', function (field, value) { me.fireEvent('viewtab:formula', [0, value]); @@ -286,6 +290,13 @@ define([ { caption: me.textFreezeCol, value: Asc.c_oAscFrozenPaneAddType.firstCol + }, + { caption: '--' }, + { + caption: me.textShowFrozenPanesShadow, + value: 'shadow', + checkable: true, + checked: Common.localStorage.getBool('sse-freeze-shadow', true) } ] })); @@ -403,6 +414,7 @@ define([ textCombineSheetAndStatusBars: 'Combine sheet and status bars', textAlwaysShowToolbar: 'Always show toolbar', textInterfaceTheme: 'Interface theme', + textShowFrozenPanesShadow: 'Show frozen panes shadow' } }()), SSE.Views.ViewTab || {})); });