web-apps/apps/documenteditor/main/app/controller/Toolbar.js

3678 lines
184 KiB
JavaScript
Raw Normal View History

2016-04-01 13:17:09 +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
*
* 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 Controller
*
* Created by Alexander Yuzhin on 1/15/14
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([
'core',
'common/main/lib/component/Window',
'common/main/lib/view/CopyWarningDialog',
'common/main/lib/view/ImageFromUrlDialog',
'common/main/lib/view/InsertTableDialog',
2018-10-03 11:00:08 +00:00
'common/main/lib/view/SelectFileDlg',
2019-11-08 08:34:53 +00:00
'common/main/lib/view/SymbolTableDialog',
2016-10-21 10:54:36 +00:00
'common/main/lib/util/define',
2016-03-11 00:48:53 +00:00
'documenteditor/main/app/view/Toolbar',
'documenteditor/main/app/view/DropcapSettingsAdvanced',
'documenteditor/main/app/view/StyleTitleDialog',
'documenteditor/main/app/view/PageMarginsDialog',
2016-12-19 11:44:02 +00:00
'documenteditor/main/app/view/PageSizeDialog',
2017-06-23 14:27:20 +00:00
'documenteditor/main/app/controller/PageLayout',
2017-12-12 11:14:27 +00:00
'documenteditor/main/app/view/CustomColumnsDialog',
2019-04-05 11:28:51 +00:00
'documenteditor/main/app/view/ControlSettingsDialog',
'documenteditor/main/app/view/WatermarkSettingsDialog',
'documenteditor/main/app/view/ListSettingsDialog',
'documenteditor/main/app/view/DateTimeDialog',
2021-04-15 21:32:56 +00:00
'documenteditor/main/app/view/LineNumbersDialog',
'documenteditor/main/app/view/TextToTableDialog'
2016-03-11 00:48:53 +00:00
], function () {
'use strict';
DE.Controllers.Toolbar = Backbone.Controller.extend(_.extend({
models: [],
collections: [],
controllers: [],
2016-03-11 00:48:53 +00:00
views: [
'Toolbar'
],
initialize: function() {
this._state = {
activated: false,
bullets: {
type: undefined,
subtype: undefined
},
prstyle: undefined,
prcontrolsdisable:undefined,
dropcap: Asc.c_oAscDropCap.None,
2016-03-11 00:48:53 +00:00
clrhighlight: undefined,
clrtext: undefined,
pgsize: [0, 0],
linespace: undefined,
pralign: undefined,
clrback: undefined,
valign: undefined,
can_undo: undefined,
can_redo: undefined,
bold: undefined,
italic: undefined,
strike: undefined,
underline: undefined,
pgorient: undefined,
lock_doc: undefined,
can_copycut: undefined,
pgmargins: undefined,
fontsize: undefined,
in_equation: false,
2020-09-28 20:49:46 +00:00
in_chart: false,
2020-09-29 09:42:16 +00:00
linenum_apply: Asc.c_oAscSectionApplyType.All,
suppress_num: undefined
2016-03-11 00:48:53 +00:00
};
this.flg = {};
this.diagramEditor = null;
this._isAddingShape = false;
this.editMode = true;
2019-08-21 14:08:21 +00:00
this.binding = {};
2016-03-11 00:48:53 +00:00
this.addListeners({
'Toolbar': {
2017-04-22 12:42:52 +00:00
'insert:break' : this.onClickPageBreak,
2018-03-05 09:28:37 +00:00
'change:compact' : this.onClickChangeCompact,
2019-08-30 14:55:29 +00:00
'home:open' : this.onHomeOpen,
2019-09-03 10:32:06 +00:00
'add:chart' : this.onSelectChart,
'insert:textart' : this.onInsertTextart
2017-04-10 13:39:03 +00:00
},
'FileMenu': {
'menu:hide': this.onFileMenu.bind(this, 'hide'),
'menu:show': this.onFileMenu.bind(this, 'show')
2017-07-13 09:43:40 +00:00
},
'Common.Views.Header': {
2017-08-23 11:51:27 +00:00
'print': function (opts) {
var _main = this.getApplication().getController('Main');
_main.onPrint();
},
'save': function (opts) {
this.api.asc_Save();
},
'undo': this.onUndo,
'redo': this.onRedo,
2017-07-13 09:43:40 +00:00
'downloadas': function (opts) {
var _main = this.getApplication().getController('Main');
var _file_type = _main.document.fileType,
_format;
if ( !!_file_type ) {
2021-09-13 13:53:44 +00:00
if ( /^pdf|xps|oxps|djvu/i.test(_file_type) ) {
2017-08-23 11:51:27 +00:00
_main.api.asc_DownloadOrigin();
return;
} else {
_format = Asc.c_oAscFileType[ _file_type.toUpperCase() ];
}
}
var _supported = [
Asc.c_oAscFileType.TXT,
Asc.c_oAscFileType.RTF,
Asc.c_oAscFileType.ODT,
Asc.c_oAscFileType.DOCX,
2018-07-18 11:07:24 +00:00
Asc.c_oAscFileType.HTML,
Asc.c_oAscFileType.PDFA,
Asc.c_oAscFileType.DOTX,
Asc.c_oAscFileType.OTT,
Asc.c_oAscFileType.FB2,
2021-07-29 15:52:37 +00:00
Asc.c_oAscFileType.EPUB,
2021-12-06 15:37:37 +00:00
Asc.c_oAscFileType.DOCM
];
2021-12-06 15:37:37 +00:00
if (_main.appOptions.canFeatureForms) {
_supported = _supported.concat([Asc.c_oAscFileType.DOCXF, Asc.c_oAscFileType.OFORM]);
}
if ( !_format || _supported.indexOf(_format) < 0 )
_format = Asc.c_oAscFileType.PDF;
2019-07-24 08:36:13 +00:00
_main.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(_format));
},
'go:editor': function() {
Common.Gateway.requestEditRights();
}
},
'ViewTab': {
'toolbar:setcompact': this.onChangeCompactView.bind(this)
2016-03-11 00:48:53 +00:00
}
});
var me = this;
var checkInsertAutoshape = function(e) {
var cmp = $(e.target),
cmp_sdk = cmp.closest('#editor_sdk'),
btn_id = cmp.closest('button').attr('id');
if (btn_id===undefined)
btn_id = cmp.closest('.btn-group').attr('id');
if (cmp.attr('id') != 'editor_sdk' && cmp_sdk.length<=0) {
if ( me.toolbar.btnInsertText.pressed && btn_id != me.toolbar.btnInsertText.id ||
me.toolbar.btnInsertShape.pressed && btn_id != me.toolbar.btnInsertShape.id) {
me._isAddingShape = false;
me._addAutoshape(false);
me.toolbar.btnInsertShape.toggle(false, true);
me.toolbar.btnInsertText.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
} else if ( me.toolbar.btnInsertShape.pressed && btn_id == me.toolbar.btnInsertShape.id) {
_.defer(function(){
me.api.StartAddShape('', false);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}, 100);
}
}
};
this.onApiEndAddShape = function() {
this.toolbar.fireEvent('insertshape', this.toolbar);
if (this.toolbar.btnInsertShape.pressed)
this.toolbar.btnInsertShape.toggle(false, true);
if (this.toolbar.btnInsertText.pressed)
this.toolbar.btnInsertText.toggle(false, true);
$(document.body).off('mouseup', checkInsertAutoshape);
};
this._addAutoshape = function(isstart, type) {
if (this.api) {
if (isstart) {
this.api.StartAddShape(type, true);
$(document.body).on('mouseup', checkInsertAutoshape);
} else {
this.api.StartAddShape('', false);
$(document.body).off('mouseup', checkInsertAutoshape);
}
}
};
// Common.NotificationCenter.on('menu:afterkeydown', _.bind(this.onAfterKeydownMenu, this));
Common.NotificationCenter.on('style:commitsave', _.bind(this.onSaveStyle, this));
Common.NotificationCenter.on('style:commitchange', _.bind(this.onUpdateStyle, this));
2021-12-22 23:00:22 +00:00
Common.NotificationCenter.on('toolbar:collapse', _.bind(function () {
this.toolbar.collapse();
}, this));
2016-03-11 00:48:53 +00:00
},
onLaunch: function() {
var me = this;
2016-03-11 00:48:53 +00:00
// Create toolbar view
this.toolbar = this.createView('Toolbar');
me.toolbar.on('render:before', function (cmp) {
});
Common.NotificationCenter.on('app:ready', me.onAppReady.bind(me));
Common.NotificationCenter.on('app:face', me.onAppShowed.bind(me));
2016-03-11 00:48:53 +00:00
},
setMode: function(mode) {
this.mode = mode;
this.toolbar.applyLayout(mode);
},
attachUIEvents: function(toolbar) {
2016-03-11 00:48:53 +00:00
/**
* UI Events
*/
toolbar.btnPrint.on('click', _.bind(this.onPrint, this));
toolbar.btnPrint.on('disabled', _.bind(this.onBtnChangeState, this, 'print:disabled'));
2016-03-11 00:48:53 +00:00
toolbar.btnSave.on('click', _.bind(this.onSave, this));
toolbar.btnUndo.on('click', _.bind(this.onUndo, this));
toolbar.btnUndo.on('disabled', _.bind(this.onBtnChangeState, this, 'undo:disabled'));
2016-03-11 00:48:53 +00:00
toolbar.btnRedo.on('click', _.bind(this.onRedo, this));
toolbar.btnRedo.on('disabled', _.bind(this.onBtnChangeState, this, 'redo:disabled'));
toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, 'copy'));
toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, 'paste'));
toolbar.btnCut.on('click', _.bind(this.onCopyPaste, this, 'cut'));
toolbar.btnSelectAll.on('click', _.bind(this.onSelectAll, this));
2016-03-11 00:48:53 +00:00
toolbar.btnIncFontSize.on('click', _.bind(this.onIncrease, this));
toolbar.btnDecFontSize.on('click', _.bind(this.onDecrease, this));
2021-01-18 13:41:49 +00:00
toolbar.mnuChangeCase.on('item:click', _.bind(this.onChangeCase, this));
2016-03-11 00:48:53 +00:00
toolbar.btnBold.on('click', _.bind(this.onBold, this));
toolbar.btnItalic.on('click', _.bind(this.onItalic, this));
toolbar.btnUnderline.on('click', _.bind(this.onUnderline, this));
toolbar.btnStrikeout.on('click', _.bind(this.onStrikeout, this));
toolbar.btnSuperscript.on('click', _.bind(this.onSuperscript, this));
toolbar.btnSubscript.on('click', _.bind(this.onSubscript, this));
toolbar.btnAlignLeft.on('click', _.bind(this.onHorizontalAlign, this, 1));
toolbar.btnAlignCenter.on('click', _.bind(this.onHorizontalAlign, this, 2));
toolbar.btnAlignRight.on('click', _.bind(this.onHorizontalAlign, this, 0));
toolbar.btnAlignJust.on('click', _.bind(this.onHorizontalAlign, this, 3));
toolbar.btnDecLeftOffset.on('click', _.bind(this.onDecOffset, this));
toolbar.btnIncLeftOffset.on('click', _.bind(this.onIncOffset, this));
toolbar.btnMarkers.on('click', _.bind(this.onMarkers, this));
toolbar.btnNumbers.on('click', _.bind(this.onNumbers, this));
toolbar.cmbFontName.on('selected', _.bind(this.onFontNameSelect, this));
toolbar.cmbFontName.on('show:after', _.bind(this.onComboOpen, this, true));
toolbar.cmbFontName.on('hide:after', _.bind(this.onHideMenus, this));
2016-03-11 00:48:53 +00:00
toolbar.cmbFontName.on('combo:blur', _.bind(this.onComboBlur, this));
toolbar.cmbFontName.on('combo:focusin', _.bind(this.onComboOpen, this, false));
toolbar.cmbFontSize.on('selected', _.bind(this.onFontSizeSelect, this));
toolbar.cmbFontSize.on('changed:before', _.bind(this.onFontSizeChanged, this, true));
toolbar.cmbFontSize.on('changed:after', _.bind(this.onFontSizeChanged, this, false));
toolbar.cmbFontSize.on('combo:blur', _.bind(this.onComboBlur, this));
toolbar.cmbFontSize.on('combo:focusin', _.bind(this.onComboOpen, this, false));
toolbar.cmbFontSize.on('show:after', _.bind(this.onComboOpen, this, true));
toolbar.cmbFontSize.on('hide:after', _.bind(this.onHideMenus, this));
2016-03-11 00:48:53 +00:00
toolbar.mnuMarkersPicker.on('item:click', _.bind(this.onSelectBullets, this, toolbar.btnMarkers));
toolbar.mnuNumbersPicker.on('item:click', _.bind(this.onSelectBullets, this, toolbar.btnNumbers));
toolbar.mnuMultilevelPicker.on('item:click', _.bind(this.onSelectBullets, this, toolbar.btnMultilevels));
2021-04-01 15:57:00 +00:00
toolbar.btnMarkers.menu.on('show:after', _.bind(this.onListShowAfter, this, 0, toolbar.mnuMarkersPicker));
toolbar.btnNumbers.menu.on('show:after', _.bind(this.onListShowAfter, this, 1, toolbar.mnuNumbersPicker));
toolbar.btnMultilevels.menu.on('show:after', _.bind(this.onListShowAfter, this, 2, toolbar.mnuMultilevelPicker));
2019-12-04 07:05:29 +00:00
toolbar.mnuMarkerSettings.on('click', _.bind(this.onMarkerSettingsClick, this, 0));
2019-12-17 11:52:30 +00:00
toolbar.mnuNumberSettings.on('click', _.bind(this.onMarkerSettingsClick, this, 1));
2019-12-17 14:25:12 +00:00
toolbar.mnuMultilevelSettings.on('click', _.bind(this.onMarkerSettingsClick, this, 2));
2021-02-03 07:32:18 +00:00
toolbar.mnuMarkerChangeLevel && toolbar.mnuMarkerChangeLevel.menu &&
toolbar.mnuMarkerChangeLevel.menu.on('show:after', _.bind(this.onChangeLevelShowAfter, this, 0));
toolbar.mnuMarkerChangeLevel.menu.on('item:click', _.bind(this.onChangeLevelClick, this, 0));
toolbar.mnuNumberChangeLevel && toolbar.mnuNumberChangeLevel.menu &&
toolbar.mnuNumberChangeLevel.menu.on('show:after', _.bind(this.onChangeLevelShowAfter, this, 1));
toolbar.mnuNumberChangeLevel.menu.on('item:click', _.bind(this.onChangeLevelClick, this, 1));
toolbar.mnuMultiChangeLevel && toolbar.mnuMultiChangeLevel.menu &&
toolbar.mnuMultiChangeLevel.menu.on('show:after', _.bind(this.onChangeLevelShowAfter, this, 2));
toolbar.mnuMultiChangeLevel.menu.on('item:click', _.bind(this.onChangeLevelClick, this, 2));
2016-03-11 00:48:53 +00:00
toolbar.btnHighlightColor.on('click', _.bind(this.onBtnHighlightColor, this));
toolbar.btnFontColor.on('click', _.bind(this.onBtnFontColor, this));
2021-07-10 19:52:39 +00:00
toolbar.btnFontColor.on('color:select', _.bind(this.onSelectFontColor, this));
toolbar.btnFontColor.on('auto:select', _.bind(this.onAutoFontColor, this));
2016-03-11 00:48:53 +00:00
toolbar.btnParagraphColor.on('click', _.bind(this.onBtnParagraphColor, this));
2021-07-10 19:52:39 +00:00
toolbar.btnParagraphColor.on('color:select', _.bind(this.onParagraphColorPickerSelect, this));
2016-03-11 00:48:53 +00:00
toolbar.mnuHighlightColorPicker.on('select', _.bind(this.onSelectHighlightColor, this));
toolbar.mnuHighlightTransparent.on('click', _.bind(this.onHighlightTransparentClick, this));
toolbar.mnuLineSpace.on('item:toggle', _.bind(this.onLineSpaceToggle, this));
toolbar.mnuNonPrinting.on('item:toggle', _.bind(this.onMenuNonPrintingToggle, this));
toolbar.btnShowHidenChars.on('toggle', _.bind(this.onNonPrintingToggle, this));
toolbar.mnuTablePicker.on('select', _.bind(this.onTablePickerSelect, this));
toolbar.mnuInsertTable.on('item:click', _.bind(this.onInsertTableClick, this));
2021-08-04 15:08:17 +00:00
toolbar.mnuInsertTable.on('show:after', _.bind(this.onInsertTableShow, this));
2016-03-11 00:48:53 +00:00
toolbar.mnuInsertImage.on('item:click', _.bind(this.onInsertImageClick, this));
toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this));
toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this));
toolbar.btnDropCap.menu.on('item:click', _.bind(this.onDropCapSelect, this));
2017-12-12 11:14:27 +00:00
toolbar.btnContentControls.menu.on('item:click', _.bind(this.onControlsSelect, this));
2020-09-21 21:01:04 +00:00
toolbar.mnuDropCapAdvanced.on('click', _.bind(this.onDropCapAdvancedClick, this, false));
2016-03-11 00:48:53 +00:00
toolbar.btnColumns.menu.on('item:click', _.bind(this.onColumnsSelect, this));
toolbar.btnPageOrient.menu.on('item:click', _.bind(this.onPageOrientSelect, this));
2016-03-11 00:48:53 +00:00
toolbar.btnPageMargins.menu.on('item:click', _.bind(this.onPageMarginsSelect, this));
2019-04-05 11:28:51 +00:00
toolbar.btnWatermark.menu.on('item:click', _.bind(this.onWatermarkSelect, this));
2016-03-11 00:48:53 +00:00
toolbar.btnClearStyle.on('click', _.bind(this.onClearStyleClick, this));
toolbar.btnCopyStyle.on('toggle', _.bind(this.onCopyStyleToggle, this));
toolbar.mnuPageSize.on('item:click', _.bind(this.onPageSizeClick, this));
toolbar.mnuColorSchema.on('item:click', _.bind(this.onColorSchemaClick, this));
2019-08-20 12:56:29 +00:00
toolbar.mnuColorSchema.on('show:after', _.bind(this.onColorSchemaShow, this));
toolbar.mnuMailRecepients.on('item:click', _.bind(this.onSelectRecepientsClick, this));
2016-03-11 00:48:53 +00:00
toolbar.mnuPageNumberPosPicker.on('item:click', _.bind(this.onInsertPageNumberClick, this));
toolbar.btnEditHeader.menu.on('item:click', _.bind(this.onEditHeaderFooterClick, this));
2020-03-03 08:08:15 +00:00
toolbar.btnInsDateTime.on('click', _.bind(this.onInsDateTimeClick, this));
2016-03-11 00:48:53 +00:00
toolbar.mnuPageNumCurrentPos.on('click', _.bind(this.onPageNumCurrentPosClick, this));
2016-10-04 12:05:12 +00:00
toolbar.mnuInsertPageCount.on('click', _.bind(this.onInsertPageCountClick, this));
2018-11-20 09:57:29 +00:00
toolbar.btnBlankPage.on('click', _.bind(this.onBtnBlankPageClick, this));
2016-03-11 00:48:53 +00:00
toolbar.listStyles.on('click', _.bind(this.onListStyleSelect, this));
toolbar.listStyles.on('contextmenu', _.bind(this.onListStyleContextMenu, this));
toolbar.styleMenu.on('hide:before', _.bind(this.onListStyleBeforeHide, this));
toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this));
2019-11-08 08:34:53 +00:00
toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this));
toolbar.mnuNoControlsColor.on('click', _.bind(this.onNoControlsColor, this));
toolbar.mnuControlsColorPicker.on('select', _.bind(this.onSelectControlsColor, this));
toolbar.btnLineNumbers.menu.on('item:click', _.bind(this.onLineNumbersSelect, this));
2020-09-29 09:42:16 +00:00
toolbar.btnLineNumbers.menu.on('show:after', _.bind(this.onLineNumbersShow, this));
Common.Gateway.on('insertimage', _.bind(this.insertImage, this));
Common.Gateway.on('setmailmergerecipients', _.bind(this.setMailMergeRecipients, this));
$('#id-toolbar-menu-new-control-color').on('click', _.bind(this.onNewControlsColor, this));
2021-09-16 09:36:12 +00:00
toolbar.listStylesAdditionalMenuItem.on('click', this.onMenuSaveStyle.bind(this));
2016-03-11 00:48:53 +00:00
this.onSetupCopyStyleButton();
this.onBtnChangeState('undo:disabled', toolbar.btnUndo, toolbar.btnUndo.isDisabled());
this.onBtnChangeState('redo:disabled', toolbar.btnRedo, toolbar.btnRedo.isDisabled());
2016-03-11 00:48:53 +00:00
},
setApi: function(api) {
this.api = api;
if (this.mode.isEdit) {
this.toolbar.setApi(api);
this.api.asc_registerCallback('asc_onFontSize', _.bind(this.onApiFontSize, this));
this.api.asc_registerCallback('asc_onBold', _.bind(this.onApiBold, this));
this.api.asc_registerCallback('asc_onItalic', _.bind(this.onApiItalic, this));
this.api.asc_registerCallback('asc_onUnderline', _.bind(this.onApiUnderline, this));
this.api.asc_registerCallback('asc_onStrikeout', _.bind(this.onApiStrikeout, this));
this.api.asc_registerCallback('asc_onVerticalAlign', _.bind(this.onApiVerticalAlign, this));
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo'));
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_registerCallback('asc_onListType', _.bind(this.onApiBullets, this));
this.api.asc_registerCallback('asc_onPrAlign', _.bind(this.onApiParagraphAlign, this));
this.api.asc_registerCallback('asc_onTextColor', _.bind(this.onApiTextColor, this));
this.api.asc_registerCallback('asc_onParaSpacingLine', _.bind(this.onApiLineSpacing, this));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
this.api.asc_registerCallback('asc_onDocSize', _.bind(this.onApiPageSize, this));
this.api.asc_registerCallback('asc_onPaintFormatChanged', _.bind(this.onApiStyleChange, this));
this.api.asc_registerCallback('asc_onParaStyleName', _.bind(this.onApiParagraphStyleChange, this));
this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this)); //for shapes
this.api.asc_registerCallback('asc_onPageOrient', _.bind(this.onApiPageOrient, this));
this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this));
this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this));
this.api.asc_registerCallback('asc_onLockDocumentSchema', _.bind(this.onApiLockDocumentSchema, this));
this.api.asc_registerCallback('asc_onUnLockDocumentSchema', _.bind(this.onApiUnLockDocumentSchema, this));
this.api.asc_registerCallback('asc_onLockHeaderFooters', _.bind(this.onApiLockHeaderFooters, this));
this.api.asc_registerCallback('asc_onUnLockHeaderFooters', _.bind(this.onApiUnLockHeaderFooters, this));
this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onApiZoomChange, this));
this.api.asc_registerCallback('asc_onMarkerFormatChanged', _.bind(this.onApiStartHighlight, this));
this.api.asc_registerCallback('asc_onTextHighLight', _.bind(this.onApiHighlightColor, this));
this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onCanCopyCut', _.bind(this.onApiCanCopyCut, this));
2019-08-15 13:51:48 +00:00
this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this));
this.api.asc_registerCallback('asc_onColumnsProps', _.bind(this.onColumnsProps, this));
this.api.asc_registerCallback('asc_onSectionProps', _.bind(this.onSectionProps, this));
2020-09-27 20:44:54 +00:00
this.api.asc_registerCallback('asc_onLineNumbersProps', _.bind(this.onLineNumbersProps, this));
this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this));
this.api.asc_registerCallback('asc_onShowParaMarks', _.bind(this.onShowParaMarks, this));
this.api.asc_registerCallback('asc_onChangeSdtGlobalSettings', _.bind(this.onChangeSdtGlobalSettings, this));
this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this.onTextLanguage, this));
Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this));
2019-11-21 14:44:29 +00:00
this.api.asc_registerCallback('asc_onTableDrawModeChanged', _.bind(this.onTableDraw, this));
this.api.asc_registerCallback('asc_onTableEraseModeChanged', _.bind(this.onTableErase, this));
Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this));
Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this));
2020-09-21 21:01:04 +00:00
Common.NotificationCenter.on('dropcap:settings', _.bind(this.onDropCapAdvancedClick, this));
} else if (this.mode.isRestrictedEdit) {
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObjectRestrictedEdit, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
}
2016-03-11 00:48:53 +00:00
},
onChangeCompactView: function(view, compact) {
2017-04-06 09:34:01 +00:00
this.toolbar.setFolded(compact);
2017-04-20 14:45:47 +00:00
this.toolbar.fireEvent('view:compact', [this, compact]);
2016-03-11 00:48:53 +00:00
2017-04-20 09:27:27 +00:00
Common.localStorage.setBool('de-compact-toolbar', compact);
2016-03-11 00:48:53 +00:00
Common.NotificationCenter.trigger('layout:changed', 'toolbar');
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
2017-04-22 12:42:52 +00:00
onClickChangeCompact: function (from) {
if ( from != 'file' ) {
var me = this;
setTimeout(function () {
me.onChangeCompactView(null, !me.toolbar.isCompact());
}, 0);
}
},
onContextMenu: function() {
2017-07-10 15:32:33 +00:00
this.toolbar.collapse();
},
onApiChangeFont: function(font) {
2020-04-22 09:35:55 +00:00
!Common.Utils.ModalWindow.isVisible() && this.toolbar.cmbFontName.onApiChangeFont(font);
},
2016-03-11 00:48:53 +00:00
onApiFontSize: function(size) {
if (this._state.fontsize !== size) {
this.toolbar.cmbFontSize.setValue(size);
this._state.fontsize = size;
}
},
onApiBold: function(on) {
if (this._state.bold !== on) {
this.toolbar.btnBold.toggle(on === true, true);
this._state.bold = on;
}
},
onApiItalic: function(on) {
if (this._state.italic !== on) {
this.toolbar.btnItalic.toggle(on === true, true);
this._state.italic = on;
}
},
onApiUnderline: function(on) {
if (this._state.underline !== on) {
this.toolbar.btnUnderline.toggle(on === true, true);
this._state.underline = on;
}
},
onApiStrikeout: function(on) {
if (this._state.strike !== on) {
this.toolbar.btnStrikeout.toggle(on === true, true);
this._state.strike = on;
}
},
onApiVerticalAlign: function(typeBaseline) {
if (this._state.valign !== typeBaseline) {
2022-06-29 18:33:05 +00:00
this.toolbar.btnSuperscript.toggle(typeBaseline==Asc.vertalign_SuperScript, true);
this.toolbar.btnSubscript.toggle(typeBaseline==Asc.vertalign_SubScript, true);
2016-03-11 00:48:53 +00:00
this._state.valign = typeBaseline;
}
},
onApiCanRevert: function(which, can) {
if (which=='undo') {
if (this._state.can_undo !== can) {
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.undoLock, !can, {array: [this.toolbar.btnUndo]});
2016-03-11 00:48:53 +00:00
this._state.can_undo = can;
}
} else {
if (this._state.can_redo !== can) {
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.redoLock, !can, {array: [this.toolbar.btnRedo]});
2016-03-11 00:48:53 +00:00
this._state.can_redo = can;
}
}
},
onApiCanCopyCut: function(can) {
if (this._state.can_copycut !== can) {
this.toolbar.lockToolbar(Common.enumLock.copyLock, !can, {array: [this.toolbar.btnCopy, this.toolbar.btnCut]});
2016-03-11 00:48:53 +00:00
this._state.can_copycut = can;
}
},
onApiBullets: function(v) {
var type = v.get_ListType();
if (this._state.bullets.type != type || this._state.bullets.subtype != v.get_ListSubType() ||
this.toolbar.btnMarkers.pressed && (type!==0) || this.toolbar.btnNumbers.pressed && (type!==1) || this.toolbar.btnMultilevels.pressed && (type!==2) ) {
this._state.bullets.type = type;
this._state.bullets.subtype = v.get_ListSubType();
this._clearBullets();
switch(this._state.bullets.type) {
case 0:
this.toolbar.btnMarkers.toggle(true, true);
2019-12-18 13:48:36 +00:00
if (this._state.bullets.subtype>0)
2019-12-17 09:32:15 +00:00
this.toolbar.mnuMarkersPicker.selectByIndex(this._state.bullets.subtype, true);
else
this.toolbar.mnuMarkersPicker.deselectAll(true);
2019-12-17 10:15:51 +00:00
this.toolbar.mnuMultilevelPicker.deselectAll(true);
2019-12-17 11:52:30 +00:00
this.toolbar.mnuMarkerSettings && this.toolbar.mnuMarkerSettings.setDisabled(this._state.bullets.subtype<0);
2021-02-03 07:32:18 +00:00
this.toolbar.mnuMarkerChangeLevel && this.toolbar.mnuMarkerChangeLevel.setDisabled(this._state.bullets.subtype<0);
2019-12-17 14:25:12 +00:00
this.toolbar.mnuMultilevelSettings && this.toolbar.mnuMultilevelSettings.setDisabled(this._state.bullets.subtype<0);
this.toolbar.mnuMultiChangeLevel && this.toolbar.mnuMultiChangeLevel.setDisabled(this._state.bullets.subtype<0);
2016-03-11 00:48:53 +00:00
break;
case 1:
2019-12-17 11:52:30 +00:00
var idx;
2016-03-11 00:48:53 +00:00
switch(this._state.bullets.subtype) {
case 1:
idx = 4;
break;
case 2:
idx = 5;
break;
case 3:
idx = 6;
break;
case 4:
idx = 1;
break;
case 5:
idx = 2;
break;
case 6:
idx = 3;
break;
case 7:
idx = 7;
break;
}
2022-08-31 16:16:36 +00:00
if (Common.Locale.getDefaultLanguage() === 'ru') {
2022-07-26 17:49:50 +00:00
if (this._state.bullets.subtype>7 && this._state.bullets.subtype<=11) {
idx = this._state.bullets.subtype;
}
}
2016-03-11 00:48:53 +00:00
this.toolbar.btnNumbers.toggle(true, true);
2019-12-17 11:52:30 +00:00
if (idx!==undefined)
2019-12-17 10:15:51 +00:00
this.toolbar.mnuNumbersPicker.selectByIndex(idx, true);
else
this.toolbar.mnuNumbersPicker.deselectAll(true);
this.toolbar.mnuMultilevelPicker.deselectAll(true);
2019-12-17 11:52:30 +00:00
this.toolbar.mnuNumberSettings && this.toolbar.mnuNumberSettings.setDisabled(idx==0);
2021-02-03 07:32:18 +00:00
this.toolbar.mnuNumberChangeLevel && this.toolbar.mnuNumberChangeLevel.setDisabled(idx==0);
2019-12-17 14:25:12 +00:00
this.toolbar.mnuMultilevelSettings && this.toolbar.mnuMultilevelSettings.setDisabled(idx==0);
this.toolbar.mnuMultiChangeLevel && this.toolbar.mnuMultiChangeLevel.setDisabled(idx==0);
2016-03-11 00:48:53 +00:00
break;
case 2:
this.toolbar.btnMultilevels.toggle(true, true);
this.toolbar.mnuMultilevelPicker.selectByIndex(this._state.bullets.subtype, true);
break;
}
}
},
onApiParagraphAlign: function(v) {
if (this._state.pralign !== v) {
this._state.pralign = v;
var index = -1,
align,
toolbar = this.toolbar;
switch (v) {
case 0: index = 2; align = 'btn-align-right'; break;
case 1: index = 0; align = 'btn-align-left'; break;
case 2: index = 1; align = 'btn-align-center'; break;
case 3: index = 3; align = 'btn-align-just'; break;
default: index = -255; align = 'btn-align-left'; break;
}
if (v === null || v===undefined) {
toolbar.btnAlignRight.toggle(false, true);
toolbar.btnAlignLeft.toggle(false, true);
toolbar.btnAlignCenter.toggle(false, true);
toolbar.btnAlignJust.toggle(false, true);
return;
}
toolbar.btnAlignRight.toggle(v===0, true);
toolbar.btnAlignLeft.toggle(v===1, true);
toolbar.btnAlignCenter.toggle(v===2, true);
toolbar.btnAlignJust.toggle(v===3, true);
}
},
onApiLineSpacing: function(vc) {
var line = (vc.get_Line() === null || vc.get_LineRule() === null || vc.get_LineRule() != 1) ? -1 : vc.get_Line();
if (this._state.linespace !== line) {
this._state.linespace = line;
_.each(this.toolbar.mnuLineSpace.items, function(item){
item.setChecked(false, true);
});
if (line<0) return;
if ( Math.abs(line-1.)<0.0001 )
this.toolbar.mnuLineSpace.items[0].setChecked(true, true);
else if ( Math.abs(line-1.15)<0.0001 )
this.toolbar.mnuLineSpace.items[1].setChecked(true, true);
else if ( Math.abs(line-1.5)<0.0001 )
this.toolbar.mnuLineSpace.items[2].setChecked(true, true);
else if ( Math.abs(line-2)<0.0001 )
this.toolbar.mnuLineSpace.items[3].setChecked(true, true);
else if ( Math.abs(line-2.5)<0.0001 )
this.toolbar.mnuLineSpace.items[4].setChecked(true, true);
else if ( Math.abs(line-3)<0.0001 )
this.toolbar.mnuLineSpace.items[5].setChecked(true, true);
}
},
onApiPageSize: function(w, h) {
2018-03-12 09:11:22 +00:00
if (this._state.pgorient===undefined) return;
var width = this._state.pgorient ? w : h,
height = this._state.pgorient ? h : w;
2018-08-10 10:46:19 +00:00
if (Math.abs(this._state.pgsize[0] - w) > 0.1 ||
Math.abs(this._state.pgsize[1] - h) > 0.1) {
2016-03-11 00:48:53 +00:00
this._state.pgsize = [w, h];
if (this.toolbar.mnuPageSize) {
2017-11-13 08:41:32 +00:00
this.toolbar.mnuPageSize.clearAll();
2016-03-11 00:48:53 +00:00
_.each(this.toolbar.mnuPageSize.items, function(item){
if (item.value && typeof(item.value) == 'object' &&
2018-08-10 10:46:19 +00:00
Math.abs(item.value[0] - width) < 0.1 && Math.abs(item.value[1] - height) < 0.1) {
2016-03-11 00:48:53 +00:00
item.setChecked(true);
return false;
}
}, this);
}
}
},
onSectionProps: function(props) {
if (props) {
var left = props.get_LeftMargin(),
top = props.get_TopMargin(),
right = props.get_RightMargin(),
bottom = props.get_BottomMargin();
2018-08-10 10:46:19 +00:00
if (!this._state.pgmargins || Math.abs(this._state.pgmargins[0] - top) > 0.1 ||
Math.abs(this._state.pgmargins[1] - left) > 0.1 || Math.abs(this._state.pgmargins[2] - bottom) > 0.1 ||
Math.abs(this._state.pgmargins[3] - right) > 0.1) {
2016-03-11 00:48:53 +00:00
this._state.pgmargins = [top, left, bottom, right];
if (this.toolbar.btnPageMargins.menu) {
2017-11-13 08:41:32 +00:00
this.toolbar.btnPageMargins.menu.clearAll();
2016-03-11 00:48:53 +00:00
_.each(this.toolbar.btnPageMargins.menu.items, function(item){
if (item.value && typeof(item.value) == 'object' &&
2018-08-10 10:46:19 +00:00
Math.abs(item.value[0] - top) < 0.1 && Math.abs(item.value[1] - left) < 0.1 &&
Math.abs(item.value[2] - bottom) < 0.1 && Math.abs(item.value[3] - right) < 0.1) {
2016-03-11 00:48:53 +00:00
item.setChecked(true);
return false;
}
}, this);
}
}
}
},
2018-02-26 14:38:35 +00:00
onShowParaMarks: function(v) {
this.toolbar.mnuNonPrinting.items[0].setChecked(v, true);
this.toolbar.btnShowHidenChars.toggle(v, true);
Common.localStorage.setItem("de-show-hiddenchars", v);
},
onApiFocusObjectRestrictedEdit: function(selectedObjects) {
if (!this.editMode) return;
var i = -1, type,
paragraph_locked = false,
header_locked = false,
image_locked = false,
in_image = false,
frame_pr = undefined;
while (++i < selectedObjects.length) {
type = selectedObjects[i].get_ObjectType();
if (type === Asc.c_oAscTypeSelectElement.Paragraph) {
frame_pr = selectedObjects[i].get_ObjectValue();
paragraph_locked = selectedObjects[i].get_ObjectValue().get_Locked();
} else if (type === Asc.c_oAscTypeSelectElement.Header) {
header_locked = selectedObjects[i].get_ObjectValue().get_Locked();
} else if (type === Asc.c_oAscTypeSelectElement.Image) {
in_image = true;
image_locked = selectedObjects[i].get_ObjectValue().get_Locked();
}
}
var rich_del_lock = (frame_pr) ? !frame_pr.can_DeleteBlockContentControl() : false,
rich_edit_lock = (frame_pr) ? !frame_pr.can_EditBlockContentControl() : false,
plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : false,
plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : false;
2022-04-12 15:31:21 +00:00
if (this.btnsComment) {
this.toolbar.lockToolbar(Common.enumLock.cantAddQuotedComment, !this.api.can_AddQuotedComment(), {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.imageLock, image_locked, {array: this.btnsComment});
this.mode.compatibleFeatures && this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: this.btnsComment});
if (this.api.asc_IsContentControl()) {
var control_props = this.api.asc_GetContentControlProperties(),
spectype = control_props ? control_props.get_SpecificType() : Asc.c_oAscContentControlSpecificType.None;
this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture ||
spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime, {array: this.btnsComment});
2022-09-09 11:56:29 +00:00
} else
this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, false, {array: this.btnsComment});
2022-04-12 15:31:21 +00:00
this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.headerLock, header_locked, {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.richEditLock, rich_edit_lock, {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.plainEditLock, plain_edit_lock, {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.richDelLock, rich_del_lock, {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: this.btnsComment});
}
},
2016-03-11 00:48:53 +00:00
onApiFocusObject: function(selectedObjects) {
if (!this.editMode) return;
var pr, sh, i = -1, type,
paragraph_locked = false,
header_locked = false,
image_locked = false,
2016-03-11 00:48:53 +00:00
can_add_table = false,
can_add_image = false,
enable_dropcap = undefined,
disable_dropcapadv = true,
frame_pr = undefined,
shape_pr = undefined,
2016-03-11 00:48:53 +00:00
toolbar = this.toolbar,
in_header = false,
in_chart = false,
in_equation = false,
btn_eq_state = false,
2017-12-12 11:14:27 +00:00
in_image = false,
2019-10-02 12:33:42 +00:00
in_control = false,
in_para = false,
in_footnote = this.api.asc_IsCursorInFootnote() || this.api.asc_IsCursorInEndnote();
2016-03-11 00:48:53 +00:00
while (++i < selectedObjects.length) {
type = selectedObjects[i].get_ObjectType();
pr = selectedObjects[i].get_ObjectValue();
if (type === Asc.c_oAscTypeSelectElement.Paragraph) {
2016-03-11 00:48:53 +00:00
paragraph_locked = pr.get_Locked();
can_add_table = pr.get_CanAddTable();
can_add_image = pr.get_CanAddImage();
frame_pr = pr;
sh = pr.get_Shade();
2019-10-02 12:33:42 +00:00
in_para = true;
} else if (type === Asc.c_oAscTypeSelectElement.Header) {
2016-03-11 00:48:53 +00:00
header_locked = pr.get_Locked();
in_header = true;
} else if (type === Asc.c_oAscTypeSelectElement.Image) {
2017-09-01 07:03:11 +00:00
in_image = true;
image_locked = pr.get_Locked();
2016-03-11 00:48:53 +00:00
if (pr && pr.get_ChartProperties())
in_chart = true;
if (pr && pr.get_ShapeProperties())
shape_pr = pr.get_ShapeProperties();
} else if (type === Asc.c_oAscTypeSelectElement.Math) {
2016-03-11 00:48:53 +00:00
in_equation = true;
if (Asc.c_oAscMathInterfaceType.Common === pr.get_Type())
2016-03-11 00:48:53 +00:00
btn_eq_state = true;
}
if (type === Asc.c_oAscTypeSelectElement.Table || type === Asc.c_oAscTypeSelectElement.Header || type === Asc.c_oAscTypeSelectElement.Image) {
2016-03-11 00:48:53 +00:00
enable_dropcap = false;
}
if (enable_dropcap!==false && type == Asc.c_oAscTypeSelectElement.Paragraph)
2016-03-11 00:48:53 +00:00
enable_dropcap = true;
}
if (sh)
this.onParagraphColor(sh);
2019-12-20 13:18:17 +00:00
var rich_del_lock = (frame_pr) ? !frame_pr.can_DeleteBlockContentControl() : false,
rich_edit_lock = (frame_pr) ? !frame_pr.can_EditBlockContentControl() : false,
plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : false,
plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : false,
in_smart_art = shape_pr && shape_pr.asc_getFromSmartArt(),
in_smart_art_internal = shape_pr && shape_pr.asc_getFromSmartArtInternal();
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: this.toolbar.paragraphControls.concat([toolbar.btnContentControls, toolbar.btnClearStyle])});
this.toolbar.lockToolbar(Common.enumLock.headerLock, header_locked, {array: this.toolbar.paragraphControls.concat([toolbar.btnContentControls, toolbar.btnClearStyle, toolbar.btnWatermark])});
this.toolbar.lockToolbar(Common.enumLock.richEditLock, rich_edit_lock, {array: this.toolbar.paragraphControls.concat([toolbar.btnClearStyle])});
this.toolbar.lockToolbar(Common.enumLock.plainEditLock, plain_edit_lock, {array: this.toolbar.paragraphControls.concat([toolbar.btnClearStyle])});
2022-04-12 15:31:21 +00:00
this.toolbar.lockToolbar(Common.enumLock.richDelLock, rich_del_lock, {array: toolbar.btnsPageBreak.concat(this.btnsComment).concat([toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertTextArt,
toolbar.btnInsDateTime, toolbar.btnBlankPage, toolbar.btnInsertEquation, toolbar.btnInsertSymbol ])});
2022-04-12 15:31:21 +00:00
this.toolbar.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: toolbar.btnsPageBreak.concat(this.btnsComment).concat([toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertTextArt,
toolbar.btnInsDateTime, toolbar.btnBlankPage, toolbar.btnInsertEquation, toolbar.btnInsertSymbol ])});
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.inChart, in_chart, {array: toolbar.textOnlyControls.concat([toolbar.btnClearStyle, toolbar.btnInsertEquation])});
this.toolbar.lockToolbar(Common.enumLock.inSmartart, in_smart_art, {array: toolbar.textOnlyControls.concat([toolbar.btnClearStyle])});
this.toolbar.lockToolbar(Common.enumLock.inSmartartInternal, in_smart_art_internal, {array: toolbar.textOnlyControls.concat([toolbar.btnClearStyle, toolbar.btnDecLeftOffset, toolbar.btnIncLeftOffset])});
this.toolbar.lockToolbar(Common.enumLock.inEquation, in_equation, {array: toolbar.btnsPageBreak.concat([toolbar.btnDropCap, toolbar.btnInsertTable, toolbar.btnBlankPage, toolbar.btnInsertShape,
toolbar.btnInsertText, toolbar.btnInsertTextArt, toolbar.btnInsertImage, toolbar.btnSuperscript, toolbar.btnSubscript, toolbar.btnEditHeader])});
2016-03-11 00:48:53 +00:00
in_control = this.api.asc_IsContentControl();
var control_props = in_control ? this.api.asc_GetContentControlProperties() : null,
lock_type = (in_control&&control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked,
control_plain = (in_control&&control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false;
(lock_type===undefined) && (lock_type = Asc.c_oAscSdtLockType.Unlocked);
var content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked;
if (!toolbar.btnContentControls.isDisabled()) {
2020-10-07 16:13:24 +00:00
var control_disable = control_plain || content_locked,
if_form = control_props && control_props.get_FormPr();
for (var i=0; i<7; i++)
toolbar.btnContentControls.menu.items[i].setDisabled(control_disable);
2020-10-07 16:13:24 +00:00
toolbar.btnContentControls.menu.items[8].setDisabled(!in_control || lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked || if_form);
toolbar.btnContentControls.menu.items[10].setDisabled(!in_control || if_form);
}
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.controlPlain, control_plain, {array: [toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertText, toolbar.btnInsertTextArt,
toolbar.btnInsertShape, toolbar.btnInsertEquation, toolbar.btnDropCap, toolbar.btnColumns, toolbar.mnuInsertPageNum ]});
2016-03-11 00:48:53 +00:00
if (enable_dropcap && frame_pr) {
var value = frame_pr.get_FramePr(),
drop_value = Asc.c_oAscDropCap.None;
2016-03-11 00:48:53 +00:00
if (value!==undefined) {
drop_value = value.get_DropCap();
enable_dropcap = ( drop_value === Asc.c_oAscDropCap.Drop || drop_value === Asc.c_oAscDropCap.Margin);
2016-03-11 00:48:53 +00:00
disable_dropcapadv = false;
} else {
enable_dropcap = frame_pr.get_CanAddDropCap();
}
if (enable_dropcap)
this.onDropCap(drop_value);
}
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.dropcapLock, !enable_dropcap, {array: [toolbar.btnDropCap]});
2017-04-03 16:24:24 +00:00
if ( !toolbar.btnDropCap.isDisabled() )
2016-03-11 00:48:53 +00:00
toolbar.mnuDropCapAdvanced.setDisabled(disable_dropcapadv);
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.cantAddTable, !can_add_table, {array: [toolbar.btnInsertTable]});
this.toolbar.lockToolbar(Common.enumLock.cantAddPageNum, toolbar.mnuPageNumCurrentPos.isDisabled() && toolbar.mnuPageNumberPosPicker.isDisabled(), {array: [toolbar.mnuInsertPageNum]});
this.toolbar.lockToolbar(Common.enumLock.inHeader, in_header, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage])});
this.toolbar.lockToolbar(Common.enumLock.inControl, in_control, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage])});
this.toolbar.lockToolbar(Common.enumLock.cantPageBreak, in_image && !btn_eq_state, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage])});
this.toolbar.lockToolbar(Common.enumLock.contentLock, content_locked, {array: [toolbar.btnInsertShape, toolbar.btnInsertText, toolbar.btnInsertImage, toolbar.btnInsertTextArt, toolbar.btnInsertChart ]});
this.toolbar.lockToolbar(Common.enumLock.inFootnote, in_footnote, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage, toolbar.btnInsertShape, toolbar.btnInsertText, toolbar.btnInsertTextArt ])});
this.toolbar.lockToolbar(Common.enumLock.cantAddImagePara, in_para && !can_add_image, {array: [toolbar.btnInsertImage, toolbar.btnInsertTextArt]});
if (in_chart !== this._state.in_chart) {
toolbar.btnInsertChart.updateHint(in_chart ? toolbar.tipChangeChart : toolbar.tipInsertChart);
this._state.in_chart = in_chart;
}
var need_disable = paragraph_locked || header_locked || in_equation || control_plain || rich_del_lock || plain_del_lock || content_locked || in_para && !can_add_image;
need_disable = !in_chart && need_disable;
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.cantAddChart, need_disable, {array: [toolbar.btnInsertChart]});
this.toolbar.lockToolbar(Common.enumLock.chartLock, in_chart && image_locked, {array: [toolbar.btnInsertChart]});
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.cantAddEquation, !can_add_image&&!in_equation, {array: [toolbar.btnInsertEquation]});
this.toolbar.lockToolbar(Common.enumLock.noParagraphSelected, !in_para, {array: [toolbar.btnInsertSymbol, toolbar.btnInsDateTime]});
this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: [toolbar.btnColumns]});
this.toolbar.lockToolbar(Common.enumLock.inImagePara, in_image && in_para, {array: [toolbar.btnLineNumbers]});
2021-07-07 13:18:34 +00:00
2016-03-11 00:48:53 +00:00
if (toolbar.listStylesAdditionalMenuItem && (frame_pr===undefined) !== toolbar.listStylesAdditionalMenuItem.isDisabled())
toolbar.listStylesAdditionalMenuItem.setDisabled(frame_pr===undefined);
2022-04-12 15:31:21 +00:00
if (this.btnsComment) {
// comments
this.toolbar.lockToolbar(Common.enumLock.cantAddQuotedComment, !this.api.can_AddQuotedComment(), {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.imageLock, image_locked, {array: this.btnsComment});
this.mode.compatibleFeatures && this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: this.btnsComment});
if (control_props) {
var spectype = control_props.get_SpecificType();
this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture ||
spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime,
{array: this.btnsComment});
2022-09-09 11:56:29 +00:00
} else
this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, false, {array: this.btnsComment});
2020-01-30 13:00:36 +00:00
}
2020-09-29 09:42:16 +00:00
if (frame_pr) {
this._state.suppress_num = !!frame_pr.get_SuppressLineNumbers();
}
2016-03-11 00:48:53 +00:00
this._state.in_equation = in_equation;
},
onApiStyleChange: function(v) {
this.toolbar.btnCopyStyle.toggle(v, true);
this.modeAlwaysSetStyle = false;
},
2019-11-20 14:10:32 +00:00
onTableDraw: function(v) {
this.toolbar.mnuInsertTable && this.toolbar.mnuInsertTable.items[2].setChecked(!!v, true);
},
onTableErase: function(v) {
this.toolbar.mnuInsertTable && this.toolbar.mnuInsertTable.items[3].setChecked(!!v, true);
},
2016-03-11 00:48:53 +00:00
onApiParagraphStyleChange: function(name) {
if (this._state.prstyle != name) {
var listStyle = this.toolbar.listStyles,
listStylesVisible = (listStyle.rendered);
if (listStylesVisible) {
listStyle.suspendEvents();
var styleRec = listStyle.menuPicker.store.findWhere({
title: name
});
this._state.prstyle = (listStyle.menuPicker.store.length>0 || window.styles_loaded) ? name : undefined;
2016-03-11 00:48:53 +00:00
listStyle.menuPicker.selectRecord(styleRec);
listStyle.resumeEvents();
}
}
},
onApiPageOrient: function(isportrait) {
if (this._state.pgorient !== isportrait) {
this.toolbar.btnPageOrient.menu.items[isportrait ? 0 : 1].setChecked(true);
2016-03-11 00:48:53 +00:00
this._state.pgorient = isportrait;
}
},
onApiLockDocumentProps: function() {
if (this._state.lock_doc!==true) {
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.docPropsLock, true, {array: [this.toolbar.btnPageOrient, this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnColumns, this.toolbar.btnLineNumbers]});
2016-03-11 00:48:53 +00:00
if (this._state.activated) this._state.lock_doc = true;
}
},
onApiUnLockDocumentProps: function() {
if (this._state.lock_doc!==false) {
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.docPropsLock, false, {array: [this.toolbar.btnPageOrient, this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnColumns, this.toolbar.btnLineNumbers]});
2016-03-11 00:48:53 +00:00
if (this._state.activated) this._state.lock_doc = false;
}
},
onApiLockDocumentSchema: function() {
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.docSchemaLock, true, {array: [this.toolbar.btnColorSchemas]});
2016-03-11 00:48:53 +00:00
},
onApiUnLockDocumentSchema: function() {
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.docSchemaLock, false, {array: [this.toolbar.btnColorSchemas]});
2016-03-11 00:48:53 +00:00
},
onApiLockHeaderFooters: function() {
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.headerFooterLock, true, {array: [this.toolbar.mnuPageNumberPosPicker]});
this.toolbar.lockToolbar(Common.enumLock.cantAddPageNum, this.toolbar.mnuPageNumCurrentPos.isDisabled(), {array: [this.toolbar.mnuInsertPageNum]});
2016-03-11 00:48:53 +00:00
},
onApiUnLockHeaderFooters: function() {
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.headerFooterLock, false, {array: [this.toolbar.mnuPageNumberPosPicker]});
this.toolbar.lockToolbar(Common.enumLock.cantAddPageNum, false, {array: [this.toolbar.mnuInsertPageNum]});
2016-03-11 00:48:53 +00:00
},
2018-03-21 11:28:28 +00:00
onApiZoomChange: function(percent, type) {},
2016-03-11 00:48:53 +00:00
onApiStartHighlight: function(pressed) {
this.toolbar.btnHighlightColor.toggle(pressed, true);
},
onApiHighlightColor: function(c) {
var textpr = this.api.get_TextProps().get_TextPr();
if (textpr) {
c = textpr.get_HighLight();
if (c == -1) {
if (this._state.clrhighlight != -1) {
this.toolbar.mnuHighlightTransparent.setChecked(true, true);
if (this.toolbar.mnuHighlightColorPicker) {
2016-03-11 00:48:53 +00:00
this._state.clrhighlight = -1;
this.toolbar.mnuHighlightColorPicker.clearSelection();
2016-03-11 00:48:53 +00:00
}
}
} else if (c !== null) {
if (this._state.clrhighlight != c.get_hex().toUpperCase()) {
this.toolbar.mnuHighlightTransparent.setChecked(false);
this._state.clrhighlight = c.get_hex().toUpperCase();
if ( this.toolbar.mnuHighlightColorPicker && _.contains(this.toolbar.mnuHighlightColorPicker.colors, this._state.clrhighlight) )
this.toolbar.mnuHighlightColorPicker.selectByRGB(this._state.clrhighlight, true);
2016-03-11 00:48:53 +00:00
}
} else {
if ( this._state.clrhighlight !== c) {
this.toolbar.mnuHighlightTransparent.setChecked(false, true);
this.toolbar.mnuHighlightColorPicker && this.toolbar.mnuHighlightColorPicker.clearSelection();
2016-03-11 00:48:53 +00:00
this._state.clrhighlight = c;
}
}
}
},
onApiInitEditorStyles: function(styles) {
this._onInitEditorStyles(styles);
},
2018-08-08 13:51:02 +00:00
onChangeSdtGlobalSettings: function() {
var show = this.api.asc_GetGlobalContentControlShowHighlight();
2020-12-25 13:46:01 +00:00
this.toolbar.mnuNoControlsColor && this.toolbar.mnuNoControlsColor.setChecked(!show, true);
this.toolbar.mnuControlsColorPicker && this.toolbar.mnuControlsColorPicker.clearSelection();
2018-08-08 13:51:02 +00:00
if (show){
var clr = this.api.asc_GetGlobalContentControlHighlightColor();
if (clr) {
2018-08-28 14:52:21 +00:00
clr = Common.Utils.ThemeColor.getHexColor(clr.get_r(), clr.get_g(), clr.get_b());
2020-12-25 13:46:01 +00:00
this.toolbar.mnuControlsColorPicker && this.toolbar.mnuControlsColorPicker.selectByRGB(clr, true);
2018-08-08 13:51:02 +00:00
}
}
},
2016-03-11 00:48:53 +00:00
onNewDocument: function(btn, e) {
if (this.api)
this.api.OpenNewDocument();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'New Document');
},
onOpenDocument: function(btn, e) {
if (this.api)
this.api.LoadDocumentFromDisk();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Open Document');
},
onPrint: function(e) {
Common.NotificationCenter.trigger('file:print', this.toolbar);
2016-03-11 00:48:53 +00:00
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('Print');
Common.component.Analytics.trackEvent('ToolBar', 'Print');
},
onSave: function(e) {
var toolbar = this.toolbar;
2016-03-11 00:48:53 +00:00
if (this.api) {
var isModified = this.api.asc_isDocumentCanSave();
2019-11-20 09:42:39 +00:00
var isSyncButton = toolbar.btnCollabChanges && toolbar.btnCollabChanges.cmpEl.hasClass('notify');
if (!isModified && !isSyncButton && !toolbar.mode.forcesave)
2016-03-11 00:48:53 +00:00
return;
this.api.asc_Save();
}
toolbar.btnSave.setDisabled(!toolbar.mode.forcesave);
2016-03-11 00:48:53 +00:00
Common.NotificationCenter.trigger('edit:complete', toolbar);
2016-03-11 00:48:53 +00:00
Common.component.Analytics.trackEvent('Save');
Common.component.Analytics.trackEvent('ToolBar', 'Save');
},
onBtnChangeState: function(prop) {
if ( /\:disabled$/.test(prop) ) {
var _is_disabled = arguments[2];
this.toolbar.fireEvent(prop, [_is_disabled]);
}
},
2016-03-11 00:48:53 +00:00
onUndo: function(btn, e) {
if (this.api)
this.api.Undo();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Undo');
},
onRedo: function(btn, e) {
if (this.api)
this.api.Redo();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Redo');
},
onCopyPaste: function(type, e) {
2016-03-11 00:48:53 +00:00
var me = this;
if (me.api) {
var res = (type === 'cut') ? me.api.Cut() : ((type === 'copy') ? me.api.Copy() : me.api.Paste());
if (!res) {
if (!Common.localStorage.getBool("de-hide-copywarning")) {
2016-03-11 00:48:53 +00:00
(new Common.Views.CopyWarningDialog({
handler: function(dontshow) {
if (dontshow) Common.localStorage.setItem("de-hide-copywarning", 1);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
}
} else
Common.component.Analytics.trackEvent('ToolBar', 'Copy Warning');
2016-03-11 00:48:53 +00:00
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
2016-03-11 00:48:53 +00:00
},
onSelectAll: function(e) {
if (this.api)
this.api.asc_EditSelectAll();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Select All');
},
2016-03-11 00:48:53 +00:00
onIncrease: function(e) {
if (this.api)
this.api.FontSizeIn();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Font Size');
},
onDecrease: function(e) {
if (this.api)
this.api.FontSizeOut();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Font Size');
},
onBold: function(btn, e) {
this._state.bold = undefined;
if (this.api)
this.api.put_TextPrBold(btn.pressed);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Bold');
},
onItalic: function(btn, e) {
this._state.italic = undefined;
if (this.api)
this.api.put_TextPrItalic(btn.pressed);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Italic');
},
onUnderline: function(btn, e) {
this._state.underline = undefined;
if (this.api)
this.api.put_TextPrUnderline(btn.pressed);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Underline');
},
onStrikeout: function(btn, e) {
this._state.strike = undefined;
if (this.api)
this.api.put_TextPrStrikeout(btn.pressed);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Strikeout');
},
onSuperscript: function(btn, e) {
if (!this.toolbar.btnSubscript.pressed) {
this._state.valign = undefined;
if (this.api)
2022-06-29 18:33:05 +00:00
this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SuperScript : Asc.vertalign_Baseline);
2016-03-11 00:48:53 +00:00
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Superscript');
}
},
onSubscript: function(btn, e) {
if (!this.toolbar.btnSuperscript.pressed) {
this._state.valign = undefined;
if (this.api)
2022-06-29 18:33:05 +00:00
this.api.put_TextPrBaseline(btn.pressed ? Asc.vertalign_SubScript : Asc.vertalign_Baseline);
2016-03-11 00:48:53 +00:00
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Subscript');
}
},
onDecOffset: function(btn, e) {
if (this.api)
this.api.DecreaseIndent();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Indent');
},
onIncOffset: function(btn, e) {
if (this.api)
this.api.IncreaseIndent();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Indent');
},
onHorizontalAlign: function(type, btn, e) {
this._state.pralign = undefined;
2021-06-18 12:24:44 +00:00
if (this.api) {
if (!btn.pressed) {
type = (type==1) ? 3 : 1;
}
2016-03-11 00:48:53 +00:00
this.api.put_PrAlign(type);
2021-06-18 12:24:44 +00:00
}
2016-03-11 00:48:53 +00:00
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Align');
},
onMarkers: function(btn, e) {
var record = {
data: {
type: 0,
subtype: btn.pressed ? 0: -1
}
};
this.onSelectBullets(null, null, null, record);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onNumbers: function(btn, e) {
var record = {
data: {
type: 1,
subtype: btn.pressed ? 0: -1
}
};
this.onSelectBullets(null, null, null, record);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onComboBlur: function() {
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onFontNameSelect: function(combo, record) {
if (this.api) {
if (record.isNewFont) {
2020-04-22 09:35:55 +00:00
!Common.Utils.ModalWindow.isVisible() &&
2016-03-11 00:48:53 +00:00
Common.UI.warning({
width: 500,
msg: this.confirmAddFontName,
buttons: ['yes', 'no'],
primary: 'yes',
callback: _.bind(function(btn) {
if (btn == 'yes') {
this.api.put_TextPrFontName(record.name);
Common.component.Analytics.trackEvent('ToolBar', 'Font Name');
} else {
this.toolbar.cmbFontName.setValue(this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name());
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
}, this)
});
} else {
this.api.put_TextPrFontName(record.name);
Common.component.Analytics.trackEvent('ToolBar', 'Font Name');
}
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onComboOpen: function(needfocus, combo) {
_.delay(function() {
var input = $('input', combo.cmpEl).select();
if (needfocus) input.focus();
else if (!combo.isMenuOpen()) input.one('mouseup', function (e) { e.preventDefault(); });
}, 10);
},
onFontSizeSelect: function(combo, record) {
this._state.fontsize = undefined;
if (this.api)
this.api.put_TextPrFontSize(record.value);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Font Size');
},
onFontSizeChanged: function(before, combo, record, e) {
var value,
me = this;
if (before) {
var item = combo.store.findWhere({
displayValue: record.value
});
if (!item) {
2020-03-31 13:49:33 +00:00
value = /^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(record.value);
2016-03-11 00:48:53 +00:00
if (!value) {
value = this._getApiTextSize();
2022-02-16 19:51:34 +00:00
setTimeout(function(){
Common.UI.warning({
msg: me.textFontSizeErr,
callback: function() {
_.defer(function(btn) {
$('input', combo.cmpEl).focus();
})
}
});
}, 1);
2016-03-11 00:48:53 +00:00
combo.setRawValue(value);
e.preventDefault();
return false;
}
}
} else {
2020-03-31 13:49:33 +00:00
value = Common.Utils.String.parseFloat(record.value);
2020-11-27 16:35:04 +00:00
value = value > 300
? 300
2016-03-11 00:48:53 +00:00
: value < 1
? 1
: Math.floor((value+0.4)*2)/2;
combo.setRawValue(value);
this._state.fontsize = undefined;
if (this.api)
this.api.put_TextPrFontSize(value);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
}
},
2021-01-18 13:41:49 +00:00
onChangeCase: function(menu, item, e) {
if (this.api)
this.api.asc_ChangeTextCase(item.value);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
2021-04-01 15:57:00 +00:00
onListShowAfter: function(type, picker) {
var store = picker.store;
2021-03-30 16:40:02 +00:00
var arr = [];
store.each(function(item){
arr.push(item.get('id'));
});
if (this.api) {
2022-07-26 20:45:51 +00:00
this.api.SetDrawImagePreviewBulletForMenu(arr, type);
2021-03-30 16:40:02 +00:00
}
},
2016-03-11 00:48:53 +00:00
onSelectBullets: function(btn, picker, itemView, record) {
var rawData = {},
isPickerSelect = _.isFunction(record.toJSON);
if (isPickerSelect){
if (record.get('selected')) {
rawData = record.toJSON();
} else {
// record deselected
return;
}
} else {
rawData = record;
}
if (btn) {
btn.toggle(rawData.data.subtype > -1, true);
}
2019-12-20 08:46:14 +00:00
this._state.bullets.type = undefined;
this._state.bullets.subtype = undefined;
2016-03-11 00:48:53 +00:00
if (this.api)
this.api.put_ListType(rawData.data.type, rawData.data.subtype);
Common.component.Analytics.trackEvent('ToolBar', 'List Type');
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
2019-12-04 07:05:29 +00:00
onMarkerSettingsClick: function(type) {
2019-12-04 10:35:56 +00:00
var me = this;
var listId = me.api.asc_GetCurrentNumberingId(),
level = me.api.asc_GetCurrentNumberingLvl(),
2019-12-18 13:48:36 +00:00
props = (listId !== null) ? me.api.asc_GetNumberingPr(listId) : null;
2019-12-17 11:52:30 +00:00
if (props) {
(new DE.Views.ListSettingsDialog({
2019-12-04 07:05:29 +00:00
api: me.api,
props: props,
2019-12-04 10:35:56 +00:00
level: level,
2019-12-17 11:52:30 +00:00
type: type,
2019-12-04 07:05:29 +00:00
interfaceLang: me.mode.lang,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
2019-12-18 13:48:36 +00:00
me.api.asc_ChangeNumberingLvl(listId, value.props, value.num);
2019-12-04 07:05:29 +00:00
}
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
}
},
2021-02-03 07:32:18 +00:00
onChangeLevelShowAfter: function(type, menu) {
var me = this;
var listId = me.api.asc_GetCurrentNumberingId(),
level = me.api.asc_GetCurrentNumberingLvl(),
props = (listId !== null) ? me.api.asc_GetNumberingPr(listId) : null;
2021-04-23 14:59:55 +00:00
var item = _.find(menu.items, function(item) { return item.options.level == level; });
menu.clearAll();
item && item.setChecked(true);
2021-02-03 07:32:18 +00:00
if (props) {
this.api.SetDrawImagePreviewBulletChangeListLevel(menu.options.previewIds, props);
}
},
onChangeLevelClick: function(type, menu, item) {
if (this.api) {
2021-02-05 11:08:18 +00:00
this.api.asc_SetNumberingLvl(item.options.level);
2021-02-03 07:32:18 +00:00
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
2016-03-11 00:48:53 +00:00
onLineSpaceToggle: function(menu, item, state, e) {
if (!!state) {
this._state.linespace = undefined;
if (this.api)
this.api.put_PrLineSpacing(c_paragraphLinerule.LINERULE_AUTO, item.value);
Common.component.Analytics.trackEvent('ToolBar', 'Line Spacing');
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
}
},
onMenuNonPrintingToggle: function(menu, item, state, e) {
var me = this;
if (item.value === 'characters') {
Common.localStorage.setItem("de-show-hiddenchars", state);
me.toolbar.btnShowHidenChars.toggle(state, true);
if (me.api)
me.api.put_ShowParaMarks(state);
Common.NotificationCenter.trigger('edit:complete', me);
Common.component.Analytics.trackEvent('ToolBar', 'Hidden Characters');
} else if (item.value === 'table') {
Common.localStorage.setItem("de-show-tableline", state);
me.api && me.api.put_ShowTableEmptyLine(state);
Common.NotificationCenter.trigger('edit:complete', me);
}
},
onNonPrintingToggle: function(btn, state) {
var me = this;
if (state) {
me.toolbar.mnuNonPrinting.items[0].setChecked(true, true);
Common.component.Analytics.trackEvent('ToolBar', 'Hidden Characters');
} else {
me.toolbar.mnuNonPrinting.items[0].setChecked(false, true);
}
if (me.api)
me.api.put_ShowParaMarks(state);
Common.localStorage.setItem("de-show-hiddenchars", state);
Common.NotificationCenter.trigger('edit:complete', me);
},
2017-03-31 10:54:02 +00:00
onClickPageBreak: function(value, e) {
if ( value === 'column' ) {
this.api.put_AddColumnBreak();
Common.component.Analytics.trackEvent('ToolBar', 'Column Break');
} else
if ( value == 'page' ) {
this.api.put_AddPageBreak();
Common.component.Analytics.trackEvent('ToolBar', 'Page Break');
} else {
this.api.add_SectionBreak( value );
2016-03-11 00:48:53 +00:00
Common.component.Analytics.trackEvent('ToolBar', 'Section Break');
}
2017-03-31 10:54:02 +00:00
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
2016-03-11 00:48:53 +00:00
},
onTablePickerSelect: function(picker, columns, rows, e) {
if (this.api) {
this.toolbar.fireEvent('inserttable', this.toolbar);
this.api.put_Table(columns, rows);
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Table');
},
2021-08-04 15:08:17 +00:00
onInsertTableShow: function(menu) {
var selected = this.api.asc_GetSelectedText();
menu.items[4].setDisabled(!selected || selected.length<1);
},
2016-03-11 00:48:53 +00:00
onInsertTableClick: function(menu, item, e) {
2021-04-15 21:32:56 +00:00
var me = this;
2016-03-11 00:48:53 +00:00
if (item.value === 'custom') {
(new Common.Views.InsertTableDialog({
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
me.toolbar.fireEvent('inserttable', me.toolbar);
me.api.put_Table(value.columns, value.rows);
}
Common.component.Analytics.trackEvent('ToolBar', 'Table');
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
2016-03-11 00:48:53 +00:00
}
})).show();
2019-11-20 14:10:32 +00:00
} else if (item.value == 'draw') {
item.isChecked() && menu.items[3].setChecked(false, true);
this.api.SetTableDrawMode(item.isChecked());
} else if (item.value == 'erase') {
item.isChecked() && menu.items[2].setChecked(false, true);
this.api.SetTableEraseMode(item.isChecked());
2021-04-15 21:32:56 +00:00
} else if (item.value == 'convert') {
(new DE.Views.TextToTableDialog({
props: this.api.asc_PreConvertTextToTable(),
handler: function(result, value) {
if (result == 'ok' && me.api) {
me.api.asc_ConvertTextToTable(value);
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
2022-04-01 14:49:24 +00:00
} else if (item.value == 'sse') {
var oleEditor = this.getApplication().getController('Common.Controllers.ExternalOleEditor').getView('Common.Views.ExternalOleEditor');
if (oleEditor) {
oleEditor.setEditMode(false);
oleEditor.show();
oleEditor.setOleData("empty");
}
2016-03-11 00:48:53 +00:00
}
},
onInsertImageClick: function(menu, item, e) {
var me = this;
if (item.value === 'file') {
this.toolbar.fireEvent('insertimage', this.toolbar);
if (this.api)
2021-05-11 12:24:53 +00:00
setTimeout(function() {me.api.asc_addImage();}, 1);
2016-03-11 00:48:53 +00:00
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Image');
2018-10-03 11:00:08 +00:00
} else if (item.value === 'url') {
2016-03-11 00:48:53 +00:00
(new Common.Views.ImageFromUrlDialog({
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) {
me.toolbar.fireEvent('insertimage', me.toolbar);
2021-08-26 12:14:29 +00:00
me.api.AddImageUrl([checkUrl]);
2016-03-11 00:48:53 +00:00
Common.component.Analytics.trackEvent('ToolBar', 'Image');
} else {
Common.UI.warning({
msg: this.textEmptyImgUrl
});
}
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
}
})).show();
2018-10-03 11:00:08 +00:00
} else if (item.value === 'storage') {
Common.NotificationCenter.trigger('storage:image-load', 'add');
}
},
openImageFromStorage: function(type) {
var me = this;
if (this.toolbar.mode.canRequestInsertImage) {
Common.Gateway.requestInsertImage(type);
} else {
(new Common.Views.SelectFileDlg({
fileChoiceUrl: this.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly")
})).on('selectfile', function(obj, file){
file && (file.c = type);
!file.images && (file.images = [{fileType: file.fileType, url: file.url}]); // SelectFileDlg uses old format for inserting image
file.url = null;
me.insertImage(file);
}).show();
}
},
insertImageFromStorage: function(data) {
2021-08-27 11:07:50 +00:00
if (data && data._urls && (!data.c || data.c=='add')) {
this.toolbar.fireEvent('insertimage', this.toolbar);
2021-08-27 11:07:50 +00:00
(data._urls.length>0) && this.api.AddImageUrl(data._urls, undefined, data.token);// for loading from storage
Common.component.Analytics.trackEvent('ToolBar', 'Image');
}
},
insertImage: function(data) { // gateway
if (data && (data.url || data.images)) {
data.url && console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead.");
2021-08-26 12:14:29 +00:00
var arr = [];
if (data.images && data.images.length>0) {
for (var i=0; i<data.images.length; i++) {
data.images[i] && data.images[i].url && arr.push( data.images[i].url);
}
} else
data.url && arr.push(data.url);
2021-08-27 11:07:50 +00:00
data._urls = arr;
2016-03-11 00:48:53 +00:00
}
Common.NotificationCenter.trigger('storage:image-insert', data);
},
2016-03-11 00:48:53 +00:00
onBtnInsertTextClick: function(btn, e) {
if (this.api)
this._addAutoshape(btn.pressed, 'textRect');
if (this.toolbar.btnInsertShape.pressed)
this.toolbar.btnInsertShape.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertShape);
Common.component.Analytics.trackEvent('ToolBar', 'Add Text');
},
onInsertShapeHide: function(btn, e) {
if (this.toolbar.btnInsertShape.pressed && !this._isAddingShape) {
this.toolbar.btnInsertShape.toggle(false, true);
}
this._isAddingShape = false;
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertShape);
},
onPageOrientSelect: function(menu, item) {
2016-03-11 00:48:53 +00:00
this._state.pgorient = undefined;
if (this.api && item.checked) {
this.api.change_PageOrient(item.value);
}
2016-03-11 00:48:53 +00:00
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Page Orientation');
},
onClearStyleClick: function(btn, e) {
if (this.api)
this.api.ClearFormating();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onCopyStyleToggle: function(btn, state, e) {
if (this.api)
this.api.SetPaintFormat(state ? 1 : 0);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
this.modeAlwaysSetStyle = state;
},
onPageSizeClick: function(menu, item, state) {
if (this.api && state) {
this._state.pgsize = [0, 0];
if (item.value !== 'advanced') {
if (this.checkPageSize(item.value[0], item.value[1])) {
var section = this.api.asc_GetSectionProps();
this.onApiPageSize(section.get_W(), section.get_H());
return;
} else
this.api.change_DocSize(item.value[0], item.value[1]);
} else {
2017-04-25 13:16:12 +00:00
var win, props,
2016-03-11 00:48:53 +00:00
me = this;
win = new DE.Views.PageSizeDialog({
checkPageSize: _.bind(this.checkPageSize, this),
2016-03-11 00:48:53 +00:00
handler: function(dlg, result) {
if (result == 'ok') {
props = dlg.getSettings();
me.api.change_DocSize(props[0], props[1]);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
}
});
win.show();
win.setSettings(me.api.asc_GetSectionProps());
}
Common.component.Analytics.trackEvent('ToolBar', 'Page Size');
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
onPageMarginsSelect: function(menu, item) {
if (this.api) {
this._state.pgmargins = undefined;
if (item.value !== 'advanced') {
if (this.checkPageSize(undefined, undefined, item.value[1], item.value[3], item.value[0], item.value[2])) {
this.onSectionProps(this.api.asc_GetSectionProps());
2016-03-11 00:48:53 +00:00
return;
} else {
var props = new Asc.CDocumentSectionProps();
2016-03-11 00:48:53 +00:00
props.put_TopMargin(item.value[0]);
props.put_LeftMargin(item.value[1]);
props.put_BottomMargin(item.value[2]);
props.put_RightMargin(item.value[3]);
this.api.asc_SetSectionProps(props);
}
} else {
var win, props,
me = this;
win = new DE.Views.PageMarginsDialog({
2019-12-18 08:08:58 +00:00
api: me.api,
2016-03-11 00:48:53 +00:00
handler: function(dlg, result) {
if (result == 'ok') {
props = dlg.getSettings();
var mnu = me.toolbar.btnPageMargins.menu.items[0];
mnu.setVisible(true);
mnu.setChecked(true);
mnu.options.value = mnu.value = [props.get_TopMargin(), props.get_LeftMargin(), props.get_BottomMargin(), props.get_RightMargin()];
$(mnu.el).html(mnu.template({id: Common.UI.getId(), caption : mnu.caption, options : mnu.options}));
Common.localStorage.setItem("de-pgmargins-top", props.get_TopMargin());
Common.localStorage.setItem("de-pgmargins-left", props.get_LeftMargin());
Common.localStorage.setItem("de-pgmargins-bottom", props.get_BottomMargin());
Common.localStorage.setItem("de-pgmargins-right", props.get_RightMargin());
me.api.asc_SetSectionProps(props);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
}
});
win.show();
win.setSettings(me.api.asc_GetSectionProps());
}
Common.component.Analytics.trackEvent('ToolBar', 'Page Margins');
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
checkPageSize: function(width, height, left, right, top, bottom) {
var section = this.api.asc_GetSectionProps();
(width===undefined) && (width = parseFloat(section.get_W().toFixed(4)));
(height===undefined) && (height = parseFloat(section.get_H().toFixed(4)));
(left===undefined) && (left = parseFloat(section.get_LeftMargin().toFixed(4)));
(right===undefined) && (right = parseFloat(section.get_RightMargin().toFixed(4)));
(top===undefined) && (top = parseFloat(section.get_TopMargin().toFixed(4)));
(bottom===undefined) && (bottom = parseFloat(section.get_BottomMargin().toFixed(4)));
var gutterLeft = section.get_GutterAtTop() ? 0 : parseFloat(section.get_Gutter().toFixed(4)),
gutterTop = section.get_GutterAtTop() ? parseFloat(section.get_Gutter().toFixed(4)) : 0;
var errmsg = null;
if (left + right + gutterLeft > width-12.7 )
errmsg = this.txtMarginsW;
else if (top + bottom + gutterTop > height-2.6 )
errmsg = this.txtMarginsH;
if (errmsg) {
Common.UI.warning({
title: this.notcriticalErrorTitle,
msg : errmsg,
callback: function() {
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
}
});
return true;
}
},
onLineNumbersSelect: function(menu, item) {
2020-09-27 20:44:54 +00:00
if (_.isUndefined(item.value))
return;
switch (item.value) {
case 0:
2021-07-07 13:18:34 +00:00
this._state.linenum = undefined;
2020-11-05 10:11:40 +00:00
this.api.asc_SetLineNumbersProps(Asc.c_oAscSectionApplyType.Current, null);
2020-09-28 20:49:46 +00:00
break;
case 1:
case 2:
case 3:
2020-09-27 20:44:54 +00:00
this._state.linenum = undefined;
if (this.api && item.checked) {
2020-09-28 20:49:46 +00:00
var props = new Asc.CSectionLnNumType();
props.put_Restart(item.value==1 ? Asc.c_oAscLineNumberRestartType.Continuous : (item.value==2 ? Asc.c_oAscLineNumberRestartType.NewPage : Asc.c_oAscLineNumberRestartType.NewSection));
2020-11-25 15:28:56 +00:00
!!this.api.asc_GetLineNumbersProps() && props.put_CountBy(undefined);
2020-11-05 10:11:40 +00:00
this.api.asc_SetLineNumbersProps(Asc.c_oAscSectionApplyType.Current, props);
2020-09-27 20:44:54 +00:00
}
break;
case 4:
2020-09-28 20:49:46 +00:00
this.api && this.api.asc_SetParagraphSuppressLineNumbers(item.checked);
break;
case 5:
var win,
me = this;
win = new DE.Views.LineNumbersDialog({
2020-09-28 20:49:46 +00:00
applyTo: me._state.linenum_apply,
handler: function(dlg, result) {
if (result == 'ok') {
2020-09-28 20:49:46 +00:00
var settings = dlg.getSettings();
me.api.asc_SetLineNumbersProps(settings.type, settings.props);
me._state.linenum_apply = settings.type;
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
}
});
win.show();
2020-09-28 20:49:46 +00:00
win.setSettings(me.api.asc_GetLineNumbersProps());
break;
}
2020-09-28 20:49:46 +00:00
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
2020-09-27 20:44:54 +00:00
onLineNumbersProps: function(props) {
2020-09-28 20:49:46 +00:00
var index = 0;
2020-09-27 20:44:54 +00:00
if (props) {
2020-09-28 20:49:46 +00:00
switch (props.get_Restart()) {
case Asc.c_oAscLineNumberRestartType.Continuous: index = 1; break;
case Asc.c_oAscLineNumberRestartType.NewPage: index = 2; break;
case Asc.c_oAscLineNumberRestartType.NewSection: index = 3; break;
}
2020-09-27 20:44:54 +00:00
}
2020-09-28 20:49:46 +00:00
if (this._state.linenum === index)
return;
this.toolbar.btnLineNumbers.menu.items[index].setChecked(true);
this._state.linenum = index;
2020-09-27 20:44:54 +00:00
},
2020-09-29 09:42:16 +00:00
onLineNumbersShow: function(menu) {
menu.items[4].setChecked(this._state.suppress_num);
},
2016-03-11 00:48:53 +00:00
onColorSchemaClick: function(menu, item) {
if (this.api) {
2019-12-19 08:00:49 +00:00
this.api.asc_ChangeColorSchemeByIdx(item.value);
2016-03-11 00:48:53 +00:00
Common.component.Analytics.trackEvent('ToolBar', 'Color Scheme');
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
2019-08-20 12:56:29 +00:00
onColorSchemaShow: function(menu) {
if (this.api) {
2019-12-19 08:00:49 +00:00
var value = this.api.asc_GetCurrentColorSchemeIndex();
2019-08-20 12:56:29 +00:00
var item = _.find(menu.items, function(item) { return item.value == value; });
(item) ? item.setChecked(true) : menu.clearAll();
}
},
2016-03-11 00:48:53 +00:00
onDropCapSelect: function(menu, item) {
if (_.isUndefined(item.value))
return;
this._state.dropcap = undefined;
if (this.api && item.checked) {
if (item.value === Asc.c_oAscDropCap.None) {
2016-03-11 00:48:53 +00:00
this.api.removeDropcap(true);
} else {
var SelectedObjects = this.api.getSelectedElements(),
i = -1;
while (++i < SelectedObjects.length) {
if (SelectedObjects[i].get_ObjectType() == Asc.c_oAscTypeSelectElement.Paragraph) {
2016-03-11 00:48:53 +00:00
var pr = SelectedObjects[i].get_ObjectValue();
var value = pr.get_FramePr();
if (!_.isUndefined(value)) {
2016-04-18 12:21:15 +00:00
value = new Asc.asc_CParagraphFrame();
2016-03-11 00:48:53 +00:00
value.put_FromDropCapMenu(true);
value.put_DropCap(item.value);
this.api.put_FramePr(value);
} else {
this.api.asc_addDropCap((item.value === Asc.c_oAscDropCap.Drop));
2016-03-11 00:48:53 +00:00
}
break;
}
}
}
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Drop Cap');
},
onDropCap: function(v) {
if (this._state.dropcap === v)
return;
var index = -1;
switch (v) {
case Asc.c_oAscDropCap.None: index = 0; break;
case Asc.c_oAscDropCap.Drop: index = 1; break;
case Asc.c_oAscDropCap.Margin: index = 2; break;
2016-03-11 00:48:53 +00:00
}
if (index < 0)
2017-11-13 08:41:32 +00:00
this.toolbar.btnDropCap.menu.clearAll();
2016-03-11 00:48:53 +00:00
else
this.toolbar.btnDropCap.menu.items[index].setChecked(true);
this._state.dropcap = v;
},
2020-09-21 21:01:04 +00:00
onDropCapAdvancedClick: function(isFrame) {
2016-03-11 00:48:53 +00:00
var win, props, text,
me = this;
2020-09-21 21:01:04 +00:00
if (!isFrame && _.isUndefined(me.fontstore)) {
2016-03-11 00:48:53 +00:00
me.fontstore = new Common.Collections.Fonts();
var fonts = me.toolbar.cmbFontName.store.toJSON();
var arr = [];
_.each(fonts, function(font, index){
if (!font.cloneid) {
arr.push(_.clone(font));
}
});
me.fontstore.add(arr);
}
if (me.api){
var selectedElements = me.api.getSelectedElements(),
selectedElementsLenght = selectedElements.length;
if (selectedElements && _.isArray(selectedElements)){
for (var i = 0; i < selectedElementsLenght; i++) {
if (selectedElements[i].get_ObjectType() == Asc.c_oAscTypeSelectElement.Paragraph) {
2016-03-11 00:48:53 +00:00
props = selectedElements[i].get_ObjectValue();
break;
}
}
}
if (props) {
(new DE.Views.DropcapSettingsAdvanced({
tableStylerRows: 2,
tableStylerColumns: 1,
2020-09-21 21:01:04 +00:00
fontStore: !isFrame ? me.fontstore : null,
2016-03-11 00:48:53 +00:00
paragraphProps: props,
borderProps: me.borderAdvancedProps,
api: me.api,
2020-09-21 21:01:04 +00:00
isFrame: !!isFrame,
2016-03-11 00:48:53 +00:00
handler: function(result, value) {
if (result == 'ok') {
me.borderAdvancedProps = value.borderProps;
2020-09-21 21:01:04 +00:00
if (value.paragraphProps &&
( !isFrame && value.paragraphProps.get_DropCap() === Asc.c_oAscDropCap.None ||
isFrame && value.paragraphProps.get_Wrap() === c_oAscFrameWrap.None)) {
me.api.removeDropcap(!isFrame);
2016-03-11 00:48:53 +00:00
} else
me.api.put_FramePr(value.paragraphProps);
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
}
}
},
2017-12-12 11:14:27 +00:00
onControlsSelect: function(menu, item) {
if (!(this.mode && this.mode.canFeatureContentControl)) return;
2017-12-12 11:14:27 +00:00
if (item.value == 'settings' || item.value == 'remove') {
if (this.api.asc_IsContentControl()) {
var props = this.api.asc_GetContentControlProperties();
if (props) {
var id = props.get_InternalId();
if (item.value == 'settings') {
var me = this;
(new DE.Views.ControlSettingsDialog({
props: props,
api: me.api,
controlLang: me._state.lang,
interfaceLang: me.mode.lang,
2017-12-12 11:14:27 +00:00
handler: function(result, value) {
if (result == 'ok') {
me.api.asc_SetContentControlProperties(value, id);
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
} else {
this.api.asc_RemoveContentControlWrapper(id);
Common.component.Analytics.trackEvent('ToolBar', 'Remove Content Control');
}
}
}
} else {
2020-06-22 17:15:47 +00:00
var isnew = (item.value.indexOf('new-')==0),
oPr, oFormPr;
if (isnew) {
oFormPr = new AscCommon.CSdtFormPr();
this.toolbar.fireEvent('insertcontrol', this.toolbar);
2020-06-22 17:15:47 +00:00
}
if (item.value == 'plain' || item.value == 'rich')
this.api.asc_AddContentControl((item.value=='plain') ? Asc.c_oAscSdtLevelType.Inline : Asc.c_oAscSdtLevelType.Block);
2020-06-22 17:15:47 +00:00
else if (item.value.indexOf('picture')>=0)
this.api.asc_AddContentControlPicture(oFormPr);
2020-06-23 10:14:45 +00:00
else if (item.value.indexOf('checkbox')>=0 || item.value.indexOf('radiobox')>=0) {
if (isnew) {
oPr = new AscCommon.CSdtCheckBoxPr();
2021-03-26 21:36:57 +00:00
(item.value.indexOf('radiobox')>=0) && oPr.put_GroupKey(this.textGroup + ' 1');
2020-06-23 10:14:45 +00:00
}
2020-06-22 17:15:47 +00:00
this.api.asc_AddContentControlCheckBox(oPr, oFormPr);
} else if (item.value == 'date')
this.api.asc_AddContentControlDatePicker();
2020-06-22 17:15:47 +00:00
else if (item.value.indexOf('combobox')>=0 || item.value.indexOf('dropdown')>=0)
this.api.asc_AddContentControlList(item.value.indexOf('combobox')>=0, oPr, oFormPr);
2020-06-23 10:14:45 +00:00
else if (item.value == 'new-field') {
var props = new AscCommon.CContentControlPr();
2020-06-23 10:14:45 +00:00
oPr = new AscCommon.CSdtTextFormPr();
props.put_TextFormPr(oPr);
props.put_FormPr(oFormPr);
this.api.asc_AddContentControlTextForm(props);
2020-06-23 10:14:45 +00:00
}
2017-12-12 11:14:27 +00:00
Common.component.Analytics.trackEvent('ToolBar', 'Add Content Control');
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
2016-03-11 00:48:53 +00:00
onNewControlsColor: function(picker, color) {
this.toolbar.mnuControlsColorPicker.addNewColor();
},
onNoControlsColor: function(item) {
2018-08-08 13:51:02 +00:00
if (!item.isChecked())
2019-01-31 12:22:55 +00:00
this.api.asc_SetGlobalContentControlShowHighlight(true, 220, 220, 220);
else
this.api.asc_SetGlobalContentControlShowHighlight(false);
},
onSelectControlsColor: function(picker, color) {
var clr = Common.Utils.ThemeColor.getRgbColor(color);
if (this.api) {
2019-01-31 12:22:55 +00:00
this.api.asc_SetGlobalContentControlShowHighlight(true, clr.get_r(), clr.get_g(), clr.get_b());
}
Common.component.Analytics.trackEvent('ToolBar', 'Content Controls Color');
},
2016-03-11 00:48:53 +00:00
onColumnsSelect: function(menu, item) {
if (_.isUndefined(item.value))
return;
this._state.columns = undefined;
2017-06-23 14:27:20 +00:00
if (this.api) {
if (item.value == 'advanced') {
2020-04-08 16:35:41 +00:00
var win,
2017-06-23 14:27:20 +00:00
me = this;
win = new DE.Views.CustomColumnsDialog({
handler: function(dlg, result) {
if (result == 'ok') {
props = dlg.getSettings();
me.api.asc_SetColumnsProps(props);
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
}
});
win.show();
win.setSettings(me.api.asc_GetColumnsProps());
} else if (item.checked) {
var props = new Asc.CDocumentColumnsProps(),
cols = item.value,
def_space = 12.5;
props.put_EqualWidth(cols<3);
if (cols<3) {
props.put_Num(cols+1);
props.put_Space(def_space);
} else {
var total = this.api.asc_GetColumnsProps().get_TotalWidth(),
left = (total - def_space*2)/3,
right = total - def_space - left;
props.put_ColByValue(0, (cols == 3) ? left : right, def_space);
props.put_ColByValue(1, (cols == 3) ? right : left, 0);
}
this.api.asc_SetColumnsProps(props);
2016-03-11 00:48:53 +00:00
}
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Insert Columns');
},
onColumnsProps: function(props) {
if (props) {
var equal = props.get_EqualWidth(),
num = (equal) ? props.get_Num() : props.get_ColsCount(),
def_space = 12.5,
index = -1;
if (equal && num<4 && (num==1 || Math.abs(props.get_Space() - def_space)<0.1))
index = (num-1);
else if (!equal && num==2) {
var left = props.get_Col(0).get_W(),
space = props.get_Col(0).get_Space(),
right = props.get_Col(1).get_W(),
total = props.get_TotalWidth();
if (Math.abs(space - def_space)<0.1) {
var width = (total - space*2)/3;
if ( left<right && Math.abs(left - width)<0.1 )
index = 3;
else if (left>right && Math.abs(right - width)<0.1)
index = 4;
}
}
if (this._state.columns === index)
return;
if (index < 0)
2017-11-13 08:41:32 +00:00
this.toolbar.btnColumns.menu.clearAll();
2016-03-11 00:48:53 +00:00
else
this.toolbar.btnColumns.menu.items[index].setChecked(true);
this._state.columns = index;
}
},
2019-08-30 14:55:29 +00:00
onSelectChart: function(type) {
2016-03-11 00:48:53 +00:00
var me = this,
chart = false;
var selectedElements = me.api.getSelectedElements();
if (selectedElements && _.isArray(selectedElements)) {
for (var i = 0; i< selectedElements.length; i++) {
if (Asc.c_oAscTypeSelectElement.Image == selectedElements[i].get_ObjectType()) {
var elValue = selectedElements[i].get_ObjectValue().get_ChartProperties();
if (elValue) {
chart = elValue;
break;
}
}
}
}
if (chart) {
var isCombo = (type==Asc.c_oAscChartTypeSettings.comboBarLine || type==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
type==Asc.c_oAscChartTypeSettings.comboAreaBar || type==Asc.c_oAscChartTypeSettings.comboCustom);
if (isCombo && chart.getSeries().length<2) {
Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ComboSeriesError, Asc.c_oAscError.Level.NoCritical);
} else
chart.changeType(type);
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
} else {
if (!this.diagramEditor)
2022-06-22 17:35:09 +00:00
this.diagramEditor = this.getApplication().getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor');
2016-03-11 00:48:53 +00:00
if (this.diagramEditor && me.api) {
this.diagramEditor.setEditMode(false);
2022-06-22 17:35:09 +00:00
this.diagramEditor.show();
2016-03-11 00:48:53 +00:00
chart = me.api.asc_getChartObject(type);
if (chart) {
this.diagramEditor.setChartData(new Asc.asc_CChartBinary(chart));
}
me.toolbar.fireEvent('insertchart', me.toolbar);
2016-03-11 00:48:53 +00:00
}
}
},
2019-09-03 10:32:06 +00:00
onInsertTextart: function (data) {
if (this.api) {
this.toolbar.fireEvent('inserttextart', this.toolbar);
this.api.AddTextArt(data);
if (this.toolbar.btnInsertShape.pressed)
this.toolbar.btnInsertShape.toggle(false, true);
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertTextArt);
Common.component.Analytics.trackEvent('ToolBar', 'Add Text Art');
}
},
2021-09-20 14:38:41 +00:00
onInsertPageNumberClick: function(picker, item, record, e) {
2016-03-11 00:48:53 +00:00
if (this.api)
this.api.put_PageNum(record.get('data').type, record.get('data').subtype);
2021-09-20 14:38:41 +00:00
if (e.type !== 'click')
this.toolbar.btnEditHeader.menu.hide();
2016-03-11 00:48:53 +00:00
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Page Number');
},
2016-10-04 12:05:12 +00:00
onInsertPageCountClick: function(item, e) {
if (this.api)
this.api.asc_AddPageCount();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Pages Count');
},
2016-03-11 00:48:53 +00:00
onEditHeaderFooterClick: function(menu, item) {
if (this.api) {
if (item.value == 'header')
this.api.GoToHeader(this.api.getCurrentPage());
else if (item.value == 'footer')
this.api.GoToFooter(this.api.getCurrentPage());
2022-03-14 12:42:42 +00:00
else if (item.value == 'header-remove')
this.api.asc_RemoveHeader(this.api.getCurrentPage());
else if (item.value == 'footer-remove')
this.api.asc_RemoveFooter(this.api.getCurrentPage());
2016-03-11 00:48:53 +00:00
else
return;
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Edit ' + item.value);
}
},
onPageNumCurrentPosClick: function(item, e) {
if (this.api)
this.api.put_PageNum(-1);
if (e.type !== 'click')
this.toolbar.btnEditHeader.menu.hide();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Page Number');
},
2018-11-20 09:57:29 +00:00
onBtnBlankPageClick: function(btn) {
if (this.api)
2018-11-20 14:43:15 +00:00
this.api.asc_AddBlankPage();
2018-11-20 09:57:29 +00:00
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Blank Page');
},
2019-04-05 11:28:51 +00:00
onWatermarkSelect: function(menu, item) {
if (this.api) {
2019-06-18 09:35:01 +00:00
if (item.value == 'remove')
this.api.asc_WatermarkRemove();
else {
2019-04-05 11:28:51 +00:00
var me = this;
if (_.isUndefined(me.fontstore)) {
me.fontstore = new Common.Collections.Fonts();
var fonts = me.toolbar.cmbFontName.store.toJSON();
var arr = [];
_.each(fonts, function(font, index){
if (!font.cloneid) {
arr.push(_.clone(font));
}
});
me.fontstore.add(arr);
}
(new DE.Views.WatermarkSettingsDialog({
2019-06-17 14:05:27 +00:00
props: me.api.asc_GetWatermarkProps(),
2019-04-05 11:28:51 +00:00
api: me.api,
lang: me.mode.lang,
storage: me.mode.canRequestInsertImage || me.mode.fileChoiceUrl && me.mode.fileChoiceUrl.indexOf("{documentType}")>-1,
2019-04-05 11:28:51 +00:00
fontStore: me.fontstore,
handler: function(result, value) {
if (result == 'ok') {
2019-06-17 14:05:27 +00:00
me.api.asc_SetWatermarkProps(value);
2019-04-05 11:28:51 +00:00
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
2019-06-18 09:35:01 +00:00
}
2019-04-05 11:28:51 +00:00
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Edit ' + item.value);
}
},
2016-03-11 00:48:53 +00:00
onListStyleSelect: function(combo, record) {
this._state.prstyle = undefined;
if (this.api)
this.api.put_Style(record.get('title'));
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Style');
},
onListStyleBeforeHide: function(item, e) {
this.toolbar.listStyles.isStylesNotClosable = false;
},
onListStyleContextMenu: function (combo, record, e) {
if (!this.toolbar.mode.canEditStyles)
return;
var showPoint;
var menu = this.toolbar.styleMenu;
var api = this.api;
var isAllCustomDeleted = true;
var isAllDefailtNotModifaed = true;
_.each(window.styles.get_MergedStyles(), function (style) {
var isDefault = api.asc_IsStyleDefault(style.get_Name());
if (isDefault) {
if (api.asc_IsDefaultStyleChanged(style.get_Name())) {
isAllDefailtNotModifaed = false;
}
} else {
isAllCustomDeleted = false;
}
});
menu.items[3].setDisabled(isAllDefailtNotModifaed);
menu.items[4].setDisabled(isAllCustomDeleted);
var parentOffset = this.toolbar.$el.offset(),
top = e.clientY*Common.Utils.zoom();
2016-03-11 00:48:53 +00:00
if ($('#header-container').is(":visible")) {
top -= $('#header-container').height()
}
showPoint = [e.clientX*Common.Utils.zoom(), top - parentOffset.top];
2016-03-11 00:48:53 +00:00
if (record != undefined) {
//itemMenu
var isDefault = this.api.asc_IsStyleDefault(record.get("title"));
menu.items[0].setVisible(true);
menu.items[1].setVisible(!isDefault);
menu.items[2].setVisible(isDefault);
menu.items[3].setVisible(isDefault);
menu.items[4].setVisible(!isDefault);
menu.items[2].setDisabled(!this.api.asc_IsDefaultStyleChanged(record.get("title")));
for (var i in menu.items) {
menu.items[i].styleTitle = record.get("title");
}
var selectedElements = api.getSelectedElements(),
isParagraph = false;
if (selectedElements && _.isArray(selectedElements)){
for (var i = 0; i <selectedElements.length; i++) {
if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) {
2016-03-11 00:48:53 +00:00
isParagraph = true; break;
}
}
}
menu.items[0].setDisabled(!isParagraph);
} else {
//comboMenu
menu.items[0].setVisible(false);
menu.items[1].setVisible(false);
menu.items[2].setVisible(false);
menu.items[3].setVisible(true);
menu.items[4].setVisible(true);
}
if (showPoint != undefined) {
var menuContainer = this.toolbar.$el.find('#menu-style-container');
if (!menu.rendered) {
if (menuContainer.length < 1) {
menuContainer = $('<div id="menu-style-container" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>', menu.id);
$(this.toolbar.el).append(menuContainer);
}
menu.render(menuContainer);
menu.cmpEl.attr({tabindex: "-1"});
}
menuContainer.css({
left: showPoint[0],
top: showPoint[1]
});
var parent = $(menu.el);
parent.trigger($.Event('show.bs.dropdown'));
parent.trigger($.Event('hide.bs.dropdown'));
if (menu.isVisible()) {
$(menu).toggleClass('open').trigger('shown.bs.dropdown');
}
this.toolbar.listStyles.isStylesNotClosable = true;
menu.show();
}
},
onSaveStyle: function (style) {
window.styles_loaded = false;
var me = this, win;
if (me.api) {
var handlerDlg = function (dlg, result) {
if (result == 'ok') {
var title = dlg.getTitle(),
nextStyle = dlg.getNextStyle(),
characterStyle = style.get_Link();
me._state.prstyle = title;
style.put_Name(title);
characterStyle.put_Name(title + '_character');
style.put_Next((nextStyle) ? nextStyle.asc_getName() : null);
2016-03-11 00:48:53 +00:00
me.api.asc_AddNewStyle(style);
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
};
var formats = [],
mainController = me.getApplication().getController('Main');
2016-03-11 00:48:53 +00:00
_.each(window.styles.get_MergedStyles(), function (style) {
formats.push({value: style, displayValue: mainController.translationTable[style.get_Name()] || style.get_Name()})
2016-03-11 00:48:53 +00:00
});
win = new DE.Views.StyleTitleDialog({
handler: handlerDlg,
formats: formats
});
win.show();
}
Common.component.Analytics.trackEvent('ToolBar', 'Save as Style');
},
onMenuSaveStyle: function(item, e) {
var me = this;
if (me.api && !me.toolbar.listStylesAdditionalMenuItem.isDisabled()) {
me.onSaveStyle(me.api.asc_GetStyleFromFormatting());
}
},
// onAfterKeydownMenu: function (e) {
// if (e.keyCode == Common.UI.Keys.ESC) {
// if ($('#menu-style-container').hasClass("open")) {
// $('#menu-style-container').removeClass('open').trigger('hidden.bs.dropdown');
// } else if ($(e.currentTarget).hasClass("open")) {
// $(e.currentTarget).removeClass('open').trigger('hidden.bs.dropdown');
// }
// }
// },
onUpdateStyle: function(newStyle) {
if (this.api) {
newStyle.put_Name(this._state.prstyle);
this.api.asc_AddNewStyle(newStyle);
}
},
_clearBullets: function() {
this.toolbar.btnMarkers.toggle(false, true);
this.toolbar.btnNumbers.toggle(false, true);
this.toolbar.btnMultilevels.toggle(false, true);
this.toolbar.mnuMarkersPicker.selectByIndex(0, true);
this.toolbar.mnuNumbersPicker.selectByIndex(0, true);
this.toolbar.mnuMultilevelPicker.selectByIndex(0, true);
2019-12-17 11:52:30 +00:00
this.toolbar.mnuMarkerSettings && this.toolbar.mnuMarkerSettings.setDisabled(true);
this.toolbar.mnuNumberSettings && this.toolbar.mnuNumberSettings.setDisabled(true);
2019-12-17 14:25:12 +00:00
this.toolbar.mnuMultilevelSettings && this.toolbar.mnuMultilevelSettings.setDisabled(true);
2021-02-03 07:32:18 +00:00
this.toolbar.mnuMarkerChangeLevel && this.toolbar.mnuMarkerChangeLevel.setDisabled(true);
this.toolbar.mnuNumberChangeLevel && this.toolbar.mnuNumberChangeLevel.setDisabled(true);
this.toolbar.mnuMultiChangeLevel && this.toolbar.mnuMultiChangeLevel.setDisabled(true);
2016-03-11 00:48:53 +00:00
},
_getApiTextSize: function () {
var out_value = 12,
textPr = this.api.get_TextProps();
if (textPr && textPr.get_TextPr) {
out_value = textPr.get_TextPr().get_FontSize();
}
return out_value;
},
onAutoFontColor: function(e) {
this._state.clrtext = this._state.clrtext_asccolor = undefined;
2016-04-18 12:21:15 +00:00
var color = new Asc.asc_CColor();
2016-03-11 00:48:53 +00:00
color.put_auto(true);
this.api.put_TextColor(color);
this.toolbar.btnFontColor.currentColor = {color: color, isAuto: true};
this.toolbar.mnuFontColorPicker.currentColor = {color: color, isAuto: true};
},
onSelectHighlightColor: function(picker, color) {
this._setMarkerColor(color, 'menu');
},
2021-07-10 23:25:12 +00:00
onSelectFontColor: function(btn, color) {
2016-03-11 00:48:53 +00:00
this._state.clrtext = this._state.clrtext_asccolor = undefined;
this.toolbar.btnFontColor.currentColor = color;
2021-01-21 19:48:27 +00:00
this.toolbar.btnFontColor.setColor((typeof(color) == 'object') ? (color.isAuto ? '000' : color.color) : color);
2016-03-11 00:48:53 +00:00
this.toolbar.mnuFontColorPicker.currentColor = color;
if (this.api)
this.api.put_TextColor(color.isAuto ? color.color : Common.Utils.ThemeColor.getRgbColor(color));
Common.component.Analytics.trackEvent('ToolBar', 'Text Color');
},
2021-07-10 23:25:12 +00:00
onParagraphColorPickerSelect: function(btn, color) {
2016-03-11 00:48:53 +00:00
this._state.clrback = this._state.clrshd_asccolor = undefined;
this.toolbar.btnParagraphColor.currentColor = color;
2021-01-21 19:48:27 +00:00
this.toolbar.btnParagraphColor.setColor(color);
2016-03-11 00:48:53 +00:00
this.toolbar.mnuParagraphColorPicker.currentColor = color;
if (this.api) {
if (color == 'transparent') {
this.api.put_ParagraphShade(false);
} else {
this.api.put_ParagraphShade(true, Common.Utils.ThemeColor.getRgbColor(color));
}
}
Common.NotificationCenter.trigger('edit:complete', this);
},
onBtnHighlightColor: function(btn) {
if (btn.pressed) {
this._setMarkerColor(btn.currentColor);
Common.component.Analytics.trackEvent('ToolBar', 'Highlight Color');
}
else {
this.api.SetMarkerFormat(false);
}
},
onBtnFontColor: function() {
this.toolbar.mnuFontColorPicker.trigger('select', this.toolbar.mnuFontColorPicker, this.toolbar.mnuFontColorPicker.currentColor);
},
onBtnParagraphColor: function() {
this.toolbar.mnuParagraphColorPicker.trigger('select', this.toolbar.mnuParagraphColorPicker, this.toolbar.mnuParagraphColorPicker.currentColor);
},
onHighlightTransparentClick: function(item, e) {
this._setMarkerColor('transparent', 'menu');
},
onParagraphColor: function(shd) {
var picker = this.toolbar.mnuParagraphColorPicker, clr;
if (shd!==null && shd!==undefined && shd.get_Value()===Asc.c_oAscShdClear) {
2016-03-11 00:48:53 +00:00
var color = shd.get_Color();
if (color) {
if (color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) {
2016-03-11 00:48:53 +00:00
clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value() };
} else {
clr = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b());
}
} else
clr= 'transparent';
} else {
clr = 'transparent';
}
var type1 = typeof(clr),
type2 = typeof(this._state.clrback);
if ( (type1 !== type2) || (type1=='object' &&
(clr.effectValue!==this._state.clrback.effectValue || this._state.clrback.color.indexOf(clr.color)<0)) ||
(type1!='object' && this._state.clrback.indexOf(clr)<0 )) {
if ( typeof(clr) == 'object' ) {
var isselected = false;
for (var i=0; i<10; i++) {
if ( Common.Utils.ThemeColor.ThemeValues[i] == clr.effectValue ) {
picker.select(clr,true);
isselected = true;
break;
}
}
if (!isselected) picker.clearSelection();
} else
picker.select(clr,true);
this._state.clrback = clr;
}
this._state.clrshd_asccolor = shd;
},
onApiTextColor: function(color) {
if (color.get_auto()) {
if (this._state.clrtext !== 'auto') {
2021-07-10 19:52:39 +00:00
this.toolbar.btnFontColor.setAutoColor(true);
2016-03-11 00:48:53 +00:00
this.toolbar.mnuFontColorPicker.clearSelection();
this._state.clrtext = 'auto';
}
} else {
var picker = this.toolbar.mnuFontColorPicker, clr;
if (color) {
color.get_type() == Asc.c_oAscColor.COLOR_TYPE_SCHEME ?
2016-03-11 00:48:53 +00:00
clr = {color: Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b()), effectValue: color.get_value()} :
clr = Common.Utils.ThemeColor.getHexColor(color.get_r(), color.get_g(), color.get_b());
}
var type1 = typeof(clr),
type2 = typeof(this._state.clrtext);
if ( (this._state.clrtext == 'auto') || (type1 !== type2) || (type1=='object' &&
(clr.effectValue!==this._state.clrtext.effectValue || this._state.clrtext.color.indexOf(clr.color)<0)) ||
(type1!='object' && this._state.clrtext.indexOf(clr)<0 )) {
2021-07-10 19:52:39 +00:00
this.toolbar.btnFontColor.setAutoColor(false);
2016-03-11 00:48:53 +00:00
if ( typeof(clr) == 'object' ) {
var isselected = false;
for (var i=0; i<10; i++) {
if ( Common.Utils.ThemeColor.ThemeValues[i] == clr.effectValue ) {
picker.select(clr,true);
isselected = true;
break;
}
}
if (!isselected) picker.clearSelection();
} else {
picker.select(clr,true);
}
this._state.clrtext = clr;
}
}
this._state.clrtext_asccolor = color;
},
2019-08-20 11:05:13 +00:00
onApiAutoShapes: function() {
var me = this;
var onShowBefore = function(menu) {
me.fillAutoShapes();
menu.off('show:before', onShowBefore);
};
me.toolbar.btnInsertShape.menu.on('show:before', onShowBefore);
},
2016-03-11 00:48:53 +00:00
fillAutoShapes: function() {
2021-10-04 12:56:34 +00:00
var me = this;
2016-03-11 00:48:53 +00:00
2021-09-16 17:47:48 +00:00
var menuitem = new Common.UI.MenuItem({
template: _.template('<div id="id-toolbar-menu-insertshape" class="menu-insertshape"></div>')
});
me.toolbar.btnInsertShape.menu.addItem(menuitem);
var recents = Common.localStorage.getItem('de-recent-shapes');
var shapePicker = new Common.UI.DataViewShape({
el: $('#id-toolbar-menu-insertshape'),
itemTemplate: _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
2021-10-04 12:56:34 +00:00
groups: me.getApplication().getCollection('ShapeGroups'),
2021-09-16 17:47:48 +00:00
parentMenu: me.toolbar.btnInsertShape.menu,
2022-01-17 16:44:25 +00:00
restoreHeight: 652,
2021-09-16 17:47:48 +00:00
textRecentlyUsed: me.textRecentlyUsed,
recentShapes: recents ? JSON.parse(recents) : null
});
shapePicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
if (record) {
me._addAutoshape(true, record.get('data').shapeType);
me._isAddingShape = true;
}
2019-08-19 14:33:30 +00:00
2021-09-16 17:47:48 +00:00
if (me.toolbar.btnInsertText.pressed) {
me.toolbar.btnInsertText.toggle(false, true);
}
2019-08-19 14:33:30 +00:00
2021-09-16 17:47:48 +00:00
if (e.type !== 'click')
me.toolbar.btnInsertShape.menu.hide();
Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertShape);
Common.component.Analytics.trackEvent('ToolBar', 'Add Shape');
2019-08-19 14:33:30 +00:00
}
2021-09-16 17:47:48 +00:00
});
2016-03-11 00:48:53 +00:00
},
fillEquations: function() {
2016-10-24 10:58:34 +00:00
if (!this.toolbar.btnInsertEquation.rendered || this.toolbar.btnInsertEquation.menu.items.length>0) return;
2016-03-11 00:48:53 +00:00
var me = this, equationsStore = this.getApplication().getCollection('EquationGroups');
2016-08-23 11:36:55 +00:00
me.toolbar.btnInsertEquation.menu.removeAll();
var onShowAfter = function(menu) {
for (var i = 0; i < equationsStore.length; ++i) {
var equationPicker = new Common.UI.DataViewSimple({
2019-08-20 11:05:13 +00:00
el: $('#id-toolbar-menu-equationgroup' + i, menu.items[i].$el),
parentMenu: menu.items[i].menu,
store: equationsStore.at(i).get('groupStore'),
scrollAlwaysVisible: true,
itemTemplate: _.template(
'<div class="item-equation" style="" >' +
'<div class="equation-icon" style="background-position:<%= posX %>px <%= posY %>px;width:<%= width %>px;height:<%= height %>px;" id="<%= id %>"></div>' +
'</div>')
});
equationPicker.on('item:click', function(picker, item, record, e) {
if (me.api) {
if (record)
me.api.asc_AddMath(record.get('data').equationType);
if (me.toolbar.btnInsertText.pressed) {
me.toolbar.btnInsertText.toggle(false, true);
}
if (me.toolbar.btnInsertShape.pressed) {
me.toolbar.btnInsertShape.toggle(false, true);
}
if (e.type !== 'click')
me.toolbar.btnInsertEquation.menu.hide();
Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnInsertEquation);
Common.component.Analytics.trackEvent('ToolBar', 'Add Equation');
}
});
}
2019-08-20 08:05:52 +00:00
menu.off('show:after', onShowAfter);
};
me.toolbar.btnInsertEquation.menu.on('show:after', onShowAfter);
2016-03-11 00:48:53 +00:00
for (var i = 0; i < equationsStore.length; ++i) {
var equationGroup = equationsStore.at(i);
var menuItem = new Common.UI.MenuItem({
caption: equationGroup.get('groupName'),
menu: new Common.UI.Menu({
menuAlign: 'tl-tr',
items: [
{ template: _.template('<div id="id-toolbar-menu-equationgroup' + i +
'" class="menu-shape" style="width:' + (equationGroup.get('groupWidth') + 8) + 'px; ' +
equationGroup.get('groupHeight') + 'margin-left:5px;"></div>') }
]
})
});
me.toolbar.btnInsertEquation.menu.addItem(menuItem);
}
},
onInsertEquationClick: function() {
if (this.api && !this._state.in_equation) {
this.api.asc_AddMath();
Common.component.Analytics.trackEvent('ToolBar', 'Add Equation');
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertEquation);
},
2019-11-08 08:34:53 +00:00
onInsertSymbolClick: function() {
2019-11-15 11:42:07 +00:00
if (this.dlgSymbolTable && this.dlgSymbolTable.isVisible()) return;
2019-11-08 08:34:53 +00:00
if (this.api) {
var me = this,
selected = me.api.asc_GetSelectedText();
2019-11-15 11:42:07 +00:00
me.dlgSymbolTable = new Common.Views.SymbolTableDialog({
api: me.api,
lang: me.mode.lang,
modal: false,
type: 1,
special: true,
showShortcutKey: true,
font: selected && selected.length>0 ? this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name() : undefined,
symbol: selected && selected.length>0 ? selected.charAt(0) : undefined,
2019-11-15 11:42:07 +00:00
buttons: [{value: 'ok', caption: this.textInsert}, 'close'],
handler: function(dlg, result, settings) {
if (result == 'ok') {
2020-08-27 15:54:14 +00:00
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(), settings.code, settings.special);
2019-11-15 11:42:07 +00:00
} else
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
});
me.dlgSymbolTable.show();
me.dlgSymbolTable.on('symbol:dblclick', function(cmp, result, settings) {
2020-08-27 15:54:14 +00:00
me.api.asc_insertSymbol(settings.font ? settings.font : me.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(), settings.code, settings.special);
2019-11-11 14:48:09 +00:00
});
2019-11-08 08:34:53 +00:00
}
},
2019-08-15 13:51:48 +00:00
onApiMathTypes: function(equation) {
this._equationTemp = equation;
var me = this;
var onShowBefore = function(menu) {
me.onMathTypes(me._equationTemp);
me.toolbar.btnInsertEquation.menu.off('show:before', onShowBefore);
};
me.toolbar.btnInsertEquation.menu.on('show:before', onShowBefore);
},
2016-03-11 00:48:53 +00:00
onMathTypes: function(equation) {
var equationgrouparray = [],
equationsStore = this.getCollection('EquationGroups');
equationsStore.reset();
// equations groups
var c_oAscMathMainTypeStrings = {};
// [translate, count cells, scroll]
2016-10-21 10:54:36 +00:00
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Symbol ] = [this.textSymbols, 11];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Fraction ] = [this.textFraction, 4];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Script ] = [this.textScript, 4];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Radical ] = [this.textRadical, 4];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Integral ] = [this.textIntegral, 3, true];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.LargeOperator] = [this.textLargeOperator, 5, true];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Bracket ] = [this.textBracket, 4, true];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Function ] = [this.textFunction, 3, true];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Accent ] = [this.textAccent, 4];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.LimitLog ] = [this.textLimitAndLog, 3];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Operator ] = [this.textOperator, 4];
c_oAscMathMainTypeStrings[Common.define.c_oAscMathMainType.Matrix ] = [this.textMatrix, 4, true];
2016-03-11 00:48:53 +00:00
// equations sub groups
// equations types
var translationTable = {}, name = '', translate = '';
2016-10-21 10:54:36 +00:00
for (name in Common.define.c_oAscMathType) {
if (Common.define.c_oAscMathType.hasOwnProperty(name)) {
2016-03-11 00:48:53 +00:00
var arr = name.split('_');
if (arr.length==2 && arr[0]=='Symbol') {
translate = 'txt' + arr[0] + '_' + arr[1].toLocaleLowerCase();
} else
translate = 'txt' + name;
2016-10-21 10:54:36 +00:00
translationTable[Common.define.c_oAscMathType[name]] = this[translate];
2016-03-11 00:48:53 +00:00
}
}
2019-08-15 13:39:48 +00:00
var i,id = 0, count = 0, length = 0, width = 0, height = 0, store = null, list = null, eqStore = null, eq = null, data;
2016-03-11 00:48:53 +00:00
if (equation) {
2019-08-15 13:39:48 +00:00
data = equation.get_Data();
count = data.length;
2016-03-11 00:48:53 +00:00
if (count) {
for (var j = 0; j < count; ++j) {
2019-08-15 13:39:48 +00:00
var group = data[j];
id = group.get_Id();
width = group.get_W();
height = group.get_H();
2016-03-11 00:48:53 +00:00
store = new Backbone.Collection([], {
model: DE.Models.EquationModel
});
if (store) {
2019-08-15 13:39:48 +00:00
var allItemsCount = 0, itemsCount = 0, ids = 0, arr = [];
length = group.get_Data().length;
2016-03-11 00:48:53 +00:00
for (i = 0; i < length; ++i) {
2019-08-15 13:39:48 +00:00
eqStore = group.get_Data()[i];
2016-03-11 00:48:53 +00:00
itemsCount = eqStore.get_Data().length;
for (var p = 0; p < itemsCount; ++p) {
eq = eqStore.get_Data()[p];
ids = eq.get_Id();
translate = '';
if (translationTable.hasOwnProperty(ids)) {
translate = translationTable[ids];
}
2019-08-15 13:39:48 +00:00
arr.push({
2016-03-11 00:48:53 +00:00
data : {equationType: ids},
tip : translate,
allowSelected : true,
selected : false,
width : eqStore.get_W(),
height : eqStore.get_H(),
posX : -eq.get_X(),
posY : -eq.get_Y()
});
}
allItemsCount += itemsCount;
}
2019-08-15 13:39:48 +00:00
store.add(arr);
2016-03-11 00:48:53 +00:00
width = c_oAscMathMainTypeStrings[id][1] * (width + 10); // 4px margin + 4px margin + 1px border + 1px border
var normHeight = parseInt(370 / (height + 10)) * (height + 10);
equationgrouparray.push({
groupName : c_oAscMathMainTypeStrings[id][0],
groupStore : store,
groupWidth : width,
groupHeight : c_oAscMathMainTypeStrings[id][2] ? ' height:'+ normHeight +'px!important; ' : ''
});
}
}
equationsStore.add(equationgrouparray);
this.fillEquations();
}
}
},
activateControls: function() {
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.disableOnStart, false);
this.toolbar.lockToolbar(Common.enumLock.undoLock, this._state.can_undo!==true, {array: [this.toolbar.btnUndo]});
this.toolbar.lockToolbar(Common.enumLock.redoLock, this._state.can_redo!==true, {array: [this.toolbar.btnRedo]});
this.toolbar.lockToolbar(Common.enumLock.copyLock, this._state.can_copycut!==true, {array: [this.toolbar.btnCopy, this.toolbar.btnCut]});
2021-12-29 16:32:43 +00:00
this.toolbar.lockToolbar(Common.enumLock.mmergeLock, !!this._state.mmdisable, {array: [this.toolbar.btnMailRecepients]});
if (!this._state.mmdisable) {
this.toolbar.mnuMailRecepients.items[2].setVisible(this.toolbar.mode.fileChoiceUrl || this.toolbar.mode.canRequestMailMergeRecipients);
}
2016-03-11 00:48:53 +00:00
this._state.activated = true;
var props = this.api.asc_GetSectionProps();
this.onApiPageSize(props.get_W(), props.get_H());
},
DisableMailMerge: function() {
this._state.mmdisable = true;
2021-12-29 16:32:43 +00:00
this.toolbar && this.toolbar.btnMailRecepients && this.toolbar.lockToolbar(Common.enumLock.mmergeLock, true, {array: [this.toolbar.btnMailRecepients]});
},
2016-03-11 00:48:53 +00:00
updateThemeColors: function() {
var updateColors = function(picker, defaultColorIndex) {
if (picker) {
var clr;
var effectcolors = Common.Utils.ThemeColor.getEffectColors();
for (var i = 0; i < effectcolors.length; i++) {
if (typeof(picker.currentColor) == 'object' &&
clr === undefined &&
picker.currentColor.effectId == effectcolors[i].effectId)
clr = effectcolors[i];
}
picker.updateColors(effectcolors, Common.Utils.ThemeColor.getStandartColors());
if (picker.currentColor === undefined) {
picker.currentColor = effectcolors[defaultColorIndex];
} else if ( clr!==undefined ) {
picker.currentColor = clr;
}
}
};
updateColors(this.toolbar.mnuFontColorPicker, 1);
if (this.toolbar.btnFontColor.currentColor===undefined || !this.toolbar.btnFontColor.currentColor.isAuto) {
this.toolbar.btnFontColor.currentColor = this.toolbar.mnuFontColorPicker.currentColor.color || this.toolbar.mnuFontColorPicker.currentColor;
2021-01-21 19:48:27 +00:00
this.toolbar.btnFontColor.setColor(this.toolbar.btnFontColor.currentColor);
2016-03-11 00:48:53 +00:00
}
if (this._state.clrtext_asccolor!==undefined) {
this._state.clrtext = undefined;
this.onApiTextColor(this._state.clrtext_asccolor);
}
this._state.clrtext_asccolor = undefined;
updateColors(this.toolbar.mnuParagraphColorPicker, 0);
this.toolbar.btnParagraphColor.currentColor = this.toolbar.mnuParagraphColorPicker.currentColor.color || this.toolbar.mnuParagraphColorPicker.currentColor;
2021-01-21 19:48:27 +00:00
this.toolbar.btnParagraphColor.setColor(this.toolbar.btnParagraphColor.currentColor);
2016-03-11 00:48:53 +00:00
if (this._state.clrshd_asccolor!==undefined) {
this._state.clrback = undefined;
this.onParagraphColor(this._state.clrshd_asccolor);
}
this._state.clrshd_asccolor = undefined;
},
_onInitEditorStyles: function(styles) {
window.styles_loaded = false;
var self = this,
listStyles = self.toolbar.listStyles;
window.styles = styles;
if (!listStyles) {
self.styles = styles;
return;
}
2019-08-21 07:50:32 +00:00
var arr = [];
var mainController = this.getApplication().getController('Main');
2016-03-11 00:48:53 +00:00
_.each(styles.get_MergedStyles(), function(style){
2019-08-21 07:50:32 +00:00
arr.push({
2016-03-11 00:48:53 +00:00
imageUrl: style.asc_getImage(),
title : style.get_Name(),
tip : mainController.translationTable[style.get_Name()] || style.get_Name(),
2016-03-11 00:48:53 +00:00
id : Common.UI.getId()
});
});
2019-08-21 07:50:32 +00:00
listStyles.menuPicker.store.reset(arr); // remove all
2016-03-11 00:48:53 +00:00
if (listStyles.menuPicker.store.length > 0 && listStyles.rendered){
var styleRec;
if (self._state.prstyle) styleRec = listStyles.menuPicker.store.findWhere({title: self._state.prstyle});
listStyles.fillComboView((styleRec) ? styleRec : listStyles.menuPicker.store.at(0), true);
Common.NotificationCenter.trigger('edit:complete', this);
} else if (listStyles.rendered)
listStyles.clearComboView();
2016-03-11 00:48:53 +00:00
window.styles_loaded = true;
},
2018-03-05 09:28:37 +00:00
onHomeOpen: function() {
var listStyles = this.toolbar.listStyles;
if (listStyles && listStyles.needFillComboView && listStyles.menuPicker.store.length > 0 && listStyles.rendered){
var styleRec;
if (this._state.prstyle) styleRec = listStyles.menuPicker.store.findWhere({title: this._state.prstyle});
listStyles.fillComboView((styleRec) ? styleRec : listStyles.menuPicker.store.at(0), true);
}
},
2016-03-11 00:48:53 +00:00
_setMarkerColor: function(strcolor, h) {
var me = this;
if (h === 'menu') {
2021-07-10 19:54:51 +00:00
me._state.clrhighlight = undefined;
me.onApiHighlightColor();
2016-03-11 00:48:53 +00:00
me.toolbar.btnHighlightColor.currentColor = strcolor;
2021-01-21 19:48:27 +00:00
me.toolbar.btnHighlightColor.setColor(me.toolbar.btnHighlightColor.currentColor);
2016-03-11 00:48:53 +00:00
me.toolbar.btnHighlightColor.toggle(true, true);
}
strcolor = strcolor || 'transparent';
if (strcolor == 'transparent') {
me.api.SetMarkerFormat(true, false);
} else {
var r = strcolor[0] + strcolor[1],
g = strcolor[2] + strcolor[3],
b = strcolor[4] + strcolor[5];
me.api.SetMarkerFormat(true, true, parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
}
2016-10-13 08:40:59 +00:00
Common.NotificationCenter.trigger('edit:complete', me.toolbar, me.toolbar.btnHighlightColor);
2016-03-11 00:48:53 +00:00
Common.component.Analytics.trackEvent('ToolBar', 'Highlight Color');
},
onHideMenus: function(e){
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
2016-03-11 00:48:53 +00:00
onSetupCopyStyleButton: function () {
this.modeAlwaysSetStyle = false;
var me = this;
Common.NotificationCenter.on({
'edit:complete': function () {
if (me.api && me.modeAlwaysSetStyle) {
2019-02-19 12:47:50 +00:00
me.api.SetPaintFormat(AscCommon.c_oAscFormatPainterState.kOff);
2016-03-11 00:48:53 +00:00
me.toolbar.btnCopyStyle.toggle(false, true);
me.modeAlwaysSetStyle = false;
}
}
});
$(me.toolbar.btnCopyStyle.cmpEl).dblclick(function () {
if (me.api) {
me.modeAlwaysSetStyle = true;
me.toolbar.btnCopyStyle.toggle(true, true);
2019-02-19 12:47:50 +00:00
me.api.SetPaintFormat(AscCommon.c_oAscFormatPainterState.kMultiple);
2016-03-11 00:48:53 +00:00
}
});
},
onApiCoAuthoringDisconnect: function(enableDownload) {
this.mode.isEdit && this.toolbar.setMode({isDisconnected:true, enableDownload: !!enableDownload});
2016-03-11 00:48:53 +00:00
this.editMode = false;
this.DisableToolbar(true, true);
2016-03-11 00:48:53 +00:00
},
DisableToolbar: function(disable, viewMode, reviewmode, fillformmode) {
2016-03-11 00:48:53 +00:00
if (viewMode!==undefined) this.editMode = !viewMode;
disable = disable || !this.editMode;
2017-08-23 14:49:56 +00:00
var toolbar_mask = $('.toolbar-mask'),
group_mask = $('.toolbar-group-mask'),
mask = (reviewmode || fillformmode) ? group_mask : toolbar_mask;
2016-03-11 00:48:53 +00:00
if (disable && mask.length>0 || !disable && mask.length==0) return;
var toolbar = this.toolbar;
2021-12-16 16:49:24 +00:00
toolbar.hideMoreBtns();
if (reviewmode)
toolbar.lockToolbar(Common.enumLock.previewReviewMode, disable);
else if (fillformmode)
toolbar.lockToolbar(Common.enumLock.viewFormMode, disable);
2016-03-11 00:48:53 +00:00
if(disable) {
if (reviewmode || fillformmode)
mask = $("<div class='toolbar-group-mask'>").appendTo(toolbar.$el.find('.toolbar'));
else
2017-08-23 14:49:56 +00:00
mask = $("<div class='toolbar-mask'>").appendTo(toolbar.$el.find('.toolbar'));
2016-03-11 00:48:53 +00:00
} else {
mask.remove();
}
toolbar.$el.find('.toolbar').toggleClass('masked', $('.toolbar-mask').length>0);
disable = disable || ((reviewmode || fillformmode) ? toolbar_mask.length>0 : group_mask.length>0);
2017-04-21 13:36:06 +00:00
if ( toolbar.synchTooltip )
toolbar.synchTooltip.hide();
toolbar._state.previewmode = reviewmode && disable;
if (reviewmode) {
toolbar._state.previewmode && toolbar.btnSave && toolbar.btnSave.setDisabled(true);
if (toolbar.needShowSynchTip) {
toolbar.needShowSynchTip = false;
toolbar.onCollaborativeChanges();
}
}
disable ? Common.util.Shortcuts.suspendEvents('alt+h') : Common.util.Shortcuts.resumeEvents('alt+h');
2016-03-11 00:48:53 +00:00
},
onSelectRecepientsClick: function(menu, item, e) {
2016-03-11 00:48:53 +00:00
if (this._mailMergeDlg) return;
var me = this;
if (item.value === 'file') {
this.api && this.api.asc_StartMailMerge();
} else if (item.value === 'url') {
(new Common.Views.ImageFromUrlDialog({
2021-11-29 09:45:30 +00:00
title: me.dataUrl,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) {
2021-08-27 08:19:59 +00:00
me.api.asc_StartMailMerge({ fileType: "csv", url: checkUrl });
} else {
Common.UI.warning({
msg: me.textEmptyMMergeUrl
});
}
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
}
})).show();
} else if (item.value === 'storage') {
if (this.toolbar.mode.canRequestMailMergeRecipients) {
Common.Gateway.requestMailMergeRecipients();
} else {
me._mailMergeDlg = new Common.Views.SelectFileDlg({
fileChoiceUrl: this.toolbar.mode.fileChoiceUrl.replace("{fileExt}", "xlsx").replace("{documentType}", "")
});
me._mailMergeDlg.on('selectfile', function(obj, recepients){
me.setMailMergeRecipients(recepients);
}).on('close', function(obj){
me._mailMergeDlg = undefined;
});
me._mailMergeDlg.show();
}
}
},
2016-03-11 00:48:53 +00:00
setMailMergeRecipients: function(recepients) {
this.api.asc_StartMailMerge(recepients);
if (!this.mergeEditor)
this.mergeEditor = this.getApplication().getController('Common.Controllers.ExternalMergeEditor').getView('Common.Views.ExternalMergeEditor');
if (this.mergeEditor)
this.mergeEditor.setEditMode(false);
2016-03-11 00:48:53 +00:00
},
createDelayedElements: function() {
this.toolbar.createDelayedElements();
this.attachUIEvents(this.toolbar);
},
onAppShowed: function (config) {
var me = this;
2017-04-10 13:39:03 +00:00
2021-12-05 09:12:27 +00:00
var compactview = !(config.isEdit || config.isRestrictedEdit && config.canFillForms && config.isFormCreator);
if ( config.isEdit || config.isRestrictedEdit && config.canFillForms && config.isFormCreator) {
2017-04-20 14:45:47 +00:00
if ( Common.localStorage.itemExists("de-compact-toolbar") ) {
compactview = Common.localStorage.getBool("de-compact-toolbar");
} else
if ( config.customization && config.customization.compactToolbar )
compactview = true;
}
me.toolbar.render(_.extend({isCompactView: compactview}, config));
2017-04-10 13:39:03 +00:00
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration, dataHintTitle: 'U', layoutname: 'toolbar-collaboration'};
var $panel = me.application.getController('Common.Controllers.ReviewChanges').createToolbarPanel();
2020-12-22 12:37:05 +00:00
if ( $panel ) {
2020-10-07 07:43:34 +00:00
me.toolbar.addTab(tab, $panel, 5);
2021-11-01 22:08:27 +00:00
me.toolbar.setVisible('review', (config.isEdit || config.canCoAuthoring && config.canComments) && Common.UI.LayoutManager.isElementVisible('toolbar-collaboration') ); // use config.canViewReview in review controller. set visible review tab in view mode only when asc_HaveRevisionsChanges
2020-12-22 12:37:05 +00:00
}
if ( config.isEdit ) {
me.toolbar.setMode(config);
me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled'));
if (!(config.customization && config.customization.compactHeader)) {
// hide 'print' and 'save' buttons group and next separator
me.toolbar.btnPrint.$el.parents('.group').hide().next().hide();
// hide 'undo' and 'redo' buttons and retrieve parent container
var $box = me.toolbar.btnUndo.$el.hide().next().hide().parent();
2018-02-07 15:30:45 +00:00
// move 'paste' button to the container instead of 'undo' and 'redo'
me.toolbar.btnPaste.$el.detach().appendTo($box);
me.toolbar.btnPaste.$el.find('button').attr('data-hint-direction', 'bottom');
me.toolbar.btnCopy.$el.removeClass('split');
2022-07-12 20:56:02 +00:00
me.toolbar.processPanelVisible(null, true, true);
}
2018-02-07 15:30:45 +00:00
if ( config.isDesktopApp ) {
if ( config.canProtect ) {
tab = {action: 'protect', caption: me.toolbar.textTabProtect, dataHintTitle: 'T', layoutname: 'toolbar-protect'};
$panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
2018-02-07 15:30:45 +00:00
2020-10-07 07:43:34 +00:00
if ($panel) me.toolbar.addTab(tab, $panel, 6);
2018-02-07 15:30:45 +00:00
}
}
var links = me.getApplication().getController('Links');
links.setApi(me.api).setConfig({toolbar: me});
Array.prototype.push.apply(me.toolbar.lockControls, links.getView('Links').getButtons());
}
2021-12-05 09:12:27 +00:00
if ( config.isEdit && config.canFeatureContentControl && config.canFeatureForms || config.isRestrictedEdit && config.canFillForms ) {
if (config.isFormCreator) {
tab = {caption: me.textTabForms, action: 'forms', dataHintTitle: 'M'};
2021-04-30 09:36:34 +00:00
var forms = me.getApplication().getController('FormsTab');
forms.setApi(me.api).setConfig({toolbar: me, config: config});
$panel = forms.createToolbarPanel();
if ($panel) {
me.toolbar.addTab(tab, $panel, 4);
me.toolbar.setVisible('forms', true);
config.isEdit && config.canFeatureContentControl && config.canFeatureForms && Array.prototype.push.apply(me.toolbar.lockControls, forms.getView('FormsTab').getButtons());
!compactview && (config.isFormCreator || config.isRestrictedEdit && config.canFillForms) && me.toolbar.setTab('forms');
}
2020-10-07 11:20:14 +00:00
}
}
2021-04-30 09:36:34 +00:00
config.isEdit && config.canFeatureContentControl && me.onChangeSdtGlobalSettings();
tab = {caption: me.toolbar.textTabView, action: 'view', extcls: config.isEdit ? 'canedit' : '', layoutname: 'toolbar-view', dataHintTitle: 'W'};
var viewtab = me.getApplication().getController('ViewTab');
viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
$panel = viewtab.createToolbarPanel();
if ($panel) {
me.toolbar.addTab(tab, $panel, 7);
me.toolbar.setVisible('view', Common.UI.LayoutManager.isElementVisible('toolbar-view'));
}
},
onAppReady: function (config) {
var me = this;
me.appOptions = config;
2022-04-12 15:31:21 +00:00
this.btnsComment = [];
2017-06-15 13:18:40 +00:00
if ( config.canCoAuthoring && config.canComments ) {
this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', this.toolbar.capBtnComment,
2021-12-29 16:32:43 +00:00
[ Common.enumLock.paragraphLock, Common.enumLock.headerLock, Common.enumLock.richEditLock, Common.enumLock.plainEditLock, Common.enumLock.richDelLock, Common.enumLock.plainDelLock,
2022-01-13 19:38:44 +00:00
Common.enumLock.cantAddQuotedComment, Common.enumLock.imageLock, Common.enumLock.inSpecificForm, Common.enumLock.inImage, Common.enumLock.lostConnect, Common.enumLock.disableOnStart,
Common.enumLock.previewReviewMode, Common.enumLock.viewFormMode ],
undefined, undefined, undefined, '1', 'bottom');
if ( this.btnsComment.length ) {
2017-04-06 09:42:43 +00:00
var _comments = DE.getController('Common.Controllers.Comments').getView();
this.btnsComment.forEach(function (btn) {
2017-08-02 13:47:40 +00:00
btn.updateHint( _comments.textHintAddComment );
2017-03-31 10:55:10 +00:00
btn.on('click', function (btn, e) {
Common.NotificationCenter.trigger('app:comment:add', 'toolbar');
});
if (btn.cmpEl.closest('#review-changes-panel').length>0)
btn.setCaption(me.toolbar.capBtnAddComment);
2017-03-31 10:55:10 +00:00
}, this);
}
Array.prototype.push.apply(this.toolbar.paragraphControls, this.btnsComment);
2022-01-13 19:38:44 +00:00
Array.prototype.push.apply(this.toolbar.lockControls, this.btnsComment);
}
(new Promise(function(accept) {
accept();
})).then(function () {
if ( config.isEdit ) {
me.controllers.pageLayout = new DE.Controllers.PageLayout({
id: 'ImageLayout',
application: me.getApplication()
});
me.controllers.pageLayout.onLaunch(me.toolbar)
.setApi(me.api)
.onAppReady(config);
}
});
},
2017-04-21 13:36:06 +00:00
getView: function (name) {
return !name ? this.toolbar : Backbone.Controller.prototype.getView.apply(this, arguments);
},
onFileMenu: function (opts) {
2018-05-18 09:59:01 +00:00
if ( opts == 'show' ) {
if ( !this.toolbar.isTabActive('file') )
this.toolbar.setTab('file');
} else {
if ( this.toolbar.isTabActive('file') )
this.toolbar.setTab();
}
},
onTextLanguage: function(langId) {
this._state.lang = langId;
},
2020-03-03 08:08:15 +00:00
onInsDateTimeClick: function() {
//insert date time
var me = this;
(new DE.Views.DateTimeDialog({
api: this.api,
lang: this._state.lang,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
2020-03-06 11:18:01 +00:00
me.api.asc_addDateTime(value);
2020-03-03 08:08:15 +00:00
}
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
},
2016-03-11 00:48:53 +00:00
textEmptyImgUrl : 'You need to specify image URL.',
textWarning : 'Warning',
2021-02-03 13:56:01 +00:00
textFontSizeErr : 'The entered value is incorrect.<br>Please enter a numeric value between 1 and 300',
2016-03-11 00:48:53 +00:00
textSymbols : 'Symbols',
textFraction : 'Fraction',
textScript : 'Script',
textRadical : 'Radical',
textIntegral : 'Integral',
textLargeOperator : 'Large Operator',
textBracket : 'Bracket',
textFunction : 'Function',
textAccent : 'Accent',
textLimitAndLog : 'Limit And Log',
textOperator : 'Operator',
textMatrix : 'Matrix',
txtSymbol_pm : 'Plus Minus',
txtSymbol_infinity : 'Infinity',
txtSymbol_equals : 'Equal',
txtSymbol_neq : 'Not Equal To',
txtSymbol_about : 'Approximately',
txtSymbol_times : 'Multiplication Sign',
txtSymbol_div : 'Division Sign',
txtSymbol_factorial : 'Factorial',
txtSymbol_propto : 'Proportional To',
txtSymbol_less : 'Less Than',
txtSymbol_ll : 'Much Less Than',
txtSymbol_greater : 'Greater Than',
txtSymbol_gg : 'Much Greater Than',
txtSymbol_leq : 'Less Than or Equal To',
txtSymbol_geq : 'Greater Than or Equal To',
txtSymbol_mp : 'Minus Plus',
txtSymbol_cong : 'Approximately Equal To',
txtSymbol_approx : 'Almost Equal To',
txtSymbol_equiv : 'Identical To',
txtSymbol_forall : 'For All',
txtSymbol_additional : 'Complement',
txtSymbol_partial : 'Partial Differential',
txtSymbol_sqrt : 'Radical Sign',
txtSymbol_cbrt : 'Cube Root',
txtSymbol_qdrt : 'Fourth Root',
txtSymbol_cup : 'Union',
txtSymbol_cap : 'Intersection',
txtSymbol_emptyset : 'Empty Set',
txtSymbol_percent : 'Percentage',
txtSymbol_degree : 'Degrees',
txtSymbol_fahrenheit : 'Degrees Fahrenheit',
txtSymbol_celsius : 'Degrees Celsius',
txtSymbol_inc : 'Increment',
txtSymbol_nabla : 'Nabla',
txtSymbol_exists : 'There Exist',
txtSymbol_notexists : 'There Does Not Exist',
txtSymbol_in : 'Element Of',
txtSymbol_ni : 'Contains as Member',
txtSymbol_leftarrow : 'Left Arrow',
txtSymbol_uparrow : 'Up Arrow',
txtSymbol_rightarrow : 'Right Arrow',
txtSymbol_downarrow : 'Down Arrow',
txtSymbol_leftrightarrow : 'Left-Right Arrow',
txtSymbol_therefore : 'Therefore',
txtSymbol_plus : 'Plus',
txtSymbol_minus : 'Minus',
txtSymbol_not : 'Not Sign',
txtSymbol_ast : 'Asterisk Operator',
txtSymbol_bullet : 'Bulet Operator',
txtSymbol_vdots : 'Vertical Ellipsis',
txtSymbol_cdots : 'Midline Horizontal Ellipsis',
txtSymbol_rddots : 'Up Right Diagonal Ellipsis',
txtSymbol_ddots : 'Down Right Diagonal Ellipsis',
txtSymbol_aleph : 'Alef',
txtSymbol_beth : 'Bet',
txtSymbol_qed : 'End of Proof',
txtSymbol_alpha : 'Alpha',
txtSymbol_beta : 'Beta',
txtSymbol_gamma : 'Gamma',
txtSymbol_delta : 'Delta',
txtSymbol_varepsilon : 'Epsilon Variant',
txtSymbol_epsilon : 'Epsilon',
txtSymbol_zeta : 'Zeta',
txtSymbol_eta : 'Eta',
txtSymbol_theta : 'Theta',
txtSymbol_vartheta : 'Theta Variant',
txtSymbol_iota : 'Iota',
txtSymbol_kappa : 'Kappa',
txtSymbol_lambda : 'Lambda',
txtSymbol_mu : 'Mu',
txtSymbol_nu : 'Nu',
txtSymbol_xsi : 'Xi',
txtSymbol_o : 'Omicron',
txtSymbol_pi : 'Pi',
txtSymbol_varpi : 'Pi Variant',
txtSymbol_rho : 'Rho',
txtSymbol_varrho : 'Rho Variant',
txtSymbol_sigma : 'Sigma',
txtSymbol_varsigma : 'Sigma Variant',
txtSymbol_tau : 'Tau',
txtSymbol_upsilon : 'Upsilon',
txtSymbol_varphi : 'Phi Variant',
txtSymbol_phi : 'Phi',
txtSymbol_chi : 'Chi',
txtSymbol_psi : 'Psi',
txtSymbol_omega : 'Omega',
txtFractionVertical : 'Stacked Fraction',
txtFractionDiagonal : 'Skewed Fraction',
txtFractionHorizontal : 'Linear Fraction',
txtFractionSmall : 'Small Fraction',
txtFractionDifferential_1 : 'Differential',
txtFractionDifferential_2 : 'Differential',
txtFractionDifferential_3 : 'Differential',
txtFractionDifferential_4 : 'Differential',
txtFractionPi_2 : 'Pi Over 2',
txtScriptSup : 'Superscript',
txtScriptSub : 'Subscript',
txtScriptSubSup : 'Subscript-Superscript',
txtScriptSubSupLeft : 'Left Subscript-Superscript',
txtScriptCustom_1 : 'Script',
txtScriptCustom_2 : 'Script',
txtScriptCustom_3 : 'Script',
txtScriptCustom_4 : 'Script',
txtRadicalSqrt : 'Square Root',
txtRadicalRoot_n : 'Radical With Degree',
txtRadicalRoot_2 : 'Square Root With Degree',
txtRadicalRoot_3 : 'Cubic Root',
txtRadicalCustom_1 : 'Radical',
txtRadicalCustom_2 : 'Radical',
txtIntegral : 'Integral',
txtIntegralSubSup : 'Integral',
txtIntegralCenterSubSup : 'Integral',
txtIntegralDouble : 'Double Integral',
txtIntegralDoubleSubSup : 'Double Integral',
txtIntegralDoubleCenterSubSup : 'Double Integral',
txtIntegralTriple : 'Triple Integral',
txtIntegralTripleSubSup : 'Triple Integral',
txtIntegralTripleCenterSubSup : 'Triple Integral',
txtIntegralOriented : 'Contour Integral',
txtIntegralOrientedSubSup : 'Contour Integral',
txtIntegralOrientedCenterSubSup : 'Contour Integral',
txtIntegralOrientedDouble : 'Surface Integral',
txtIntegralOrientedDoubleSubSup : 'Surface Integral',
txtIntegralOrientedDoubleCenterSubSup : 'Surface Integral',
txtIntegralOrientedTriple : 'Volume Integral',
txtIntegralOrientedTripleSubSup : 'Volume Integral',
txtIntegralOrientedTripleCenterSubSup : 'Volume Integral',
txtIntegral_dx : 'Differential x',
txtIntegral_dy : 'Differential y',
txtIntegral_dtheta : 'Differential theta',
txtLargeOperator_Sum : 'Summation',
txtLargeOperator_Sum_CenterSubSup : 'Summation',
txtLargeOperator_Sum_SubSup : 'Summation',
txtLargeOperator_Sum_CenterSub : 'Summation',
txtLargeOperator_Sum_Sub : 'Summation',
txtLargeOperator_Prod : 'Product',
txtLargeOperator_Prod_CenterSubSup : 'Product',
txtLargeOperator_Prod_SubSup : 'Product',
txtLargeOperator_Prod_CenterSub : 'Product',
txtLargeOperator_Prod_Sub : 'Product',
txtLargeOperator_CoProd : 'Co-Product',
txtLargeOperator_CoProd_CenterSubSup : 'Co-Product',
txtLargeOperator_CoProd_SubSup : 'Co-Product',
txtLargeOperator_CoProd_CenterSub : 'Co-Product',
txtLargeOperator_CoProd_Sub : 'Co-Product',
txtLargeOperator_Union : 'Union',
txtLargeOperator_Union_CenterSubSup : 'Union',
txtLargeOperator_Union_SubSup : 'Union',
txtLargeOperator_Union_CenterSub : 'Union',
txtLargeOperator_Union_Sub : 'Union',
txtLargeOperator_Intersection : 'Intersection',
txtLargeOperator_Intersection_CenterSubSup : 'Intersection',
txtLargeOperator_Intersection_SubSup : 'Intersection',
txtLargeOperator_Intersection_CenterSub : 'Intersection',
txtLargeOperator_Intersection_Sub : 'Intersection',
txtLargeOperator_Disjunction : 'Vee',
txtLargeOperator_Disjunction_CenterSubSup : 'Vee',
txtLargeOperator_Disjunction_SubSup : 'Vee',
txtLargeOperator_Disjunction_CenterSub : 'Vee',
txtLargeOperator_Disjunction_Sub : 'Vee',
txtLargeOperator_Conjunction : 'Wedge',
txtLargeOperator_Conjunction_CenterSubSup : 'Wedge',
txtLargeOperator_Conjunction_SubSup : 'Wedge',
txtLargeOperator_Conjunction_CenterSub : 'Wedge',
txtLargeOperator_Conjunction_Sub : 'Wedge',
txtLargeOperator_Custom_1 : 'Summation',
txtLargeOperator_Custom_2 : 'Summation',
txtLargeOperator_Custom_3 : 'Summation',
txtLargeOperator_Custom_4 : 'Product',
txtLargeOperator_Custom_5 : 'Union',
txtBracket_Round : 'Brackets',
txtBracket_Square : 'Brackets',
txtBracket_Curve : 'Brackets',
txtBracket_Angle : 'Brackets',
txtBracket_LowLim : 'Brackets',
txtBracket_UppLim : 'Brackets',
txtBracket_Line : 'Brackets',
txtBracket_LineDouble : 'Brackets',
txtBracket_Square_OpenOpen : 'Brackets',
txtBracket_Square_CloseClose : 'Brackets',
txtBracket_Square_CloseOpen : 'Brackets',
txtBracket_SquareDouble : 'Brackets',
txtBracket_Round_Delimiter_2 : 'Brackets with Separators',
txtBracket_Curve_Delimiter_2 : 'Brackets with Separators',
txtBracket_Angle_Delimiter_2 : 'Brackets with Separators',
txtBracket_Angle_Delimiter_3 : 'Brackets with Separators',
txtBracket_Round_OpenNone : 'Single Bracket',
txtBracket_Round_NoneOpen : 'Single Bracket',
txtBracket_Square_OpenNone : 'Single Bracket',
txtBracket_Square_NoneOpen : 'Single Bracket',
txtBracket_Curve_OpenNone : 'Single Bracket',
txtBracket_Curve_NoneOpen : 'Single Bracket',
txtBracket_Angle_OpenNone : 'Single Bracket',
txtBracket_Angle_NoneOpen : 'Single Bracket',
txtBracket_LowLim_OpenNone : 'Single Bracket',
txtBracket_LowLim_NoneNone : 'Single Bracket',
txtBracket_UppLim_OpenNone : 'Single Bracket',
txtBracket_UppLim_NoneOpen : 'Single Bracket',
txtBracket_Line_OpenNone : 'Single Bracket',
txtBracket_Line_NoneOpen : 'Single Bracket',
txtBracket_LineDouble_OpenNone : 'Single Bracket',
txtBracket_LineDouble_NoneOpen : 'Single Bracket',
txtBracket_SquareDouble_OpenNone : 'Single Bracket',
txtBracket_SquareDouble_NoneOpen : 'Single Bracket',
txtBracket_Custom_1 : 'Case (Two Conditions)',
txtBracket_Custom_2 : 'Cases (Three Conditions)',
txtBracket_Custom_3 : 'Stack Object',
txtBracket_Custom_4 : 'Stack Object',
txtBracket_Custom_5 : 'Cases Example',
txtBracket_Custom_6 : 'Binomial Coefficient',
txtBracket_Custom_7 : 'Binomial Coefficient',
txtFunction_Sin : 'Sine Function',
txtFunction_Cos : 'Cosine Function',
txtFunction_Tan : 'Tangent Function',
txtFunction_Csc : 'Cosecant Function',
txtFunction_Sec : 'Secant Function',
txtFunction_Cot : 'Cotangent Function',
txtFunction_1_Sin : 'Inverse Sine Function',
txtFunction_1_Cos : 'Inverse Cosine Function',
txtFunction_1_Tan : 'Inverse Tangent Function',
txtFunction_1_Csc : 'Inverse Cosecant Function',
txtFunction_1_Sec : 'Inverse Secant Function',
txtFunction_1_Cot : 'Inverse Cotangent Function',
txtFunction_Sinh : 'Hyperbolic Sine Function',
txtFunction_Cosh : 'Hyperbolic Cosine Function',
txtFunction_Tanh : 'Hyperbolic Tangent Function',
txtFunction_Csch : 'Hyperbolic Cosecant Function',
txtFunction_Sech : 'Hyperbolic Secant Function',
txtFunction_Coth : 'Hyperbolic Cotangent Function',
txtFunction_1_Sinh : 'Hyperbolic Inverse Sine Function',
txtFunction_1_Cosh : 'Hyperbolic Inverse Cosine Function',
txtFunction_1_Tanh : 'Hyperbolic Inverse Tangent Function',
txtFunction_1_Csch : 'Hyperbolic Inverse Cosecant Function',
txtFunction_1_Sech : 'Hyperbolic Inverse Secant Function',
txtFunction_1_Coth : 'Hyperbolic Inverse Cotangent Function',
txtFunction_Custom_1 : 'Sine theta',
txtFunction_Custom_2 : 'Cos 2x',
txtFunction_Custom_3 : 'Tangent formula',
txtAccent_Dot : 'Dot',
txtAccent_DDot : 'Double Dot',
txtAccent_DDDot : 'Triple Dot',
txtAccent_Hat : 'Hat',
txtAccent_Check : 'Check',
txtAccent_Accent : 'Acute',
txtAccent_Grave : 'Grave',
txtAccent_Smile : 'Breve',
txtAccent_Tilde : 'Tilde',
txtAccent_Bar : 'Bar',
txtAccent_DoubleBar : 'Double Overbar',
txtAccent_CurveBracketTop : 'Overbrace',
txtAccent_CurveBracketBot : 'Underbrace',
txtAccent_GroupTop : 'Grouping Character Above',
txtAccent_GroupBot : 'Grouping Character Below',
txtAccent_ArrowL : 'Leftwards Arrow Above',
txtAccent_ArrowR : 'Rightwards Arrow Above',
txtAccent_ArrowD : 'Right-Left Arrow Above',
txtAccent_HarpoonL : 'Leftwards Harpoon Above',
txtAccent_HarpoonR : 'Rightwards Harpoon Above',
txtAccent_BorderBox : 'Boxed Formula (With Placeholder)',
txtAccent_BorderBoxCustom : 'Boxed Formula (Example)',
txtAccent_BarTop : 'Overbar',
txtAccent_BarBot : 'Underbar',
txtAccent_Custom_1 : 'Vector A',
txtAccent_Custom_2 : 'ABC With Overbar',
txtAccent_Custom_3 : 'x XOR y With Overbar',
txtLimitLog_LogBase : 'Logarithm',
txtLimitLog_Log : 'Logarithm',
txtLimitLog_Lim : 'Limit',
txtLimitLog_Min : 'Minimum',
txtLimitLog_Max : 'Maximum',
txtLimitLog_Ln : 'Natural Logarithm',
txtLimitLog_Custom_1 : 'Limit Example',
txtLimitLog_Custom_2 : 'Maximum Example',
txtOperator_ColonEquals : 'Colon Equal',
txtOperator_EqualsEquals : 'Equal Equal',
txtOperator_PlusEquals : 'Plus Equal',
txtOperator_MinusEquals : 'Minus Equal',
txtOperator_Definition : 'Equal to By Definition',
txtOperator_UnitOfMeasure : 'Measured By',
txtOperator_DeltaEquals : 'Delta Equal To',
txtOperator_ArrowL_Top : 'Leftwards Arrow Above',
txtOperator_ArrowR_Top : 'Rightwards Arrow Above',
txtOperator_ArrowL_Bot : 'Leftwards Arrow Below',
txtOperator_ArrowR_Bot : 'Rightwards Arrow Below',
txtOperator_DoubleArrowL_Top : 'Leftwards Arrow Above',
txtOperator_DoubleArrowR_Top : 'Rightwards Arrow Above',
txtOperator_DoubleArrowL_Bot : 'Leftwards Arrow Below',
txtOperator_DoubleArrowR_Bot : 'Rightwards Arrow Below',
txtOperator_ArrowD_Top : 'Right-Left Arrow Above',
txtOperator_ArrowD_Bot : 'Right-Left Arrow Above',
txtOperator_DoubleArrowD_Top : 'Right-Left Arrow Below',
txtOperator_DoubleArrowD_Bot : 'Right-Left Arrow Below',
txtOperator_Custom_1 : 'Yileds',
txtOperator_Custom_2 : 'Delta Yields',
txtMatrix_1_2 : '1x2 Empty Matrix',
txtMatrix_2_1 : '2x1 Empty Matrix',
txtMatrix_1_3 : '1x3 Empty Matrix',
txtMatrix_3_1 : '3x1 Empty Matrix',
txtMatrix_2_2 : '2x2 Empty Matrix',
txtMatrix_2_3 : '2x3 Empty Matrix',
txtMatrix_3_2 : '3x2 Empty Matrix',
txtMatrix_3_3 : '3x3 Empty Matrix',
txtMatrix_Dots_Center : 'Midline Dots',
txtMatrix_Dots_Baseline : 'Baseline Dots',
txtMatrix_Dots_Vertical : 'Vertical Dots',
txtMatrix_Dots_Diagonal : 'Diagonal Dots',
txtMatrix_Identity_2 : '2x2 Identity Matrix',
txtMatrix_Identity_2_NoZeros : '3x3 Identity Matrix',
txtMatrix_Identity_3 : '3x3 Identity Matrix',
txtMatrix_Identity_3_NoZeros : '3x3 Identity Matrix',
txtMatrix_2_2_RoundBracket : 'Empty Matrix with Brackets',
txtMatrix_2_2_SquareBracket : 'Empty Matrix with Brackets',
txtMatrix_2_2_LineBracket : 'Empty Matrix with Brackets',
txtMatrix_2_2_DLineBracket : 'Empty Matrix with Brackets',
txtMatrix_Flat_Round : 'Sparse Matrix',
txtMatrix_Flat_Square : 'Sparse Matrix',
confirmAddFontName: 'The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the device fonts, the saved font will be used when it is available.<br>Do you want to continue?',
notcriticalErrorTitle: 'Warning',
txtMarginsW: 'Left and right margins are too high for a given page wight',
2019-11-11 14:48:09 +00:00
txtMarginsH: 'Top and bottom margins are too high for a given page height',
2020-10-07 11:20:14 +00:00
textInsert: 'Insert',
2021-03-26 21:36:57 +00:00
textTabForms: 'Forms',
textGroup: 'Group',
2021-09-16 17:47:48 +00:00
textEmptyMMergeUrl: 'You need to specify URL.',
textRecentlyUsed: 'Recently Used',
2021-11-29 09:45:30 +00:00
dataUrl: 'Paste a data URL'
2016-03-11 00:48:53 +00:00
}, DE.Controllers.Toolbar || {}));
});