Merge pull request #1413 from ONLYOFFICE/feature/tab-view

Feature/tab view
This commit is contained in:
JuliaSvinareva 2021-12-14 13:31:27 +03:00 committed by GitHub
commit 558a18ce0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 1239 additions and 43 deletions

View file

@ -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: {

View file

@ -759,3 +759,8 @@
}
}
#slot-field-zoom {
float: left;
min-width: 46px;
}

View file

@ -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',

View file

@ -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();
},

View file

@ -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.$el.closest('.btn-slot').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;

View file

@ -173,6 +173,9 @@ define([
'go:editor': function() {
Common.Gateway.requestEditRights();
}
},
'ViewTab': {
'toolbar:setcompact': this.onChangeCompactView.bind(this)
}
});
@ -3230,6 +3233,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.canFeatureForms || config.isRestrictedEdit && config.canFillForms ) {
if (config.isFormCreator) {

View file

@ -0,0 +1,207 @@
/*
*
* (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 = {};
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('contenttheme:dark', this.onContentThemeChangedToDark.bind(this));
},
setApi: function (api) {
if (api) {
this.api = api;
this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onZoomChange, this));
}
return this;
},
setConfig: function(config) {
this.toolbar = config.toolbar;
this.view = this.createView('ViewTab', {
toolbar: this.toolbar.toolbar,
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'),
'rulers:change': _.bind(this.onChangeRulers, this),
'darkmode:change': _.bind(this.onChangeDarkMode, 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': {
'rulers:hide': _.bind(function (isChecked) {
this.view.chRulers.setValue(!isChecked, true);
}, this)
}
});
},
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);
},
onAppReady: function (config) {
var me = this;
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'
});
}
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);
}
});
}
},
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);
},
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);
},
onChangeDarkMode: function () {
Common.UI.Themes.toggleContentTheme();
},
onContentThemeChangedToDark: function (isdark) {
this.view && this.view.btnDarkDocument.toggle(isdark, true);
},
}, DE.Controllers.ViewTab || {}));
});

View file

@ -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:'--'},
@ -421,6 +429,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('rulers:hide', [item.isChecked()]);
break;
case 'zoom:page':
item.isChecked() ? me.api.zoomFitToPage() : me.api.zoomCustomMode();

View file

@ -174,6 +174,49 @@
</div>
</div>
</section>
<section class="panel" data-tab="view">
<div class="group" data-layout-name="toolbar-view-navigation">
<span class="btn-slot text x-huge" id="slot-btn-navigation"></span>
</div>
<div class="separator long" data-layout-name="toolbar-view-navigation"></div>
<div class="group small">
<div class="elset" style="display: flex;">
<span class="btn-slot" id="slot-field-zoom" style="flex-grow: 1;"></span>
</div>
<div class="elset" style="text-align: center;">
<span class="btn-slot text" id="slot-lbl-zoom" style="font-size: 11px;text-align: center;margin-top: 4px;"></span>
</div>
</div>
<div class="group small">
<div class="elset">
<span class="btn-slot text" id="slot-btn-ftp" style="font-size: 11px;text-align: center;"></span>
</div>
<div class="elset">
<span class="btn-slot text" id="slot-btn-ftw" style="font-size: 11px;text-align: center;"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span>
<span class="btn-slot text x-huge" id="slot-btn-dark-document"></span>
</div>
<div class="separator long"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot text" id="slot-chk-statusbar"></span>
</div>
<div class="elset">
<span class="btn-slot text" id="slot-chk-toolbar"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot text" id="slot-chk-rulers"></span>
</div>
<div class="elset"></div>
</div>
</section>
</section>
</section>
</div>

View file

@ -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 **/
}

View file

@ -113,7 +113,9 @@ 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'},
undefined, undefined, undefined,
{caption: me.textTabView, action: 'view', extcls: 'canedit', layoutname: 'toolbar-view', dataHintTitle: 'W'}
]
}
);
@ -2650,7 +2652,8 @@ define([
tipMarkersArrow: 'Arrow bullets',
tipMarkersCheckmark: 'Checkmark bullets',
tipMarkersFRhombus: 'Filled rhombus bullets',
tipMarkersDash: 'Dash bullets'
tipMarkersDash: 'Dash bullets',
textTabView: 'View'
}
})(), DE.Views.Toolbar || {}));
});

View file

