2016-04-01 13:17:09 +00:00
|
|
|
/*
|
|
|
|
*
|
2019-01-17 13:05:03 +00:00
|
|
|
* (c) Copyright Ascensio System SIA 2010-2019
|
2016-04-01 13:17:09 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
2019-01-17 13:00:34 +00:00
|
|
|
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
|
|
|
* street, Riga, Latvia, EU, LV-1050.
|
2016-04-01 13:17:09 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
2016-03-11 00:48:53 +00:00
|
|
|
/**
|
|
|
|
* Toolbar.js
|
|
|
|
*
|
|
|
|
* Toolbar view
|
|
|
|
*
|
2017-02-15 13:45:25 +00:00
|
|
|
* Created by Maxim.Kadushkin on 2/13/17
|
2018-03-01 12:16:38 +00:00
|
|
|
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
|
2016-03-11 00:48:53 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
define([
|
|
|
|
'jquery',
|
|
|
|
'underscore',
|
|
|
|
'backbone',
|
|
|
|
'text!documenteditor/main/app/template/Toolbar.template',
|
2018-05-15 12:37:26 +00:00
|
|
|
'text!documenteditor/main/app/template/ToolbarView.template',
|
2016-03-11 00:48:53 +00:00
|
|
|
'common/main/lib/collection/Fonts',
|
|
|
|
'common/main/lib/component/Button',
|
|
|
|
'common/main/lib/component/ComboBox',
|
|
|
|
'common/main/lib/component/DataView',
|
|
|
|
'common/main/lib/component/ColorPalette',
|
|
|
|
'common/main/lib/component/ThemeColorPalette',
|
|
|
|
'common/main/lib/component/Menu',
|
|
|
|
'common/main/lib/component/DimensionPicker',
|
|
|
|
'common/main/lib/component/Window',
|
|
|
|
'common/main/lib/component/ComboBoxFonts',
|
|
|
|
'common/main/lib/component/ComboDataView'
|
|
|
|
,'common/main/lib/component/SynchronizeTip'
|
2017-04-22 12:42:52 +00:00
|
|
|
,'common/main/lib/component/Mixtbar'
|
2018-05-15 12:37:26 +00:00
|
|
|
], function ($, _, Backbone, template, template_view) {
|
2016-03-11 00:48:53 +00:00
|
|
|
'use strict';
|
|
|
|
|
2017-04-22 12:42:52 +00:00
|
|
|
DE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend((function(){
|
2017-02-28 10:09:05 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
return {
|
|
|
|
el: '#toolbar',
|
|
|
|
|
|
|
|
// Compile our stats template
|
2017-02-27 12:02:37 +00:00
|
|
|
// template: _.template(template),
|
2017-02-20 14:51:33 +00:00
|
|
|
|
|
|
|
// Delegated events for creating new items, and clearing completed ones.
|
|
|
|
events: {
|
|
|
|
//
|
|
|
|
},
|
|
|
|
|
|
|
|
initialize: function () {
|
2017-04-20 10:23:50 +00:00
|
|
|
var me = this;
|
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
/**
|
|
|
|
* UI Components
|
|
|
|
*/
|
|
|
|
|
|
|
|
this.SchemeNames = [
|
|
|
|
this.txtScheme1, this.txtScheme2, this.txtScheme3, this.txtScheme4, this.txtScheme5,
|
|
|
|
this.txtScheme6, this.txtScheme7, this.txtScheme8, this.txtScheme9, this.txtScheme10,
|
|
|
|
this.txtScheme11, this.txtScheme12, this.txtScheme13, this.txtScheme14, this.txtScheme15,
|
|
|
|
this.txtScheme16, this.txtScheme17, this.txtScheme18, this.txtScheme19, this.txtScheme20,
|
|
|
|
this.txtScheme21
|
|
|
|
];
|
|
|
|
|
|
|
|
this.paragraphControls = [];
|
|
|
|
this.toolbarControls = [];
|
|
|
|
this.textOnlyControls = [];
|
|
|
|
this._state = {
|
2017-09-01 14:48:31 +00:00
|
|
|
hasCollaborativeChanges: undefined,
|
|
|
|
previewmode: false
|
2017-02-20 14:51:33 +00:00
|
|
|
};
|
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
Common.NotificationCenter.on('app:ready', me.onAppReady.bind(this));
|
|
|
|
return this;
|
|
|
|
},
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
applyLayout: function (config) {
|
|
|
|
var me = this;
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
if ( config.isEdit ) {
|
|
|
|
Common.UI.Mixtbar.prototype.initialize.call(this, {
|
|
|
|
template: _.template(template),
|
|
|
|
tabs: [
|
2018-05-16 14:41:47 +00:00
|
|
|
{caption: me.textTabFile, action: 'file', extcls: 'canedit', haspanel:false},
|
2018-05-15 12:37:26 +00:00
|
|
|
{caption: me.textTabHome, action: 'home', extcls: 'canedit'},
|
|
|
|
{caption: me.textTabInsert, action: 'ins', extcls: 'canedit'},
|
|
|
|
{caption: me.textTabLayout, action: 'layout', extcls: 'canedit'},
|
|
|
|
{caption: me.textTabLinks, action: 'links', extcls: 'canedit'}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnSaveCls = 'btn-save';
|
|
|
|
this.btnSaveTip = this.tipSave + Common.Utils.String.platformKey('Ctrl+S');
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnPrint = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-print',
|
|
|
|
cls: 'btn-toolbar',
|
2018-09-25 14:09:59 +00:00
|
|
|
iconCls: 'btn-print no-mask',
|
|
|
|
signals: ['disabled']
|
2018-05-15 12:37:26 +00:00
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnPrint);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnSave = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-save',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'no-mask ' + this.btnSaveCls,
|
|
|
|
signals: ['disabled']
|
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnSave);
|
|
|
|
this.btnCollabChanges = this.btnSave;
|
|
|
|
|
|
|
|
this.btnUndo = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-undo',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-undo',
|
|
|
|
signals: ['disabled']
|
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnUndo);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnRedo = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-redo',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-redo',
|
|
|
|
signals: ['disabled']
|
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnRedo);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnCopy = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-copy',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-copy'
|
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnCopy);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnPaste = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-paste',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-paste'
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnPaste);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnIncFontSize = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-incfont',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-incfont'
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnIncFontSize);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnDecFontSize = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-decfont',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-decfont'
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnDecFontSize);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnBold = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-bold',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-bold',
|
|
|
|
enableToggle: true
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnBold);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnItalic = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-italic',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-italic',
|
|
|
|
enableToggle: true
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnItalic);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnUnderline = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-underline',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-underline',
|
|
|
|
enableToggle: true
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnUnderline);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnStrikeout = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-strikeout',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-strikeout',
|
|
|
|
enableToggle: true
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnStrikeout);
|
|
|
|
|
|
|
|
this.btnSuperscript = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-superscript',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-superscript',
|
|
|
|
enableToggle: true,
|
|
|
|
toggleGroup: 'superscriptGroup'
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnSuperscript);
|
|
|
|
|
|
|
|
this.btnSubscript = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-subscript',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-subscript',
|
|
|
|
enableToggle: true,
|
|
|
|
toggleGroup: 'superscriptGroup'
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnSubscript);
|
|
|
|
|
|
|
|
this.btnHighlightColor = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-highlight',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-highlight',
|
|
|
|
enableToggle: true,
|
|
|
|
allowDepress: true,
|
|
|
|
split: true,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
style: 'min-width: 100px;',
|
|
|
|
items: [
|
|
|
|
{template: _.template('<div id="id-toolbar-menu-highlight" style="width: 120px; height: 120px; margin: 10px;"></div>')},
|
|
|
|
{caption: '--'},
|
|
|
|
this.mnuHighlightTransparent = new Common.UI.MenuItem({
|
|
|
|
caption: this.strMenuNoFill,
|
|
|
|
checkable: true
|
|
|
|
})
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnHighlightColor);
|
|
|
|
this.textOnlyControls.push(this.btnHighlightColor);
|
|
|
|
|
|
|
|
this.btnFontColor = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-fontcolor',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-fontcolor',
|
|
|
|
split: true,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
id: 'id-toolbar-menu-auto-fontcolor',
|
|
|
|
caption: this.textAutoColor,
|
|
|
|
template: _.template('<a tabindex="-1" type="menuitem"><span class="menu-item-icon" style="background-image: none; width: 12px; height: 12px; margin: 1px 7px 0 -7px; background-color: #000;"></span><%= caption %></a>')
|
|
|
|
},
|
|
|
|
{caption: '--'},
|
|
|
|
{template: _.template('<div id="id-toolbar-menu-fontcolor" style="width: 169px; height: 220px; margin: 10px;"></div>')},
|
|
|
|
{template: _.template('<a id="id-toolbar-menu-new-fontcolor" style="padding-left:12px;">' + this.textNewColor + '</a>')}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnFontColor);
|
|
|
|
|
|
|
|
this.btnParagraphColor = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-paracolor',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-paracolor',
|
|
|
|
split: true,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
items: [
|
|
|
|
{template: _.template('<div id="id-toolbar-menu-paracolor" style="width: 169px; height: 220px; margin: 10px;"></div>')},
|
|
|
|
{template: _.template('<a id="id-toolbar-menu-new-paracolor" style="padding-left:12px;">' + this.textNewColor + '</a>')}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnParagraphColor);
|
|
|
|
this.textOnlyControls.push(this.btnParagraphColor);
|
|
|
|
|
|
|
|
this.btnAlignLeft = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-align-left',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-align-left',
|
|
|
|
enableToggle: true,
|
|
|
|
allowDepress: false,
|
|
|
|
toggleGroup: 'alignGroup'
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnAlignLeft);
|
|
|
|
|
|
|
|
this.btnAlignCenter = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-align-center',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-align-center',
|
|
|
|
enableToggle: true,
|
|
|
|
allowDepress: false,
|
|
|
|
toggleGroup: 'alignGroup'
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnAlignCenter);
|
|
|
|
|
|
|
|
this.btnAlignRight = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-align-right',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-align-right',
|
|
|
|
enableToggle: true,
|
|
|
|
allowDepress: false,
|
|
|
|
toggleGroup: 'alignGroup'
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnAlignRight);
|
|
|
|
|
|
|
|
this.btnAlignJust = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-align-just',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-align-just',
|
|
|
|
enableToggle: true,
|
|
|
|
allowDepress: false,
|
|
|
|
toggleGroup: 'alignGroup'
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnAlignJust);
|
|
|
|
|
|
|
|
this.btnHorizontalAlign = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-halign',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-align-left',
|
|
|
|
icls: 'btn-align-left',
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
cls: 'ppm-toolbar',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
caption: this.tipAlignLeft + Common.Utils.String.platformKey('Ctrl+L'),
|
|
|
|
iconCls: 'mnu-align-left',
|
|
|
|
icls: 'btn-align-left',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'halignGroup',
|
|
|
|
checked: true,
|
|
|
|
value: 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.tipAlignCenter + Common.Utils.String.platformKey('Ctrl+E'),
|
|
|
|
iconCls: 'mnu-align-center',
|
|
|
|
icls: 'btn-align-center',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'halignGroup',
|
|
|
|
value: 2
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.tipAlignRight + Common.Utils.String.platformKey('Ctrl+R'),
|
|
|
|
iconCls: 'mnu-align-right',
|
|
|
|
icls: 'btn-align-right',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'halignGroup',
|
|
|
|
value: 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.tipAlignJust + Common.Utils.String.platformKey('Ctrl+J'),
|
|
|
|
iconCls: 'mnu-align-just',
|
|
|
|
icls: 'btn-align-just',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'halignGroup',
|
|
|
|
value: 3
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnHorizontalAlign);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnDecLeftOffset = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-decoffset',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-decoffset'
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnDecLeftOffset);
|
|
|
|
|
|
|
|
this.btnIncLeftOffset = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-incoffset',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-incoffset'
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnIncLeftOffset);
|
|
|
|
|
|
|
|
this.btnLineSpace = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-linespace',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-linespace',
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
style: 'min-width: 60px;',
|
|
|
|
items: [
|
|
|
|
{caption: '1.0', value: 1.0, checkable: true, toggleGroup: 'linesize'},
|
|
|
|
{caption: '1.15', value: 1.15, checkable: true, toggleGroup: 'linesize'},
|
|
|
|
{caption: '1.5', value: 1.5, checkable: true, toggleGroup: 'linesize'},
|
|
|
|
{caption: '2.0', value: 2.0, checkable: true, toggleGroup: 'linesize'},
|
|
|
|
{caption: '2.5', value: 2.5, checkable: true, toggleGroup: 'linesize'},
|
|
|
|
{caption: '3.0', value: 3.0, checkable: true, toggleGroup: 'linesize'}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnLineSpace);
|
|
|
|
|
|
|
|
this.btnShowHidenChars = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-hidenchars',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-hidenchars',
|
|
|
|
enableToggle: true,
|
|
|
|
split: true,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
style: 'min-width: 60px;',
|
|
|
|
items: [
|
|
|
|
{caption: this.mniHiddenChars, value: 'characters', checkable: true},
|
|
|
|
{caption: this.mniHiddenBorders, value: 'table', checkable: true}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnShowHidenChars);
|
|
|
|
|
|
|
|
this.btnMarkers = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-markers',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-setmarkers',
|
|
|
|
enableToggle: true,
|
|
|
|
toggleGroup: 'markersGroup',
|
|
|
|
split: true,
|
|
|
|
menu: true
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnMarkers);
|
|
|
|
this.textOnlyControls.push(this.btnMarkers);
|
|
|
|
|
|
|
|
this.btnNumbers = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-numbering',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-numbering',
|
|
|
|
enableToggle: true,
|
|
|
|
toggleGroup: 'markersGroup',
|
|
|
|
split: true,
|
|
|
|
menu: true
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnNumbers);
|
|
|
|
this.textOnlyControls.push(this.btnNumbers);
|
|
|
|
|
|
|
|
this.btnMultilevels = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-multilevels',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-multilevels',
|
|
|
|
menu: true
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnMultilevels);
|
|
|
|
this.textOnlyControls.push(this.btnMultilevels);
|
|
|
|
|
|
|
|
var clone = function (source) {
|
|
|
|
var obj = {};
|
|
|
|
for (var prop in source)
|
|
|
|
obj[prop] = (typeof(source[prop]) == 'object') ? clone(source[prop]) : source[prop];
|
|
|
|
return obj;
|
|
|
|
};
|
|
|
|
|
|
|
|
this.mnuMarkersPicker = {
|
|
|
|
conf: {index: 0},
|
|
|
|
selectByIndex: function (idx) {
|
|
|
|
this.conf.index = idx;
|
2017-02-20 14:51:33 +00:00
|
|
|
}
|
2018-05-15 12:37:26 +00:00
|
|
|
};
|
|
|
|
this.mnuNumbersPicker = clone(this.mnuMarkersPicker);
|
|
|
|
this.mnuMultilevelPicker = clone(this.mnuMarkersPicker);
|
|
|
|
|
|
|
|
this.btnInsertTable = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-inserttable',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-inserttable',
|
|
|
|
caption: me.capBtnInsTable,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
items: [
|
|
|
|
{template: _.template('<div id="id-toolbar-menu-tablepicker" class="dimension-picker" style="margin: 5px 10px;"></div>')},
|
|
|
|
{caption: this.mniCustomTable, value: 'custom'}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnInsertTable);
|
|
|
|
|
|
|
|
this.btnInsertImage = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-insertimage',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-insertimage',
|
|
|
|
caption: me.capBtnInsImage,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
items: [
|
|
|
|
{caption: this.mniImageFromFile, value: 'file'},
|
2018-10-03 11:00:08 +00:00
|
|
|
{caption: this.mniImageFromUrl, value: 'url'},
|
|
|
|
{caption: this.mniImageFromStorage, value: 'storage'}
|
2018-05-15 12:37:26 +00:00
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnInsertImage);
|
|
|
|
|
|
|
|
this.btnInsertChart = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-insertchart',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
caption: me.capBtnInsChart,
|
|
|
|
iconCls: 'btn-insertchart',
|
2019-08-30 14:55:29 +00:00
|
|
|
menu: true
|
2018-05-15 12:37:26 +00:00
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnInsertChart);
|
|
|
|
|
|
|
|
this.btnInsertText = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-inserttext',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-text',
|
|
|
|
caption: me.capBtnInsTextbox,
|
|
|
|
enableToggle: true
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnInsertText);
|
|
|
|
this.btnInsertTextArt = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-inserttextart',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-textart',
|
|
|
|
caption: me.capBtnInsTextart,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
cls: 'menu-shapes',
|
|
|
|
items: [
|
|
|
|
{template: _.template('<div id="id-toolbar-menu-insart" style="width: 239px; margin-left: 5px;"></div>')}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnInsertTextArt);
|
|
|
|
|
|
|
|
this.btnEditHeader = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-editheader',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-editheader',
|
|
|
|
caption: me.capBtnInsHeader,
|
|
|
|
menu: true
|
|
|
|
});
|
|
|
|
this.mnuPageNumberPosPicker = {
|
|
|
|
conf: {disabled: false},
|
|
|
|
isDisabled: function () {
|
|
|
|
return this.conf.disabled;
|
|
|
|
},
|
|
|
|
setDisabled: function (val) {
|
|
|
|
this.conf.disabled = val;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
this.mnuPageNumCurrentPos = clone(this.mnuPageNumberPosPicker);
|
|
|
|
this.mnuInsertPageNum = clone(this.mnuPageNumberPosPicker);
|
|
|
|
this.mnuInsertPageCount = clone(this.mnuPageNumberPosPicker);
|
|
|
|
this.paragraphControls.push(this.mnuPageNumCurrentPos);
|
|
|
|
this.paragraphControls.push(this.mnuInsertPageCount);
|
|
|
|
this.toolbarControls.push(this.btnEditHeader);
|
|
|
|
|
2018-11-20 09:57:29 +00:00
|
|
|
this.btnBlankPage = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-blankpage',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-blankpage',
|
|
|
|
caption: me.capBtnBlankPage
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnBlankPage);
|
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnInsertShape = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-insertshape',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-insertshape',
|
|
|
|
caption: me.capBtnInsShape,
|
|
|
|
enableToggle: true,
|
|
|
|
menu: new Common.UI.Menu({cls: 'menu-shapes'})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnInsertShape);
|
|
|
|
|
|
|
|
this.btnInsertEquation = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-insertequation',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-insertequation',
|
|
|
|
caption: me.capBtnInsEquation,
|
|
|
|
split: true,
|
|
|
|
menu: new Common.UI.Menu({cls: 'menu-shapes'})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnInsertEquation);
|
|
|
|
|
|
|
|
this.btnDropCap = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-dropcap',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-dropcap',
|
|
|
|
caption: me.capBtnInsDropcap,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
cls: 'ppm-toolbar',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
caption: this.textNone,
|
|
|
|
iconCls: 'mnu-dropcap-none',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuDropCap',
|
|
|
|
value: Asc.c_oAscDropCap.None,
|
|
|
|
checked: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textInText,
|
|
|
|
iconCls: 'mnu-dropcap-intext',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuDropCap',
|
|
|
|
value: Asc.c_oAscDropCap.Drop
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textInMargin,
|
|
|
|
iconCls: 'mnu-dropcap-inmargin',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuDropCap',
|
|
|
|
value: Asc.c_oAscDropCap.Margin
|
|
|
|
},
|
|
|
|
{caption: '--'},
|
|
|
|
this.mnuDropCapAdvanced = new Common.UI.MenuItem({caption: this.mniEditDropCap})
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnDropCap);
|
|
|
|
|
|
|
|
this.btnContentControls = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-controls',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-controls',
|
|
|
|
caption: me.capBtnInsControls,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
cls: 'ppm-toolbar',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
caption: this.textPlainControl,
|
|
|
|
iconCls: 'mnu-control-plain',
|
|
|
|
value: Asc.c_oAscSdtLevelType.Inline
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textRichControl,
|
|
|
|
iconCls: 'mnu-control-rich',
|
|
|
|
value: Asc.c_oAscSdtLevelType.Block
|
|
|
|
},
|
|
|
|
{caption: '--'},
|
|
|
|
{
|
|
|
|
caption: this.textRemoveControl,
|
|
|
|
iconCls: 'mnu-control-remove',
|
|
|
|
value: 'remove'
|
|
|
|
},
|
|
|
|
{caption: '--'},
|
|
|
|
{
|
|
|
|
caption: this.mniEditControls,
|
|
|
|
value: 'settings'
|
2018-07-23 14:39:53 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.mniHighlightControls,
|
|
|
|
value: 'highlight',
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
menuAlign : 'tl-tr',
|
|
|
|
items: [
|
|
|
|
this.mnuNoControlsColor = new Common.UI.MenuItem({
|
|
|
|
id: 'id-toolbar-menu-no-highlight-controls',
|
|
|
|
caption: this.textNoHighlight,
|
|
|
|
checkable: true
|
|
|
|
}),
|
|
|
|
{caption: '--'},
|
|
|
|
{template: _.template('<div id="id-toolbar-menu-controls-color" style="width: 169px; height: 220px; margin: 10px;"></div>')},
|
|
|
|
{template: _.template('<a id="id-toolbar-menu-new-control-color" style="padding-left:12px;">' + this.textNewColor + '</a>')}
|
|
|
|
]
|
|
|
|
})
|
2018-05-15 12:37:26 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnContentControls);
|
|
|
|
|
|
|
|
this.btnColumns = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-columns',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-columns',
|
|
|
|
caption: me.capBtnColumns,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
cls: 'ppm-toolbar',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
caption: this.textColumnsOne,
|
|
|
|
iconCls: 'mnu-columns-one',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuColumns',
|
|
|
|
value: 0
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textColumnsTwo,
|
|
|
|
iconCls: 'mnu-columns-two',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuColumns',
|
|
|
|
value: 1
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textColumnsThree,
|
|
|
|
iconCls: 'mnu-columns-three',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuColumns',
|
|
|
|
value: 2
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textColumnsLeft,
|
|
|
|
iconCls: 'mnu-columns-left',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuColumns',
|
|
|
|
value: 3
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textColumnsRight,
|
|
|
|
iconCls: 'mnu-columns-right',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuColumns',
|
|
|
|
value: 4
|
|
|
|
},
|
|
|
|
{caption: '--'},
|
|
|
|
{caption: this.textColumnsCustom, value: 'advanced'}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.btnColumns);
|
|
|
|
|
|
|
|
this.btnPageOrient = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-pageorient',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-pageorient',
|
|
|
|
caption: me.capBtnPageOrient,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
cls: 'ppm-toolbar',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
caption: this.textPortrait,
|
|
|
|
iconCls: 'mnu-orient-portrait',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuOrient',
|
|
|
|
value: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textLandscape,
|
|
|
|
iconCls: 'mnu-orient-landscape',
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuOrient',
|
|
|
|
value: false
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnPageOrient);
|
|
|
|
|
|
|
|
|
|
|
|
var pageMarginsTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><b><%= caption %></b></div>' +
|
|
|
|
'<% if (options.value !== null) { %><div style="display: inline-block;margin-right: 20px;min-width: 80px;">' +
|
|
|
|
'<label style="display: block;">' + this.textTop + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label>' +
|
|
|
|
'<label style="display: block;">' + this.textLeft + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div><div style="display: inline-block;">' +
|
|
|
|
'<label style="display: block;">' + this.textBottom + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[2]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label>' +
|
|
|
|
'<label style="display: block;">' + this.textRight + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[3]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></label></div>' +
|
|
|
|
'<% } %></a>');
|
|
|
|
|
|
|
|
this.btnPageMargins = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-pagemargins',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-pagemargins',
|
|
|
|
caption: me.capBtnMargins,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
caption: this.textMarginsLast,
|
|
|
|
checkable: true,
|
|
|
|
template: pageMarginsTemplate,
|
|
|
|
toggleGroup: 'menuPageMargins'
|
|
|
|
}, //top,left,bottom,right
|
|
|
|
{
|
|
|
|
caption: this.textMarginsNormal,
|
|
|
|
checkable: true,
|
|
|
|
template: pageMarginsTemplate,
|
|
|
|
toggleGroup: 'menuPageMargins',
|
|
|
|
value: [20, 30, 20, 15]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textMarginsUsNormal,
|
|
|
|
checkable: true,
|
|
|
|
template: pageMarginsTemplate,
|
|
|
|
toggleGroup: 'menuPageMargins',
|
|
|
|
value: [25.4, 25.4, 25.4, 25.4]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textMarginsNarrow,
|
|
|
|
checkable: true,
|
|
|
|
template: pageMarginsTemplate,
|
|
|
|
toggleGroup: 'menuPageMargins',
|
|
|
|
value: [12.7, 12.7, 12.7, 12.7]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textMarginsModerate,
|
|
|
|
checkable: true,
|
|
|
|
template: pageMarginsTemplate,
|
|
|
|
toggleGroup: 'menuPageMargins',
|
|
|
|
value: [25.4, 19.1, 25.4, 19.1]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textMarginsWide,
|
|
|
|
checkable: true,
|
|
|
|
template: pageMarginsTemplate,
|
|
|
|
toggleGroup: 'menuPageMargins',
|
|
|
|
value: [25.4, 50.8, 25.4, 50.8]
|
|
|
|
},
|
|
|
|
{caption: '--'},
|
|
|
|
{caption: this.textPageMarginsCustom, value: 'advanced'}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnPageMargins);
|
|
|
|
|
|
|
|
var pageSizeTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><b><%= caption %></b></div>' +
|
|
|
|
'<div><%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x ' +
|
|
|
|
'<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %></div></a>');
|
|
|
|
|
|
|
|
this.btnPageSize = new Common.UI.Button({
|
|
|
|
id: 'tlbtn-pagesize',
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-pagesize',
|
|
|
|
caption: me.capBtnPageSize,
|
|
|
|
menu: new Common.UI.Menu({
|
2019-06-21 07:46:00 +00:00
|
|
|
restoreHeight: true,
|
2018-05-15 12:37:26 +00:00
|
|
|
items: [
|
|
|
|
{
|
|
|
|
caption: 'US Letter',
|
|
|
|
subtitle: '21,59cm x 27,94cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
|
|
|
value: [215.9, 279.4]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'US Legal',
|
|
|
|
subtitle: '21,59cm x 35,56cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
|
|
|
value: [215.9, 355.6]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'A4',
|
|
|
|
subtitle: '21cm x 29,7cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
|
|
|
value: [210, 297],
|
|
|
|
checked: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'A5',
|
|
|
|
subtitle: '14,81cm x 20,99cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
2018-05-23 07:43:10 +00:00
|
|
|
value: [148, 210]
|
2018-05-15 12:37:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'B5',
|
|
|
|
subtitle: '17,6cm x 25,01cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
2018-05-23 07:43:10 +00:00
|
|
|
value: [176, 250]
|
2018-05-15 12:37:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'Envelope #10',
|
|
|
|
subtitle: '10,48cm x 24,13cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
|
|
|
value: [104.8, 241.3]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'Envelope DL',
|
|
|
|
subtitle: '11,01cm x 22,01cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
2018-05-23 07:43:10 +00:00
|
|
|
value: [110, 220]
|
2018-05-15 12:37:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'Tabloid',
|
|
|
|
subtitle: '27,94cm x 43,17cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
2018-05-23 07:43:10 +00:00
|
|
|
value: [279.4, 431.8]
|
2018-05-15 12:37:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'A3',
|
|
|
|
subtitle: '29,7cm x 42,01cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
2018-05-23 07:43:10 +00:00
|
|
|
value: [297, 420]
|
2018-05-15 12:37:26 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'Tabloid Oversize',
|
|
|
|
subtitle: '30,48cm x 45,71cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
|
|
|
value: [304.8, 457.1]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'ROC 16K',
|
|
|
|
subtitle: '19,68cm x 27,3cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
|
|
|
value: [196.8, 273]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'Envelope Choukei 3',
|
|
|
|
subtitle: '11,99cm x 23,49cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
|
|
|
value: [119.9, 234.9]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: 'Super B/A3',
|
|
|
|
subtitle: '33,02cm x 48,25cm',
|
|
|
|
template: pageSizeTemplate,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuPageSize',
|
|
|
|
value: [330.2, 482.5]
|
|
|
|
},
|
|
|
|
{caption: '--'},
|
|
|
|
{caption: this.textPageSizeCustom, value: 'advanced'}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnPageSize);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnClearStyle = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-clearstyle',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-clearstyle'
|
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnClearStyle);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnCopyStyle = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-copystyle',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-copystyle',
|
|
|
|
enableToggle: true
|
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnCopyStyle);
|
|
|
|
|
|
|
|
this.btnColorSchemas = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-colorschemas',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-colorschemas',
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
items: [],
|
2019-06-21 07:46:00 +00:00
|
|
|
restoreHeight: true
|
2018-05-15 12:37:26 +00:00
|
|
|
})
|
|
|
|
});
|
|
|
|
this.toolbarControls.push(this.btnColorSchemas);
|
2017-03-29 16:24:20 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.btnMailRecepients = new Common.UI.Button({
|
|
|
|
id: 'id-toolbar-btn-mailrecepients',
|
|
|
|
cls: 'btn-toolbar',
|
|
|
|
iconCls: 'btn-mailrecepients'
|
|
|
|
});
|
2017-03-29 16:24:20 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
me.btnImgAlign = new Common.UI.Button({
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-img-align',
|
|
|
|
caption: me.capImgAlign,
|
|
|
|
menu: true
|
|
|
|
});
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
me.btnImgGroup = new Common.UI.Button({
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-img-group',
|
|
|
|
caption: me.capImgGroup,
|
|
|
|
menu: true
|
|
|
|
});
|
|
|
|
me.btnImgForward = new Common.UI.Button({
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-img-frwd',
|
|
|
|
caption: me.capImgForward,
|
|
|
|
split: true,
|
|
|
|
menu: true
|
|
|
|
});
|
|
|
|
me.btnImgBackward = new Common.UI.Button({
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-img-bkwd',
|
|
|
|
caption: me.capImgBackward,
|
|
|
|
split: true,
|
|
|
|
menu: true
|
|
|
|
});
|
|
|
|
me.btnImgWrapping = new Common.UI.Button({
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
|
|
|
iconCls: 'btn-img-wrap',
|
|
|
|
caption: me.capImgWrapping,
|
|
|
|
menu: true
|
|
|
|
});
|
2019-04-05 11:28:51 +00:00
|
|
|
|
|
|
|
me.btnWatermark = new Common.UI.Button({
|
|
|
|
cls: 'btn-toolbar x-huge icon-top',
|
2019-06-18 13:20:52 +00:00
|
|
|
iconCls: 'btn-watermark',
|
2019-04-05 11:28:51 +00:00
|
|
|
caption: me.capBtnWatermark,
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
cls: 'ppm-toolbar',
|
|
|
|
items: [
|
|
|
|
{
|
2019-06-18 09:35:01 +00:00
|
|
|
caption: this.textEditWatermark,
|
|
|
|
value: 'edit'
|
2019-04-05 11:28:51 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
caption: this.textRemWatermark,
|
|
|
|
value: 'remove'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
me.toolbarControls.push(me.btnImgAlign,
|
2019-04-05 11:28:51 +00:00
|
|
|
me.btnImgGroup, me.btnImgForward, me.btnImgBackward, me.btnImgWrapping, me.btnWatermark);
|
2018-05-15 12:37:26 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Menus
|
|
|
|
//
|
|
|
|
|
|
|
|
this.mnuLineSpace = this.btnLineSpace.menu;
|
|
|
|
this.mnuNonPrinting = this.btnShowHidenChars.menu;
|
|
|
|
this.mnuInsertTable = this.btnInsertTable.menu;
|
|
|
|
this.mnuInsertImage = this.btnInsertImage.menu;
|
|
|
|
this.mnuPageSize = this.btnPageSize.menu;
|
|
|
|
this.mnuColorSchema = this.btnColorSchemas.menu;
|
|
|
|
|
|
|
|
this.cmbFontSize = new Common.UI.ComboBox({
|
|
|
|
cls: 'input-group-nr',
|
|
|
|
menuStyle: 'min-width: 55px;',
|
|
|
|
hint: this.tipFontSize,
|
|
|
|
data: [
|
|
|
|
{value: 8, displayValue: "8"},
|
|
|
|
{value: 9, displayValue: "9"},
|
|
|
|
{value: 10, displayValue: "10"},
|
|
|
|
{value: 11, displayValue: "11"},
|
|
|
|
{value: 12, displayValue: "12"},
|
|
|
|
{value: 14, displayValue: "14"},
|
|
|
|
{value: 16, displayValue: "16"},
|
|
|
|
{value: 18, displayValue: "18"},
|
|
|
|
{value: 20, displayValue: "20"},
|
|
|
|
{value: 22, displayValue: "22"},
|
|
|
|
{value: 24, displayValue: "24"},
|
|
|
|
{value: 26, displayValue: "26"},
|
|
|
|
{value: 28, displayValue: "28"},
|
|
|
|
{value: 36, displayValue: "36"},
|
|
|
|
{value: 48, displayValue: "48"},
|
2019-02-12 11:48:27 +00:00
|
|
|
{value: 72, displayValue: "72"},
|
|
|
|
{value: 96, displayValue: "96"}
|
2018-05-15 12:37:26 +00:00
|
|
|
]
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.cmbFontSize);
|
|
|
|
|
|
|
|
this.cmbFontName = new Common.UI.ComboBoxFonts({
|
|
|
|
cls: 'input-group-nr',
|
|
|
|
menuCls: 'scrollable-menu',
|
|
|
|
menuStyle: 'min-width: 325px;',
|
|
|
|
hint: this.tipFontName,
|
|
|
|
store: new Common.Collections.Fonts()
|
|
|
|
});
|
|
|
|
this.paragraphControls.push(this.cmbFontName);
|
|
|
|
|
|
|
|
this.listStylesAdditionalMenuItem = new Common.UI.MenuItem({
|
|
|
|
template: _.template(
|
|
|
|
'<div id="id-save-style-container" class = "save-style-container">' +
|
|
|
|
'<span id="id-save-style-plus" class="plus img-commonctrl" ></span>' +
|
|
|
|
'<label id="id-save-style-link" class="save-style-link" >' + me.textStyleMenuNew + '</label>' +
|
|
|
|
'</div>')
|
|
|
|
});
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.listStyles = new Common.UI.ComboDataView({
|
|
|
|
cls: 'combo-styles',
|
|
|
|
itemWidth: 104,
|
|
|
|
itemHeight: 38,
|
2016-03-11 00:48:53 +00:00
|
|
|
// hint : this.tipParagraphStyle,
|
2018-05-15 12:37:26 +00:00
|
|
|
enableKeyEvents: true,
|
|
|
|
additionalMenuItems: [this.listStylesAdditionalMenuItem],
|
|
|
|
beforeOpenHandler: function (e) {
|
|
|
|
var cmp = this,
|
|
|
|
menu = cmp.openButton.menu,
|
|
|
|
minMenuColumn = 6;
|
|
|
|
|
|
|
|
if (menu.cmpEl) {
|
|
|
|
var itemEl = $(cmp.cmpEl.find('.dataview.inner .style').get(0)).parent();
|
|
|
|
var itemMargin = /*parseInt($(itemEl.get(0)).parent().css('margin-right'))*/-1;
|
|
|
|
var itemWidth = itemEl.is(':visible') ? parseInt(itemEl.css('width')) :
|
|
|
|
(cmp.itemWidth + parseInt(itemEl.css('padding-left')) + parseInt(itemEl.css('padding-right')) +
|
|
|
|
parseInt(itemEl.css('border-left-width')) + parseInt(itemEl.css('border-right-width')));
|
|
|
|
|
|
|
|
var minCount = cmp.menuPicker.store.length >= minMenuColumn ? minMenuColumn : cmp.menuPicker.store.length,
|
|
|
|
columnCount = Math.min(cmp.menuPicker.store.length, Math.round($('.dataview', $(cmp.fieldPicker.el)).width() / (itemMargin + itemWidth) + 0.5));
|
|
|
|
|
|
|
|
columnCount = columnCount < minCount ? minCount : columnCount;
|
|
|
|
menu.menuAlignEl = cmp.cmpEl;
|
|
|
|
|
|
|
|
menu.menuAlign = 'tl-tl';
|
|
|
|
var offset = cmp.cmpEl.width() - cmp.openButton.$el.width() - columnCount * (itemMargin + itemWidth) - 1;
|
|
|
|
menu.setOffset(Math.min(offset, 0));
|
|
|
|
|
|
|
|
menu.cmpEl.css({
|
|
|
|
'width': columnCount * (itemWidth + itemMargin),
|
|
|
|
'min-height': cmp.cmpEl.height()
|
|
|
|
});
|
|
|
|
}
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
if (cmp.menuPicker.scroller) {
|
|
|
|
cmp.menuPicker.scroller.update({
|
|
|
|
includePadding: true,
|
|
|
|
suppressScrollX: true
|
|
|
|
});
|
|
|
|
}
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
cmp.removeTips();
|
2017-02-20 14:51:33 +00:00
|
|
|
}
|
2018-05-15 12:37:26 +00:00
|
|
|
});
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.listStyles.fieldPicker.itemTemplate = _.template([
|
|
|
|
'<div class="style" id="<%= id %>">',
|
|
|
|
'<div style="background-image: url(<%= imageUrl %>); width: ' + this.listStyles.itemWidth + 'px; height: ' + this.listStyles.itemHeight + 'px;"/>',
|
|
|
|
'</div>'
|
|
|
|
].join(''));
|
|
|
|
this.listStyles.menuPicker.itemTemplate = _.template([
|
|
|
|
'<div class="style" id="<%= id %>">',
|
|
|
|
'<div style="background-image: url(<%= imageUrl %>); width: ' + this.listStyles.itemWidth + 'px; height: ' + this.listStyles.itemHeight + 'px;"/>',
|
|
|
|
'</div>'
|
|
|
|
].join(''));
|
|
|
|
this.paragraphControls.push(this.listStyles);
|
|
|
|
this.textOnlyControls.push(this.listStyles);
|
|
|
|
|
|
|
|
// Disable all components before load document
|
|
|
|
_.each(this.toolbarControls.concat(this.paragraphControls), function (cmp) {
|
|
|
|
if (_.isFunction(cmp.setDisabled))
|
|
|
|
cmp.setDisabled(true);
|
|
|
|
});
|
|
|
|
this.btnMailRecepients.setDisabled(true);
|
|
|
|
|
|
|
|
var editStyleMenuUpdate = new Common.UI.MenuItem({
|
|
|
|
caption: me.textStyleMenuUpdate
|
|
|
|
}).on('click', _.bind(me.onStyleMenuUpdate, me));
|
|
|
|
|
|
|
|
var editStyleMenuRestore = new Common.UI.MenuItem({
|
|
|
|
caption: me.textStyleMenuDelete
|
|
|
|
}).on('click', _.bind(me.onStyleMenuDelete, me));
|
|
|
|
|
|
|
|
var editStyleMenuDelete = new Common.UI.MenuItem({
|
|
|
|
caption: me.textStyleMenuRestore
|
|
|
|
}).on('click', _.bind(me.onStyleMenuDelete, me));
|
|
|
|
|
|
|
|
var editStyleMenuRestoreAll = new Common.UI.MenuItem({
|
|
|
|
caption: me.textStyleMenuRestoreAll
|
|
|
|
}).on('click', _.bind(me.onStyleMenuRestoreAll, me));
|
|
|
|
|
|
|
|
var editStyleMenuDeleteAll = new Common.UI.MenuItem({
|
|
|
|
caption: me.textStyleMenuDeleteAll
|
|
|
|
}).on('click', _.bind(me.onStyleMenuDeleteAll, me));
|
|
|
|
|
|
|
|
if (this.styleMenu == null) {
|
|
|
|
this.styleMenu = new Common.UI.Menu({
|
|
|
|
items: [
|
|
|
|
editStyleMenuUpdate,
|
|
|
|
editStyleMenuRestore,
|
|
|
|
editStyleMenuDelete,
|
|
|
|
editStyleMenuRestoreAll,
|
|
|
|
editStyleMenuDeleteAll
|
|
|
|
]
|
|
|
|
});
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
this.on('render:after', _.bind(this.onToolbarAfterRender, this));
|
|
|
|
} else {
|
|
|
|
Common.UI.Mixtbar.prototype.initialize.call(this, {
|
|
|
|
template: _.template(template_view),
|
|
|
|
tabs: [
|
2018-05-16 14:41:47 +00:00
|
|
|
{caption: me.textTabFile, action: 'file', haspanel: false}
|
2018-05-15 12:37:26 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
);
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
2017-02-20 14:51:33 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function (mode) {
|
|
|
|
var me = this;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Render UI layout
|
|
|
|
*/
|
|
|
|
|
2017-03-01 13:33:12 +00:00
|
|
|
this.fireEvent('render:before', [this]);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2017-04-20 14:45:47 +00:00
|
|
|
me.isCompactView = mode.isCompactView;
|
2017-04-20 10:35:06 +00:00
|
|
|
if ( mode.isEdit ) {
|
2017-04-22 12:42:52 +00:00
|
|
|
me.$el.html(me.rendererComponents(me.$layout));
|
2017-04-20 10:35:06 +00:00
|
|
|
} else {
|
2017-04-22 12:42:52 +00:00
|
|
|
me.$layout.find('.canedit').hide();
|
|
|
|
me.$layout.addClass('folded');
|
|
|
|
me.$el.html(me.$layout);
|
2017-04-10 13:39:03 +00:00
|
|
|
}
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-03-01 13:33:12 +00:00
|
|
|
this.fireEvent('render:after', [this]);
|
2017-04-22 12:42:52 +00:00
|
|
|
Common.UI.Mixtbar.prototype.afterRender.call(this);
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
Common.NotificationCenter.on({
|
2017-04-22 12:42:52 +00:00
|
|
|
'window:resize': function() {
|
|
|
|
Common.UI.Mixtbar.prototype.onResize.apply(me, arguments);
|
|
|
|
}
|
2017-02-20 14:51:33 +00:00
|
|
|
});
|
2017-02-15 13:45:25 +00:00
|
|
|
|
2018-05-15 12:37:26 +00:00
|
|
|
if ( mode.isEdit ) {
|
|
|
|
/** coauthoring begin **/
|
|
|
|
this.showSynchTip = !Common.localStorage.getBool("de-hide-synch");
|
|
|
|
this.needShowSynchTip = false;
|
|
|
|
/** coauthoring end **/
|
|
|
|
|
|
|
|
me.setTab('home');
|
|
|
|
|
|
|
|
var top = Common.localStorage.getItem("de-pgmargins-top"),
|
|
|
|
left = Common.localStorage.getItem("de-pgmargins-left"),
|
|
|
|
bottom = Common.localStorage.getItem("de-pgmargins-bottom"),
|
|
|
|
right = Common.localStorage.getItem("de-pgmargins-right");
|
|
|
|
if ( top!==null && left!==null && bottom!==null && right!==null ) {
|
|
|
|
var mnu = this.btnPageMargins.menu.items[0];
|
|
|
|
mnu.options.value = mnu.value = [parseFloat(top), parseFloat(left), parseFloat(bottom), parseFloat(right)];
|
|
|
|
mnu.setVisible(true);
|
|
|
|
$(mnu.el).html(mnu.template({id: Common.UI.getId(), caption : mnu.caption, options : mnu.options}));
|
|
|
|
} else
|
|
|
|
this.btnPageMargins.menu.items[0].setVisible(false);
|
|
|
|
}
|
|
|
|
|
2017-04-06 09:34:01 +00:00
|
|
|
if ( me.isCompactView )
|
2018-03-21 11:28:28 +00:00
|
|
|
me.setFolded(true);
|
2017-02-15 13:45:25 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2017-08-30 12:23:22 +00:00
|
|
|
onTabClick: function (e) {
|
2018-05-16 14:41:47 +00:00
|
|
|
var me = this,
|
|
|
|
tab = $(e.currentTarget).find('> a[data-tab]').data('tab'),
|
|
|
|
is_file_active = me.isTabActive('file');
|
2017-08-30 12:23:22 +00:00
|
|
|
|
|
|
|
Common.UI.Mixtbar.prototype.onTabClick.apply(me, arguments);
|
2018-03-05 09:28:37 +00:00
|
|
|
|
2018-05-16 14:41:47 +00:00
|
|
|
if ( is_file_active ) {
|
|
|
|
me.fireEvent('file:close');
|
|
|
|
} else
|
|
|
|
if ( tab == 'file' ) {
|
|
|
|
me.fireEvent('file:open');
|
|
|
|
me.setTab(tab);
|
|
|
|
}
|
|
|
|
|
2018-03-05 09:28:37 +00:00
|
|
|
if ( me.isTabActive('home'))
|
|
|
|
me.fireEvent('home:open');
|
2017-08-30 12:23:22 +00:00
|
|
|
},
|
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
rendererComponents: function (html) {
|
|
|
|
var $host = $(html);
|
|
|
|
var _injectComponent = function (id, cmp) {
|
2019-08-22 14:28:26 +00:00
|
|
|
Common.Utils.injectComponent($host.findById(id), cmp);
|
2017-02-20 14:51:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_injectComponent('#slot-field-fontname', this.cmbFontName);
|
|
|
|
_injectComponent('#slot-field-fontsize', this.cmbFontSize);
|
|
|
|
_injectComponent('#slot-btn-print', this.btnPrint);
|
|
|
|
_injectComponent('#slot-btn-save', this.btnSave);
|
|
|
|
_injectComponent('#slot-btn-undo', this.btnUndo);
|
|
|
|
_injectComponent('#slot-btn-redo', this.btnRedo);
|
|
|
|
_injectComponent('#slot-btn-copy', this.btnCopy);
|
|
|
|
_injectComponent('#slot-btn-paste', this.btnPaste);
|
|
|
|
_injectComponent('#slot-btn-incfont', this.btnIncFontSize);
|
|
|
|
_injectComponent('#slot-btn-decfont', this.btnDecFontSize);
|
|
|
|
_injectComponent('#slot-btn-bold', this.btnBold);
|
|
|
|
_injectComponent('#slot-btn-italic', this.btnItalic);
|
|
|
|
_injectComponent('#slot-btn-underline', this.btnUnderline);
|
|
|
|
_injectComponent('#slot-btn-strikeout', this.btnStrikeout);
|
|
|
|
_injectComponent('#slot-btn-superscript', this.btnSuperscript);
|
|
|
|
_injectComponent('#slot-btn-subscript', this.btnSubscript);
|
|
|
|
_injectComponent('#slot-btn-highlight', this.btnHighlightColor);
|
|
|
|
_injectComponent('#slot-btn-fontcolor', this.btnFontColor);
|
|
|
|
_injectComponent('#slot-btn-align-left', this.btnAlignLeft);
|
|
|
|
_injectComponent('#slot-btn-align-center', this.btnAlignCenter);
|
|
|
|
_injectComponent('#slot-btn-align-right', this.btnAlignRight);
|
|
|
|
_injectComponent('#slot-btn-align-just', this.btnAlignJust);
|
|
|
|
_injectComponent('#slot-btn-incoffset', this.btnIncLeftOffset);
|
|
|
|
_injectComponent('#slot-btn-decoffset', this.btnDecLeftOffset);
|
|
|
|
_injectComponent('#slot-btn-linespace', this.btnLineSpace);
|
|
|
|
_injectComponent('#slot-btn-hidenchars', this.btnShowHidenChars);
|
|
|
|
_injectComponent('#slot-btn-markers', this.btnMarkers);
|
|
|
|
_injectComponent('#slot-btn-numbering', this.btnNumbers);
|
|
|
|
_injectComponent('#slot-btn-multilevels', this.btnMultilevels);
|
|
|
|
_injectComponent('#slot-btn-instable', this.btnInsertTable);
|
|
|
|
_injectComponent('#slot-btn-insimage', this.btnInsertImage);
|
|
|
|
_injectComponent('#slot-btn-inschart', this.btnInsertChart);
|
|
|
|
_injectComponent('#slot-btn-instext', this.btnInsertText);
|
2017-06-26 13:11:50 +00:00
|
|
|
_injectComponent('#slot-btn-instextart', this.btnInsertTextArt);
|
2017-02-20 14:51:33 +00:00
|
|
|
_injectComponent('#slot-btn-dropcap', this.btnDropCap);
|
2017-12-12 11:14:27 +00:00
|
|
|
_injectComponent('#slot-btn-controls', this.btnContentControls);
|
2017-02-20 14:51:33 +00:00
|
|
|
_injectComponent('#slot-btn-columns', this.btnColumns);
|
|
|
|
_injectComponent('#slot-btn-editheader', this.btnEditHeader);
|
2018-11-20 09:57:29 +00:00
|
|
|
_injectComponent('#slot-btn-blankpage', this.btnBlankPage);
|
2017-02-20 14:51:33 +00:00
|
|
|
_injectComponent('#slot-btn-insshape', this.btnInsertShape);
|
|
|
|
_injectComponent('#slot-btn-insequation', this.btnInsertEquation);
|
|
|
|
_injectComponent('#slot-btn-pageorient', this.btnPageOrient);
|
|
|
|
_injectComponent('#slot-btn-pagemargins', this.btnPageMargins);
|
|
|
|
_injectComponent('#slot-btn-pagesize', this.btnPageSize);
|
|
|
|
_injectComponent('#slot-btn-clearstyle', this.btnClearStyle);
|
|
|
|
_injectComponent('#slot-btn-copystyle', this.btnCopyStyle);
|
|
|
|
_injectComponent('#slot-btn-colorschemas', this.btnColorSchemas);
|
|
|
|
_injectComponent('#slot-btn-paracolor', this.btnParagraphColor);
|
|
|
|
_injectComponent('#slot-field-styles', this.listStyles);
|
|
|
|
_injectComponent('#slot-btn-halign', this.btnHorizontalAlign);
|
|
|
|
_injectComponent('#slot-btn-mailrecepients', this.btnMailRecepients);
|
2017-03-29 16:24:20 +00:00
|
|
|
_injectComponent('#slot-img-align', this.btnImgAlign);
|
|
|
|
_injectComponent('#slot-img-group', this.btnImgGroup);
|
|
|
|
_injectComponent('#slot-img-movefrwd', this.btnImgForward);
|
|
|
|
_injectComponent('#slot-img-movebkwd', this.btnImgBackward);
|
|
|
|
_injectComponent('#slot-img-wrapping', this.btnImgWrapping);
|
2019-04-05 11:28:51 +00:00
|
|
|
_injectComponent('#slot-btn-watermark', this.btnWatermark);
|
2017-03-29 16:24:20 +00:00
|
|
|
|
2019-06-11 07:52:13 +00:00
|
|
|
this.btnsPageBreak = Common.Utils.injectButtons($host.find('.btn-slot.btn-pagebreak'), '', 'btn-pagebreak', this.capBtnInsPagebreak, undefined, true, true);
|
|
|
|
Array.prototype.push.apply(this.paragraphControls, this.btnsPageBreak);
|
2017-03-31 10:54:02 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
return $host;
|
|
|
|
},
|
|
|
|
|
2017-03-31 10:54:02 +00:00
|
|
|
onAppReady: function (config) {
|
|
|
|
var me = this;
|
|
|
|
(new Promise( function(resolve, reject) {
|
|
|
|
resolve();
|
|
|
|
})).then(function () {
|
2017-04-10 13:39:03 +00:00
|
|
|
if ( !config.isEdit ) return;
|
|
|
|
|
2017-03-31 10:54:02 +00:00
|
|
|
me.btnsPageBreak.forEach( function(btn) {
|
|
|
|
btn.updateHint( me.tipPageBreak );
|
|
|
|
|
|
|
|
var _menu_section_break = new Common.UI.Menu({
|
|
|
|
menuAlign: 'tl-tr',
|
|
|
|
items: [
|
|
|
|
{caption: me.textNextPage, value: Asc.c_oAscSectionBreakType.NextPage},
|
|
|
|
{caption: me.textContPage, value: Asc.c_oAscSectionBreakType.Continuous},
|
|
|
|
{caption: me.textEvenPage, value: Asc.c_oAscSectionBreakType.EvenPage},
|
|
|
|
{caption: me.textOddPage, value: Asc.c_oAscSectionBreakType.OddPage}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
|
|
|
var _menu = new Common.UI.Menu({
|
|
|
|
items: [
|
2019-03-21 09:44:09 +00:00
|
|
|
{caption: me.textInsPageBreak, value: 'page'},
|
2017-03-31 10:54:02 +00:00
|
|
|
{caption: me.textInsColumnBreak, value: 'column'},
|
|
|
|
{caption: me.textInsSectionBreak, value: 'section', menu: _menu_section_break}
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
|
|
|
btn.setMenu(_menu);
|
|
|
|
});
|
2017-04-04 15:43:19 +00:00
|
|
|
|
|
|
|
var _holder_view = DE.getController('DocumentHolder').getView();
|
|
|
|
me.btnImgForward.updateHint(me.tipSendForward);
|
|
|
|
me.btnImgForward.setMenu(new Common.UI.Menu({
|
|
|
|
items: [{
|
|
|
|
caption : _holder_view.textArrangeFront,
|
|
|
|
iconCls : 'mnu-arrange-front',
|
|
|
|
valign : Asc.c_oAscChangeLevel.BringToFront
|
|
|
|
}, {
|
|
|
|
caption : _holder_view.textArrangeForward,
|
|
|
|
iconCls : 'mnu-arrange-forward',
|
|
|
|
valign : Asc.c_oAscChangeLevel.BringForward
|
|
|
|
}
|
|
|
|
]})
|
|
|
|
);
|
|
|
|
|
|
|
|
me.btnImgBackward.updateHint(me.tipSendBackward);
|
|
|
|
me.btnImgBackward.setMenu(new Common.UI.Menu({
|
|
|
|
items: [{
|
|
|
|
caption : _holder_view.textArrangeBack,
|
|
|
|
iconCls : 'mnu-arrange-back',
|
|
|
|
valign : Asc.c_oAscChangeLevel.SendToBack
|
|
|
|
}, {
|
|
|
|
caption : _holder_view.textArrangeBackward,
|
|
|
|
iconCls : 'mnu-arrange-backward',
|
|
|
|
valign : Asc.c_oAscChangeLevel.BringBackward
|
|
|
|
}]
|
|
|
|
}));
|
|
|
|
|
|
|
|
me.btnImgAlign.updateHint(me.tipImgAlign);
|
2019-02-12 12:31:27 +00:00
|
|
|
|
|
|
|
me.mniAlignToPage = new Common.UI.MenuItem({
|
|
|
|
caption: me.txtPageAlign,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'imgalign',
|
|
|
|
value: -1
|
|
|
|
}).on('click', function (mnu) {
|
|
|
|
Common.Utils.InternalSettings.set("de-img-align-to", 1);
|
|
|
|
});
|
|
|
|
me.mniAlignToMargin = new Common.UI.MenuItem({
|
|
|
|
caption: me.txtMarginAlign,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'imgalign',
|
|
|
|
value: -1
|
|
|
|
}).on('click', function (mnu) {
|
|
|
|
Common.Utils.InternalSettings.set("de-img-align-to", 2);
|
|
|
|
});
|
|
|
|
me.mniAlignObjects = new Common.UI.MenuItem({
|
|
|
|
caption: me.txtObjectsAlign,
|
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'imgalign',
|
|
|
|
value: -1
|
|
|
|
}).on('click', function (mnu) {
|
|
|
|
Common.Utils.InternalSettings.set("de-img-align-to", 3);
|
|
|
|
});
|
|
|
|
|
|
|
|
me.mniDistribHor = new Common.UI.MenuItem({
|
|
|
|
caption: me.txtDistribHor,
|
|
|
|
iconCls: 'mnu-distrib-hor',
|
|
|
|
value: 6
|
|
|
|
});
|
|
|
|
me.mniDistribVert = new Common.UI.MenuItem({
|
|
|
|
caption: me.txtDistribVert,
|
|
|
|
iconCls: 'mnu-distrib-vert',
|
|
|
|
value: 7
|
|
|
|
});
|
|
|
|
|
2017-04-04 15:43:19 +00:00
|
|
|
me.btnImgAlign.setMenu(new Common.UI.Menu({
|
|
|
|
items: [{
|
|
|
|
caption : _holder_view.textShapeAlignLeft,
|
|
|
|
iconCls : 'mnu-img-align-left',
|
2019-02-12 12:31:27 +00:00
|
|
|
value: Asc.c_oAscAlignShapeType.ALIGN_LEFT
|
2017-04-04 15:43:19 +00:00
|
|
|
}, {
|
|
|
|
caption : _holder_view.textShapeAlignCenter,
|
|
|
|
iconCls : 'mnu-img-align-center',
|
2019-02-12 12:31:27 +00:00
|
|
|
value: Asc.c_oAscAlignShapeType.ALIGN_CENTER
|
2017-04-04 15:43:19 +00:00
|
|
|
}, {
|
|
|
|
caption : _holder_view.textShapeAlignRight,
|
|
|
|
iconCls : 'mnu-img-align-right',
|
2019-02-12 12:31:27 +00:00
|
|
|
value: Asc.c_oAscAlignShapeType.ALIGN_RIGHT
|
2017-04-04 15:43:19 +00:00
|
|
|
}, {
|
|
|
|
caption : _holder_view.textShapeAlignTop,
|
|
|
|
iconCls : 'mnu-img-align-top',
|
2019-02-12 12:31:27 +00:00
|
|
|
value: Asc.c_oAscAlignShapeType.ALIGN_TOP
|
2017-04-04 15:43:19 +00:00
|
|
|
}, {
|
|
|
|
caption : _holder_view.textShapeAlignMiddle,
|
|
|
|
iconCls : 'mnu-img-align-middle',
|
2019-02-12 12:31:27 +00:00
|
|
|
value: Asc.c_oAscAlignShapeType.ALIGN_MIDDLE
|
2017-04-04 15:43:19 +00:00
|
|
|
}, {
|
|
|
|
caption : _holder_view.textShapeAlignBottom,
|
|
|
|
iconCls : 'mnu-img-align-bottom',
|
2019-02-12 12:31:27 +00:00
|
|
|
value: Asc.c_oAscAlignShapeType.ALIGN_BOTTOM
|
|
|
|
},
|
|
|
|
{caption: '--'},
|
|
|
|
me.mniDistribHor,
|
|
|
|
me.mniDistribVert,
|
|
|
|
{caption: '--'},
|
|
|
|
me.mniAlignToPage,
|
|
|
|
me.mniAlignToMargin,
|
|
|
|
me.mniAlignObjects
|
|
|
|
]
|
2017-04-04 15:43:19 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
me.btnImgGroup.updateHint(me.tipImgGroup);
|
|
|
|
me.btnImgGroup.setMenu(new Common.UI.Menu({
|
|
|
|
items: [{
|
|
|
|
caption : _holder_view.txtGroup,
|
|
|
|
iconCls : 'mnu-arrange-group',
|
|
|
|
groupval: 1
|
|
|
|
}, {
|
|
|
|
caption : _holder_view.txtUngroup,
|
|
|
|
iconCls : 'mnu-arrange-ungroup',
|
|
|
|
groupval: -1
|
|
|
|
}]
|
|
|
|
}));
|
|
|
|
|
|
|
|
me.btnImgWrapping.updateHint(me.tipImgWrapping);
|
|
|
|
me.btnImgWrapping.setMenu(new Common.UI.Menu({
|
|
|
|
cls: 'ppm-toolbar',
|
|
|
|
items: [{
|
|
|
|
caption : _holder_view.txtInline,
|
|
|
|
iconCls : 'mnu-wrap-inline',
|
|
|
|
toggleGroup : 'imgwrapping',
|
|
|
|
wrapType : Asc.c_oAscWrapStyle2.Inline,
|
|
|
|
checkable : true
|
|
|
|
}, {
|
|
|
|
caption : _holder_view.txtSquare,
|
|
|
|
iconCls : 'mnu-wrap-square',
|
|
|
|
toggleGroup : 'imgwrapping',
|
|
|
|
wrapType : Asc.c_oAscWrapStyle2.Square,
|
|
|
|
checkable : true
|
|
|
|
}, {
|
|
|
|
caption : _holder_view.txtTight,
|
|
|
|
iconCls : 'mnu-wrap-tight',
|
|
|
|
toggleGroup : 'imgwrapping',
|
|
|
|
wrapType : Asc.c_oAscWrapStyle2.Tight,
|
|
|
|
checkable : true
|
|
|
|
}, {
|
|
|
|
caption : _holder_view.txtThrough,
|
|
|
|
iconCls : 'mnu-wrap-through',
|
|
|
|
toggleGroup : 'imgwrapping',
|
|
|
|
wrapType : Asc.c_oAscWrapStyle2.Through,
|
|
|
|
checkable : true
|
|
|
|
}, {
|
|
|
|
caption : _holder_view.txtTopAndBottom,
|
|
|
|
iconCls : 'mnu-wrap-topAndBottom',
|
|
|
|
toggleGroup : 'imgwrapping',
|
|
|
|
wrapType : Asc.c_oAscWrapStyle2.TopAndBottom,
|
|
|
|
checkable : true
|
|
|
|
}, {
|
|
|
|
caption : _holder_view.txtInFront,
|
|
|
|
iconCls : 'mnu-wrap-inFront',
|
|
|
|
toggleGroup : 'imgwrapping',
|
|
|
|
wrapType : Asc.c_oAscWrapStyle2.InFront,
|
|
|
|
checkable : true
|
|
|
|
}, {
|
|
|
|
caption : _holder_view.txtBehind,
|
|
|
|
iconCls : 'mnu-wrap-behind',
|
|
|
|
toggleGroup : 'imgwrapping',
|
|
|
|
wrapType : Asc.c_oAscWrapStyle2.Behind,
|
|
|
|
checkable : true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}));
|
2019-04-05 11:28:51 +00:00
|
|
|
|
|
|
|
me.btnWatermark.updateHint(me.tipWatermark);
|
2017-03-31 10:54:02 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
createDelayedElements: function () {
|
|
|
|
if (this.api) {
|
|
|
|
this.mnuNonPrinting.items[0].setChecked(this.api.get_ShowParaMarks(), true);
|
|
|
|
this.mnuNonPrinting.items[1].setChecked(this.api.get_ShowTableEmptyLine(), true);
|
|
|
|
this.btnShowHidenChars.toggle(this.mnuNonPrinting.items[0].checked, true);
|
|
|
|
|
|
|
|
this.updateMetricUnit();
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
2016-08-04 17:02:57 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
// set hints
|
|
|
|
this.btnPrint.updateHint(this.tipPrint + Common.Utils.String.platformKey('Ctrl+P'));
|
|
|
|
this.btnSave.updateHint(this.btnSaveTip);
|
|
|
|
this.btnUndo.updateHint(this.tipUndo + Common.Utils.String.platformKey('Ctrl+Z'));
|
|
|
|
this.btnRedo.updateHint(this.tipRedo + Common.Utils.String.platformKey('Ctrl+Y'));
|
|
|
|
this.btnCopy.updateHint(this.tipCopy + Common.Utils.String.platformKey('Ctrl+C'));
|
|
|
|
this.btnPaste.updateHint(this.tipPaste + Common.Utils.String.platformKey('Ctrl+V'));
|
|
|
|
this.btnIncFontSize.updateHint(this.tipIncFont + Common.Utils.String.platformKey('Ctrl+]'));
|
|
|
|
this.btnDecFontSize.updateHint(this.tipDecFont + Common.Utils.String.platformKey('Ctrl+['));
|
|
|
|
this.btnBold.updateHint(this.textBold + Common.Utils.String.platformKey('Ctrl+B'));
|
|
|
|
this.btnItalic.updateHint(this.textItalic + Common.Utils.String.platformKey('Ctrl+I'));
|
|
|
|
this.btnUnderline.updateHint(this.textUnderline + Common.Utils.String.platformKey('Ctrl+U'));
|
|
|
|
this.btnStrikeout.updateHint(this.textStrikeout);
|
|
|
|
this.btnSuperscript.updateHint(this.textSuperscript);
|
|
|
|
this.btnSubscript.updateHint(this.textSubscript);
|
|
|
|
this.btnHighlightColor.updateHint(this.tipHighlightColor);
|
|
|
|
this.btnFontColor.updateHint(this.tipFontColor);
|
|
|
|
this.btnParagraphColor.updateHint(this.tipPrColor);
|
|
|
|
this.btnAlignLeft.updateHint(this.tipAlignLeft + Common.Utils.String.platformKey('Ctrl+L'));
|
|
|
|
this.btnAlignCenter.updateHint(this.tipAlignCenter + Common.Utils.String.platformKey('Ctrl+E'));
|
|
|
|
this.btnAlignRight.updateHint(this.tipAlignRight + Common.Utils.String.platformKey('Ctrl+R'));
|
|
|
|
this.btnAlignJust.updateHint(this.tipAlignJust + Common.Utils.String.platformKey('Ctrl+J'));
|
|
|
|
this.btnHorizontalAlign.updateHint(this.tipHAligh);
|
|
|
|
this.btnDecLeftOffset.updateHint(this.tipDecPrLeft + Common.Utils.String.platformKey('Ctrl+Shift+M'));
|
|
|
|
this.btnIncLeftOffset.updateHint(this.tipIncPrLeft + Common.Utils.String.platformKey('Ctrl+M'));
|
|
|
|
this.btnLineSpace.updateHint(this.tipLineSpace);
|
2018-02-26 14:38:35 +00:00
|
|
|
this.btnShowHidenChars.updateHint(this.tipShowHiddenChars + Common.Utils.String.platformKey('Ctrl+*'));
|
2017-02-20 14:51:33 +00:00
|
|
|
this.btnMarkers.updateHint(this.tipMarkers);
|
|
|
|
this.btnNumbers.updateHint(this.tipNumbers);
|
|
|
|
this.btnMultilevels.updateHint(this.tipMultilevels);
|
|
|
|
this.btnInsertTable.updateHint(this.tipInsertTable);
|
|
|
|
this.btnInsertImage.updateHint(this.tipInsertImage);
|
|
|
|
this.btnInsertChart.updateHint(this.tipInsertChart);
|
|
|
|
this.btnInsertText.updateHint(this.tipInsertText);
|
2017-06-26 13:11:50 +00:00
|
|
|
this.btnInsertTextArt.updateHint(this.tipInsertTextArt);
|
2017-02-20 14:51:33 +00:00
|
|
|
this.btnEditHeader.updateHint(this.tipEditHeader);
|
2018-11-20 09:57:29 +00:00
|
|
|
this.btnBlankPage.updateHint(this.tipBlankPage);
|
2017-02-20 14:51:33 +00:00
|
|
|
this.btnInsertShape.updateHint(this.tipInsertShape);
|
|
|
|
this.btnInsertEquation.updateHint(this.tipInsertEquation);
|
|
|
|
this.btnDropCap.updateHint(this.tipDropCap);
|
2017-12-12 11:14:27 +00:00
|
|
|
this.btnContentControls.updateHint(this.tipControls);
|
2017-02-20 14:51:33 +00:00
|
|
|
this.btnColumns.updateHint(this.tipColumns);
|
|
|
|
this.btnPageOrient.updateHint(this.tipPageOrient);
|
|
|
|
this.btnPageSize.updateHint(this.tipPageSize);
|
|
|
|
this.btnPageMargins.updateHint(this.tipPageMargins);
|
|
|
|
this.btnClearStyle.updateHint(this.tipClearStyle);
|
|
|
|
this.btnCopyStyle.updateHint(this.tipCopyStyle + Common.Utils.String.platformKey('Ctrl+Shift+C'));
|
|
|
|
this.btnColorSchemas.updateHint(this.tipColorSchemas);
|
|
|
|
this.btnMailRecepients.updateHint(this.tipMailRecepients);
|
|
|
|
|
|
|
|
// set menus
|
|
|
|
|
|
|
|
var me = this;
|
|
|
|
|
|
|
|
this.btnMarkers.setMenu(
|
|
|
|
new Common.UI.Menu({
|
2018-02-07 12:14:20 +00:00
|
|
|
style: 'min-width: 139px',
|
2017-02-20 14:51:33 +00:00
|
|
|
items: [
|
2018-02-07 12:14:20 +00:00
|
|
|
{template: _.template('<div id="id-toolbar-menu-markers" class="menu-markers" style="width: 139px; margin: 0 5px;"></div>')}
|
2017-02-20 14:51:33 +00:00
|
|
|
]
|
|
|
|
})
|
|
|
|
);
|
2016-08-04 17:02:57 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
this.btnNumbers.setMenu(
|
|
|
|
new Common.UI.Menu({
|
|
|
|
items: [
|
2017-05-16 10:06:23 +00:00
|
|
|
{template: _.template('<div id="id-toolbar-menu-numbering" class="menu-markers" style="width: 185px; margin: 0 5px;"></div>')}
|
2017-02-20 14:51:33 +00:00
|
|
|
]
|
|
|
|
})
|
|
|
|
);
|
2016-08-04 17:02:57 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
this.btnMultilevels.setMenu(
|
|
|
|
new Common.UI.Menu({
|
2017-05-16 10:06:23 +00:00
|
|
|
style: 'min-width: 90px',
|
2017-02-20 14:51:33 +00:00
|
|
|
items: [
|
2017-05-16 10:06:23 +00:00
|
|
|
{template: _.template('<div id="id-toolbar-menu-multilevels" class="menu-markers" style="width: 93px; margin: 0 5px;"></div>')}
|
2017-02-20 14:51:33 +00:00
|
|
|
]
|
2016-08-17 13:25:21 +00:00
|
|
|
})
|
2017-02-20 14:51:33 +00:00
|
|
|
);
|
2016-08-17 13:25:21 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
this.btnEditHeader.setMenu(
|
|
|
|
new Common.UI.Menu({
|
|
|
|
items: [
|
|
|
|
{caption: this.mniEditHeader, value: 'header'},
|
|
|
|
{caption: this.mniEditFooter, value: 'footer'},
|
|
|
|
{caption: '--'},
|
|
|
|
this.mnuInsertPageNum = new Common.UI.MenuItem({
|
|
|
|
caption: this.textInsertPageNumber,
|
|
|
|
disabled: this.mnuInsertPageNum.isDisabled(),
|
|
|
|
menu: new Common.UI.Menu({
|
|
|
|
menuAlign: 'tl-tr',
|
|
|
|
items: [
|
|
|
|
{template: _.template('<div id="id-toolbar-menu-pageposition" class="menu-pageposition"></div>')},
|
|
|
|
this.mnuPageNumCurrentPos = new Common.UI.MenuItem({
|
|
|
|
caption: this.textToCurrent,
|
|
|
|
disabled: this.mnuPageNumCurrentPos.isDisabled(),
|
|
|
|
value: 'current'
|
|
|
|
})
|
|
|
|
]
|
|
|
|
})
|
|
|
|
}),
|
|
|
|
this.mnuInsertPageCount = new Common.UI.MenuItem({
|
|
|
|
caption: this.textInsertPageCount,
|
|
|
|
disabled: this.mnuInsertPageCount.isDisabled()
|
|
|
|
})
|
|
|
|
]
|
|
|
|
})
|
|
|
|
);
|
|
|
|
this.paragraphControls.push(this.mnuPageNumCurrentPos);
|
|
|
|
this.paragraphControls.push(this.mnuInsertPageCount);
|
|
|
|
|
2019-08-30 14:55:29 +00:00
|
|
|
this.btnInsertChart.setMenu( new Common.UI.Menu({
|
|
|
|
style: 'width: 435px;',
|
|
|
|
items: [
|
|
|
|
{template: _.template('<div id="id-toolbar-menu-insertchart" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}
|
|
|
|
]
|
|
|
|
}));
|
|
|
|
|
|
|
|
var onShowBefore = function(menu) {
|
|
|
|
var picker = new Common.UI.DataView({
|
|
|
|
el: $('#id-toolbar-menu-insertchart'),
|
|
|
|
parentMenu: menu,
|
|
|
|
showLast: false,
|
|
|
|
restoreHeight: 421,
|
|
|
|
groups: new Common.UI.DataViewGroupStore([
|
|
|
|
{id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts},
|
|
|
|
{id: 'menu-chart-group-line', caption: me.textLine},
|
|
|
|
{id: 'menu-chart-group-pie', caption: me.textPie},
|
|
|
|
{id: 'menu-chart-group-hbar', caption: me.textBar},
|
|
|
|
{id: 'menu-chart-group-area', caption: me.textArea, inline: true},
|
|
|
|
{id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true},
|
|
|
|
{id: 'menu-chart-group-stock', caption: me.textStock, inline: true}
|
|
|
|
// {id: 'menu-chart-group-surface', caption: me.textSurface}
|
|
|
|
]),
|
|
|
|
store: new Common.UI.DataViewStore([
|
|
|
|
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal'},
|
|
|
|
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'},
|
|
|
|
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'},
|
|
|
|
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'},
|
|
|
|
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'},
|
|
|
|
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'},
|
|
|
|
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'},
|
|
|
|
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'},
|
|
|
|
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'},
|
|
|
|
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'},
|
|
|
|
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'},
|
|
|
|
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'},
|
|
|
|
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'},
|
|
|
|
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'},
|
|
|
|
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'},
|
|
|
|
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'},
|
|
|
|
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'},
|
|
|
|
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'},
|
|
|
|
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'},
|
|
|
|
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'},
|
|
|
|
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'},
|
|
|
|
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'},
|
|
|
|
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'},
|
|
|
|
{ group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'},
|
|
|
|
{ group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'}
|
|
|
|
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'},
|
|
|
|
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'},
|
|
|
|
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'},
|
|
|
|
// { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'}
|
|
|
|
|
|
|
|
]),
|
|
|
|
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')
|
|
|
|
});
|
|
|
|
picker.on('item:click', function (picker, item, record, e) {
|
|
|
|
if (record)
|
|
|
|
me.fireEvent('add:chart', [record.get('type')]);
|
|
|
|
});
|
|
|
|
menu.off('show:before', onShowBefore);
|
|
|
|
};
|
|
|
|
this.btnInsertChart.menu.on('show:before', onShowBefore);
|
|
|
|
|
2019-09-03 10:32:06 +00:00
|
|
|
var onShowBeforeTextArt = function (menu) {
|
|
|
|
var collection = DE.getCollection('Common.Collections.TextArt');
|
|
|
|
if (collection.length<1)
|
|
|
|
DE.getController('Main').fillTextArt(me.api.asc_getTextArtPreviews());
|
|
|
|
var picker = new Common.UI.DataView({
|
|
|
|
el: $('#id-toolbar-menu-insart'),
|
|
|
|
store: collection,
|
|
|
|
parentMenu: menu,
|
|
|
|
showLast: false,
|
|
|
|
itemTemplate: _.template('<div class="item-art"><img src="<%= imageUrl %>" id="<%= id %>" style="width:50px;height:50px;"></div>')
|
|
|
|
});
|
|
|
|
picker.on('item:click', function (picker, item, record, e) {
|
|
|
|
if (record)
|
|
|
|
me.fireEvent('insert:textart', [record.get('data')]);
|
|
|
|
if (e.type !== 'click') menu.hide();
|
|
|
|
});
|
|
|
|
menu.off('show:before', onShowBeforeTextArt);
|
|
|
|
};
|
|
|
|
this.btnInsertTextArt.menu.on('show:before', onShowBeforeTextArt);
|
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
// set dataviews
|
|
|
|
|
|
|
|
var _conf = this.mnuMarkersPicker.conf;
|
|
|
|
this.mnuMarkersPicker = new Common.UI.DataView({
|
|
|
|
el: $('#id-toolbar-menu-markers'),
|
|
|
|
parentMenu: this.btnMarkers.menu,
|
2018-02-07 12:14:20 +00:00
|
|
|
restoreHeight: 138,
|
2017-02-20 14:51:33 +00:00
|
|
|
allowScrollbar: false,
|
|
|
|
store: new Common.UI.DataViewStore([
|
|
|
|
{offsety: 0, data: {type: 0, subtype: -1}},
|
|
|
|
{offsety: 38, data: {type: 0, subtype: 1}},
|
|
|
|
{offsety: 76, data: {type: 0, subtype: 2}},
|
|
|
|
{offsety: 114, data: {type: 0, subtype: 3}},
|
|
|
|
{offsety: 152, data: {type: 0, subtype: 4}},
|
|
|
|
{offsety: 190, data: {type: 0, subtype: 5}},
|
|
|
|
{offsety: 228, data: {type: 0, subtype: 6}},
|
2018-02-07 12:14:20 +00:00
|
|
|
{offsety: 266, data: {type: 0, subtype: 7}},
|
|
|
|
{offsety: 684, data: {type: 0, subtype: 8}}
|
2017-02-20 14:51:33 +00:00
|
|
|
]),
|
|
|
|
itemTemplate: _.template('<div id="<%= id %>" class="item-markerlist" style="background-position: 0 -<%= offsety %>px;"></div>')
|
|
|
|
});
|
|
|
|
_conf && this.mnuMarkersPicker.selectByIndex(_conf.index, true);
|
|
|
|
|
|
|
|
_conf = this.mnuNumbersPicker.conf;
|
|
|
|
this.mnuNumbersPicker = new Common.UI.DataView({
|
|
|
|
el: $('#id-toolbar-menu-numbering'),
|
|
|
|
parentMenu: this.btnNumbers.menu,
|
2017-05-16 10:06:23 +00:00
|
|
|
restoreHeight: 92,
|
2017-02-20 14:51:33 +00:00
|
|
|
allowScrollbar: false,
|
|
|
|
store: new Common.UI.DataViewStore([
|
|
|
|
{offsety: 0, data: {type: 1, subtype: -1}},
|
2017-05-16 10:06:23 +00:00
|
|
|
{offsety: 570, data: {type: 1, subtype: 4}},
|
|
|
|
{offsety: 532, data: {type: 1, subtype: 5}},
|
|
|
|
{offsety: 608, data: {type: 1, subtype: 6}},
|
|
|
|
{offsety: 418, data: {type: 1, subtype: 1}},
|
|
|
|
{offsety: 456, data: {type: 1, subtype: 2}},
|
|
|
|
{offsety: 494, data: {type: 1, subtype: 3}},
|
|
|
|
{offsety: 646, data: {type: 1, subtype: 7}}
|
2016-08-04 17:02:57 +00:00
|
|
|
]),
|
2017-05-16 10:06:23 +00:00
|
|
|
itemTemplate: _.template('<div id="<%= id %>" class="item-markerlist" style="background-position: 0 -<%= offsety %>px;"></div>')
|
2017-02-20 14:51:33 +00:00
|
|
|
});
|
|
|
|
_conf && this.mnuNumbersPicker.selectByIndex(_conf.index, true);
|
|
|
|
|
|
|
|
_conf = this.mnuMultilevelPicker.conf;
|
|
|
|
this.mnuMultilevelPicker = new Common.UI.DataView({
|
|
|
|
el: $('#id-toolbar-menu-multilevels'),
|
|
|
|
parentMenu: this.btnMultilevels.menu,
|
2017-05-16 10:06:23 +00:00
|
|
|
restoreHeight: 92,
|
2017-02-20 14:51:33 +00:00
|
|
|
allowScrollbar: false,
|
|
|
|
store: new Common.UI.DataViewStore([
|
|
|
|
{offsety: 0, data: {type: 2, subtype: -1}},
|
2017-05-16 10:06:23 +00:00
|
|
|
{offsety: 304, data: {type: 2, subtype: 1}},
|
|
|
|
{offsety: 342, data: {type: 2, subtype: 2}},
|
|
|
|
{offsety: 380, data: {type: 2, subtype: 3}}
|
2016-08-04 17:02:57 +00:00
|
|
|
]),
|
2017-05-16 10:06:23 +00:00
|
|
|
itemTemplate: _.template('<div id="<%= id %>" class="item-markerlist" style="background-position: 0 -<%= offsety %>px;"></div>')
|
2017-02-20 14:51:33 +00:00
|
|
|
});
|
|
|
|
_conf && this.mnuMultilevelPicker.selectByIndex(_conf.index, true);
|
2016-08-04 17:02:57 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
_conf = this.mnuPageNumberPosPicker ? this.mnuPageNumberPosPicker.conf : undefined;
|
|
|
|
this.mnuPageNumberPosPicker = new Common.UI.DataView({
|
2016-08-04 17:02:57 +00:00
|
|
|
el: $('#id-toolbar-menu-pageposition'),
|
|
|
|
allowScrollbar: false,
|
|
|
|
store: new Common.UI.DataViewStore([
|
2017-02-20 14:51:33 +00:00
|
|
|
{
|
|
|
|
offsety: 132,
|
|
|
|
allowSelected: false,
|
|
|
|
data: {
|
|
|
|
type: c_pageNumPosition.PAGE_NUM_POSITION_TOP,
|
|
|
|
subtype: c_pageNumPosition.PAGE_NUM_POSITION_LEFT
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
offsety: 99,
|
|
|
|
allowSelected: false,
|
|
|
|
data: {
|
|
|
|
type: c_pageNumPosition.PAGE_NUM_POSITION_TOP,
|
|
|
|
subtype: c_pageNumPosition.PAGE_NUM_POSITION_CENTER
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
offsety: 66,
|
|
|
|
allowSelected: false,
|
|
|
|
data: {
|
|
|
|
type: c_pageNumPosition.PAGE_NUM_POSITION_TOP,
|
|
|
|
subtype: c_pageNumPosition.PAGE_NUM_POSITION_RIGHT
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
offsety: 33,
|
|
|
|
allowSelected: false,
|
|
|
|
data: {
|
|
|
|
type: c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,
|
|
|
|
subtype: c_pageNumPosition.PAGE_NUM_POSITION_LEFT
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
offsety: 0,
|
|
|
|
allowSelected: false,
|
|
|
|
data: {
|
|
|
|
type: c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,
|
|
|
|
subtype: c_pageNumPosition.PAGE_NUM_POSITION_CENTER
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
offsety: 165,
|
|
|
|
allowSelected: false,
|
|
|
|
data: {
|
|
|
|
type: c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,
|
|
|
|
subtype: c_pageNumPosition.PAGE_NUM_POSITION_RIGHT
|
|
|
|
}
|
|
|
|
}
|
2016-08-04 17:02:57 +00:00
|
|
|
]),
|
|
|
|
itemTemplate: _.template('<div id="<%= id %>" class="item-pagenumber" style="background-position: 0 -<%= offsety %>px"></div>')
|
2017-02-20 14:51:33 +00:00
|
|
|
});
|
|
|
|
_conf && this.mnuPageNumberPosPicker.setDisabled(_conf.disabled);
|
|
|
|
|
|
|
|
this.mnuTablePicker = new Common.UI.DimensionPicker({
|
|
|
|
el: $('#id-toolbar-menu-tablepicker'),
|
|
|
|
minRows: 8,
|
|
|
|
minColumns: 10,
|
|
|
|
maxRows: 8,
|
|
|
|
maxColumns: 10
|
|
|
|
});
|
2017-04-24 11:41:51 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onToolbarAfterRender: function(toolbar) {
|
|
|
|
// DataView and pickers
|
|
|
|
//
|
2017-04-26 13:51:23 +00:00
|
|
|
var colorVal;
|
|
|
|
if (this.btnHighlightColor.cmpEl) {
|
|
|
|
colorVal = $('<div class="btn-color-value-line"></div>');
|
|
|
|
$('button:first-child', this.btnHighlightColor.cmpEl).append(colorVal);
|
|
|
|
this.btnHighlightColor.currentColor = 'FFFF00';
|
|
|
|
colorVal.css('background-color', '#' + this.btnHighlightColor.currentColor);
|
|
|
|
this.mnuHighlightColorPicker = new Common.UI.ColorPalette({
|
|
|
|
el: $('#id-toolbar-menu-highlight'),
|
|
|
|
colors: [
|
|
|
|
'FFFF00', '00FF00', '00FFFF', 'FF00FF', '0000FF', 'FF0000', '00008B', '008B8B',
|
|
|
|
'006400', '800080', '8B0000', '808000', 'FFFFFF', 'D3D3D3', 'A9A9A9', '000000'
|
|
|
|
]
|
|
|
|
});
|
|
|
|
this.mnuHighlightColorPicker.select('FFFF00');
|
|
|
|
}
|
2017-04-24 11:41:51 +00:00
|
|
|
|
2017-04-26 13:51:23 +00:00
|
|
|
if (this.btnFontColor.cmpEl) {
|
|
|
|
colorVal = $('<div class="btn-color-value-line"></div>');
|
|
|
|
$('button:first-child', this.btnFontColor.cmpEl).append(colorVal);
|
|
|
|
colorVal.css('background-color', this.btnFontColor.currentColor || 'transparent');
|
|
|
|
this.mnuFontColorPicker = new Common.UI.ThemeColorPalette({
|
|
|
|
el: $('#id-toolbar-menu-fontcolor')
|
|
|
|
});
|
|
|
|
}
|
2017-04-24 11:41:51 +00:00
|
|
|
|
2017-04-26 13:51:23 +00:00
|
|
|
if (this.btnParagraphColor.cmpEl) {
|
|
|
|
colorVal = $('<div class="btn-color-value-line"></div>');
|
|
|
|
$('button:first-child', this.btnParagraphColor.cmpEl).append(colorVal);
|
|
|
|
colorVal.css('background-color', this.btnParagraphColor.currentColor || 'transparent');
|
|
|
|
this.mnuParagraphColorPicker = new Common.UI.ThemeColorPalette({
|
|
|
|
el: $('#id-toolbar-menu-paracolor'),
|
|
|
|
transparent: true
|
|
|
|
});
|
|
|
|
}
|
2018-07-23 14:39:53 +00:00
|
|
|
|
|
|
|
if (this.btnContentControls.cmpEl) {
|
|
|
|
this.mnuControlsColorPicker = new Common.UI.ThemeColorPalette({
|
|
|
|
el: $('#id-toolbar-menu-controls-color')
|
|
|
|
});
|
|
|
|
}
|
2017-02-20 14:51:33 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
updateMetricUnit: function () {
|
|
|
|
var items = this.btnPageMargins.menu.items;
|
|
|
|
for (var i = 0; i < items.length; i++) {
|
|
|
|
var mnu = items[i];
|
|
|
|
if (mnu.checkable) {
|
|
|
|
var checked = mnu.checked;
|
|
|
|
$(mnu.el).html(mnu.template({
|
|
|
|
id: Common.UI.getId(),
|
|
|
|
caption: mnu.caption,
|
|
|
|
options: mnu.options
|
|
|
|
}));
|
|
|
|
if (checked) mnu.setChecked(checked);
|
|
|
|
}
|
2016-04-07 09:08:13 +00:00
|
|
|
}
|
2017-02-20 14:51:33 +00:00
|
|
|
items = this.btnPageSize.menu.items;
|
|
|
|
for (var i = 0; i < items.length; i++) {
|
|
|
|
var mnu = items[i];
|
|
|
|
if (mnu.checkable) {
|
|
|
|
var checked = mnu.checked;
|
|
|
|
$(mnu.el).html(mnu.template({
|
|
|
|
id: Common.UI.getId(),
|
|
|
|
caption: mnu.caption,
|
|
|
|
options: mnu.options
|
|
|
|
}));
|
|
|
|
if (checked) mnu.setChecked(checked);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
setApi: function (api) {
|
|
|
|
this.api = api;
|
|
|
|
/** coauthoring begin **/
|
|
|
|
this.api.asc_registerCallback('asc_onSendThemeColorSchemes', _.bind(this.onSendThemeColorSchemes, this));
|
|
|
|
this.api.asc_registerCallback('asc_onCollaborativeChanges', _.bind(this.onCollaborativeChanges, this));
|
|
|
|
this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onApiUsersChanged, this));
|
|
|
|
this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onApiUsersChanged, this));
|
|
|
|
/** coauthoring end **/
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
|
|
|
setMode: function (mode) {
|
|
|
|
if (mode.isDisconnected) {
|
2018-02-15 23:56:17 +00:00
|
|
|
this.btnSave.setDisabled(true);
|
2018-10-25 13:19:29 +00:00
|
|
|
if (!mode.enableDownload)
|
2017-02-20 14:51:33 +00:00
|
|
|
this.btnPrint.setDisabled(true);
|
2016-04-07 09:08:13 +00:00
|
|
|
}
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
this.mode = mode;
|
2016-08-23 11:36:55 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
this.btnMailRecepients.setVisible(mode.canCoAuthoring == true && mode.canUseMailMerge);
|
|
|
|
this.listStylesAdditionalMenuItem.setVisible(mode.canEditStyles);
|
2018-06-26 12:46:49 +00:00
|
|
|
this.btnContentControls.menu.items[4].setVisible(mode.canEditContentControl);
|
|
|
|
this.btnContentControls.menu.items[5].setVisible(mode.canEditContentControl);
|
2019-07-29 12:50:55 +00:00
|
|
|
this.mnuInsertImage.items[2].setVisible(this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1);
|
2017-02-20 14:51:33 +00:00
|
|
|
},
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
onSendThemeColorSchemes: function (schemas) {
|
|
|
|
var me = this;
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
if (this.mnuColorSchema && this.mnuColorSchema.items.length > 0) {
|
|
|
|
_.each(this.mnuColorSchema.items, function (item) {
|
|
|
|
item.remove();
|
|
|
|
});
|
|
|
|
}
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
if (this.mnuColorSchema == null) {
|
|
|
|
this.mnuColorSchema = new Common.UI.Menu({
|
2019-06-21 07:46:00 +00:00
|
|
|
restoreHeight: true
|
2016-08-23 08:25:57 +00:00
|
|
|
});
|
2017-02-20 14:51:33 +00:00
|
|
|
}
|
|
|
|
this.mnuColorSchema.items = [];
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
var itemTemplate = _.template([
|
|
|
|
'<a id="<%= id %>" tabindex="-1" type="menuitem" class="<%= options.cls %>">',
|
2016-03-11 00:48:53 +00:00
|
|
|
'<span class="colors">',
|
2017-02-20 14:51:33 +00:00
|
|
|
'<% _.each(options.colors, function(color) { %>',
|
|
|
|
'<span class="color" style="background: <%= color %>;"></span>',
|
|
|
|
'<% }) %>',
|
2016-03-11 00:48:53 +00:00
|
|
|
'</span>',
|
|
|
|
'<span class="text"><%= caption %></span>',
|
2017-02-20 14:51:33 +00:00
|
|
|
'</a>'
|
|
|
|
].join(''));
|
|
|
|
|
|
|
|
_.each(schemas, function (schema, index) {
|
|
|
|
var colors = schema.get_colors();//schema.colors;
|
|
|
|
var schemecolors = [];
|
|
|
|
for (var j = 2; j < 7; j++) {
|
|
|
|
var clr = '#' + Common.Utils.ThemeColor.getHexColor(colors[j].get_r(), colors[j].get_g(), colors[j].get_b());
|
|
|
|
schemecolors.push(clr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (index == 21) {
|
|
|
|
this.mnuColorSchema.addItem({
|
|
|
|
caption: '--'
|
|
|
|
});
|
|
|
|
}
|
2019-08-21 09:16:32 +00:00
|
|
|
var name = schema.get_name();
|
2019-08-20 09:54:51 +00:00
|
|
|
this.mnuColorSchema.addItem({
|
|
|
|
template: itemTemplate,
|
|
|
|
cls: 'color-schemas-menu',
|
|
|
|
colors: schemecolors,
|
2019-08-21 09:16:32 +00:00
|
|
|
caption: (index < 21) ? (me.SchemeNames[index] || name) : name,
|
|
|
|
value: name,
|
2019-08-20 12:56:29 +00:00
|
|
|
checkable: true,
|
|
|
|
toggleGroup: 'menuSchema'
|
2019-08-20 09:54:51 +00:00
|
|
|
});
|
2017-02-20 14:51:33 +00:00
|
|
|
}, this);
|
|
|
|
},
|
|
|
|
|
|
|
|
/** coauthoring begin **/
|
|
|
|
onCollaborativeChanges: function () {
|
|
|
|
if (this._state.hasCollaborativeChanges) return;
|
2018-02-26 13:31:34 +00:00
|
|
|
if (!this.btnCollabChanges.rendered || this._state.previewmode) {
|
2017-02-20 14:51:33 +00:00
|
|
|
this.needShowSynchTip = true;
|
|
|
|
return;
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
this._state.hasCollaborativeChanges = true;
|
2018-02-26 13:31:34 +00:00
|
|
|
this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass('btn-synch');
|
2017-02-20 14:51:33 +00:00
|
|
|
if (this.showSynchTip) {
|
2018-02-26 13:31:34 +00:00
|
|
|
this.btnCollabChanges.updateHint('');
|
2017-02-20 14:51:33 +00:00
|
|
|
if (this.synchTooltip === undefined)
|
|
|
|
this.createSynchTip();
|
|
|
|
|
|
|
|
this.synchTooltip.show();
|
2016-03-11 00:48:53 +00:00
|
|
|
} else {
|
2018-02-26 13:31:34 +00:00
|
|
|
this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
|
|
|
|
2018-02-15 23:56:17 +00:00
|
|
|
this.btnSave.setDisabled(false);
|
2017-02-20 14:51:33 +00:00
|
|
|
Common.Gateway.collaborativeChanges();
|
|
|
|
},
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
createSynchTip: function () {
|
|
|
|
this.synchTooltip = new Common.UI.SynchronizeTip({
|
2019-02-07 10:18:56 +00:00
|
|
|
extCls: (this.mode.customization && !!this.mode.customization.compactHeader) ? undefined : 'inc-index',
|
2018-02-26 13:31:34 +00:00
|
|
|
target: this.btnCollabChanges.$el
|
2017-02-20 14:51:33 +00:00
|
|
|
});
|
|
|
|
this.synchTooltip.on('dontshowclick', function () {
|
|
|
|
this.showSynchTip = false;
|
|
|
|
this.synchTooltip.hide();
|
2018-02-26 13:31:34 +00:00
|
|
|
this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
2017-02-20 14:51:33 +00:00
|
|
|
Common.localStorage.setItem("de-hide-synch", 1);
|
|
|
|
}, this);
|
|
|
|
this.synchTooltip.on('closeclick', function () {
|
|
|
|
this.synchTooltip.hide();
|
2018-02-26 13:31:34 +00:00
|
|
|
this.btnCollabChanges.updateHint(this.tipSynchronize + Common.Utils.String.platformKey('Ctrl+S'));
|
2017-02-20 14:51:33 +00:00
|
|
|
}, this);
|
|
|
|
},
|
|
|
|
|
|
|
|
synchronizeChanges: function () {
|
2018-02-26 13:31:34 +00:00
|
|
|
if ( !this._state.previewmode && this.btnCollabChanges.rendered ) {
|
2018-02-24 22:19:36 +00:00
|
|
|
var me = this;
|
2017-02-20 14:51:33 +00:00
|
|
|
|
2018-02-26 13:31:34 +00:00
|
|
|
if ( me.btnCollabChanges.$icon.hasClass('btn-synch') ) {
|
|
|
|
me.btnCollabChanges.$icon.removeClass('btn-synch').addClass(me.btnSaveCls);
|
2017-02-20 14:51:33 +00:00
|
|
|
if (this.synchTooltip)
|
|
|
|
this.synchTooltip.hide();
|
2018-02-26 13:31:34 +00:00
|
|
|
this.btnCollabChanges.updateHint(this.btnSaveTip);
|
|
|
|
|
2018-02-15 23:56:17 +00:00
|
|
|
this.btnSave.setDisabled(!me.mode.forcesave);
|
2017-02-20 14:51:33 +00:00
|
|
|
this._state.hasCollaborativeChanges = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
onApiUsersChanged: function (users) {
|
|
|
|
var editusers = [];
|
|
|
|
_.each(users, function (item) {
|
|
|
|
if (!item.asc_getView())
|
|
|
|
editusers.push(item);
|
|
|
|
});
|
|
|
|
|
2018-02-26 13:31:34 +00:00
|
|
|
var me = this;
|
2017-02-20 14:51:33 +00:00
|
|
|
var length = _.size(editusers);
|
|
|
|
var cls = (length > 1) ? 'btn-save-coauth' : 'btn-save';
|
2018-02-26 13:31:34 +00:00
|
|
|
if ( cls !== me.btnSaveCls && me.btnCollabChanges.rendered ) {
|
|
|
|
me.btnSaveTip = ((length > 1) ? me.tipSaveCoauth : me.tipSave ) + Common.Utils.String.platformKey('Ctrl+S');
|
|
|
|
|
|
|
|
if ( !me.btnCollabChanges.$icon.hasClass('btn-synch') ) {
|
|
|
|
me.btnCollabChanges.$icon.removeClass(me.btnSaveCls).addClass(cls);
|
|
|
|
me.btnCollabChanges.updateHint(me.btnSaveTip);
|
2017-02-20 14:51:33 +00:00
|
|
|
|
|
|
|
}
|
2018-02-26 13:31:34 +00:00
|
|
|
me.btnSaveCls = cls;
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
2017-02-20 14:51:33 +00:00
|
|
|
},
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
/** coauthoring end **/
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
onStyleMenuUpdate: function (item, e, eOpt) {
|
|
|
|
var me = this;
|
|
|
|
if (me.api) {
|
|
|
|
var style = me.api.asc_GetStyleFromFormatting();
|
|
|
|
var title = item.styleTitle;
|
|
|
|
|
|
|
|
var characterStyle = style.get_Link();
|
|
|
|
style.put_Name(title);
|
|
|
|
characterStyle.put_Name(title + '_character');
|
|
|
|
me.api.asc_AddNewStyle(style);
|
|
|
|
setTimeout(function () {
|
|
|
|
me.listStyles.openButton.menu.hide();
|
|
|
|
}, 100);
|
|
|
|
}
|
|
|
|
},
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
onStyleMenuDelete: function (item, e, eOpt) {
|
|
|
|
var me = this;
|
|
|
|
if (me.api) {
|
|
|
|
this.api.asc_RemoveStyle(item.styleTitle);
|
2016-03-11 00:48:53 +00:00
|
|
|
}
|
2017-02-20 14:51:33 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
onStyleMenuRestoreAll: function (item, e, eOpt) {
|
|
|
|
var me = this;
|
|
|
|
if (me.api) {
|
|
|
|
_.each(window.styles.get_MergedStyles(), function (style) {
|
|
|
|
if (me.api.asc_IsStyleDefault(style.get_Name())) {
|
|
|
|
me.api.asc_RemoveStyle(style.get_Name());
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2016-03-11 00:48:53 +00:00
|
|
|
|
2017-02-20 14:51:33 +00:00
|
|
|
onStyleMenuDeleteAll: function (item, e, eOpt) {
|
|
|
|
if (this.api)
|
|
|
|
this.api.asc_RemoveAllCustomStyles();
|
|
|
|
},
|
|
|
|
|
|
|
|
textBold: 'Bold',
|
|
|
|
textItalic: 'Italic',
|
|
|
|
textUnderline: 'Underline',
|
|
|
|
textStrikeout: 'Strikeout',
|
|
|
|
textSuperscript: 'Superscript',
|
|
|
|
textSubscript: 'Subscript',
|
|
|
|
strMenuNoFill: 'No Fill',
|
|
|
|
tipFontName: 'Font Name',
|
|
|
|
tipFontSize: 'Font Size',
|
|
|
|
tipParagraphStyle: 'Paragraph Style',
|
|
|
|
tipCopy: 'Copy',
|
|
|
|
tipPaste: 'Paste',
|
|
|
|
tipUndo: 'Undo',
|
|
|
|
tipRedo: 'Redo',
|
|
|
|
tipPrint: 'Print',
|
|
|
|
tipSave: 'Save',
|
|
|
|
tipIncFont: 'Increment font size',
|
|
|
|
tipDecFont: 'Decrement font size',
|
|
|
|
tipHighlightColor: 'Highlight color',
|
|
|
|
tipFontColor: 'Font color',
|
|
|
|
tipMarkers: 'Bullets',
|
|
|
|
tipNumbers: 'Numbering',
|
|
|
|
tipMultilevels: 'Outline',
|
|
|
|
tipAlignLeft: 'Align Left',
|
|
|
|
tipAlignRight: 'Align Right',
|
|
|
|
tipAlignCenter: 'Align Center',
|
|
|
|
tipAlignJust: 'Justified',
|
|
|
|
tipDecPrLeft: 'Decrease Indent',
|
|
|
|
tipIncPrLeft: 'Increase Indent',
|
|
|
|
tipShowHiddenChars: 'Nonprinting Characters',
|
|
|
|
tipLineSpace: 'Paragraph Line Spacing',
|
|
|
|
tipPrColor: 'Background color',
|
|
|
|
tipInsertTable: 'Insert Table',
|
2018-06-14 07:22:41 +00:00
|
|
|
tipInsertImage: 'Insert Image',
|
2017-02-20 14:51:33 +00:00
|
|
|
tipPageBreak: 'Insert Page or Section break',
|
|
|
|
tipInsertNum: 'Insert Page Number',
|
|
|
|
tipClearStyle: 'Clear Style',
|
|
|
|
tipCopyStyle: 'Copy Style',
|
|
|
|
tipPageSize: 'Page Size',
|
|
|
|
tipPageOrient: 'Page Orientation',
|
|
|
|
tipBack: 'Back',
|
|
|
|
tipInsertShape: 'Insert Autoshape',
|
|
|
|
tipInsertEquation: 'Insert Equation',
|
2018-06-14 07:22:41 +00:00
|
|
|
mniImageFromFile: 'Image from file',
|
|
|
|
mniImageFromUrl: 'Image from url',
|
2017-02-20 14:51:33 +00:00
|
|
|
mniCustomTable: 'Insert Custom Table',
|
|
|
|
textTitleError: 'Error',
|
|
|
|
textInsertPageNumber: 'Insert page number',
|
|
|
|
textToCurrent: 'To Current Position',
|
2019-08-01 12:31:37 +00:00
|
|
|
tipEditHeader: 'Edit header or footer',
|
2017-02-20 14:51:33 +00:00
|
|
|
mniEditHeader: 'Edit Document Header',
|
|
|
|
mniEditFooter: 'Edit Document Footer',
|
|
|
|
mniHiddenChars: 'Nonprinting Characters',
|
|
|
|
mniHiddenBorders: 'Hidden Table Borders',
|
|
|
|
tipSynchronize: 'The document has been changed by another user. Please click to save your changes and reload the updates.',
|
|
|
|
textNewColor: 'Add New Custom Color',
|
|
|
|
textAutoColor: 'Automatic',
|
|
|
|
tipInsertChart: 'Insert Chart',
|
|
|
|
textLine: 'Line',
|
|
|
|
textColumn: 'Column',
|
|
|
|
textBar: 'Bar',
|
|
|
|
textArea: 'Area',
|
|
|
|
textPie: 'Pie',
|
|
|
|
textPoint: 'XY (Scatter)',
|
|
|
|
textStock: 'Stock',
|
|
|
|
tipColorSchemas: 'Change Color Scheme',
|
|
|
|
tipInsertText: 'Insert Text',
|
2017-06-27 11:14:19 +00:00
|
|
|
tipInsertTextArt: 'Insert Text Art',
|
2017-02-20 14:51:33 +00:00
|
|
|
tipHAligh: 'Horizontal Align',
|
|
|
|
mniEditDropCap: 'Drop Cap Settings',
|
|
|
|
textNone: 'None',
|
|
|
|
textInText: 'In Text',
|
|
|
|
textInMargin: 'In Margin',
|
|
|
|
tipDropCap: 'Insert drop cap',
|
|
|
|
txtScheme1: 'Office',
|
|
|
|
txtScheme2: 'Grayscale',
|
|
|
|
txtScheme3: 'Apex',
|
|
|
|
txtScheme4: 'Aspect',
|
|
|
|
txtScheme5: 'Civic',
|
|
|
|
txtScheme6: 'Concourse',
|
|
|
|
txtScheme7: 'Equity',
|
|
|
|
txtScheme8: 'Flow',
|
|
|
|
txtScheme9: 'Foundry',
|
|
|
|
txtScheme10: 'Median',
|
|
|
|
txtScheme11: 'Metro',
|
|
|
|
txtScheme12: 'Module',
|
|
|
|
txtScheme13: 'Opulent',
|
|
|
|
txtScheme14: 'Oriel',
|
|
|
|
txtScheme15: 'Origin',
|
|
|
|
txtScheme16: 'Paper',
|
|
|
|
txtScheme17: 'Solstice',
|
|
|
|
txtScheme18: 'Technic',
|
|
|
|
txtScheme19: 'Trek',
|
|
|
|
txtScheme20: 'Urban',
|
|
|
|
txtScheme21: 'Verve',
|
|
|
|
textInsPageBreak: 'Insert Page Break',
|
|
|
|
textInsColumnBreak: 'Insert Column Break',
|
|
|
|
textInsSectionBreak: 'Insert Section Break',
|
|
|
|
textNextPage: 'Next Page',
|
|
|
|
textContPage: 'Continuous Page',
|
|
|
|
textEvenPage: 'Even Page',
|
|
|
|
textOddPage: 'Odd Page',
|
|
|
|
tipSaveCoauth: 'Save your changes for the other users to see them.',
|
|
|
|
tipMailRecepients: 'Mail Merge',
|
|
|
|
textStyleMenuUpdate: 'Update from select',
|
|
|
|
textStyleMenuRestore: 'Restore to default',
|
|
|
|
textStyleMenuDelete: 'Delete style',
|
|
|
|
textStyleMenuRestoreAll: 'Restore all to default styles',
|
|
|
|
textStyleMenuDeleteAll: 'Delete all custom styles',
|
|
|
|
textStyleMenuNew: 'New style from selection',
|
|
|
|
tipColumns: 'Insert columns',
|
|
|
|
textColumnsOne: 'One',
|
|
|
|
textColumnsTwo: 'Two',
|
|
|
|
textColumnsThree: 'Three',
|
|
|
|
textColumnsLeft: 'Left',
|
|
|
|
textColumnsRight: 'Right',
|
|
|
|
tipPageMargins: 'Page Margins',
|
|
|
|
textMarginsLast: 'Last Custom',
|
|
|
|
textMarginsNormal: 'Normal',
|
|
|
|
textMarginsUsNormal: 'US Normal',
|
|
|
|
textMarginsNarrow: 'Narrow',
|
|
|
|
textMarginsModerate: 'Moderate',
|
|
|
|
textMarginsWide: 'Wide',
|
|
|
|
textPageMarginsCustom: 'Custom margins',
|
|
|
|
textTop: 'Top: ',
|
|
|
|
textLeft: 'Left: ',
|
|
|
|
textBottom: 'Bottom: ',
|
|
|
|
textRight: 'Right: ',
|
|
|
|
textPageSizeCustom: 'Custom Page Size',
|
|
|
|
textPortrait: 'Portrait',
|
|
|
|
textLandscape: 'Landscape',
|
|
|
|
textInsertPageCount: 'Insert number of pages',
|
|
|
|
textCharts: 'Charts',
|
2017-04-20 10:23:50 +00:00
|
|
|
tipChangeChart: 'Change Chart Type',
|
2017-04-19 12:09:44 +00:00
|
|
|
capBtnInsPagebreak: 'Page Break',
|
2018-06-14 07:22:41 +00:00
|
|
|
capBtnInsImage: 'Image',
|
2017-04-19 12:09:44 +00:00
|
|
|
capBtnInsTable: 'Table',
|
|
|
|
capBtnInsChart: 'Chart',
|
2017-04-20 10:23:50 +00:00
|
|
|
textTabFile: 'File',
|
|
|
|
textTabHome: 'Home',
|
|
|
|
textTabInsert: 'Insert',
|
2018-06-28 09:27:11 +00:00
|
|
|
textTabLayout: 'Layout',
|
2017-04-20 14:45:47 +00:00
|
|
|
textTabReview: 'Review',
|
2017-04-19 12:09:44 +00:00
|
|
|
capBtnInsShape: 'Shape',
|
2017-10-18 12:08:11 +00:00
|
|
|
capBtnInsTextbox: 'Text Box',
|
2017-06-27 11:14:19 +00:00
|
|
|
capBtnInsTextart: 'Text Art',
|
2017-04-19 12:09:44 +00:00
|
|
|
capBtnInsDropcap: 'Drop Cap',
|
|
|
|
capBtnInsEquation: 'Equation',
|
2019-05-28 10:00:42 +00:00
|
|
|
capBtnInsHeader: 'Header/Footer',
|
2017-04-19 12:09:44 +00:00
|
|
|
capBtnColumns: 'Columns',
|
|
|
|
capBtnPageOrient: 'Orientation',
|
|
|
|
capBtnMargins: 'Margins',
|
|
|
|
capBtnPageSize: 'Size',
|
|
|
|
tipImgAlign: 'Align objects',
|
|
|
|
tipImgGroup: 'Group objects',
|
|
|
|
tipImgWrapping: 'Wrap text',
|
2018-06-28 09:27:11 +00:00
|
|
|
tipSendForward: 'Bring forward',
|
2017-04-19 12:09:44 +00:00
|
|
|
tipSendBackward: 'Send backward',
|
|
|
|
capImgAlign: 'Align',
|
|
|
|
capImgGroup: 'Group',
|
2018-06-28 09:27:11 +00:00
|
|
|
capImgForward: 'Bring Forward',
|
|
|
|
capImgBackward: 'Send Backward',
|
2017-06-15 13:18:40 +00:00
|
|
|
capImgWrapping: 'Wrapping',
|
2017-06-23 14:27:20 +00:00
|
|
|
capBtnComment: 'Comment',
|
2017-07-05 12:22:02 +00:00
|
|
|
textColumnsCustom: 'Custom Columns',
|
2017-11-28 12:23:37 +00:00
|
|
|
textSurface: 'Surface',
|
2017-11-15 07:59:06 +00:00
|
|
|
textTabCollaboration: 'Collaboration',
|
2017-12-12 11:14:27 +00:00
|
|
|
textTabProtect: 'Protection',
|
2018-02-16 09:14:20 +00:00
|
|
|
textTabLinks: 'References',
|
2017-12-13 13:52:14 +00:00
|
|
|
capBtnInsControls: 'Content Control',
|
|
|
|
textRichControl: 'Rich text',
|
|
|
|
textPlainControl: 'Plain text',
|
|
|
|
textRemoveControl: 'Remove',
|
|
|
|
mniEditControls: 'Settings',
|
2018-07-23 14:39:53 +00:00
|
|
|
tipControls: 'Insert content control',
|
|
|
|
mniHighlightControls: 'Highlight settings',
|
2018-10-03 11:00:08 +00:00
|
|
|
textNoHighlight: 'No highlighting',
|
2018-11-20 09:57:29 +00:00
|
|
|
mniImageFromStorage: 'Image from Storage',
|
|
|
|
capBtnBlankPage: 'Blank Page',
|
2019-02-12 12:31:27 +00:00
|
|
|
tipBlankPage: 'Insert blank page',
|
|
|
|
txtDistribHor: 'Distribute Horizontally',
|
|
|
|
txtDistribVert: 'Distribute Vertically',
|
|
|
|
txtPageAlign: 'Align to Page',
|
|
|
|
txtMarginAlign: 'Align to Margin',
|
2019-04-05 11:28:51 +00:00
|
|
|
txtObjectsAlign: 'Align Selected Objects',
|
|
|
|
capBtnWatermark: 'Watermark',
|
2019-06-18 13:20:52 +00:00
|
|
|
textEditWatermark: 'Custom Watermark',
|
2019-04-05 11:28:51 +00:00
|
|
|
textRemWatermark: 'Remove Watermark',
|
2019-06-18 09:35:01 +00:00
|
|
|
tipWatermark: 'Edit watermark'
|
2017-02-20 14:51:33 +00:00
|
|
|
}
|
|
|
|
})(), DE.Views.Toolbar || {}));
|
2016-03-11 00:48:53 +00:00
|
|
|
});
|