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; +}