@ -0,0 +1,256 @@
/*
*
* (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(){
return {
options: {},
setEvents() {
var me = this;
me.btnNavigation.on('click', function (btn, e) {
me.fireEvent('viewtab:navigation', [btn.pressed]);
});
me.cmbZoom.on('selected', function (combo, record) {
me.fireEvent('zoom:value', [record.value]);
});
me.btnFitToPage.on('click', function () {
me.fireEvent('zoom:topage');
});
me.btnFitToWidth.on('click', function () {
me.fireEvent('zoom:towidth');
});
me.chToolbar.on('change', _.bind(function(checkbox, state) {
me.fireEvent('toolbar:setcompact', [me.chToolbar, state !== 'checked']);
}, me));
me.chStatusbar.on('change', _.bind(function (checkbox, state) {
me.fireEvent('statusbar:hide', [me.chStatusbar, state !== 'checked']);
}, me));
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) {
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-menu-navigation',
caption: this.textNavigation,
enableToggle: true,
disabled: true,
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,
disabled: true,
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 },
{ displayValue: "300%", value: 300 },
{ displayValue: "400%", value: 400 },
{ displayValue: "500%", value: 500 }
],
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,
toggleGroup: 'view-zoom',
enableToggle: true,
disabled: true,
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,
toggleGroup: 'view-zoom',
enableToggle: true,
disabled: true,
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 day',
caption: this.textInterfaceTheme,
menu: true,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
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,
enableToggle: true,
disabled: true,
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,
value: !Common.localStorage.getBool("de-hidden-status"),
disabled: true,
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: !options.compactToolbar,
disabled: true,
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: !Common.Utils.InternalSettings.get("de-hidden-rulers"),
disabled: true,
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);
},
turnNavigation: function (state) {
this.btnNavigation && this.btnNavigation.toggle(state, true);
},
textNavigation: 'Navigation',
textZoom: 'Zoom',
textFitToPage: 'Fit To Page',
textFitToWidth: 'Fit To Width',
textInterfaceTheme: 'Interface theme',
textStatusBar: 'Status Bar',
textAlwaysShowToolbar: 'Always show toolbar',
textRulers: 'Rulers',
textDarkDocument: 'Dark document'
}
}()), DE.Views.ViewTab || {}));
});

View file

@ -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',

View file

@ -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',

View file

@ -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.$el.closest('.btn-slot').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 || {}));
});

View file

@ -177,6 +177,9 @@ define([
'go:editor': function() {
Common.Gateway.requestEditRights();
}
},
'ViewTab': {
'toolbar:setcompact': this.onChangeCompactView.bind(this)
}
});
@ -2482,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'));
}
@ -2494,6 +2497,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)) {

View file

@ -0,0 +1,201 @@
/*
*
* (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 = {
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;
},
setConfig: function(config) {
this.toolbar = config.toolbar;
this.view = this.createView('ViewTab', {
toolbar: this.toolbar.toolbar,
mode: config.mode,
compactToolbar: this.toolbar.toolbar.isCompactView
});
this.addListeners({
'ViewTab': {
'zoom:value': _.bind(this.onChangeZoomValue, this),
'zoom:toslide': _.bind(this.onBtnZoomTo, this, 'toslide'),
'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) {
this.view.chToolbar.setValue(!state, true);
}, this)
},
'Statusbar': {
'view:hide': _.bind(function (statusbar, state) {
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),
}
});
},
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);
},
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;
if (me.view) {
(new Promise(function (accept, reject) {
accept();
})).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));
}
}
},
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);
},
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', this.view);
}
}, PE.Controllers.ViewTab || {}));
});

View file

@ -111,6 +111,17 @@ define([
// Events generated by main view
'Viewport': {
},
'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);
}
}
});
Common.NotificationCenter.on('preview:start', this.onPreviewStart.bind(this));
@ -237,7 +248,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,16 +256,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("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,
@ -298,8 +309,8 @@ define([
style: 'min-width: 180px;',
items: [
me.header.mnuitemCompactToolbar,
mnuitemHideStatusBar,
mnuitemHideRulers,
me.header.mnuitemHideStatusBar,
me.header.mnuitemHideRulers,
me.header.mnuitemHideNotes,
{caption:'--'},
me.header.mnuitemFitPage,
@ -460,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();

View file

@ -178,6 +178,46 @@
</div>
</div>
</section>
<section class="panel" data-tab="view">
<div class="group small">
<div class="elset" style="display: flex;">
<span class="btn-slot" id="slot-field-zoom" style="flex-grow: 1;"></span>
</div>
<div class="elset" style="text-align: center;">
<span class="btn-slot text" id="slot-lbl-zoom" style="font-size: 11px;text-align: center;margin-top: 4px;"></span>
</div>
</div>
<div class="group small">
<div class="elset">
<span class="btn-slot text" id="slot-btn-fts" style="font-size: 11px;text-align: center;"></span>
</div>
<div class="elset">
<span class="btn-slot text" id="slot-btn-ftw" style="font-size: 11px;text-align: center;"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span>
</div>
<div class="separator long"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot text" id="slot-chk-notes"></span>
</div>
<div class="elset">
<span class="btn-slot text" id="slot-chk-rulers"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot text" id="slot-chk-statusbar"></span>
</div>
<div class="elset">
<span class="btn-slot text" id="slot-chk-toolbar"></span>
</div>
</div>
</section>
</section>
</section>
</div>

View file

@ -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, undefined,
{caption: me.textTabView, action: 'view', extcls: 'canedit', layoutname: 'toolbar-view', dataHintTitle: 'W'}
]
}
);
@ -1987,7 +1989,8 @@ define([
tipMarkersCheckmark: 'Checkmark bullets',
tipMarkersFRhombus: 'Filled rhombus bullets',
tipMarkersDash: 'Dash bullets',
tipNone: 'None'
tipNone: 'None',
textTabView: 'View'
}
}()), PE.Views.Toolbar || {}));
});

View file

@ -0,0 +1,234 @@
/*
*
* (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(){
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]);
});
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));
me.chNotes && me.chNotes.on('change', _.bind(function (checkbox, state) {
me.fireEvent('notes:change', [me.chNotes, state === 'checked']);
}, me));
},
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this);
this.toolbar = options.toolbar;
this.appConfig = options.mode;
var _set = PE.enumLock;
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.disableOnStart],
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 },
{ displayValue: "300%", value: 300 },
{ displayValue: "400%", value: 400 },
{ displayValue: "500%", value: 500 }
],
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,
lock: [_set.disableOnStart],
toggleGroup: 'view-zoom',
enableToggle: true,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'medium'
});
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,
lock: [_set.disableOnStart],
toggleGroup: 'view-zoom',
enableToggle: true,
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 day',
caption: this.textInterfaceTheme,
lock: [_set.disableOnStart],
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: !Common.localStorage.getBool("pe-hidden-status"),
lock: [_set.disableOnStart],
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: !options.compactToolbar,
lock: [_set.disableOnStart],
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: !Common.Utils.InternalSettings.get("pe-hidden-rulers"),
lock: [_set.disableOnStart],
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: !Common.localStorage.getBool('pe-hidden-notes', this.appConfig.customization && this.appConfig.customization.hideNotes===true),
lock: [_set.disableOnStart],
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 || {}));
});

View file

@ -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',

View file

@ -70,6 +70,9 @@ define([
},
'Common.Views.Header': {
'statusbar:setcompact': _.bind(this.onChangeViewMode, this)
},
'ViewTab': {
'statusbar:setcompact': _.bind(this.onChangeViewMode, this)
}
});
},

View file

@ -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));

View file

@ -79,11 +79,13 @@ 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': {
'viewtab:freeze': this.onFreeze,
'viewtab:freezeshadow': this.onFreezeShadow,
'viewtab:formula': this.onViewSettings,
'viewtab:headings': this.onViewSettings,
'viewtab:gridlines': this.onViewSettings,
@ -95,7 +97,20 @@ 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.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));
@ -128,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);

View file

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

View file

@ -267,6 +267,10 @@
</div>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-freeze"></span>
</div>
@ -287,6 +291,15 @@
<span class="btn-slot text" id="slot-chk-zeros"></span>
</div>
</div>
<div class="separator long"></div>
<div class="group small">
<div class="elset">
<span class="btn-slot text" id="slot-chk-statusbar"></span>
</div>
<div class="elset">
<span class="btn-slot text" id="slot-chk-toolbar"></span>
</div>
</div>
</section>
</section>
</section>

View file

@ -384,7 +384,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'}
]}
);

View file

@ -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]);
@ -75,6 +79,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 {
@ -212,6 +222,40 @@ 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 day',
caption: this.textInterfaceTheme,
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 : Common.localStorage.getBool('sse-compact-statusbar', 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 : !options.compactToolbar,
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));
@ -249,11 +293,38 @@ 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)
}
]
}));
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);
});
},
@ -342,7 +413,11 @@ 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',
textShowFrozenPanesShadow: 'Show frozen panes shadow'
}
}()), SSE.Views.ViewTab || {}));
});

View file

@ -146,8 +146,3 @@
margin-right: 2px;
}
}
#slot-field-zoom {
float: left;
min-width: 46px;
}