2016-04-01 13:17:09 +00:00
/ *
*
2018-03-01 12:16:38 +00:00
* ( c ) Copyright Ascensio System Limited 2010 - 2018
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 Lubanas st . 125 a - 25 , Riga , Latvia ,
* EU , LV - 1021.
*
* 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' ,
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' ,
'documenteditor/main/app/view/ControlSettingsDialog'
2016-03-11 00:48:53 +00:00
] , function ( ) {
'use strict' ;
DE . Controllers . Toolbar = Backbone . Controller . extend ( _ . extend ( {
models : [ ] ,
collections : [ ] ,
2017-04-04 15:43:19 +00:00
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 ,
2016-04-05 11:52:34 +00:00
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 ,
2016-12-27 09:34:08 +00:00
in _equation : false ,
in _chart : false
2016-03-11 00:48:53 +00:00
} ;
this . flg = { } ;
this . diagramEditor = null ;
this . _isAddingShape = false ;
this . editMode = true ;
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 ,
'home:open' : this . onHomeOpen
2017-04-10 13:39:03 +00:00
} ,
'FileMenu' : {
2017-04-27 14:34:34 +00:00
'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' : {
2018-03-21 11:28:28 +00:00
'toolbar:setcompact' : this . onChangeCompactView . bind ( this ) ,
2017-08-23 11:51:27 +00:00
'print' : function ( opts ) {
var _main = this . getApplication ( ) . getController ( 'Main' ) ;
_main . onPrint ( ) ;
} ,
2018-01-24 10:57:58 +00:00
'save' : function ( opts ) {
this . api . asc _Save ( ) ;
} ,
'undo' : this . onUndo ,
'redo' : this . onRedo ,
2017-07-13 09:43:40 +00:00
'downloadas' : function ( opts ) {
2017-07-21 14:55:27 +00:00
var _main = this . getApplication ( ) . getController ( 'Main' ) ;
var _file _type = _main . document . fileType ,
_format ;
if ( ! ! _file _type ) {
if ( /^pdf|xps|djvu/i . test ( _file _type ) ) {
2017-08-23 11:51:27 +00:00
_main . api . asc _DownloadOrigin ( ) ;
2017-07-21 14:55:27 +00:00
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
2017-07-21 14:55:27 +00:00
] ;
if ( ! _format || _supported . indexOf ( _format ) < 0 )
_format = Asc . c _oAscFileType . PDF ;
_main . api . asc _DownloadAs ( _format ) ;
} ,
2017-07-21 10:41:56 +00:00
'go:editor' : function ( ) {
Common . Gateway . requestEditRights ( ) ;
}
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 ) ) ;
} ,
onLaunch : function ( ) {
2017-03-29 11:19:57 +00:00
var me = this ;
2016-03-11 00:48:53 +00:00
// Create toolbar view
this . toolbar = this . createView ( 'Toolbar' ) ;
2017-03-29 11:19:57 +00:00
me . toolbar . on ( 'render:before' , function ( cmp ) {
} ) ;
2017-03-29 16:29:04 +00:00
Common . NotificationCenter . on ( 'app:ready' , me . onAppReady . bind ( me ) ) ;
2017-04-04 15:22:02 +00:00
Common . NotificationCenter . on ( 'app:face' , me . onAppShowed . bind ( me ) ) ;
2016-03-11 00:48:53 +00:00
} ,
2018-05-15 12:37:26 +00:00
setMode : function ( mode ) {
this . mode = mode ;
this . toolbar . applyLayout ( mode ) ;
} ,
2017-04-24 11:41:51 +00:00
attachUIEvents : function ( toolbar ) {
2016-03-11 00:48:53 +00:00
/ * *
* UI Events
* /
toolbar . btnPrint . on ( 'click' , _ . bind ( this . onPrint , this ) ) ;
2018-09-25 14:09:59 +00:00
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 ) ) ;
2018-02-15 23:56:17 +00:00
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 ) ) ;
2018-02-15 23:56:17 +00:00
toolbar . btnRedo . on ( 'disabled' , _ . bind ( this . onBtnChangeState , this , 'redo:disabled' ) ) ;
2016-03-11 00:48:53 +00:00
toolbar . btnCopy . on ( 'click' , _ . bind ( this . onCopyPaste , this , true ) ) ;
toolbar . btnPaste . on ( 'click' , _ . bind ( this . onCopyPaste , this , false ) ) ;
toolbar . btnIncFontSize . on ( 'click' , _ . bind ( this . onIncrease , this ) ) ;
toolbar . btnDecFontSize . on ( 'click' , _ . bind ( this . onDecrease , this ) ) ;
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 . btnHorizontalAlign . menu . on ( 'item:click' , _ . bind ( this . onMenuHorizontalAlignSelect , this ) ) ;
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 ) ) ;
2016-07-08 09:12:09 +00:00
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 ) ) ;
2016-07-08 09:12:09 +00:00
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 ) ) ;
toolbar . btnHighlightColor . on ( 'click' , _ . bind ( this . onBtnHighlightColor , this ) ) ;
toolbar . btnFontColor . on ( 'click' , _ . bind ( this . onBtnFontColor , this ) ) ;
toolbar . btnParagraphColor . on ( 'click' , _ . bind ( this . onBtnParagraphColor , this ) ) ;
toolbar . mnuHighlightColorPicker . on ( 'select' , _ . bind ( this . onSelectHighlightColor , this ) ) ;
toolbar . mnuFontColorPicker . on ( 'select' , _ . bind ( this . onSelectFontColor , this ) ) ;
toolbar . mnuParagraphColorPicker . on ( 'select' , _ . bind ( this . onParagraphColorPickerSelect , this ) ) ;
toolbar . mnuHighlightTransparent . on ( 'click' , _ . bind ( this . onHighlightTransparentClick , this ) ) ;
$ ( '#id-toolbar-menu-auto-fontcolor' ) . on ( 'click' , _ . bind ( this . onAutoFontColor , this ) ) ;
$ ( '#id-toolbar-menu-new-fontcolor' ) . on ( 'click' , _ . bind ( this . onNewFontColor , this ) ) ;
$ ( '#id-toolbar-menu-new-paracolor' ) . on ( 'click' , _ . bind ( this . onNewParagraphColor , 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 ) ) ;
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 ) ) ;
2016-03-11 00:48:53 +00:00
toolbar . mnuDropCapAdvanced . on ( 'click' , _ . bind ( this . onDropCapAdvancedClick , this ) ) ;
toolbar . btnColumns . menu . on ( 'item:click' , _ . bind ( this . onColumnsSelect , this ) ) ;
2016-07-04 13:04:05 +00:00
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 ) ) ;
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 ) ) ;
toolbar . btnMailRecepients . on ( 'click' , _ . bind ( this . onSelectRecepientsClick , this ) ) ;
toolbar . mnuInsertChartPicker . on ( 'item:click' , _ . bind ( this . onSelectChart , this ) ) ;
toolbar . mnuPageNumberPosPicker . on ( 'item:click' , _ . bind ( this . onInsertPageNumberClick , this ) ) ;
toolbar . btnEditHeader . menu . on ( 'item:click' , _ . bind ( this . onEditHeaderFooterClick , this ) ) ;
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 ) ) ;
2018-07-23 14:39:53 +00:00
toolbar . mnuNoControlsColor . on ( 'click' , _ . bind ( this . onNoControlsColor , this ) ) ;
toolbar . mnuControlsColorPicker . on ( 'select' , _ . bind ( this . onSelectControlsColor , this ) ) ;
$ ( '#id-toolbar-menu-new-control-color' ) . on ( 'click' , _ . bind ( this . onNewControlsColor , this ) ) ;
2016-03-11 00:48:53 +00:00
$ ( '#id-save-style-plus, #id-save-style-link' , toolbar . $el ) . on ( 'click' , this . onMenuSaveStyle . bind ( this ) ) ;
this . onSetupCopyStyleButton ( ) ;
} ,
setApi : function ( api ) {
this . api = api ;
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 ) ) ;
2018-10-25 13:19:29 +00:00
this . api . asc _registerCallback ( 'asc_onCoAuthoringDisconnect' , _ . bind ( this . onApiCoAuthoringDisconnect , this ) ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . on ( 'api:disconnect' , _ . bind ( this . onApiCoAuthoringDisconnect , this ) ) ;
this . api . asc _registerCallback ( 'asc_onCanCopyCut' , _ . bind ( this . onApiCanCopyCut , this ) ) ;
this . api . asc _registerCallback ( 'asc_onMathTypes' , _ . bind ( this . onMathTypes , this ) ) ;
this . api . asc _registerCallback ( 'asc_onColumnsProps' , _ . bind ( this . onColumnsProps , this ) ) ;
this . api . asc _registerCallback ( 'asc_onSectionProps' , _ . bind ( this . onSectionProps , this ) ) ;
2017-04-24 14:35:00 +00:00
this . api . asc _registerCallback ( 'asc_onContextMenu' , _ . bind ( this . onContextMenu , this ) ) ;
2018-02-26 14:38:35 +00:00
this . api . asc _registerCallback ( 'asc_onShowParaMarks' , _ . bind ( this . onShowParaMarks , this ) ) ;
2018-08-08 13:51:02 +00:00
this . api . asc _registerCallback ( 'asc_onChangeSdtGlobalSettings' , _ . bind ( this . onChangeSdtGlobalSettings , 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 ) ;
}
} ,
2017-04-24 14:35:00 +00:00
onContextMenu : function ( ) {
2017-07-10 15:32:33 +00:00
this . toolbar . collapse ( ) ;
2017-04-24 14:35:00 +00:00
} ,
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 ) {
this . toolbar . btnSuperscript . toggle ( typeBaseline == 1 , true ) ;
this . toolbar . btnSubscript . toggle ( typeBaseline == 2 , true ) ;
this . _state . valign = typeBaseline ;
}
} ,
onApiCanRevert : function ( which , can ) {
if ( which == 'undo' ) {
if ( this . _state . can _undo !== can ) {
this . toolbar . btnUndo . setDisabled ( ! can ) ;
this . _state . can _undo = can ;
}
} else {
if ( this . _state . can _redo !== can ) {
this . toolbar . btnRedo . setDisabled ( ! can ) ;
this . _state . can _redo = can ;
}
}
} ,
onApiCanCopyCut : function ( can ) {
if ( this . _state . can _copycut !== can ) {
this . toolbar . btnCopy . setDisabled ( ! can ) ;
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 ) ;
this . toolbar . mnuMarkersPicker . selectByIndex ( this . _state . bullets . subtype , true ) ;
break ;
case 1 :
var idx = 0 ;
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 ;
}
this . toolbar . btnNumbers . toggle ( true , true ) ;
this . toolbar . mnuNumbersPicker . selectByIndex ( idx , true ) ;
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 ( ! ( index < 0 ) ) {
this . toolbar . btnHorizontalAlign . menu . items [ index ] . setChecked ( true ) ;
} else if ( index == - 255 ) {
2017-11-13 08:41:32 +00:00
this . toolbar . btnHorizontalAlign . menu . clearAll ( ) ;
2016-03-11 00:48:53 +00:00
}
var btnHorizontalAlign = this . toolbar . btnHorizontalAlign ;
2018-02-24 22:19:36 +00:00
if ( btnHorizontalAlign . rendered && btnHorizontalAlign . $icon ) {
btnHorizontalAlign . $icon . removeClass ( btnHorizontalAlign . options . icls ) . addClass ( align ) ;
btnHorizontalAlign . options . icls = align ;
2016-03-11 00:48:53 +00:00
}
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 ;
2017-09-27 11:35:12 +00:00
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 ) ;
} ,
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 ,
2016-12-16 11:33:38 +00:00
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 ,
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 ,
in _control = false ;
2016-03-11 00:48:53 +00:00
while ( ++ i < selectedObjects . length ) {
type = selectedObjects [ i ] . get _ObjectType ( ) ;
pr = selectedObjects [ i ] . get _ObjectValue ( ) ;
2016-04-05 11:52:34 +00:00
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 ( ) ;
2016-04-05 11:52:34 +00:00
} else if ( type === Asc . c _oAscTypeSelectElement . Header ) {
2016-03-11 00:48:53 +00:00
header _locked = pr . get _Locked ( ) ;
in _header = true ;
2016-04-05 11:52:34 +00:00
} else if ( type === Asc . c _oAscTypeSelectElement . Image ) {
2017-09-01 07:03:11 +00:00
in _image = true ;
2016-12-16 11:33:38 +00:00
image _locked = pr . get _Locked ( ) ;
2016-03-11 00:48:53 +00:00
if ( pr && pr . get _ChartProperties ( ) )
in _chart = true ;
2016-04-05 11:52:34 +00:00
} else if ( type === Asc . c _oAscTypeSelectElement . Math ) {
2016-03-11 00:48:53 +00:00
in _equation = true ;
2016-04-05 11:52:34 +00:00
if ( Asc . c _oAscMathInterfaceType . Common === pr . get _Type ( ) )
2016-03-11 00:48:53 +00:00
btn _eq _state = true ;
}
2016-04-05 11:52:34 +00:00
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 ;
}
2016-04-05 11:52:34 +00:00
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 ) ;
var need _disable = paragraph _locked || header _locked ;
if ( this . _state . prcontrolsdisable != need _disable ) {
if ( this . _state . activated ) this . _state . prcontrolsdisable = need _disable ;
_ . each ( toolbar . paragraphControls , function ( item ) {
item . setDisabled ( need _disable ) ;
} , this ) ;
}
2017-12-13 13:52:14 +00:00
in _control = this . api . asc _IsContentControl ( ) ;
var control _props = in _control ? this . api . asc _GetContentControlProperties ( ) : null ,
2017-12-15 08:50:56 +00:00
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 ) ;
2017-12-13 13:52:14 +00:00
if ( ! paragraph _locked && ! header _locked ) {
2017-12-15 08:50:56 +00:00
toolbar . btnContentControls . menu . items [ 0 ] . setDisabled ( control _plain || lock _type == Asc . c _oAscSdtLockType . SdtContentLocked || lock _type == Asc . c _oAscSdtLockType . ContentLocked ) ;
toolbar . btnContentControls . menu . items [ 1 ] . setDisabled ( control _plain || lock _type == Asc . c _oAscSdtLockType . SdtContentLocked || lock _type == Asc . c _oAscSdtLockType . ContentLocked ) ;
toolbar . btnContentControls . menu . items [ 3 ] . setDisabled ( ! in _control || lock _type == Asc . c _oAscSdtLockType . SdtContentLocked || lock _type == Asc . c _oAscSdtLockType . SdtLocked ) ;
2017-12-13 13:52:14 +00:00
toolbar . btnContentControls . menu . items [ 5 ] . setDisabled ( ! in _control ) ;
}
2016-03-11 00:48:53 +00:00
var need _text _disable = paragraph _locked || header _locked || in _chart ;
if ( this . _state . textonlycontrolsdisable != need _text _disable ) {
if ( this . _state . activated ) this . _state . textonlycontrolsdisable = need _text _disable ;
if ( ! need _disable ) {
_ . each ( toolbar . textOnlyControls , function ( item ) {
item . setDisabled ( need _text _disable ) ;
} , this ) ;
}
toolbar . btnCopyStyle . setDisabled ( need _text _disable ) ;
toolbar . btnClearStyle . setDisabled ( need _text _disable ) ;
}
if ( enable _dropcap && frame _pr ) {
var value = frame _pr . get _FramePr ( ) ,
2016-04-05 11:52:34 +00:00
drop _value = Asc . c _oAscDropCap . None ;
2016-03-11 00:48:53 +00:00
if ( value !== undefined ) {
drop _value = value . get _DropCap ( ) ;
2016-04-05 11:52:34 +00:00
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 ) ;
}
2017-12-13 13:52:14 +00:00
need _disable = need _disable || ! enable _dropcap || in _equation || control _plain ;
2017-04-03 16:24:24 +00:00
toolbar . btnDropCap . setDisabled ( need _disable ) ;
2016-03-11 00:48:53 +00:00
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 ) ;
2017-12-13 13:52:14 +00:00
need _disable = ! can _add _table || header _locked || in _equation || control _plain ;
2017-04-03 16:24:24 +00:00
toolbar . btnInsertTable . setDisabled ( need _disable ) ;
2016-03-11 00:48:53 +00:00
2017-12-13 13:52:14 +00:00
need _disable = toolbar . mnuPageNumCurrentPos . isDisabled ( ) && toolbar . mnuPageNumberPosPicker . isDisabled ( ) || control _plain ;
2017-04-03 16:24:24 +00:00
toolbar . mnuInsertPageNum . setDisabled ( need _disable ) ;
2016-03-11 00:48:53 +00:00
2018-02-07 11:51:19 +00:00
var in _footnote = this . api . asc _IsCursorInFootnote ( ) ;
need _disable = paragraph _locked || header _locked || in _header || in _image || in _equation && ! btn _eq _state || in _footnote || in _control ;
2018-02-13 14:37:22 +00:00
toolbar . btnsPageBreak . setDisabled ( need _disable ) ;
2018-11-20 09:57:29 +00:00
toolbar . btnBlankPage . setDisabled ( need _disable ) ;
2016-03-11 00:48:53 +00:00
2018-07-30 09:12:38 +00:00
need _disable = paragraph _locked || header _locked || in _equation || control _plain ;
2017-04-03 16:24:24 +00:00
toolbar . btnInsertShape . setDisabled ( need _disable ) ;
toolbar . btnInsertText . setDisabled ( need _disable ) ;
2018-07-30 09:12:38 +00:00
need _disable = paragraph _locked || header _locked || ! can _add _image || in _equation || control _plain ;
toolbar . btnInsertImage . setDisabled ( need _disable ) ;
2018-02-07 11:51:19 +00:00
toolbar . btnInsertTextArt . setDisabled ( need _disable || in _image || in _footnote ) ;
2016-12-16 11:33:38 +00:00
2016-12-27 09:34:08 +00:00
if ( in _chart !== this . _state . in _chart ) {
toolbar . btnInsertChart . updateHint ( in _chart ? toolbar . tipChangeChart : toolbar . tipInsertChart ) ;
this . _state . in _chart = in _chart ;
}
2017-12-13 13:52:14 +00:00
need _disable = in _chart && image _locked || ! in _chart && need _disable || control _plain ;
2017-04-03 16:24:24 +00:00
toolbar . btnInsertChart . setDisabled ( need _disable ) ;
2016-03-11 00:48:53 +00:00
2017-12-13 13:52:14 +00:00
need _disable = paragraph _locked || header _locked || in _chart || ! can _add _image && ! in _equation || control _plain ;
2017-04-03 16:24:24 +00:00
toolbar . btnInsertEquation . setDisabled ( need _disable ) ;
2016-03-11 00:48:53 +00:00
need _disable = paragraph _locked || header _locked || in _equation ;
2017-04-03 16:24:24 +00:00
toolbar . btnSuperscript . setDisabled ( need _disable ) ;
toolbar . btnSubscript . setDisabled ( need _disable ) ;
2016-03-11 00:48:53 +00:00
2017-04-03 16:24:24 +00:00
toolbar . btnEditHeader . setDisabled ( in _equation ) ;
2016-03-11 00:48:53 +00:00
2017-12-13 13:52:14 +00:00
need _disable = paragraph _locked || header _locked || in _image || control _plain ;
2017-06-20 10:11:31 +00:00
if ( need _disable != toolbar . btnColumns . isDisabled ( ) )
toolbar . btnColumns . setDisabled ( need _disable ) ;
2016-03-11 00:48:53 +00:00
if ( toolbar . listStylesAdditionalMenuItem && ( frame _pr === undefined ) !== toolbar . listStylesAdditionalMenuItem . isDisabled ( ) )
toolbar . listStylesAdditionalMenuItem . setDisabled ( frame _pr === undefined ) ;
2017-06-29 12:06:31 +00:00
need _disable = ( paragraph _locked || header _locked ) && this . api . can _AddQuotedComment ( ) || image _locked ;
2018-02-13 14:37:22 +00:00
if ( this . btnsComment && this . btnsComment . length > 0 )
this . btnsComment . setDisabled ( need _disable ) ;
2017-06-28 11:20:49 +00:00
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 ;
} ,
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
} ) ;
2017-04-12 10:00:17 +00:00
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 ) {
2016-07-04 13:04:05 +00:00
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 ) {
this . toolbar . btnPageOrient . setDisabled ( true ) ;
this . toolbar . btnPageSize . setDisabled ( true ) ;
if ( this . _state . activated ) this . _state . lock _doc = true ;
}
} ,
onApiUnLockDocumentProps : function ( ) {
if ( this . _state . lock _doc !== false ) {
this . toolbar . btnPageOrient . setDisabled ( false ) ;
this . toolbar . btnPageSize . setDisabled ( false ) ;
if ( this . _state . activated ) this . _state . lock _doc = false ;
}
} ,
onApiLockDocumentSchema : function ( ) {
this . toolbar . btnColorSchemas . setDisabled ( true ) ;
} ,
onApiUnLockDocumentSchema : function ( ) {
this . toolbar . btnColorSchemas . setDisabled ( false ) ;
} ,
onApiLockHeaderFooters : function ( ) {
this . toolbar . mnuPageNumberPosPicker . setDisabled ( true ) ;
this . toolbar . mnuInsertPageNum . setDisabled ( this . toolbar . mnuPageNumCurrentPos . isDisabled ( ) ) ;
} ,
onApiUnLockHeaderFooters : function ( ) {
this . toolbar . mnuPageNumberPosPicker . setDisabled ( false ) ;
this . toolbar . mnuInsertPageNum . setDisabled ( false ) ;
} ,
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 . cmpEl ) {
this . _state . clrhighlight = - 1 ;
this . toolbar . mnuHighlightColorPicker . select ( null , true ) ;
}
}
} 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 ( _ . contains ( this . toolbar . mnuHighlightColorPicker . colors , this . _state . clrhighlight ) )
this . toolbar . mnuHighlightColorPicker . select ( this . _state . clrhighlight , true ) ;
}
} else {
if ( this . _state . clrhighlight !== c ) {
this . toolbar . mnuHighlightTransparent . setChecked ( false , true ) ;
this . toolbar . mnuHighlightColorPicker . select ( null , true ) ;
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 ( ) ;
this . toolbar . mnuNoControlsColor . setChecked ( ! show , true ) ;
this . toolbar . mnuControlsColorPicker . clearSelection ( ) ;
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 ( ) ) ;
2018-08-08 13:51:02 +00:00
this . toolbar . mnuControlsColorPicker . selectByRGB ( clr , true ) ;
}
}
} ,
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 ) {
if ( this . api )
this . api . asc _Print ( Common . Utils . isChrome || Common . Utils . isSafari || Common . Utils . isOpera ) ; // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'Print' ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Print' ) ;
} ,
onSave : function ( e ) {
2017-09-05 07:54:44 +00:00
var toolbar = this . toolbar ;
2016-03-11 00:48:53 +00:00
if ( this . api ) {
var isModified = this . api . asc _isDocumentCanSave ( ) ;
2018-10-09 13:15:26 +00:00
var isSyncButton = toolbar . btnCollabChanges && toolbar . btnCollabChanges . $icon . hasClass ( 'btn-synch' ) ;
2017-09-05 07:54:44 +00:00
if ( ! isModified && ! isSyncButton && ! toolbar . mode . forcesave )
2016-03-11 00:48:53 +00:00
return ;
this . api . asc _Save ( ) ;
}
2018-02-15 23:56:17 +00:00
toolbar . btnSave . setDisabled ( ! toolbar . mode . forcesave ) ;
2016-03-11 00:48:53 +00:00
2017-09-05 07:54:44 +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' ) ;
} ,
2018-02-15 23:56:17 +00:00
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 ( copy , e ) {
var me = this ;
if ( me . api ) {
2016-07-26 14:46:42 +00:00
var res = ( copy ) ? me . api . Copy ( ) : me . api . Paste ( ) ;
if ( ! res ) {
2017-04-19 11:22:31 +00:00
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 ( ) ;
}
2016-07-26 14:46:42 +00:00
} else
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Copy Warning' ) ;
2016-03-11 00:48:53 +00:00
}
2016-07-26 14:46:42 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
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 )
this . api . put _TextPrBaseline ( btn . pressed ? 1 : 0 ) ;
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 )
this . api . put _TextPrBaseline ( btn . pressed ? 2 : 0 ) ;
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 ;
if ( this . api )
this . api . put _PrAlign ( type ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Align' ) ;
} ,
onMenuHorizontalAlignSelect : function ( menu , item ) {
this . _state . pralign = undefined ;
2018-02-24 22:19:36 +00:00
var btnHorizontalAlign = this . toolbar . btnHorizontalAlign ;
2016-03-11 00:48:53 +00:00
2018-02-24 22:19:36 +00:00
btnHorizontalAlign . $icon . removeClass ( btnHorizontalAlign . options . icls ) ;
btnHorizontalAlign . options . icls = ! item . checked ? 'btn-align-left' : item . options . icls ;
btnHorizontalAlign . $icon . addClass ( btnHorizontalAlign . options . icls ) ;
2016-03-11 00:48:53 +00:00
if ( this . api && item . checked )
this . api . put _PrAlign ( item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Horizontal 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 ) {
2018-11-12 12:20:16 +00:00
! this . getApplication ( ) . getController ( 'Main' ) . isModalShowed &&
2016-03-11 00:48:53 +00:00
Common . UI . warning ( {
width : 500 ,
closable : false ,
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 ) {
value = /^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/ . exec ( record . value ) ;
if ( ! value ) {
value = this . _getApiTextSize ( ) ;
Common . UI . warning ( {
msg : this . textFontSizeErr ,
callback : function ( ) {
_ . defer ( function ( btn ) {
$ ( 'input' , combo . cmpEl ) . focus ( ) ;
} )
}
} ) ;
combo . setRawValue ( value ) ;
e . preventDefault ( ) ;
return false ;
}
}
} else {
value = parseFloat ( record . value ) ;
value = value > 100
? 100
: 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 ) ;
}
} ,
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 ) ;
}
this . _state . bullets . type = rawData . data . type ;
this . _state . bullets . subtype = rawData . data . subtype ;
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 ) ;
} ,
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' ) ;
} ,
onInsertTableClick : function ( menu , item , e ) {
if ( item . value === 'custom' ) {
var me = this ;
( 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' ) ;
}
2017-08-23 08:02:04 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
2016-03-11 00:48:53 +00:00
}
} ) ) . show ( ) ;
}
} ,
onInsertImageClick : function ( menu , item , e ) {
var me = this ;
if ( item . value === 'file' ) {
this . toolbar . fireEvent ( 'insertimage' , this . toolbar ) ;
if ( this . api )
this . api . asc _addImage ( ) ;
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 ) ;
me . api . AddImageUrl ( checkUrl ) ;
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' ) {
( new Common . Views . SelectFileDlg ( {
fileChoiceUrl : this . toolbar . mode . fileChoiceUrl . replace ( "{fileExt}" , "" ) . replace ( "{documentType}" , "ImagesOnly" )
} ) ) . on ( 'selectfile' , function ( obj , file ) {
me . toolbar . fireEvent ( 'insertimage' , me . toolbar ) ;
me . api . AddImageUrl ( file . url ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Image' ) ;
} ) . show ( ) ;
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 ) ;
} ,
2016-07-04 13:04:05 +00:00
onPageOrientSelect : function ( menu , item ) {
2016-03-11 00:48:53 +00:00
this . _state . pgorient = undefined ;
2016-07-04 13:04:05 +00:00
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' )
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 ( {
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' ) {
var section = this . api . asc _GetSectionProps ( ) ,
errmsg = null ,
me = this ;
if ( item . value [ 1 ] + item . value [ 3 ] > parseFloat ( section . get _W ( ) . toFixed ( 4 ) ) - 12.7 )
errmsg = this . txtMarginsW ;
else if ( item . value [ 0 ] + item . value [ 2 ] > parseFloat ( section . get _H ( ) . toFixed ( 4 ) ) - 2.6 )
errmsg = this . txtMarginsH ;
if ( errmsg ) {
Common . UI . warning ( {
title : this . notcriticalErrorTitle ,
msg : errmsg ,
callback : function ( ) {
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
}
} ) ;
this . onSectionProps ( section ) ;
return ;
} else {
2016-05-06 15:20:32 +00:00
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 ( {
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 ) ;
} ,
onColorSchemaClick : function ( menu , item ) {
if ( this . api ) {
this . api . ChangeColorScheme ( item . value ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Color Scheme' ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
onDropCapSelect : function ( menu , item ) {
if ( _ . isUndefined ( item . value ) )
return ;
this . _state . dropcap = undefined ;
if ( this . api && item . checked ) {
2016-04-05 11:52:34 +00:00
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 ) {
2016-04-05 11:52:34 +00:00
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 {
2016-04-05 11:52:34 +00:00
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 ) {
2016-04-05 11:52:34 +00:00
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 ;
} ,
onDropCapAdvancedClick : function ( ) {
var win , props , text ,
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 ) ;
}
if ( me . api ) {
var selectedElements = me . api . getSelectedElements ( ) ,
selectedElementsLenght = selectedElements . length ;
if ( selectedElements && _ . isArray ( selectedElements ) ) {
for ( var i = 0 ; i < selectedElementsLenght ; i ++ ) {
2016-04-05 11:52:34 +00:00
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 ,
fontStore : me . fontstore ,
paragraphProps : props ,
borderProps : me . borderAdvancedProps ,
api : me . api ,
isFrame : false ,
handler : function ( result , value ) {
if ( result == 'ok' ) {
me . borderAdvancedProps = value . borderProps ;
2016-04-05 11:52:34 +00:00
if ( value . paragraphProps && value . paragraphProps . get _DropCap ( ) === Asc . c _oAscDropCap . None ) {
2016-03-11 00:48:53 +00:00
me . api . removeDropcap ( true ) ;
} 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 ( 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 ,
2018-08-28 14:37:45 +00:00
api : me . api ,
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 {
this . api . asc _AddContentControl ( item . value ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Content Control' ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
2016-03-11 00:48:53 +00:00
2018-07-23 14:39: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 ) ;
2018-07-23 14:39:53 +00:00
} ,
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 ( ) ) ;
2018-07-23 14:39:53 +00:00
}
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' ) {
var win , props = this . api . asc _GetSectionProps ( ) ,
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 ;
}
} ,
onSelectChart : function ( picker , item , record ) {
2017-10-24 12:59:18 +00:00
if ( ! record ) return ;
2016-03-11 00:48:53 +00:00
var me = this ,
2016-12-16 11:33:38 +00:00
type = record . get ( 'type' ) ,
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 props = new Asc . asc _CImgProperty ( ) ;
chart . changeType ( type ) ;
props . put _ChartProperties ( chart ) ;
this . api . ImgApply ( props ) ;
2016-03-11 00:48:53 +00:00
2016-12-16 11:33:38 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} else {
if ( ! this . diagramEditor )
this . diagramEditor = this . getApplication ( ) . getController ( 'Common.Controllers.ExternalDiagramEditor' ) . getView ( 'Common.Views.ExternalDiagramEditor' ) ;
2016-03-11 00:48:53 +00:00
2016-12-16 11:33:38 +00:00
if ( this . diagramEditor && me . api ) {
this . diagramEditor . setEditMode ( false ) ;
this . diagramEditor . show ( ) ;
2016-03-11 00:48:53 +00:00
2016-12-16 11:33:38 +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
}
}
} ,
onInsertPageNumberClick : function ( picker , item , record ) {
if ( this . api )
this . api . put _PageNum ( record . get ( 'data' ) . type , record . get ( 'data' ) . subtype ) ;
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 ( ) ) ;
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' ) ;
} ,
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 ) ;
2018-05-07 08:13:41 +00:00
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 ( )
}
2018-05-07 08:13:41 +00:00
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 ++ ) {
2016-04-05 11:52:34 +00:00
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' ) ;
2017-04-12 10:00:17 +00:00
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 ) ;
} ;
2017-06-23 13:46:10 +00:00
var formats = [ ] ,
mainController = me . getApplication ( ) . getController ( 'Main' ) ;
2016-03-11 00:48:53 +00:00
_ . each ( window . styles . get _MergedStyles ( ) , function ( style ) {
2017-06-23 13:46:10 +00:00
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 ) ;
}
} ,
2017-04-10 13:40:48 +00:00
// onHideTitleBar: function(item, checked) {
// var headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header');
// headerView && headerView.setVisible(!checked);
//
// Common.localStorage.setItem('de-hidden-title', checked ? 1 : 0);
//
// Common.NotificationCenter.trigger('layout:changed', 'header');
// Common.NotificationCenter.trigger('edit:complete', this.toolbar);
// },
2016-03-11 00:48:53 +00:00
_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 ) ;
} ,
_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 ;
} ,
onNewFontColor : function ( picker , color ) {
this . toolbar . mnuFontColorPicker . addNewColor ( ) ;
} ,
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 } ;
$ ( '.btn-color-value-line' , this . toolbar . btnFontColor . cmpEl ) . css ( 'background-color' , '#000' ) ;
this . toolbar . mnuFontColorPicker . clearSelection ( ) ;
this . toolbar . mnuFontColorPicker . currentColor = { color : color , isAuto : true } ;
} ,
onNewParagraphColor : function ( picker , color ) {
this . toolbar . mnuParagraphColorPicker . addNewColor ( ) ;
} ,
onSelectHighlightColor : function ( picker , color ) {
this . _setMarkerColor ( color , 'menu' ) ;
} ,
onSelectFontColor : function ( picker , color ) {
this . _state . clrtext = this . _state . clrtext _asccolor = undefined ;
var clr = ( typeof ( color ) == 'object' ) ? ( color . isAuto ? '#000' : color . color ) : color ;
this . toolbar . btnFontColor . currentColor = color ;
$ ( '.btn-color-value-line' , this . toolbar . btnFontColor . cmpEl ) . css ( 'background-color' , '#' + clr ) ;
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' ) ;
} ,
onParagraphColorPickerSelect : function ( picker , color ) {
this . _state . clrback = this . _state . clrshd _asccolor = undefined ;
var clr = ( typeof ( color ) == 'object' ) ? color . color : color ;
this . toolbar . btnParagraphColor . currentColor = color ;
$ ( '.btn-color-value-line' , this . toolbar . btnParagraphColor . cmpEl ) . css ( 'background-color' , color != 'transparent' ? '#' + clr : clr ) ;
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' ) ;
item . setChecked ( true , true ) ;
this . toolbar . btnHighlightColor . currentColor = 'transparent' ;
$ ( '.btn-color-value-line' , this . toolbar . btnHighlightColor . cmpEl ) . css ( 'background-color' , 'transparent' ) ;
} ,
onParagraphColor : function ( shd ) {
var picker = this . toolbar . mnuParagraphColorPicker , clr ;
2016-04-05 16:18:57 +00:00
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 ) {
2016-04-05 11:52:34 +00:00
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' ) {
this . toolbar . mnuFontColorPicker . clearSelection ( ) ;
var clr _item = this . toolbar . btnFontColor . menu . $el . find ( '#id-toolbar-menu-auto-fontcolor > a' ) ;
! clr _item . hasClass ( 'selected' ) && clr _item . addClass ( 'selected' ) ;
this . _state . clrtext = 'auto' ;
}
} else {
var picker = this . toolbar . mnuFontColorPicker , clr ;
if ( color ) {
2016-04-05 11:52:34 +00:00
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 ) ) {
var clr _item = this . toolbar . btnFontColor . menu . $el . find ( '#id-toolbar-menu-auto-fontcolor > a' ) ;
clr _item . hasClass ( 'selected' ) && clr _item . removeClass ( 'selected' ) ;
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 ;
} ,
fillAutoShapes : function ( ) {
var me = this ,
shapesStore = this . getApplication ( ) . getCollection ( 'ShapeGroups' ) ;
for ( var i = 0 ; i < shapesStore . length ; i ++ ) {
var shapeGroup = shapesStore . at ( i ) ;
var menuItem = new Common . UI . MenuItem ( {
caption : shapeGroup . get ( 'groupName' ) ,
menu : new Common . UI . Menu ( {
menuAlign : 'tl-tr' ,
items : [
{ template : _ . template ( '<div id="id-toolbar-menu-shapegroup' + i + '" class="menu-shape" style="width: ' + ( shapeGroup . get ( 'groupWidth' ) - 8 ) + 'px; margin-left: 5px;"></div>' ) }
]
} )
} ) ;
me . toolbar . btnInsertShape . menu . addItem ( menuItem ) ;
var shapePicker = new Common . UI . DataView ( {
el : $ ( '#id-toolbar-menu-shapegroup' + i ) ,
store : shapeGroup . get ( 'groupStore' ) ,
parentMenu : menuItem . menu ,
showLast : false ,
itemTemplate : _ . template ( '<div class="item-shape"><img src="<%= imageUrl %>" id="<%= id %>"></div>' )
} ) ;
shapePicker . on ( 'item:click' , function ( picker , item , record , e ) {
if ( me . api ) {
2017-10-24 12:59:18 +00:00
if ( record ) {
me . _addAutoshape ( true , record . get ( 'data' ) . shapeType ) ;
me . _isAddingShape = true ;
}
2016-03-11 00:48:53 +00:00
if ( me . toolbar . btnInsertText . pressed ) {
me . toolbar . btnInsertText . toggle ( false , true ) ;
}
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' ) ;
}
} ) ;
}
} ,
fillEquations : function ( ) {
2016-10-24 10:58:34 +00:00
if ( ! this . toolbar . btnInsertEquation . rendered || this . toolbar . btnInsertEquation . menu . items . length > 0 ) return ;
2016-08-23 08:50:19 +00:00
2016-03-11 00:48:53 +00:00
var me = this , equationsStore = this . getApplication ( ) . getCollection ( 'EquationGroups' ) ;
me . equationPickers = [ ] ;
2016-08-23 11:36:55 +00:00
me . toolbar . btnInsertEquation . menu . removeAll ( ) ;
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 ) ;
var equationPicker = new Common . UI . DataView ( {
el : $ ( '#id-toolbar-menu-equationgroup' + i ) ,
store : equationGroup . get ( 'groupStore' ) ,
parentMenu : menuItem . menu ,
showLast : false ,
itemTemplate : _ . template ( '<div class="item-equation" ' +
'style="background-position:<%= posX %>px <%= posY %>px;" >' +
'<div style="width:<%= width %>px;height:<%= height %>px;" id="<%= id %>">' )
} ) ;
if ( equationGroup . get ( 'groupHeight' ) . length ) {
me . equationPickers . push ( equationPicker ) ;
me . toolbar . btnInsertEquation . menu . on ( 'show:after' , function ( ) {
if ( me . equationPickers . length ) {
var element = $ ( this . el ) . find ( '.over' ) . find ( '.menu-shape' ) ;
if ( element . length ) {
for ( var i = 0 ; i < me . equationPickers . length ; ++ i ) {
if ( element [ 0 ] . id == me . equationPickers [ i ] . el . id ) {
me . equationPickers [ i ] . scroller . update ( { alwaysVisibleY : true } ) ;
me . equationPickers . splice ( i , 1 ) ;
return ;
}
}
}
}
} ) ;
}
equationPicker . on ( 'item:click' , function ( picker , item , record , e ) {
if ( me . api ) {
2017-10-24 12:59:18 +00:00
if ( record )
me . api . asc _AddMath ( record . get ( 'data' ) . equationType ) ;
2016-03-11 00:48:53 +00:00
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' ) ;
}
} ) ;
}
} ,
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 ) ;
} ,
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
}
}
var i , id = 0 , count = 0 , length = 0 , width = 0 , height = 0 , store = null , list = null , eqStore = null , eq = null ;
if ( equation ) {
count = equation . get _Data ( ) . length ;
if ( count ) {
for ( var j = 0 ; j < count ; ++ j ) {
id = equation . get _Data ( ) [ j ] . get _Id ( ) ;
width = equation . get _Data ( ) [ j ] . get _W ( ) ;
height = equation . get _Data ( ) [ j ] . get _H ( ) ;
store = new Backbone . Collection ( [ ] , {
model : DE . Models . EquationModel
} ) ;
if ( store ) {
var allItemsCount = 0 , itemsCount = 0 , ids = 0 ;
length = equation . get _Data ( ) [ j ] . get _Data ( ) . length ;
for ( i = 0 ; i < length ; ++ i ) {
eqStore = equation . get _Data ( ) [ j ] . get _Data ( ) [ i ] ;
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 ] ;
}
store . add ( {
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 ;
}
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 ( ) ;
}
}
} ,
fillTextArt : function ( ) {
2017-06-26 13:11:50 +00:00
if ( ! this . toolbar . btnInsertTextArt . rendered ) return ;
2016-03-11 00:48:53 +00:00
2016-08-23 08:50:19 +00:00
var me = this ;
2016-03-11 00:48:53 +00:00
if ( this . toolbar . mnuTextArtPicker ) {
var models = this . getApplication ( ) . getCollection ( 'Common.Collections.TextArt' ) . models ,
count = this . toolbar . mnuTextArtPicker . store . length ;
if ( count > 0 && count == models . length ) {
var data = this . toolbar . mnuTextArtPicker . store . models ;
_ . each ( models , function ( template , index ) {
data [ index ] . set ( 'imageUrl' , template . get ( 'imageUrl' ) ) ;
} ) ;
} else {
this . toolbar . mnuTextArtPicker . store . reset ( models ) ;
}
} else {
this . toolbar . mnuTextArtPicker = new Common . UI . DataView ( {
el : $ ( '#id-toolbar-menu-insart' ) ,
store : this . getApplication ( ) . getCollection ( 'Common.Collections.TextArt' ) ,
2017-06-26 13:11:50 +00:00
parentMenu : this . toolbar . btnInsertTextArt . menu ,
2016-03-11 00:48:53 +00:00
showLast : false ,
2017-04-07 09:38:58 +00:00
itemTemplate : _ . template ( '<div class="item-art"><img src="<%= imageUrl %>" id="<%= id %>" style="width:50px;height:50px;"></div>' )
2016-03-11 00:48:53 +00:00
} ) ;
this . toolbar . mnuTextArtPicker . on ( 'item:click' , function ( picker , item , record , e ) {
if ( me . api ) {
2017-10-24 12:59:18 +00:00
if ( record ) {
me . toolbar . fireEvent ( 'inserttextart' , me . toolbar ) ;
me . api . AddTextArt ( record . get ( 'data' ) ) ;
}
2016-03-11 00:48:53 +00:00
if ( me . toolbar . btnInsertShape . pressed )
me . toolbar . btnInsertShape . toggle ( false , true ) ;
if ( e . type !== 'click' )
2017-06-26 13:11:50 +00:00
me . toolbar . btnInsertTextArt . menu . hide ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar , me . toolbar . btnInsertTextArt ) ;
2016-03-11 00:48:53 +00:00
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Text Art' ) ;
}
} ) ;
}
} ,
activateControls : function ( ) {
_ . each ( this . toolbar . toolbarControls , function ( item ) {
item . setDisabled ( false ) ;
} , this ) ;
this . toolbar . btnUndo . setDisabled ( this . _state . can _undo !== true ) ;
this . toolbar . btnRedo . setDisabled ( this . _state . can _redo !== true ) ;
this . toolbar . btnCopy . setDisabled ( this . _state . can _copycut !== true ) ;
this . toolbar . btnPrint . setDisabled ( ! this . toolbar . mode . canPrint ) ;
if ( this . toolbar . mode . fileChoiceUrl )
this . toolbar . btnMailRecepients . setDisabled ( false ) ;
this . _state . activated = true ;
var props = this . api . asc _GetSectionProps ( ) ;
this . onApiPageSize ( props . get _W ( ) , props . get _H ( ) ) ;
} ,
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 ;
$ ( '.btn-color-value-line' , this . toolbar . btnFontColor . cmpEl ) . css ( 'background-color' , '#' + this . toolbar . btnFontColor . currentColor ) ;
}
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 ;
$ ( '.btn-color-value-line' , this . toolbar . btnParagraphColor . cmpEl ) . css ( 'background-color' , '#' + this . toolbar . btnParagraphColor . currentColor ) ;
if ( this . _state . clrshd _asccolor !== undefined ) {
this . _state . clrback = undefined ;
this . onParagraphColor ( this . _state . clrshd _asccolor ) ;
}
this . _state . clrshd _asccolor = undefined ;
2018-07-23 14:39:53 +00:00
updateColors ( this . toolbar . mnuControlsColorPicker , 1 ) ;
2018-08-09 09:26:50 +00:00
this . onChangeSdtGlobalSettings ( ) ;
2016-03-11 00:48:53 +00:00
} ,
_onInitEditorStyles : function ( styles ) {
window . styles _loaded = false ;
var self = this ,
listStyles = self . toolbar . listStyles ;
window . styles = styles ;
if ( ! listStyles ) {
self . styles = styles ;
return ;
}
listStyles . menuPicker . store . reset ( [ ] ) ; // remove all
2017-06-23 13:46:10 +00:00
var mainController = this . getApplication ( ) . getController ( 'Main' ) ;
2016-03-11 00:48:53 +00:00
_ . each ( styles . get _MergedStyles ( ) , function ( style ) {
listStyles . menuPicker . store . add ( {
imageUrl : style . asc _getImage ( ) ,
title : style . get _Name ( ) ,
2017-06-23 13:46:10 +00:00
tip : mainController . translationTable [ style . get _Name ( ) ] || style . get _Name ( ) ,
2016-03-11 00:48:53 +00:00
id : Common . UI . getId ( )
} ) ;
} ) ;
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 ) ;
2017-04-12 10:00:17 +00:00
} 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' ) {
me . toolbar . mnuHighlightTransparent . setChecked ( false ) ;
me . toolbar . btnHighlightColor . currentColor = strcolor ;
$ ( '.btn-color-value-line' , me . toolbar . btnHighlightColor . cmpEl ) . css ( 'background-color' , '#' + strcolor ) ;
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' ) ;
} ,
2016-07-08 09:12:09 +00:00
onHideMenus : function ( e ) {
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
2016-03-11 00:48:53 +00:00
onSetupCopyStyleButton : function ( ) {
this . modeAlwaysSetStyle = false ;
var acsCopyFmtStyleState = {
kOff : 0 ,
kOn : 1 ,
kMultiple : 2
} ;
var me = this ;
Common . NotificationCenter . on ( {
'edit:complete' : function ( ) {
if ( me . api && me . modeAlwaysSetStyle ) {
me . api . SetPaintFormat ( acsCopyFmtStyleState . kOff ) ;
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 ) ;
me . api . SetPaintFormat ( acsCopyFmtStyleState . kMultiple ) ;
}
} ) ;
} ,
2018-10-25 13:19:29 +00:00
onApiCoAuthoringDisconnect : function ( enableDownload ) {
this . toolbar . setMode ( { isDisconnected : true , enableDownload : ! ! enableDownload } ) ;
2016-03-11 00:48:53 +00:00
this . editMode = false ;
2017-11-22 12:20:51 +00:00
this . DisableToolbar ( true , true ) ;
2016-03-11 00:48:53 +00:00
} ,
2017-08-23 14:49:56 +00:00
DisableToolbar : function ( disable , viewMode , reviewmode ) {
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 ? 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 ;
if ( disable ) {
2017-08-23 14:49:56 +00:00
if ( reviewmode ) {
mask = $ ( "<div class='toolbar-group-mask'>" ) . appendTo ( toolbar . $el . find ( '.toolbar section.panel .group:not(.no-mask):not(.no-group-mask)' ) ) ;
} else
mask = $ ( "<div class='toolbar-mask'>" ) . appendTo ( toolbar . $el . find ( '.toolbar' ) ) ;
2016-03-11 00:48:53 +00:00
} else {
mask . remove ( ) ;
}
2017-08-23 14:49:56 +00:00
$ ( '.no-group-mask' ) . css ( 'opacity' , ( reviewmode || ! disable ) ? 1 : 0.4 ) ;
disable = disable || ( reviewmode ? toolbar _mask . length > 0 : group _mask . length > 0 ) ;
toolbar . $el . find ( '.toolbar' ) . toggleClass ( 'masked' , disable ) ;
2017-04-21 13:36:06 +00:00
if ( toolbar . synchTooltip )
toolbar . synchTooltip . hide ( ) ;
2017-09-01 14:48:31 +00:00
toolbar . _state . previewmode = reviewmode && disable ;
if ( reviewmode ) {
2018-12-18 14:27:19 +00:00
toolbar . _state . previewmode && toolbar . btnSave && toolbar . btnSave . setDisabled ( true ) ;
2017-09-05 07:54:44 +00:00
2017-09-01 14:48:31 +00:00
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 ( ) {
if ( this . _mailMergeDlg ) return ;
var me = this ;
2018-10-03 11:00:08 +00:00
me . _mailMergeDlg = new Common . Views . SelectFileDlg ( {
fileChoiceUrl : this . toolbar . mode . fileChoiceUrl . replace ( "{fileExt}" , "xlsx" ) . replace ( "{documentType}" , "" )
2016-03-11 00:48:53 +00:00
} ) ;
2018-10-03 11:00:08 +00:00
me . _mailMergeDlg . on ( 'selectfile' , function ( obj , recepients ) {
2016-03-11 00:48:53 +00:00
me . api . asc _StartMailMerge ( recepients ) ;
if ( ! me . mergeEditor )
me . mergeEditor = me . getApplication ( ) . getController ( 'Common.Controllers.ExternalMergeEditor' ) . getView ( 'Common.Views.ExternalMergeEditor' ) ;
if ( me . mergeEditor )
me . mergeEditor . setEditMode ( false ) ;
} ) . on ( 'close' , function ( obj ) {
me . _mailMergeDlg = undefined ;
} ) ;
me . _mailMergeDlg . show ( ) ;
} ,
2016-08-04 17:02:57 +00:00
createDelayedElements : function ( ) {
this . toolbar . createDelayedElements ( ) ;
2017-04-24 11:41:51 +00:00
this . attachUIEvents ( this . toolbar ) ;
2016-08-04 17:02:57 +00:00
} ,
2017-04-04 15:22:02 +00:00
onAppShowed : function ( config ) {
var me = this ;
2017-04-10 13:39:03 +00:00
2017-04-20 14:45:47 +00:00
var compactview = ! config . isEdit ;
if ( config . isEdit ) {
if ( Common . localStorage . itemExists ( "de-compact-toolbar" ) ) {
compactview = Common . localStorage . getBool ( "de-compact-toolbar" ) ;
} else
if ( config . customization && config . customization . compactToolbar )
compactview = true ;
}
2017-04-20 11:16:50 +00:00
2017-04-20 14:45:47 +00:00
me . toolbar . render ( _ . extend ( { isCompactView : compactview } , config ) ) ;
2017-04-10 13:39:03 +00:00
2018-12-18 14:27:19 +00:00
var tab = { action : 'review' , caption : me . toolbar . textTabCollaboration } ;
var $panel = this . getApplication ( ) . getController ( 'Common.Controllers.ReviewChanges' ) . createToolbarPanel ( ) ;
if ( $panel )
me . toolbar . addTab ( tab , $panel , 4 ) ;
2017-04-10 13:39:03 +00:00
if ( config . isEdit ) {
2018-05-15 12:37:26 +00:00
me . toolbar . setMode ( config ) ;
2018-04-03 13:41:01 +00:00
me . toolbar . btnSave . on ( 'disabled' , _ . bind ( me . onBtnChangeState , me , 'save:disabled' ) ) ;
2017-11-28 12:23:37 +00:00
2019-01-31 13:41:29 +00:00
if ( ! config . canBranding || ! config . customization . compactHeader ) {
// hide 'print' and 'save' buttons group and next separator
me . toolbar . btnPrint . $el . parents ( '.group' ) . hide ( ) . next ( ) . hide ( ) ;
2018-09-25 10:46:28 +00:00
2019-01-31 13:41:29 +00:00
// 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
2019-01-31 13:41:29 +00:00
// move 'paste' button to the container instead of 'undo' and 'redo'
me . toolbar . btnPaste . $el . detach ( ) . appendTo ( $box ) ;
me . toolbar . btnCopy . $el . removeClass ( 'split' ) ;
}
2018-02-07 15:30:45 +00:00
2018-09-25 10:46:28 +00:00
if ( config . isDesktopApp ) {
2018-08-01 16:08:24 +00:00
if ( config . canProtect ) {
2018-02-07 15:30:45 +00:00
tab = { action : 'protect' , caption : me . toolbar . textTabProtect } ;
$panel = me . getApplication ( ) . getController ( 'Common.Controllers.Protection' ) . createToolbarPanel ( ) ;
if ( $panel ) me . toolbar . addTab ( tab , $panel , 5 ) ;
}
2017-04-04 15:22:02 +00:00
}
2017-12-23 08:33:49 +00:00
var links = me . getApplication ( ) . getController ( 'Links' ) ;
2017-12-26 07:32:52 +00:00
links . setApi ( me . api ) . setConfig ( { toolbar : me } ) ;
2017-12-23 08:33:49 +00:00
Array . prototype . push . apply ( me . toolbar . toolbarControls , links . getView ( 'Links' ) . getButtons ( ) ) ;
2017-04-04 15:22:02 +00:00
}
} ,
2017-03-29 16:29:04 +00:00
onAppReady : function ( config ) {
var me = this ;
2018-05-16 14:41:47 +00:00
me . appOptions = config ;
2017-03-29 16:29:04 +00:00
2017-06-15 13:18:40 +00:00
if ( config . canCoAuthoring && config . canComments ) {
2018-02-13 14:37:22 +00:00
this . btnsComment = createButtonSet ( ) ;
2017-03-29 16:29:04 +00:00
var slots = me . toolbar . $el . find ( '.slot-comment' ) ;
slots . each ( function ( index , el ) {
var _cls = 'btn-toolbar' ;
2017-03-31 10:55:10 +00:00
/x-huge/ . test ( el . className ) && ( _cls += ' x-huge icon-top' ) ;
2017-03-29 16:29:04 +00:00
var button = new Common . UI . Button ( {
2017-08-08 15:00:55 +00:00
id : 'tlbtn-addcomment-' + index ,
2017-03-29 16:29:04 +00:00
cls : _cls ,
iconCls : 'btn-menu-comments' ,
2017-06-15 13:18:40 +00:00
caption : me . toolbar . capBtnComment
2017-03-29 16:29:04 +00:00
} ) . render ( slots . eq ( index ) ) ;
2018-02-13 14:37:22 +00:00
me . btnsComment . add ( button ) ;
2017-03-29 16:29:04 +00:00
} ) ;
2017-06-28 11:20:49 +00:00
if ( this . btnsComment . length ) {
2017-04-06 09:42:43 +00:00
var _comments = DE . getController ( 'Common.Controllers.Comments' ) . getView ( ) ;
2017-06-28 11:20:49 +00:00
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' ) ;
} ) ;
} , this ) ;
}
2017-03-29 16:29:04 +00:00
}
2017-04-04 15:43:19 +00:00
( 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-03-29 16:29:04 +00:00
} ,
2017-04-21 13:36:06 +00:00
getView : function ( name ) {
return ! name ? this . toolbar : Backbone . Controller . prototype . getView . apply ( this , arguments ) ;
} ,
2017-04-27 14:34:34 +00:00
onFileMenu : function ( opts ) {
2018-05-18 09:59:01 +00:00
if ( opts == 'show' ) {
if ( ! this . toolbar . isTabActive ( 'file' ) )
this . toolbar . setTab ( 'file' ) ;
} else {
2018-05-16 14:41:47 +00:00
if ( this . toolbar . isTabActive ( 'file' ) )
this . toolbar . setTab ( ) ;
}
2017-04-27 14:34:34 +00:00
} ,
2016-03-11 00:48:53 +00:00
textEmptyImgUrl : 'You need to specify image URL.' ,
textWarning : 'Warning' ,
textFontSizeErr : 'The entered value is incorrect.<br>Please enter a numeric value between 1 and 100' ,
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' ,
2017-12-25 12:55:26 +00:00
txtMarginsH : 'Top and bottom margins are too high for a given page height'
2016-03-11 00:48:53 +00:00
} , DE . Controllers . Toolbar || { } ) ) ;
} ) ;