2016-04-01 13:17:09 +00:00
/ *
*
2019-01-17 13:05:03 +00:00
* ( c ) Copyright Ascensio System SIA 2010 - 2019
2016-04-01 13:17:09 +00:00
*
* This program is a free software product . You can redistribute it and / or
* modify it under the terms of the GNU Affero General Public License ( AGPL )
* version 3 as published by the Free Software Foundation . In accordance with
* Section 7 ( a ) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non - infringement
* of any third - party rights .
*
* This program is distributed WITHOUT ANY WARRANTY ; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . For
* details , see the GNU AGPL at : http : //www.gnu.org/licenses/agpl-3.0.html
*
2019-01-17 13:00:34 +00:00
* You can contact Ascensio System SIA at 20 A - 12 Ernesta Birznieka - Upisha
* street , Riga , Latvia , EU , LV - 1050.
2016-04-01 13:17:09 +00:00
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices , as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7 ( b ) of the License you must retain the original Product
* logo when distributing the program . Pursuant to Section 7 ( e ) we decline to
* grant you any rights under trademark law for use of our trademarks .
*
* All the Product ' s GUI elements , including illustrations and icon sets , as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution - ShareAlike 4.0 International . See the License
* terms at http : //creativecommons.org/licenses/by-sa/4.0/legalcode
*
* /
2016-03-11 00:48:53 +00:00
/ * *
* Toolbar . js
*
* Toolbar controller
*
* Created by Alexander Yuzhin on 4 / 16 / 14
2018-03-01 12:16:38 +00:00
* Copyright ( c ) 2018 Ascensio System SIA . All rights reserved .
2016-03-11 00:48:53 +00:00
*
* /
define ( [
'core' ,
'common/main/lib/component/Window' ,
'common/main/lib/view/CopyWarningDialog' ,
'common/main/lib/view/ImageFromUrlDialog' ,
'common/main/lib/view/InsertTableDialog' ,
2018-10-03 11:00:08 +00:00
'common/main/lib/view/SelectFileDlg' ,
2019-11-07 10:37:14 +00:00
'common/main/lib/view/ListSettingsDialog' ,
2019-11-14 08:48:58 +00:00
'common/main/lib/view/SymbolTableDialog' ,
2016-10-25 10:48:31 +00:00
'common/main/lib/util/define' ,
2017-08-07 14:20:17 +00:00
'presentationeditor/main/app/collection/SlideThemes' ,
2021-07-30 17:22:42 +00:00
'presentationeditor/main/app/controller/Transitions' ,
2021-10-15 01:15:43 +00:00
'presentationeditor/main/app/controller/Animation' ,
2016-03-11 00:48:53 +00:00
'presentationeditor/main/app/view/Toolbar' ,
2019-06-27 11:59:12 +00:00
'presentationeditor/main/app/view/DateTimeDialog' ,
2019-07-09 14:03:25 +00:00
'presentationeditor/main/app/view/HeaderFooterDialog' ,
2016-03-11 00:48:53 +00:00
'presentationeditor/main/app/view/HyperlinkSettingsDialog' ,
2016-06-17 12:47:49 +00:00
'presentationeditor/main/app/view/SlideSizeSettings' ,
'presentationeditor/main/app/view/SlideshowSettings'
2016-03-11 00:48:53 +00:00
] , function ( ) { 'use strict' ;
PE . Controllers . Toolbar = Backbone . Controller . extend ( _ . extend ( {
models : [ ] ,
2017-08-07 14:20:17 +00:00
collections : [
'SlideThemes'
] ,
2016-03-11 00:48:53 +00:00
views : [
'Toolbar'
] ,
initialize : function ( ) {
this . _state = {
activated : false ,
themeId : undefined ,
bullets : { type : undefined , subtype : undefined } ,
prcontrolsdisable : undefined ,
slidecontrolsdisable : undefined ,
slidelayoutdisable : undefined ,
shapecontrolsdisable : undefined ,
no _paragraph : undefined ,
2016-05-16 09:15:18 +00:00
no _text : undefined ,
2016-03-11 00:48:53 +00:00
no _object : undefined ,
clrtext : undefined ,
linespace : undefined ,
pralign : undefined ,
valign : undefined ,
vtextalign : undefined ,
can _undo : undefined ,
can _redo : undefined ,
bold : undefined ,
italic : undefined ,
strike : undefined ,
underline : undefined ,
can _group : undefined ,
can _ungroup : undefined ,
lock _doc : undefined ,
changeslide _inited : false ,
no _slides : undefined ,
can _increase : undefined ,
can _decrease : undefined ,
can _hyper : undefined ,
zoom _type : undefined ,
zoom _percent : undefined ,
2016-10-25 10:48:31 +00:00
fontsize : undefined ,
2016-12-27 09:34:08 +00:00
in _equation : undefined ,
2021-01-12 20:01:55 +00:00
in _chart : false ,
2021-01-29 14:31:46 +00:00
no _columns : false ,
clrhighlight : undefined
2016-03-11 00:48:53 +00:00
} ;
this . _isAddingShape = false ;
this . slideSizeArr = [
2021-02-16 14:05:47 +00:00
{ size : [ 9144000 , 6858000 ] , ratio : 6858000 / 9144000 , type : Asc . c _oAscSlideSZType . SzScreen4x3 } ,
{ size : [ 12192000 , 6858000 ] , ratio : 6858000 / 12192000 , type : Asc . c _oAscSlideSZType . SzCustom } ] ;
2016-03-11 00:48:53 +00:00
this . currentPageSize = {
2021-02-15 17:10:46 +00:00
type : Asc . c _oAscSlideSZType . SzCustom ,
2016-03-11 00:48:53 +00:00
width : 0 ,
height : 0
} ;
this . flg = { } ;
this . diagramEditor = null ;
this . editMode = true ;
this . addListeners ( {
'Toolbar' : {
2017-04-20 13:34:39 +00:00
'insert:image' : this . onInsertImageClick . bind ( this ) ,
'insert:text' : this . onInsertText . bind ( this ) ,
'insert:textart' : this . onInsertTextart . bind ( this ) ,
2017-04-22 13:11:04 +00:00
'insert:shape' : this . onInsertShape . bind ( this ) ,
2017-11-03 11:06:03 +00:00
'add:slide' : this . onAddSlide . bind ( this ) ,
2021-09-22 19:37:15 +00:00
'duplicate:slide' : this . onDuplicateSlide . bind ( this ) ,
'duplicate:check' : this . onDuplicateCheck . bind ( this ) ,
2019-08-30 10:01:21 +00:00
'change:slide' : this . onChangeSlide . bind ( this ) ,
2019-09-02 09:52:14 +00:00
'change:compact' : this . onClickChangeCompact ,
'add:chart' : this . onSelectChart
2017-04-20 13:34:39 +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-21 10:41:56 +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 11:10:33 +00:00
'save' : function ( opts ) {
this . api . asc _Save ( ) ;
} ,
'undo' : this . onUndo ,
'redo' : this . onRedo ,
2017-07-21 10:41:56 +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 ) {
_format = Asc . c _oAscFileType [ _file _type . toUpperCase ( ) ] ;
}
var _supported = [
Asc . c _oAscFileType . PPTX ,
2018-07-18 11:07:24 +00:00
Asc . c _oAscFileType . ODP ,
2019-02-21 13:10:37 +00:00
Asc . c _oAscFileType . PDFA ,
Asc . c _oAscFileType . POTX ,
2021-07-29 15:52:37 +00:00
Asc . c _oAscFileType . OTP ,
2021-07-30 15:57:45 +00:00
Asc . c _oAscFileType . PPTM ,
Asc . c _oAscFileType . PNG ,
Asc . c _oAscFileType . JPG
2017-07-21 14:55:27 +00:00
] ;
if ( ! _format || _supported . indexOf ( _format ) < 0 )
_format = Asc . c _oAscFileType . PDF ;
2019-07-24 08:36:13 +00:00
_main . api . asc _DownloadAs ( new Asc . asc _CDownloadOptions ( _format ) ) ;
2017-07-21 14:55:27 +00:00
} ,
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' ) ;
2021-10-12 10:58:11 +00:00
if ( btn _id === undefined )
btn _id = cmp . closest ( '.combo-dataview' ) . attr ( 'id' ) ;
2016-03-11 00:48:53 +00:00
if ( cmp . attr ( 'id' ) != 'editor_sdk' && cmp _sdk . length <= 0 ) {
2017-10-26 08:14:53 +00:00
if ( me . toolbar . btnsInsertText . pressed ( ) && ! me . toolbar . btnsInsertText . contains ( btn _id ) ||
2021-10-12 10:58:11 +00:00
me . toolbar . btnsInsertShape . pressed ( ) && ! me . toolbar . btnsInsertShape . contains ( btn _id ) ||
me . toolbar . cmbInsertShape . isComboViewRecActive ( ) && me . toolbar . cmbInsertShape . id !== btn _id )
2017-04-20 13:34:39 +00:00
{
2016-03-11 00:48:53 +00:00
me . _isAddingShape = false ;
me . _addAutoshape ( false ) ;
2017-04-20 13:34:39 +00:00
me . toolbar . btnsInsertShape . toggle ( false , true ) ;
me . toolbar . btnsInsertText . toggle ( false , true ) ;
2021-10-12 10:58:11 +00:00
me . toolbar . cmbInsertShape . deactivateRecords ( ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
2017-04-20 13:34:39 +00:00
} else
2017-10-26 08:14:53 +00:00
if ( me . toolbar . btnsInsertShape . pressed ( ) && me . toolbar . btnsInsertShape . contains ( btn _id ) ) {
2016-03-11 00:48:53 +00:00
_ . defer ( function ( ) {
me . api . StartAddShape ( '' , false ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} , 100 ) ;
}
}
} ;
this . onApiEndAddShape = function ( ) {
this . toolbar . fireEvent ( 'insertshape' , this . toolbar ) ;
2017-10-26 08:14:53 +00:00
if ( this . toolbar . btnsInsertShape . pressed ( ) )
2017-04-20 13:34:39 +00:00
this . toolbar . btnsInsertShape . toggle ( false , true ) ;
2016-03-11 00:48:53 +00:00
2017-10-26 08:14:53 +00:00
if ( this . toolbar . btnsInsertText . pressed ( ) )
2017-04-20 13:34:39 +00:00
this . toolbar . btnsInsertText . toggle ( false , true ) ;
2016-03-11 00:48:53 +00:00
2021-10-10 22:44:40 +00:00
if ( this . toolbar . cmbInsertShape . isComboViewRecActive ( ) )
2021-10-12 10:58:11 +00:00
this . toolbar . cmbInsertShape . deactivateRecords ( ) ;
2021-10-10 22:44:40 +00:00
2016-03-11 00:48:53 +00:00
$ ( 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 ) ;
}
}
} ;
} ,
onLaunch : function ( ) {
2018-02-15 23:56:17 +00:00
var me = this ;
2016-03-11 00:48:53 +00:00
// Create toolbar view
2018-02-15 23:56:17 +00:00
me . toolbar = me . createView ( 'Toolbar' ) ;
2016-03-11 00:48:53 +00:00
2017-04-20 13:34:39 +00:00
Common . NotificationCenter . on ( 'app:ready' , me . onAppReady . bind ( me ) ) ;
Common . NotificationCenter . on ( 'app:face' , me . onAppShowed . bind ( me ) ) ;
PE . getCollection ( 'ShapeGroups' ) . bind ( {
reset : me . onResetAutoshapes . bind ( this )
} ) ;
2017-11-03 11:06:03 +00:00
PE . getCollection ( 'SlideLayouts' ) . bind ( {
reset : me . onResetSlides . bind ( this )
} ) ;
2016-03-11 00:48:53 +00:00
} ,
2018-05-15 12:39: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
* /
2016-06-17 12:47:49 +00:00
toolbar . btnPreview . on ( 'click' , _ . bind ( this . onPreviewBtnClick , this ) ) ;
toolbar . btnPreview . menu . on ( 'item:click' , _ . bind ( this . onPreviewItemClick , this ) ) ;
2016-03-11 00:48:53 +00:00
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-05-15 12:39:26 +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-05-15 12:39:26 +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 ) ) ;
2020-11-27 21:23:26 +00:00
toolbar . btnIncFontSize . on ( 'click' , _ . bind ( this . onIncrease , this ) ) ;
toolbar . btnDecFontSize . on ( 'click' , _ . bind ( this . onDecrease , this ) ) ;
2016-03-11 00:48:53 +00:00
toolbar . btnBold . on ( 'click' , _ . bind ( this . onBold , this ) ) ;
toolbar . btnItalic . on ( 'click' , _ . bind ( this . onItalic , this ) ) ;
toolbar . btnUnderline . on ( 'click' , _ . bind ( this . onUnderline , this ) ) ;
toolbar . btnStrikeout . on ( 'click' , _ . bind ( this . onStrikeout , this ) ) ;
toolbar . btnSuperscript . on ( 'click' , _ . bind ( this . onSuperscript , this ) ) ;
toolbar . btnSubscript . on ( 'click' , _ . bind ( this . onSubscript , this ) ) ;
toolbar . btnHorizontalAlign . menu . on ( 'item:click' , _ . bind ( this . onMenuHorizontalAlignSelect , this ) ) ;
toolbar . btnVerticalAlign . menu . on ( 'item:click' , _ . bind ( this . onMenuVerticalAlignSelect , this ) ) ;
toolbar . btnDecLeftOffset . on ( 'click' , _ . bind ( this . onDecOffset , this ) ) ;
toolbar . btnIncLeftOffset . on ( 'click' , _ . bind ( this . onIncOffset , this ) ) ;
2021-01-29 13:06:51 +00:00
toolbar . mnuChangeCase . on ( 'item:click' , _ . bind ( this . onChangeCase , this ) ) ;
2016-03-11 00:48:53 +00:00
toolbar . btnMarkers . on ( 'click' , _ . bind ( this . onMarkers , this ) ) ;
toolbar . btnNumbers . on ( 'click' , _ . bind ( this . onNumbers , this ) ) ;
2019-10-31 10:57:03 +00:00
toolbar . mnuMarkerSettings . on ( 'click' , _ . bind ( this . onMarkerSettingsClick , this , 0 ) ) ;
toolbar . mnuNumberSettings . on ( 'click' , _ . bind ( this . onMarkerSettingsClick , this , 1 ) ) ;
2016-03-11 00:48:53 +00:00
toolbar . cmbFontName . on ( 'selected' , _ . bind ( this . onFontNameSelect , this ) ) ;
toolbar . cmbFontName . on ( 'show:after' , _ . bind ( this . onComboOpen , this , true ) ) ;
toolbar . cmbFontName . on ( 'hide:after' , _ . bind ( this . onHideMenus , this ) ) ;
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 ( 'show:after' , _ . bind ( this . onComboOpen , this , true ) ) ;
toolbar . cmbFontSize . on ( 'hide:after' , _ . bind ( this . onHideMenus , this ) ) ;
toolbar . cmbFontSize . on ( 'combo:blur' , _ . bind ( this . onComboBlur , this ) ) ;
toolbar . cmbFontSize . on ( 'combo:focusin' , _ . bind ( this . onComboOpen , this , false ) ) ;
toolbar . mnuMarkersPicker . on ( 'item:click' , _ . bind ( this . onSelectBullets , this , toolbar . btnMarkers ) ) ;
toolbar . mnuNumbersPicker . on ( 'item:click' , _ . bind ( this . onSelectBullets , this , toolbar . btnNumbers ) ) ;
2021-04-02 20:04:37 +00:00
toolbar . btnMarkers . menu . on ( 'show:after' , _ . bind ( this . onListShowAfter , this , 0 , toolbar . mnuMarkersPicker ) ) ;
toolbar . btnNumbers . menu . on ( 'show:after' , _ . bind ( this . onListShowAfter , this , 1 , toolbar . mnuNumbersPicker ) ) ;
2016-03-11 00:48:53 +00:00
toolbar . btnFontColor . on ( 'click' , _ . bind ( this . onBtnFontColor , this ) ) ;
2021-07-10 23:25:12 +00:00
toolbar . btnFontColor . on ( 'color:select' , _ . bind ( this . onSelectFontColor , this ) ) ;
2021-01-29 14:31:46 +00:00
toolbar . btnHighlightColor . on ( 'click' , _ . bind ( this . onBtnHighlightColor , this ) ) ;
toolbar . mnuHighlightColorPicker . on ( 'select' , _ . bind ( this . onSelectHighlightColor , this ) ) ;
toolbar . mnuHighlightTransparent . on ( 'click' , _ . bind ( this . onHighlightTransparentClick , this ) ) ;
2016-03-11 00:48:53 +00:00
toolbar . btnLineSpace . menu . on ( 'item:toggle' , _ . bind ( this . onLineSpaceToggle , this ) ) ;
2021-01-12 20:01:55 +00:00
toolbar . btnColumns . menu . on ( 'item:click' , _ . bind ( this . onColumnsSelect , this ) ) ;
toolbar . btnColumns . menu . on ( 'show:before' , _ . bind ( this . onBeforeColumns , this ) ) ;
2016-03-11 00:48:53 +00:00
toolbar . btnShapeAlign . menu . on ( 'item:click' , _ . bind ( this . onShapeAlign , this ) ) ;
2019-02-11 08:39:27 +00:00
toolbar . btnShapeAlign . menu . on ( 'show:before' , _ . bind ( this . onBeforeShapeAlign , this ) ) ;
2016-03-11 00:48:53 +00:00
toolbar . btnShapeArrange . menu . on ( 'item:click' , _ . bind ( this . onShapeArrange , this ) ) ;
toolbar . btnInsertHyperlink . on ( 'click' , _ . bind ( this . onHyperlinkClick , this ) ) ;
toolbar . mnuTablePicker . on ( 'select' , _ . bind ( this . onTablePickerSelect , this ) ) ;
toolbar . btnInsertTable . menu . on ( 'item:click' , _ . bind ( this . onInsertTableClick , this ) ) ;
toolbar . btnClearStyle . on ( 'click' , _ . bind ( this . onClearStyleClick , this ) ) ;
toolbar . btnCopyStyle . on ( 'toggle' , _ . bind ( this . onCopyStyleToggle , this ) ) ;
toolbar . btnColorSchemas . menu . on ( 'item:click' , _ . bind ( this . onColorSchemaClick , this ) ) ;
2019-08-20 12:56:29 +00:00
toolbar . btnColorSchemas . menu . on ( 'show:after' , _ . bind ( this . onColorSchemaShow , this ) ) ;
2016-03-11 00:48:53 +00:00
toolbar . btnSlideSize . menu . on ( 'item:click' , _ . bind ( this . onSlideSize , this ) ) ;
toolbar . listTheme . on ( 'click' , _ . bind ( this . onListThemeSelect , this ) ) ;
2016-10-25 10:48:31 +00:00
toolbar . btnInsertEquation . on ( 'click' , _ . bind ( this . onInsertEquationClick , this ) ) ;
2019-11-14 08:48:58 +00:00
toolbar . btnInsertSymbol . on ( 'click' , _ . bind ( this . onInsertSymbolClick , this ) ) ;
2019-06-26 15:38:04 +00:00
toolbar . btnEditHeader . on ( 'click' , _ . bind ( this . onEditHeaderClick , this , 'header' ) ) ;
toolbar . btnInsDateTime . on ( 'click' , _ . bind ( this . onEditHeaderClick , this , 'datetime' ) ) ;
toolbar . btnInsSlideNum . on ( 'click' , _ . bind ( this . onEditHeaderClick , this , 'slidenum' ) ) ;
2019-07-26 11:49:53 +00:00
Common . Gateway . on ( 'insertimage' , _ . bind ( this . insertImage , this ) ) ;
2020-03-02 14:36:10 +00:00
toolbar . btnInsAudio && toolbar . btnInsAudio . on ( 'click' , _ . bind ( this . onAddAudio , this ) ) ;
toolbar . btnInsVideo && toolbar . btnInsVideo . on ( 'click' , _ . bind ( this . onAddVideo , this ) ) ;
2019-02-19 12:47:50 +00:00
this . onSetupCopyStyleButton ( ) ;
2016-03-11 00:48:53 +00:00
} ,
setApi : function ( api ) {
this . api = api ;
2019-11-15 11:01:08 +00:00
if ( this . mode . isEdit ) {
this . toolbar . setApi ( api ) ;
this . api . asc _registerCallback ( 'asc_onFontSize' , _ . bind ( this . onApiFontSize , this ) ) ;
this . api . asc _registerCallback ( 'asc_onBold' , _ . bind ( this . onApiBold , this ) ) ;
this . api . asc _registerCallback ( 'asc_onItalic' , _ . bind ( this . onApiItalic , this ) ) ;
this . api . asc _registerCallback ( 'asc_onUnderline' , _ . bind ( this . onApiUnderline , this ) ) ;
this . api . asc _registerCallback ( 'asc_onStrikeout' , _ . bind ( this . onApiStrikeout , this ) ) ;
this . api . asc _registerCallback ( 'asc_onVerticalAlign' , _ . bind ( this . onApiVerticalAlign , this ) ) ;
Common . NotificationCenter . on ( 'fonts:change' , _ . bind ( this . onApiChangeFont , 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_onPaintFormatChanged' , _ . bind ( this . onApiStyleChange , this ) ) ;
this . api . asc _registerCallback ( 'asc_onListType' , _ . bind ( this . onApiBullets , this ) ) ;
this . api . asc _registerCallback ( 'asc_canIncreaseIndent' , _ . bind ( this . onApiCanIncreaseIndent , this ) ) ;
this . api . asc _registerCallback ( 'asc_canDecreaseIndent' , _ . bind ( this . onApiCanDecreaseIndent , this ) ) ;
this . api . asc _registerCallback ( 'asc_onLineSpacing' , _ . bind ( this . onApiLineSpacing , this ) ) ;
this . api . asc _registerCallback ( 'asc_onPrAlign' , _ . bind ( this . onApiParagraphAlign , this ) ) ;
this . api . asc _registerCallback ( 'asc_onVerticalTextAlign' , _ . bind ( this . onApiVerticalTextAlign , this ) ) ;
this . api . asc _registerCallback ( 'asc_onCanAddHyperlink' , _ . bind ( this . onApiCanAddHyperlink , this ) ) ;
this . api . asc _registerCallback ( 'asc_onTextColor' , _ . bind ( this . onApiTextColor , this ) ) ;
2021-01-29 14:31:46 +00:00
this . api . asc _registerCallback ( 'asc_onMarkerFormatChanged' , _ . bind ( this . onApiStartHighlight , this ) ) ;
this . api . asc _registerCallback ( 'asc_onTextHighLight' , _ . bind ( this . onApiHighlightColor , this ) ) ;
2019-11-15 11:01:08 +00:00
this . api . asc _registerCallback ( 'asc_onUpdateThemeIndex' , _ . bind ( this . onApiUpdateThemeIndex , this ) ) ;
this . api . asc _registerCallback ( 'asc_onEndAddShape' , _ . bind ( this . onApiEndAddShape , this ) ) ;
this . api . asc _registerCallback ( 'asc_onCanGroup' , _ . bind ( this . onApiCanGroup , this ) ) ;
this . api . asc _registerCallback ( 'asc_onCanUnGroup' , _ . bind ( this . onApiCanUnGroup , this ) ) ;
this . api . asc _registerCallback ( 'asc_onPresentationSize' , _ . bind ( this . onApiPageSize , this ) ) ;
this . api . asc _registerCallback ( 'asc_onCoAuthoringDisconnect' , _ . bind ( this . onApiCoAuthoringDisconnect , this ) ) ;
Common . NotificationCenter . on ( 'api:disconnect' , _ . bind ( this . onApiCoAuthoringDisconnect , this ) ) ;
this . api . asc _registerCallback ( 'asc_onZoomChange' , _ . bind ( this . onApiZoomChange , this ) ) ;
this . api . asc _registerCallback ( 'asc_onFocusObject' , _ . bind ( this . onApiFocusObject , 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_onLockDocumentTheme' , _ . bind ( this . onApiLockDocumentTheme , this ) ) ;
this . api . asc _registerCallback ( 'asc_onUnLockDocumentTheme' , _ . bind ( this . onApiUnLockDocumentTheme , this ) ) ;
this . api . asc _registerCallback ( 'asc_onInitEditorStyles' , _ . bind ( this . onApiInitEditorStyles , this ) ) ;
this . api . asc _registerCallback ( 'asc_onCountPages' , _ . bind ( this . onApiCountPages , this ) ) ;
this . api . asc _registerCallback ( 'asc_onMathTypes' , _ . bind ( this . onApiMathTypes , this ) ) ;
this . api . asc _registerCallback ( 'asc_onContextMenu' , _ . bind ( this . onContextMenu , this ) ) ;
this . api . asc _registerCallback ( 'asc_onTextLanguage' , _ . bind ( this . onTextLanguage , this ) ) ;
2020-05-13 14:20:58 +00:00
Common . NotificationCenter . on ( 'storage:image-load' , _ . bind ( this . openImageFromStorage , this ) ) ;
Common . NotificationCenter . on ( 'storage:image-insert' , _ . bind ( this . insertImageFromStorage , this ) ) ;
2019-11-15 11:01:08 +00:00
} else if ( this . mode . isRestrictedEdit ) {
this . api . asc _registerCallback ( 'asc_onCountPages' , _ . bind ( this . onApiCountPagesRestricted , this ) ) ;
}
2016-03-11 00:48:53 +00:00
} ,
onChangeCompactView : function ( view , compact ) {
2017-04-20 13:34:39 +00:00
this . toolbar . setFolded ( compact ) ;
2017-04-20 14:45:47 +00:00
this . toolbar . fireEvent ( 'view:compact' , [ this . toolbar , compact ] ) ;
2016-03-11 00:48:53 +00:00
2017-04-20 13:34:39 +00:00
Common . localStorage . setBool ( 'pe-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 13:11:04 +00:00
onClickChangeCompact : function ( from ) {
if ( from != 'file' ) {
var me = this ;
Common . Utils . asyncCall ( function ( ) {
me . onChangeCompactView ( null , ! me . toolbar . isCompact ( ) ) ;
} ) ;
}
} ,
2017-04-24 14:35:00 +00:00
onContextMenu : function ( ) {
2017-07-18 12:59:14 +00:00
this . toolbar . collapse ( ) ;
2017-04-24 14:35:00 +00:00
} ,
2019-02-01 10:13:44 +00:00
onApiChangeFont : function ( font ) {
2020-04-22 09:35:55 +00:00
! Common . Utils . ModalWindow . isVisible ( ) && this . toolbar . cmbFontName . onApiChangeFont ( font ) ;
2019-02-01 10:13:44 +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 . lockToolbar ( PE . enumLock . undoLock , ! can , { array : [ this . toolbar . btnUndo ] } ) ;
if ( this . _state . activated ) this . _state . can _undo = can ;
}
} else {
if ( this . _state . can _redo !== can ) {
this . toolbar . lockToolbar ( PE . enumLock . redoLock , ! can , { array : [ this . toolbar . btnRedo ] } ) ;
if ( this . _state . activated ) this . _state . can _redo = can ;
}
}
} ,
onApiCanIncreaseIndent : function ( value ) {
if ( this . _state . can _increase !== value ) {
this . toolbar . lockToolbar ( PE . enumLock . incIndentLock , ! value , { array : [ this . toolbar . btnIncLeftOffset ] } ) ;
if ( this . _state . activated ) this . _state . can _increase = value ;
}
} ,
onApiCanDecreaseIndent : function ( value ) {
if ( this . _state . can _decrease !== value ) {
this . toolbar . lockToolbar ( PE . enumLock . decIndentLock , ! value , { array : [ this . toolbar . btnDecLeftOffset ] } ) ;
if ( this . _state . activated ) this . _state . can _decrease = value ;
}
} ,
onApiBullets : function ( v ) {
if ( this . _state . bullets . type != v . get _ListType ( ) || this . _state . bullets . subtype != v . get _ListSubType ( ) ) {
this . _state . bullets . type = v . get _ListType ( ) ;
this . _state . bullets . subtype = v . get _ListSubType ( ) ;
this . _clearBullets ( ) ;
switch ( this . _state . bullets . type ) {
case 0 :
this . toolbar . btnMarkers . toggle ( true , true ) ;
2019-12-17 09:33:12 +00:00
if ( this . _state . bullets . subtype !== undefined )
this . toolbar . mnuMarkersPicker . selectByIndex ( this . _state . bullets . subtype , true ) ;
else
this . toolbar . mnuMarkersPicker . deselectAll ( true ) ;
2016-03-11 00:48:53 +00:00
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 ;
}
}
} ,
onApiParagraphAlign : function ( v ) {
if ( this . _state . pralign !== v ) {
this . _state . pralign = v ;
var index = - 1 ,
align ,
btnHorizontalAlign = this . toolbar . btnHorizontalAlign ;
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 ) ) {
btnHorizontalAlign . menu . items [ index ] . setChecked ( true ) ;
} else if ( index == - 255 ) {
2017-11-13 08:41:32 +00:00
btnHorizontalAlign . menu . clearAll ( ) ;
2016-03-11 00:48:53 +00:00
}
2018-02-26 13:23:07 +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
}
}
} ,
onApiVerticalTextAlign : function ( v ) {
if ( this . _state . vtextalign !== v ) {
this . _state . vtextalign = v ;
var index = - 1 ,
align = '' ,
btnVerticalAlign = this . toolbar . btnVerticalAlign ;
switch ( v ) {
2016-11-10 11:24:18 +00:00
case Asc . c _oAscVAlign . Top : index = 0 ; align = 'btn-align-top' ; break ;
case Asc . c _oAscVAlign . Center : index = 1 ; align = 'btn-align-middle' ; break ;
case Asc . c _oAscVAlign . Bottom : index = 2 ; align = 'btn-align-bottom' ; break ;
2016-03-11 00:48:53 +00:00
default : index = - 255 ; align = 'btn-align-middle' ; break ;
}
if ( ! ( index < 0 ) ) {
btnVerticalAlign . menu . items [ index ] . setChecked ( true ) ;
} else if ( index == - 255 ) {
2017-11-13 08:41:32 +00:00
btnVerticalAlign . menu . clearAll ( ) ;
2016-03-11 00:48:53 +00:00
}
2018-02-26 13:23:07 +00:00
if ( btnVerticalAlign . rendered && btnVerticalAlign . $icon ) {
btnVerticalAlign . $icon . removeClass ( btnVerticalAlign . options . icls ) . addClass ( align ) ;
btnVerticalAlign . options . icls = align ;
2016-03-11 00:48:53 +00:00
}
}
} ,
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 ;
var mnuLineSpace = this . toolbar . btnLineSpace . menu ;
_ . each ( mnuLineSpace . items , function ( item ) {
item . setChecked ( false , true ) ;
} ) ;
if ( line < 0 ) return ;
if ( Math . abs ( line - 1. ) < 0.0001 )
mnuLineSpace . items [ 0 ] . setChecked ( true , true ) ;
else if ( Math . abs ( line - 1.15 ) < 0.0001 )
mnuLineSpace . items [ 1 ] . setChecked ( true , true ) ;
else if ( Math . abs ( line - 1.5 ) < 0.0001 )
mnuLineSpace . items [ 2 ] . setChecked ( true , true ) ;
else if ( Math . abs ( line - 2 ) < 0.0001 )
mnuLineSpace . items [ 3 ] . setChecked ( true , true ) ;
else if ( Math . abs ( line - 2.5 ) < 0.0001 )
mnuLineSpace . items [ 4 ] . setChecked ( true , true ) ;
else if ( Math . abs ( line - 3 ) < 0.0001 )
mnuLineSpace . items [ 5 ] . setChecked ( true , true ) ;
}
} ,
onApiCanAddHyperlink : function ( value ) {
if ( this . _state . can _hyper !== value && this . editMode ) {
this . toolbar . lockToolbar ( PE . enumLock . hyperlinkLock , ! value , { array : [ this . toolbar . btnInsertHyperlink ] } ) ;
if ( this . _state . activated ) this . _state . can _hyper = value ;
}
} ,
2021-02-15 17:10:46 +00:00
onApiPageSize : function ( width , height , type ) {
2016-03-11 00:48:53 +00:00
if ( Math . abs ( this . currentPageSize . width - width ) > 0.001 ||
2021-02-15 17:10:46 +00:00
Math . abs ( this . currentPageSize . height - height ) > 0.001 ||
this . currentPageSize . type !== type ) {
2016-03-11 00:48:53 +00:00
this . currentPageSize . width = width ;
this . currentPageSize . height = height ;
2021-02-15 17:10:46 +00:00
this . currentPageSize . type = type ;
2016-03-11 00:48:53 +00:00
2021-02-16 14:05:47 +00:00
var ratio = height / width ;
2021-02-15 17:10:46 +00:00
var idx = - 1 ;
2016-03-11 00:48:53 +00:00
for ( var i = 0 ; i < this . slideSizeArr . length ; i ++ ) {
2021-02-15 17:10:46 +00:00
if ( Math . abs ( this . slideSizeArr [ i ] . ratio - ratio ) < 0.001 ) {
idx = i ;
2016-03-11 00:48:53 +00:00
break ;
}
}
2021-02-15 17:10:46 +00:00
this . toolbar . btnSlideSize . menu . items [ 0 ] . setChecked ( idx == 0 ) ;
this . toolbar . btnSlideSize . menu . items [ 1 ] . setChecked ( idx == 1 ) ;
2016-03-11 00:48:53 +00:00
}
} ,
onApiCountPages : function ( count ) {
if ( this . _state . no _slides !== ( count <= 0 ) ) {
this . _state . no _slides = ( count <= 0 ) ;
this . toolbar . lockToolbar ( PE . enumLock . noSlides , this . _state . no _slides , { array : this . toolbar . paragraphControls } ) ;
this . toolbar . lockToolbar ( PE . enumLock . noSlides , this . _state . no _slides , { array : [
2018-09-25 13:19:33 +00:00
this . toolbar . btnChangeSlide , this . toolbar . btnPreview , this . toolbar . btnPrint , this . toolbar . btnCopy , this . toolbar . btnPaste ,
2017-04-20 13:34:39 +00:00
this . toolbar . btnCopyStyle , this . toolbar . btnInsertTable , this . toolbar . btnInsertChart ,
this . toolbar . btnColorSchemas , this . toolbar . btnShapeAlign ,
2019-06-26 15:38:04 +00:00
this . toolbar . btnShapeArrange , this . toolbar . btnSlideSize , this . toolbar . listTheme , this . toolbar . btnEditHeader , this . toolbar . btnInsDateTime , this . toolbar . btnInsSlideNum
2016-03-11 00:48:53 +00:00
] } ) ;
2017-04-20 13:34:39 +00:00
this . toolbar . lockToolbar ( PE . enumLock . noSlides , this . _state . no _slides ,
2020-03-02 14:36:10 +00:00
{ array : this . toolbar . btnsInsertImage . concat ( this . toolbar . btnsInsertText , this . toolbar . btnsInsertShape , this . toolbar . btnInsertEquation , this . toolbar . btnInsertTextArt , this . toolbar . btnInsAudio , this . toolbar . btnInsVideo ) } ) ;
2017-06-28 11:20:49 +00:00
if ( this . btnsComment )
this . toolbar . lockToolbar ( PE . enumLock . noSlides , this . _state . no _slides , { array : this . btnsComment } ) ;
2016-03-11 00:48:53 +00:00
}
} ,
2019-11-15 11:01:08 +00:00
onApiCountPagesRestricted : function ( count ) {
if ( this . _state . no _slides !== ( count <= 0 ) ) {
this . _state . no _slides = ( count <= 0 ) ;
if ( this . btnsComment )
this . toolbar . lockToolbar ( PE . enumLock . noSlides , this . _state . no _slides , { array : this . btnsComment } ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onApiFocusObject : function ( selectedObjects ) {
if ( ! this . editMode ) return ;
var me = this ,
pr , sh , i = - 1 , type ,
paragraph _locked = undefined ,
shape _locked = undefined ,
slide _deleted = undefined ,
slide _layout _lock = undefined ,
no _paragraph = true ,
2016-05-16 09:15:18 +00:00
no _text = true ,
2016-10-25 10:48:31 +00:00
no _object = true ,
2016-12-27 09:34:08 +00:00
in _equation = false ,
2018-01-09 13:59:20 +00:00
in _chart = false ,
2021-01-12 20:01:55 +00:00
layout _index = - 1 ,
no _columns = 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 ( ) ;
no _paragraph = false ;
2016-05-16 09:15:18 +00:00
no _text = false ;
2016-04-05 11:52:34 +00:00
} else if ( type == Asc . c _oAscTypeSelectElement . Slide ) {
2016-03-11 00:48:53 +00:00
slide _deleted = pr . get _LockDelete ( ) ;
slide _layout _lock = pr . get _LockLayout ( ) ;
2018-01-09 13:59:20 +00:00
layout _index = pr . get _LayoutIndex ( ) ;
2016-04-05 11:52:34 +00:00
} else if ( type == Asc . c _oAscTypeSelectElement . Image || type == Asc . c _oAscTypeSelectElement . Shape || type == Asc . c _oAscTypeSelectElement . Chart || type == Asc . c _oAscTypeSelectElement . Table ) {
2016-03-11 00:48:53 +00:00
shape _locked = pr . get _Locked ( ) ;
no _object = false ;
2019-10-02 08:07:14 +00:00
if ( type == Asc . c _oAscTypeSelectElement . Table ||
2020-10-09 09:48:12 +00:00
type == Asc . c _oAscTypeSelectElement . Shape && ! pr . get _FromImage ( ) ) {
2016-05-16 09:15:18 +00:00
no _text = false ;
}
2020-10-09 14:24:11 +00:00
if ( type == Asc . c _oAscTypeSelectElement . Table ||
type == Asc . c _oAscTypeSelectElement . Shape && ! pr . get _FromImage ( ) && ! pr . get _FromChart ( ) ) {
no _paragraph = false ;
}
2021-01-12 20:01:55 +00:00
if ( type == Asc . c _oAscTypeSelectElement . Chart ) {
in _chart = true ;
no _columns = true ;
}
if ( type == Asc . c _oAscTypeSelectElement . Shape ) {
var shapetype = pr . asc _getType ( ) ;
if ( shapetype == 'line' || shapetype == 'bentConnector2' || shapetype == 'bentConnector3'
|| shapetype == 'bentConnector4' || shapetype == 'bentConnector5' || shapetype == 'curvedConnector2'
|| shapetype == 'curvedConnector3' || shapetype == 'curvedConnector4' || shapetype == 'curvedConnector5'
|| shapetype == 'straightConnector1' )
no _columns = true ;
}
if ( type == Asc . c _oAscTypeSelectElement . Image || type == Asc . c _oAscTypeSelectElement . Table )
no _columns = true ;
2016-10-25 10:48:31 +00:00
} else if ( type === Asc . c _oAscTypeSelectElement . Math ) {
in _equation = true ;
2016-03-11 00:48:53 +00:00
}
}
2016-12-27 09:34:08 +00:00
if ( in _chart !== this . _state . in _chart ) {
this . toolbar . btnInsertChart . updateHint ( in _chart ? this . toolbar . tipChangeChart : this . toolbar . tipInsertChart ) ;
this . _state . in _chart = in _chart ;
}
2020-10-09 14:24:11 +00:00
if ( this . _state . prcontrolsdisable !== paragraph _locked ) {
2016-03-11 00:48:53 +00:00
if ( this . _state . activated ) this . _state . prcontrolsdisable = paragraph _locked ;
2020-10-09 14:24:11 +00:00
if ( paragraph _locked !== undefined )
this . toolbar . lockToolbar ( PE . enumLock . paragraphLock , paragraph _locked , { array : me . toolbar . paragraphControls } ) ;
this . toolbar . lockToolbar ( PE . enumLock . paragraphLock , paragraph _locked === true , { array : [ me . toolbar . btnInsDateTime , me . toolbar . btnInsSlideNum ] } ) ;
2016-03-11 00:48:53 +00:00
}
if ( this . _state . no _paragraph !== no _paragraph ) {
if ( this . _state . activated ) this . _state . no _paragraph = no _paragraph ;
this . toolbar . lockToolbar ( PE . enumLock . noParagraphSelected , no _paragraph , { array : me . toolbar . paragraphControls } ) ;
this . toolbar . lockToolbar ( PE . enumLock . noParagraphSelected , no _paragraph , { array : [ me . toolbar . btnCopyStyle ] } ) ;
}
2016-05-16 09:15:18 +00:00
if ( this . _state . no _text !== no _text ) {
if ( this . _state . activated ) this . _state . no _text = no _text ;
this . toolbar . lockToolbar ( PE . enumLock . noTextSelected , no _text , { array : me . toolbar . paragraphControls } ) ;
}
2016-03-11 00:48:53 +00:00
if ( shape _locked !== undefined && this . _state . shapecontrolsdisable !== shape _locked ) {
if ( this . _state . activated ) this . _state . shapecontrolsdisable = shape _locked ;
2017-06-29 12:06:31 +00:00
this . toolbar . lockToolbar ( PE . enumLock . shapeLock , shape _locked , { array : me . toolbar . shapeControls . concat ( me . toolbar . paragraphControls ) } ) ;
2016-03-11 00:48:53 +00:00
}
if ( this . _state . no _object !== no _object ) {
if ( this . _state . activated ) this . _state . no _object = no _object ;
2017-08-04 08:49:38 +00:00
this . toolbar . lockToolbar ( PE . enumLock . noObjectSelected , no _object , { array : [ me . toolbar . btnShapeAlign , me . toolbar . btnShapeArrange , me . toolbar . btnVerticalAlign ] } ) ;
2016-03-11 00:48:53 +00:00
}
if ( slide _layout _lock !== undefined && this . _state . slidelayoutdisable !== slide _layout _lock ) {
if ( this . _state . activated ) this . _state . slidelayoutdisable = slide _layout _lock ;
this . toolbar . lockToolbar ( PE . enumLock . slideLock , slide _layout _lock , { array : [ me . toolbar . btnChangeSlide ] } ) ;
}
if ( slide _deleted !== undefined && this . _state . slidecontrolsdisable !== slide _deleted ) {
if ( this . _state . activated ) this . _state . slidecontrolsdisable = slide _deleted ;
this . toolbar . lockToolbar ( PE . enumLock . slideDeleted , slide _deleted , { array : me . toolbar . slideOnlyControls . concat ( me . toolbar . paragraphControls ) } ) ;
}
2016-10-25 10:48:31 +00:00
if ( this . _state . in _equation !== in _equation ) {
if ( this . _state . activated ) this . _state . in _equation = in _equation ;
this . toolbar . lockToolbar ( PE . enumLock . inEquation , in _equation , { array : [ me . toolbar . btnSuperscript , me . toolbar . btnSubscript ] } ) ;
}
2018-01-09 13:59:20 +00:00
2021-01-12 20:01:55 +00:00
if ( this . _state . no _columns !== no _columns ) {
if ( this . _state . activated ) this . _state . no _columns = no _columns ;
this . toolbar . lockToolbar ( PE . enumLock . noColumns , no _columns , { array : [ me . toolbar . btnColumns ] } ) ;
}
2019-08-30 10:01:21 +00:00
if ( this . toolbar . btnChangeSlide ) {
if ( this . toolbar . btnChangeSlide . mnuSlidePicker )
this . toolbar . btnChangeSlide . mnuSlidePicker . options . layout _index = layout _index ;
else
this . toolbar . btnChangeSlide . mnuSlidePicker = { options : { layout _index : layout _index } } ;
}
2016-03-11 00:48:53 +00:00
} ,
onApiStyleChange : function ( v ) {
this . toolbar . btnCopyStyle . toggle ( v , true ) ;
this . modeAlwaysSetStyle = false ;
} ,
onApiUpdateThemeIndex : function ( v ) {
if ( this . _state . themeId !== v ) {
var listStyle = this . toolbar . listTheme ,
listStylesVisible = ( listStyle . rendered ) ;
if ( listStylesVisible ) {
listStyle . suspendEvents ( ) ;
var styleRec = listStyle . menuPicker . store . findWhere ( {
themeId : v
} ) ;
this . _state . themeId = ( listStyle . menuPicker . store . length > 0 ) ? v : undefined ;
listStyle . menuPicker . selectRecord ( styleRec ) ;
listStyle . resumeEvents ( ) ;
}
}
} ,
onApiCanGroup : function ( value ) {
if ( this . _state . can _group !== value ) {
this . toolbar . mnuGroupShapes . setDisabled ( ! value ) ;
if ( this . _state . activated ) this . _state . can _group = value ;
}
} ,
onApiCanUnGroup : function ( value ) {
if ( this . _state . can _ungroup !== value ) {
this . toolbar . mnuUnGroupShapes . setDisabled ( ! value ) ;
if ( this . _state . activated ) this . _state . can _ungroup = value ;
}
} ,
onApiLockDocumentProps : function ( ) {
if ( this . _state . lock _doc !== true ) {
this . toolbar . lockToolbar ( PE . enumLock . docPropsLock , true , { array : [ this . toolbar . btnSlideSize ] } ) ;
if ( this . _state . activated ) this . _state . lock _doc = true ;
}
} ,
onApiUnLockDocumentProps : function ( ) {
if ( this . _state . lock _doc !== false ) {
this . toolbar . lockToolbar ( PE . enumLock . docPropsLock , false , { array : [ this . toolbar . btnSlideSize ] } ) ;
if ( this . _state . activated ) this . _state . lock _doc = false ;
}
} ,
onApiLockDocumentTheme : function ( ) {
2017-04-11 11:05:56 +00:00
this . toolbar . lockToolbar ( PE . enumLock . themeLock , true , { array : [ this . toolbar . btnColorSchemas , this . toolbar . listTheme ] } ) ;
2016-03-11 00:48:53 +00:00
} ,
onApiUnLockDocumentTheme : function ( ) {
2017-04-11 11:05:56 +00:00
this . toolbar . lockToolbar ( PE . enumLock . themeLock , false , { array : [ this . toolbar . btnColorSchemas , this . toolbar . listTheme ] } ) ;
2016-03-11 00:48:53 +00:00
} ,
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 ;
} ,
2018-03-21 11:28:28 +00:00
onApiZoomChange : function ( percent , type ) { } ,
2016-03-11 00:48:53 +00:00
onApiInitEditorStyles : function ( themes ) {
if ( themes ) {
this . _onInitEditorThemes ( themes [ 0 ] , themes [ 1 ] ) ;
}
} ,
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' ) ;
} ,
2017-11-03 11:06:03 +00:00
onAddSlide : function ( type ) {
if ( this . api ) {
this . api . AddSlide ( type ) ;
2016-03-11 00:48:53 +00:00
2019-08-30 10:01:21 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
2016-03-11 00:48:53 +00:00
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Slide' ) ;
}
} ,
2021-09-22 19:37:15 +00:00
onDuplicateSlide : function ( ) {
if ( this . api ) {
this . api . DublicateSlide ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Duplicate Slide' ) ;
}
} ,
onDuplicateCheck : function ( menu ) {
if ( this . api )
menu . items [ 2 ] . setDisabled ( this . api . getCountPages ( ) < 1 ) ;
} ,
2019-08-30 10:01:21 +00:00
onChangeSlide : function ( type ) {
2016-03-11 00:48:53 +00:00
if ( this . api ) {
2019-08-30 10:01:21 +00:00
this . api . ChangeLayout ( type ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Change Layout' ) ;
}
} ,
2017-08-11 07:26:21 +00:00
onPreview : function ( slidenum , presenter ) {
Common . NotificationCenter . trigger ( 'preview:start' , _ . isNumber ( slidenum ) ? slidenum : 0 , presenter ) ;
2016-03-11 00:48:53 +00:00
} ,
2016-06-17 12:47:49 +00:00
onPreviewBtnClick : function ( btn , e ) {
this . onPreview ( this . api . getCurrentPage ( ) ) ;
} ,
onPreviewItemClick : function ( menu , item ) {
switch ( item . value ) {
case 0 :
this . onPreview ( 0 ) ;
break ;
case 1 :
this . onPreview ( this . api . getCurrentPage ( ) ) ;
break ;
case 2 :
2017-08-11 07:26:21 +00:00
this . onPreview ( 0 , true ) ;
break ;
case 3 :
2016-06-17 12:47:49 +00:00
var win ,
me = this ,
selectedElements = me . api . getSelectedElements ( ) ,
loop = false ;
if ( selectedElements && _ . isArray ( selectedElements ) ) {
for ( var i = 0 ; i < selectedElements . length ; i ++ ) {
if ( Asc . c _oAscTypeSelectElement . Slide == selectedElements [ i ] . get _ObjectType ( ) ) {
var elValue = selectedElements [ i ] . get _ObjectValue ( ) ,
2020-12-02 10:11:49 +00:00
transition = elValue . get _transition ( ) ;
if ( transition )
loop = transition . get _ShowLoop ( ) ;
2016-06-17 12:47:49 +00:00
}
}
}
var handlerDlg = function ( dlg , result ) {
if ( result == 'ok' ) {
loop = dlg . getSettings ( ) ;
if ( me . api ) {
var props = new Asc . CAscSlideProps ( ) ;
2020-12-02 10:11:49 +00:00
var transition = new Asc . CAscSlideTransition ( ) ;
transition . put _ShowLoop ( loop ) ;
props . put _transition ( transition ) ;
2016-06-17 12:47:49 +00:00
me . api . SetSlideProps ( props ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} ;
win = new PE . Views . SlideshowSettings ( {
handler : handlerDlg
} ) ;
win . show ( ) ;
win . setSettings ( loop ) ;
break ;
}
} ,
2016-03-11 00:48:53 +00:00
onPrint : function ( e ) {
if ( this . api )
2021-04-20 15:46:41 +00:00
this . api . asc _Print ( new Asc . asc _CDownloadOptions ( null , Common . Utils . isChrome || Common . Utils . isSafari || Common . Utils . isOpera || Common . Utils . isGecko && Common . Utils . firefoxVersion > 86 ) ) ; // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'Print' ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Print' ) ;
} ,
onSave : function ( e ) {
2017-09-05 07:54:44 +00:00
var toolbar = this . toolbar ;
2016-03-11 00:48:53 +00:00
if ( this . api && this . api . asc _isDocumentCanSave ) {
var isModified = this . api . asc _isDocumentCanSave ( ) ;
2019-11-20 09:42:39 +00:00
var isSyncButton = toolbar . btnCollabChanges && toolbar . btnCollabChanges . cmpEl . hasClass ( 'notify' ) ;
2017-04-11 11:05:56 +00:00
if ( ! isModified && ! isSyncButton && ! this . toolbar . mode . forcesave )
2016-03-11 00:48:53 +00:00
return ;
this . api . asc _Save ( ) ;
}
2018-04-23 12:21:52 +00:00
toolbar . btnSave . setDisabled ( ! toolbar . mode . forcesave ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
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-21 09:56:11 +00:00
if ( ! Common . localStorage . getBool ( "pe-hide-copywarning" ) ) {
2016-03-11 00:48:53 +00:00
( new Common . Views . CopyWarningDialog ( {
handler : function ( dontshow ) {
if ( dontshow ) Common . localStorage . setItem ( "pe-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
} ,
2020-11-27 21:23:26 +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' ) ;
} ,
2016-03-11 00:48:53 +00:00
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' ) ;
} ,
2021-01-29 13:06:51 +00:00
onChangeCase : function ( menu , item , e ) {
if ( this . api )
this . api . asc _ChangeTextCase ( item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
2021-01-29 14:31:46 +00:00
2016-03-11 00:48:53 +00:00
onMenuHorizontalAlignSelect : function ( menu , item ) {
this . _state . pralign = undefined ;
2018-02-26 13:23:07 +00:00
var btnHorizontalAlign = this . toolbar . btnHorizontalAlign ;
2016-03-11 00:48:53 +00:00
2018-02-26 13:23:07 +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' ) ;
} ,
onMenuVerticalAlignSelect : function ( menu , item ) {
2018-02-26 13:23:07 +00:00
var btnVerticalAlign = this . toolbar . btnVerticalAlign ;
2016-03-11 00:48:53 +00:00
2018-02-26 13:23:07 +00:00
btnVerticalAlign . $icon . removeClass ( btnVerticalAlign . options . icls ) ;
btnVerticalAlign . options . icls = ! item . checked ? 'btn-align-middle' : item . options . icls ;
btnVerticalAlign . $icon . addClass ( btnVerticalAlign . options . icls ) ;
2016-03-11 00:48:53 +00:00
this . _state . vtextalign = undefined ;
if ( this . api && item . checked )
this . api . setVerticalAlign ( item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Vertical 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 ) ;
} ,
2019-10-31 10:57:03 +00:00
onMarkerSettingsClick : function ( type ) {
2019-10-30 11:01:02 +00:00
var me = this ,
props ;
var selectedElements = me . api . getSelectedElements ( ) ;
if ( selectedElements && _ . isArray ( selectedElements ) ) {
for ( var i = 0 ; i < selectedElements . length ; i ++ ) {
if ( Asc . c _oAscTypeSelectElement . Paragraph == selectedElements [ i ] . get _ObjectType ( ) ) {
props = selectedElements [ i ] . get _ObjectValue ( ) ;
break ;
}
}
}
if ( props ) {
2019-11-07 10:37:14 +00:00
( new Common . Views . ListSettingsDialog ( {
2019-11-19 14:05:02 +00:00
api : me . api ,
2019-10-30 11:01:02 +00:00
props : props ,
2019-10-31 10:57:03 +00:00
type : type ,
2019-11-19 14:05:02 +00:00
interfaceLang : me . toolbar . mode . lang ,
2019-10-30 11:01:02 +00:00
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
2020-06-26 11:02:09 +00:00
props . asc _putBullet ( value ) ;
me . api . paraApply ( props ) ;
2019-10-30 11:01:02 +00:00
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
}
} ) ) . show ( ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onComboBlur : function ( ) {
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
onFontNameSelect : function ( combo , record ) {
if ( this . api ) {
if ( record . isNewFont ) {
2020-04-22 09:35:55 +00:00
! Common . Utils . ModalWindow . isVisible ( ) &&
2016-03-11 00:48:53 +00:00
Common . UI . warning ( {
width : 500 ,
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 ) {
2020-03-31 13:49:33 +00:00
value = /^\+?(\d*(\.|,).?\d+)$|^\+?(\d+(\.|,)?\d*)$/ . exec ( record . value ) ;
2016-03-11 00:48:53 +00:00
if ( ! value ) {
value = this . _getApiTextSize ( ) ;
Common . UI . warning ( {
msg : this . textFontSizeErr ,
callback : function ( ) {
_ . defer ( function ( btn ) {
$ ( 'input' , combo . cmpEl ) . focus ( ) ;
} )
}
} ) ;
combo . setRawValue ( value ) ;
e . preventDefault ( ) ;
return false ;
}
}
} else {
2020-03-31 13:49:33 +00:00
value = Common . Utils . String . parseFloat ( record . value ) ;
2016-03-11 00:48:53 +00:00
value = value > 300 ? 300 :
value < 1 ? 1 : Math . floor ( ( value + 0.4 ) * 2 ) / 2 ;
combo . setRawValue ( value ) ;
this . _state . fontsize = undefined ;
if ( this . api ) {
this . api . put _TextPrFontSize ( value ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
}
} ,
2021-04-02 20:04:37 +00:00
onListShowAfter : function ( type , picker ) {
var store = picker . store ;
var arr = [ ] ;
store . each ( function ( item ) {
arr . push ( item . get ( 'id' ) ) ;
} ) ;
if ( this . api && this . api . SetDrawImagePreviewBulletForMenu ) {
this . api . SetDrawImagePreviewBulletForMenu ( arr , type ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onSelectBullets : function ( btn , picker , itemView , record ) {
var rawData = { } ,
isPickerSelect = _ . isFunction ( record . toJSON ) ;
if ( isPickerSelect ) {
if ( record . get ( 'selected' ) ) {
rawData = record . toJSON ( ) ;
} else {
// record deselected
return ;
}
} else {
rawData = record ;
}
if ( btn ) {
btn . toggle ( rawData . data . subtype > - 1 , true ) ;
}
if ( this . api )
this . api . put _ListType ( rawData . data . type , rawData . data . subtype ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'List Type' ) ;
} ,
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 . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Line Spacing' ) ;
}
} ,
2021-01-12 20:01:55 +00:00
onColumnsSelect : function ( menu , item ) {
if ( _ . isUndefined ( item . value ) )
return ;
this . _state . columns = undefined ;
if ( this . api ) {
if ( item . value == 'advanced' ) {
var win ,
me = this ;
var selectedElements = me . api . getSelectedElements ( ) ;
if ( selectedElements && selectedElements . length > 0 ) {
var elType , elValue ;
for ( var i = selectedElements . length - 1 ; i >= 0 ; i -- ) {
elType = selectedElements [ i ] . get _ObjectType ( ) ;
elValue = selectedElements [ i ] . get _ObjectValue ( ) ;
if ( Asc . c _oAscTypeSelectElement . Shape == elType ) {
var win = new PE . Views . ShapeSettingsAdvanced (
{
shapeProps : elValue ,
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
me . api . ShapeApply ( value . shapeProps ) ;
}
}
me . fireEvent ( 'editcomplete' , me ) ;
}
} ) ;
win . show ( ) ;
win . setActiveCategory ( 4 ) ;
break ;
}
}
}
} else if ( item . checked ) {
var props = new Asc . asc _CShapeProperty ( ) ,
cols = item . value ;
props . asc _putColumnNumber ( cols + 1 ) ;
this . api . ShapeApply ( props ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Insert Columns' ) ;
} ,
onBeforeColumns : function ( ) {
var index = - 1 ;
var selectedElements = this . api . getSelectedElements ( ) ;
if ( selectedElements && selectedElements . length > 0 ) {
var elType , elValue ;
for ( var i = selectedElements . length - 1 ; i >= 0 ; i -- ) {
if ( Asc . c _oAscTypeSelectElement . Shape == selectedElements [ i ] . get _ObjectType ( ) ) {
var value = selectedElements [ i ] . get _ObjectValue ( ) . asc _getColumnNumber ( ) ;
if ( value < 4 )
index = value - 1 ;
break ;
}
}
}
if ( this . _state . columns === index )
return ;
if ( index < 0 )
this . toolbar . btnColumns . menu . clearAll ( ) ;
else
this . toolbar . btnColumns . menu . items [ index ] . setChecked ( true ) ;
this . _state . columns = index ;
} ,
2019-02-11 08:39:27 +00:00
onBeforeShapeAlign : function ( ) {
var value = this . api . asc _getSelectedDrawingObjectsCount ( ) ,
slide _checked = Common . Utils . InternalSettings . get ( "pe-align-to-slide" ) || false ;
this . toolbar . mniAlignObjects . setDisabled ( value < 2 ) ;
this . toolbar . mniAlignObjects . setChecked ( value > 1 && ! slide _checked , true ) ;
this . toolbar . mniAlignToSlide . setChecked ( value < 2 || slide _checked , true ) ;
2019-02-11 10:16:24 +00:00
this . toolbar . mniDistribHor . setDisabled ( value < 3 && this . toolbar . mniAlignObjects . isChecked ( ) ) ;
this . toolbar . mniDistribVert . setDisabled ( value < 3 && this . toolbar . mniAlignObjects . isChecked ( ) ) ;
2019-02-11 08:39:27 +00:00
} ,
2016-03-11 00:48:53 +00:00
onShapeAlign : function ( menu , item ) {
if ( this . api ) {
2019-02-11 08:39:27 +00:00
var value = this . toolbar . mniAlignToSlide . isChecked ( ) ? Asc . c _oAscObjectsAlignType . Slide : Asc . c _oAscObjectsAlignType . Selected ;
if ( item . value > - 1 && item . value < 6 ) {
this . api . put _ShapesAlign ( item . value , value ) ;
2016-03-11 00:48:53 +00:00
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Shape Align' ) ;
} else if ( item . value == 6 ) {
2019-02-11 08:39:27 +00:00
this . api . DistributeHorizontally ( value ) ;
2016-03-11 00:48:53 +00:00
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Distribute' ) ;
2019-02-11 08:39:27 +00:00
} else if ( item . value == 7 ) {
this . api . DistributeVertically ( value ) ;
2016-03-11 00:48:53 +00:00
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Distribute' ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
}
} ,
onShapeArrange : function ( menu , item ) {
if ( this . api ) {
switch ( item . value ) {
case 1 :
this . api . shapes _bringToFront ( ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Shape Arrange' ) ;
break ;
case 2 :
this . api . shapes _bringToBack ( ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Shape Arrange' ) ;
break ;
case 3 :
this . api . shapes _bringForward ( ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Shape Arrange' ) ;
break ;
case 4 :
this . api . shapes _bringBackward ( ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Shape Arrange' ) ;
break ;
case 5 :
this . api . groupShapes ( ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Shape Group' ) ;
break ;
case 6 :
this . api . unGroupShapes ( ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Shape UnGroup' ) ;
break ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
}
} ,
onHyperlinkClick : function ( btn ) {
var me = this ,
win , props , text ;
if ( me . api ) {
var handlerDlg = function ( dlg , result ) {
if ( result == 'ok' ) {
props = dlg . getSettings ( ) ;
( text !== false )
? me . api . add _Hyperlink ( props )
: me . api . change _Hyperlink ( props ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} ;
text = me . api . can _AddHyperlink ( ) ;
2020-03-17 07:54:47 +00:00
var _arr = [ ] ;
for ( var i = 0 ; i < me . api . getCountPages ( ) ; i ++ ) {
_arr . push ( {
displayValue : i + 1 ,
value : i
} ) ;
}
2016-03-11 00:48:53 +00:00
if ( text !== false ) {
2020-03-17 07:54:47 +00:00
props = new Asc . CHyperlinkProperty ( ) ;
props . put _Text ( text ) ;
} else {
var selectedElements = me . api . getSelectedElements ( ) ;
if ( selectedElements && _ . isArray ( selectedElements ) ) {
_ . each ( selectedElements , function ( el , i ) {
if ( selectedElements [ i ] . get _ObjectType ( ) == Asc . c _oAscTypeSelectElement . Hyperlink )
props = selectedElements [ i ] . get _ObjectValue ( ) ;
2016-03-11 00:48:53 +00:00
} ) ;
}
2020-03-17 07:54:47 +00:00
}
if ( props ) {
2016-03-11 00:48:53 +00:00
win = new PE . Views . HyperlinkSettingsDialog ( {
api : me . api ,
handler : handlerDlg ,
slides : _arr
} ) ;
win . show ( ) ;
win . setSettings ( props ) ;
}
}
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Hyperlink' ) ;
} ,
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 ( ) ;
}
} ,
2017-04-20 13:34:39 +00:00
onInsertImageClick : function ( opts , e ) {
var me = this ;
if ( opts === 'file' ) {
me . toolbar . fireEvent ( 'insertimage' , this . toolbar ) ;
2016-03-11 00:48:53 +00:00
2021-05-11 12:24:53 +00:00
setTimeout ( function ( ) { me . api . asc _addImage ( ) ; } , 1 ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Image' ) ;
2018-10-03 11:00:08 +00:00
} else if ( opts === 'url' ) {
2016-03-11 00:48:53 +00:00
( new Common . Views . ImageFromUrlDialog ( {
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
var checkUrl = value . replace ( / /g , '' ) ;
if ( ! _ . isEmpty ( checkUrl ) ) {
me . toolbar . fireEvent ( 'insertimage' , me . toolbar ) ;
2021-08-26 12:14:29 +00:00
me . api . AddImageUrl ( [ checkUrl ] ) ;
2016-03-11 00:48:53 +00:00
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Image' ) ;
} else {
Common . UI . warning ( {
msg : this . textEmptyImgUrl
} ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
}
}
} ) ) . show ( ) ;
2018-10-03 11:00:08 +00:00
} else if ( opts === 'storage' ) {
2020-05-13 14:20:58 +00:00
Common . NotificationCenter . trigger ( 'storage:image-load' , 'add' ) ;
2019-07-26 11:49:53 +00:00
}
} ,
2020-05-13 14:20:58 +00:00
openImageFromStorage : function ( type ) {
var me = this ;
if ( this . toolbar . mode . canRequestInsertImage ) {
Common . Gateway . requestInsertImage ( type ) ;
} else {
( new Common . Views . SelectFileDlg ( {
fileChoiceUrl : this . toolbar . mode . fileChoiceUrl . replace ( "{fileExt}" , "" ) . replace ( "{documentType}" , "ImagesOnly" )
} ) ) . on ( 'selectfile' , function ( obj , file ) {
file && ( file . c = type ) ;
2021-10-04 16:29:27 +00:00
! file . images && ( file . images = [ { fileType : file . fileType , url : file . url } ] ) ; // SelectFileDlg uses old format for inserting image
file . url = null ;
2020-05-13 14:20:58 +00:00
me . insertImage ( file ) ;
} ) . show ( ) ;
}
} ,
insertImageFromStorage : function ( data ) {
2021-08-27 11:07:50 +00:00
if ( data && data . _urls && ( ! data . c || data . c == 'add' ) ) {
2019-07-26 11:49:53 +00:00
this . toolbar . fireEvent ( 'insertimage' , this . toolbar ) ;
2021-08-27 11:07:50 +00:00
( data . _urls . length > 0 ) && this . api . AddImageUrl ( data . _urls , undefined , data . token ) ; // for loading from storage
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Image' ) ;
}
} ,
insertImage : function ( data ) { // gateway
if ( data && ( data . url || data . images ) ) {
2021-08-30 21:12:45 +00:00
data . url && console . log ( "Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead." ) ;
2021-08-26 12:14:29 +00:00
var arr = [ ] ;
if ( data . images && data . images . length > 0 ) {
for ( var i = 0 ; i < data . images . length ; i ++ ) {
data . images [ i ] && data . images [ i ] . url && arr . push ( data . images [ i ] . url ) ;
}
} else
data . url && arr . push ( data . url ) ;
2021-08-27 11:07:50 +00:00
data . _urls = arr ;
2016-03-11 00:48:53 +00:00
}
2020-05-13 14:20:58 +00:00
Common . NotificationCenter . trigger ( 'storage:image-insert' , data ) ;
} ,
2017-04-20 13:34:39 +00:00
onInsertText : function ( status ) {
if ( status == 'begin' ) {
this . _addAutoshape ( true , 'textRect' ) ;
2016-03-11 00:48:53 +00:00
2017-10-26 08:14:53 +00:00
if ( ! this . toolbar . btnsInsertText . pressed ( ) )
2017-04-20 13:34:39 +00:00
this . toolbar . btnsInsertText . toggle ( true , true ) ;
} else
this . _addAutoshape ( false , 'textRect' ) ;
2016-03-11 00:48:53 +00:00
2017-10-26 08:14:53 +00:00
if ( this . toolbar . btnsInsertShape . pressed ( ) )
2017-04-20 13:34:39 +00:00
this . toolbar . btnsInsertShape . toggle ( false , true ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
2016-03-11 00:48:53 +00:00
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Text' ) ;
} ,
2017-04-20 13:34:39 +00:00
onInsertShape : function ( type ) {
var me = this ;
if ( type == 'menu:hide' ) {
2017-10-26 08:14:53 +00:00
if ( me . toolbar . btnsInsertShape . pressed ( ) && ! me . _isAddingShape ) {
2017-04-20 13:34:39 +00:00
me . toolbar . btnsInsertShape . toggle ( false , true ) ;
}
me . _isAddingShape = false ;
2016-03-11 00:48:53 +00:00
2017-04-20 13:34:39 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} else {
me . _addAutoshape ( true , type ) ;
me . _isAddingShape = true ;
2016-03-11 00:48:53 +00:00
2017-10-26 08:14:53 +00:00
if ( me . toolbar . btnsInsertText . pressed ( ) )
2017-04-20 13:34:39 +00:00
me . toolbar . btnsInsertText . toggle ( false , true ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Shape' ) ;
2016-03-11 00:48:53 +00:00
}
} ,
2017-04-20 13:34:39 +00:00
onInsertTextart : function ( data ) {
var me = this ;
me . toolbar . fireEvent ( 'inserttextart' , me . toolbar ) ;
me . api . AddTextArt ( data ) ;
2017-10-26 08:14:53 +00:00
if ( me . toolbar . btnsInsertShape . pressed ( ) )
2017-04-20 13:34:39 +00:00
me . toolbar . btnsInsertShape . toggle ( false , true ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Text Art' ) ;
2016-03-11 00:48:53 +00:00
} ,
2019-06-26 15:38:04 +00:00
onEditHeaderClick : function ( type , e ) {
var selectedElements = this . api . getSelectedElements ( ) ,
in _text = false ;
for ( var i = 0 ; i < selectedElements . length ; i ++ ) {
if ( selectedElements [ i ] . get _ObjectType ( ) == Asc . c _oAscTypeSelectElement . Paragraph ) {
in _text = true ;
break ;
}
}
if ( in _text && type == 'slidenum' ) {
this . api . asc _addSlideNumber ( ) ;
} else if ( in _text && type == 'datetime' ) {
//insert date time
2019-06-27 11:59:12 +00:00
var me = this ;
( new PE . Views . DateTimeDialog ( {
api : this . api ,
lang : this . _state . lang ,
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
me . api . asc _addDateTime ( value ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
}
} ) ) . show ( ) ;
2019-06-26 15:38:04 +00:00
} else {
2019-07-09 14:03:25 +00:00
//edit header/footer
var me = this ;
( new PE . Views . HeaderFooterDialog ( {
api : this . api ,
lang : this . api . asc _getDefaultLanguage ( ) ,
props : this . api . asc _getHeaderFooterProperties ( ) ,
handler : function ( result , value ) {
if ( result == 'ok' || result == 'all' ) {
if ( me . api ) {
me . api . asc _setHeaderFooterProperties ( value , result == 'all' ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
}
} ) ) . show ( ) ;
2019-06-26 15:38:04 +00:00
}
} ,
2016-03-11 00:48:53 +00:00
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 ;
} ,
onColorSchemaClick : function ( menu , item ) {
if ( this . api ) {
2019-12-19 08:00:49 +00:00
this . api . asc _ChangeColorSchemeByIdx ( item . value ) ;
2016-03-11 00:48:53 +00:00
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Color Scheme' ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
2019-08-20 12:56:29 +00:00
onColorSchemaShow : function ( menu ) {
if ( this . api ) {
2019-12-19 08:00:49 +00:00
var value = this . api . asc _GetCurrentColorSchemeIndex ( ) ;
2019-08-20 12:56:29 +00:00
var item = _ . find ( menu . items , function ( item ) { return item . value == value ; } ) ;
( item ) ? item . setChecked ( true ) : menu . clearAll ( ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onSlideSize : function ( menu , item ) {
if ( item . value !== 'advanced' ) {
2021-02-16 14:05:47 +00:00
var newwidth = ( this . currentPageSize . height / this . slideSizeArr [ item . value ] . ratio ) ;
2016-03-11 00:48:53 +00:00
this . currentPageSize = {
2021-02-15 17:10:46 +00:00
type : this . slideSizeArr [ item . value ] . type ,
2021-02-16 14:05:47 +00:00
width : newwidth ,
height : this . currentPageSize . height
2016-03-11 00:48:53 +00:00
} ;
if ( this . api )
2021-02-15 17:10:46 +00:00
this . api . changeSlideSize ( this . currentPageSize . width , this . currentPageSize . height , this . currentPageSize . type ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Slide Size' ) ;
} else {
var win , props ,
me = this ;
var handlerDlg = function ( dlg , result ) {
if ( result == 'ok' ) {
props = dlg . getSettings ( ) ;
me . currentPageSize = { type : props [ 0 ] , width : props [ 1 ] , height : props [ 2 ] } ;
2021-02-16 14:05:47 +00:00
var ratio = me . currentPageSize . height / me . currentPageSize . width ,
2021-02-15 17:10:46 +00:00
idx = - 1 ;
for ( var i = 0 ; i < me . slideSizeArr . length ; i ++ ) {
if ( Math . abs ( me . slideSizeArr [ i ] . ratio - ratio ) < 0.001 ) {
idx = i ;
break ;
}
}
me . toolbar . btnSlideSize . menu . items [ 0 ] . setChecked ( idx == 0 ) ;
me . toolbar . btnSlideSize . menu . items [ 1 ] . setChecked ( idx == 1 ) ;
2016-03-11 00:48:53 +00:00
if ( me . api )
2021-02-15 17:10:46 +00:00
me . api . changeSlideSize ( props [ 1 ] , props [ 2 ] , props [ 0 ] ) ;
2016-03-11 00:48:53 +00:00
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} ;
win = new PE . Views . SlideSizeSettings ( {
handler : handlerDlg
} ) ;
win . show ( ) ;
win . setSettings ( me . currentPageSize . type , me . currentPageSize . width , me . currentPageSize . height ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Slide Size' ) ;
}
} ,
2019-09-02 09:52:14 +00:00
onSelectChart : function ( type ) {
2016-03-11 00:48:53 +00:00
var me = this ,
2016-12-16 11:33:38 +00:00
chart = false ;
var selectedElements = me . api . getSelectedElements ( ) ;
if ( selectedElements && _ . isArray ( selectedElements ) ) {
for ( var i = 0 ; i < selectedElements . length ; i ++ ) {
if ( Asc . c _oAscTypeSelectElement . Chart == selectedElements [ i ] . get _ObjectType ( ) ) {
2020-12-08 08:48:28 +00:00
chart = selectedElements [ i ] . get _ObjectValue ( ) ;
2016-12-16 11:33:38 +00:00
break ;
}
}
}
2016-03-11 00:48:53 +00:00
2016-12-16 11:33:38 +00:00
if ( chart ) {
2020-12-08 08:48:28 +00:00
var isCombo = ( type == Asc . c _oAscChartTypeSettings . comboBarLine || type == Asc . c _oAscChartTypeSettings . comboBarLineSecondary ||
type == Asc . c _oAscChartTypeSettings . comboAreaBar || type == Asc . c _oAscChartTypeSettings . comboCustom ) ;
if ( isCombo && chart . get _ChartProperties ( ) && chart . get _ChartProperties ( ) . getSeries ( ) . length < 2 ) {
Common . NotificationCenter . trigger ( 'showerror' , Asc . c _oAscError . ID . ComboSeriesError , Asc . c _oAscError . Level . NoCritical ) ;
} else
chart . changeType ( type ) ;
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 ( ) ;
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
}
}
} ,
onListThemeSelect : function ( combo , record ) {
this . _state . themeId = undefined ;
2017-10-24 12:59:18 +00:00
if ( this . api && record )
2016-03-11 00:48:53 +00:00
this . api . ChangeTheme ( record . get ( 'themeId' ) ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Style' ) ;
} ,
_clearBullets : function ( ) {
this . toolbar . btnMarkers . toggle ( false , true ) ;
this . toolbar . btnNumbers . toggle ( false , true ) ;
this . toolbar . mnuMarkersPicker . selectByIndex ( 0 , true ) ;
this . toolbar . mnuNumbersPicker . 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 ;
} ,
2021-07-10 23:25:12 +00:00
onSelectFontColor : function ( btn , color ) {
2016-03-11 00:48:53 +00:00
this . _state . clrtext = this . _state . clrtext _asccolor = undefined ;
this . toolbar . btnFontColor . currentColor = color ;
2021-01-21 19:48:27 +00:00
this . toolbar . btnFontColor . setColor ( ( typeof ( color ) == 'object' ) ? color . color : color ) ;
2016-03-11 00:48:53 +00:00
this . toolbar . mnuFontColorPicker . currentColor = color ;
if ( this . api )
this . api . put _TextColor ( Common . Utils . ThemeColor . getRgbColor ( color ) ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Text Color' ) ;
} ,
onBtnFontColor : function ( ) {
this . toolbar . mnuFontColorPicker . trigger ( 'select' , this . toolbar . mnuFontColorPicker , this . toolbar . mnuFontColorPicker . currentColor ) ;
} ,
onApiTextColor : function ( color ) {
var clr ;
var picker = this . toolbar . mnuFontColorPicker ;
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 ( ) ) ;
}
var type1 = typeof ( clr ) ,
type2 = typeof ( this . _state . clrtext ) ;
if ( ( 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 ) ) {
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 ;
} ,
2021-01-29 14:31:46 +00:00
onApiStartHighlight : function ( pressed ) {
this . toolbar . btnHighlightColor . toggle ( pressed , true ) ;
} ,
onApiHighlightColor : function ( c ) {
if ( c ) {
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 ;
}
}
}
} ,
_setMarkerColor : function ( strcolor , h ) {
var me = this ;
if ( h === 'menu' ) {
2021-07-10 19:54:51 +00:00
me . _state . clrhighlight = undefined ;
me . onApiHighlightColor ( ) ;
2021-01-29 14:31:46 +00:00
me . toolbar . btnHighlightColor . currentColor = strcolor ;
me . toolbar . btnHighlightColor . setColor ( me . toolbar . btnHighlightColor . currentColor ) ;
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 ) ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar , me . toolbar . btnHighlightColor ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Highlight Color' ) ;
} ,
onBtnHighlightColor : function ( btn ) {
if ( btn . pressed ) {
this . _setMarkerColor ( btn . currentColor ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Highlight Color' ) ;
}
else {
this . api . SetMarkerFormat ( false ) ;
}
} ,
onSelectHighlightColor : function ( picker , color ) {
this . _setMarkerColor ( color , 'menu' ) ;
} ,
onHighlightTransparentClick : function ( item , e ) {
this . _setMarkerColor ( 'transparent' , 'menu' ) ;
} ,
2017-04-20 13:34:39 +00:00
onResetAutoshapes : function ( ) {
2021-10-08 15:21:56 +00:00
var me = this ,
collection = PE . getCollection ( 'ShapeGroups' ) ;
2019-08-20 11:05:13 +00:00
var onShowBefore = function ( menu ) {
2021-10-08 15:21:56 +00:00
me . toolbar . updateAutoshapeMenu ( menu , collection ) ;
2019-08-20 11:05:13 +00:00
menu . off ( 'show:before' , onShowBefore ) ;
} ;
me . toolbar . btnsInsertShape . forEach ( function ( btn , index ) {
btn . menu . on ( 'show:before' , onShowBefore ) ;
} ) ;
2021-10-08 15:21:56 +00:00
var onComboShowBefore = function ( menu ) {
me . toolbar . updateComboAutoshapeMenu ( collection ) ;
menu . off ( 'show:before' , onComboShowBefore ) ;
}
me . toolbar . cmbInsertShape . openButton . menu . on ( 'show:before' , onComboShowBefore ) ;
me . toolbar . cmbInsertShape . fillComboView ( collection ) ;
2021-10-12 10:58:11 +00:00
me . toolbar . cmbInsertShape . on ( 'click' , function ( btn , record , cancel ) {
if ( cancel ) {
me . _addAutoshape ( false ) ;
return ;
}
2021-10-10 22:44:40 +00:00
if ( record ) {
me . toolbar . cmbInsertShape . updateComboView ( record ) ;
me . onInsertShape ( record . get ( 'data' ) . shapeType ) ;
}
} ) ;
2016-03-11 00:48:53 +00:00
} ,
2017-11-03 11:06:03 +00:00
onResetSlides : function ( ) {
setTimeout ( function ( ) {
this . toolbar . updateAddSlideMenu ( PE . getCollection ( 'SlideLayouts' ) ) ;
} . bind ( this ) , 0 ) ;
} ,
2016-10-25 10:48:31 +00:00
fillEquations : function ( ) {
if ( ! this . toolbar . btnInsertEquation . rendered || this . toolbar . btnInsertEquation . menu . items . length > 0 ) return ;
var me = this , equationsStore = this . getApplication ( ) . getCollection ( 'EquationGroups' ) ;
me . toolbar . btnInsertEquation . menu . removeAll ( ) ;
2019-08-15 14:09:26 +00:00
var onShowAfter = function ( menu ) {
for ( var i = 0 ; i < equationsStore . length ; ++ i ) {
var equationPicker = new Common . UI . DataViewSimple ( {
el : $ ( '#id-toolbar-menu-equationgroup' + i ) ,
parentMenu : menu . items [ i ] . menu ,
store : equationsStore . at ( i ) . get ( 'groupStore' ) ,
scrollAlwaysVisible : true ,
2021-01-18 09:19:38 +00:00
itemTemplate : _ . template (
'<div class="item-equation">' +
'<div class="equation-icon" style="background-position:<%= posX %>px <%= posY %>px;width:<%= width %>px;height:<%= height %>px;" id="<%= id %>"></div>' +
2019-08-15 14:09:26 +00:00
'</div>' )
} ) ;
equationPicker . on ( 'item:click' , function ( picker , item , record , e ) {
if ( me . api ) {
if ( record )
me . api . asc _AddMath ( record . get ( 'data' ) . equationType ) ;
if ( me . toolbar . btnsInsertText . pressed ( ) ) {
me . toolbar . btnsInsertText . toggle ( false , true ) ;
}
if ( me . toolbar . btnsInsertShape . pressed ( ) ) {
me . toolbar . btnsInsertShape . toggle ( false , true ) ;
}
if ( e . type !== 'click' )
me . toolbar . btnInsertEquation . menu . hide ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar , me . toolbar . btnInsertEquation ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Equation' ) ;
}
} ) ;
}
2019-08-20 08:05:52 +00:00
menu . off ( 'show:after' , onShowAfter ) ;
2019-08-15 14:09:26 +00:00
} ;
me . toolbar . btnInsertEquation . menu . on ( 'show:after' , onShowAfter ) ;
2016-10-25 10:48:31 +00:00
for ( var i = 0 ; i < equationsStore . length ; ++ i ) {
var equationGroup = equationsStore . at ( i ) ;
var menuItem = new Common . UI . MenuItem ( {
caption : equationGroup . get ( 'groupName' ) ,
menu : new Common . UI . Menu ( {
menuAlign : 'tl-tr' ,
items : [
{ template : _ . template ( '<div id="id-toolbar-menu-equationgroup' + i +
'" class="menu-shape" style="width:' + ( equationGroup . get ( 'groupWidth' ) + 8 ) + 'px; ' +
equationGroup . get ( 'groupHeight' ) + 'margin-left:5px;"></div>' ) }
]
} )
} ) ;
me . toolbar . btnInsertEquation . menu . addItem ( menuItem ) ;
}
} ,
onInsertEquationClick : function ( ) {
if ( this . api ) {
this . api . asc _AddMath ( ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Equation' ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , this . toolbar . btnInsertEquation ) ;
} ,
2019-11-14 08:48:58 +00:00
onInsertSymbolClick : function ( ) {
if ( this . api ) {
var me = this ,
2020-10-05 14:32:18 +00:00
selected = me . api . asc _GetSelectedText ( ) ,
2019-11-14 08:48:58 +00:00
win = new Common . Views . SymbolTableDialog ( {
api : me . api ,
lang : me . toolbar . mode . lang ,
type : 1 ,
2020-04-02 13:14:45 +00:00
special : true ,
2019-11-14 08:48:58 +00:00
buttons : [ { value : 'ok' , caption : this . textInsert } , 'close' ] ,
2020-10-05 14:32:18 +00:00
font : selected && selected . length > 0 ? me . api . get _TextProps ( ) . get _TextPr ( ) . get _FontFamily ( ) . get _Name ( ) : undefined ,
symbol : selected && selected . length > 0 ? selected . charAt ( 0 ) : undefined ,
2019-11-14 08:48:58 +00:00
handler : function ( dlg , result , settings ) {
if ( result == 'ok' ) {
2020-08-27 15:54:14 +00:00
me . api . asc _insertSymbol ( settings . font ? settings . font : me . api . get _TextProps ( ) . get _TextPr ( ) . get _FontFamily ( ) . get _Name ( ) , settings . code , settings . special ) ;
2019-11-14 08:48:58 +00:00
} else
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
}
} ) ;
win . show ( ) ;
2019-11-15 13:57:55 +00:00
win . on ( 'symbol:dblclick' , function ( cmp , result , settings ) {
2020-08-27 15:54:14 +00:00
me . api . asc _insertSymbol ( settings . font ? settings . font : me . api . get _TextProps ( ) . get _TextPr ( ) . get _FontFamily ( ) . get _Name ( ) , settings . code , settings . special ) ;
2019-11-14 08:48:58 +00:00
} ) ;
}
} ,
2019-08-15 14:09:26 +00:00
onApiMathTypes : function ( equation ) {
this . _equationTemp = equation ;
var me = this ;
var onShowBefore = function ( menu ) {
me . onMathTypes ( me . _equationTemp ) ;
me . toolbar . btnInsertEquation . menu . off ( 'show:before' , onShowBefore ) ;
} ;
me . toolbar . btnInsertEquation . menu . on ( 'show:before' , onShowBefore ) ;
} ,
2016-10-25 10:48:31 +00:00
onMathTypes : function ( equation ) {
var equationgrouparray = [ ] ,
equationsStore = this . getCollection ( 'EquationGroups' ) ;
equationsStore . reset ( ) ;
// equations groups
var c _oAscMathMainTypeStrings = { } ;
// [translate, count cells, scroll]
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 ] ;
// equations sub groups
// equations types
var translationTable = { } , name = '' , translate = '' ;
for ( name in Common . define . c _oAscMathType ) {
if ( Common . define . c _oAscMathType . hasOwnProperty ( name ) ) {
var arr = name . split ( '_' ) ;
if ( arr . length == 2 && arr [ 0 ] == 'Symbol' ) {
translate = 'txt' + arr [ 0 ] + '_' + arr [ 1 ] . toLocaleLowerCase ( ) ;
} else
translate = 'txt' + name ;
translationTable [ Common . define . c _oAscMathType [ name ] ] = this [ translate ] ;
}
}
2019-08-15 14:09:26 +00:00
var i , id = 0 , count = 0 , length = 0 , width = 0 , height = 0 , store = null , list = null , eqStore = null , eq = null , data ;
2016-10-25 10:48:31 +00:00
if ( equation ) {
2019-08-15 14:09:26 +00:00
data = equation . get _Data ( ) ;
count = data . length ;
2016-10-25 10:48:31 +00:00
if ( count ) {
for ( var j = 0 ; j < count ; ++ j ) {
2019-08-15 14:09:26 +00:00
var group = data [ j ] ;
id = group . get _Id ( ) ;
width = group . get _W ( ) ;
height = group . get _H ( ) ;
2016-10-25 10:48:31 +00:00
store = new Backbone . Collection ( [ ] , {
model : PE . Models . EquationModel
} ) ;
if ( store ) {
2019-08-15 14:09:26 +00:00
var allItemsCount = 0 , itemsCount = 0 , ids = 0 , arr = [ ] ;
length = group . get _Data ( ) . length ;
2016-10-25 10:48:31 +00:00
for ( i = 0 ; i < length ; ++ i ) {
2019-08-15 14:09:26 +00:00
eqStore = group . get _Data ( ) [ i ] ;
2016-10-25 10:48:31 +00:00
itemsCount = eqStore . get _Data ( ) . length ;
for ( var p = 0 ; p < itemsCount ; ++ p ) {
eq = eqStore . get _Data ( ) [ p ] ;
ids = eq . get _Id ( ) ;
translate = '' ;
if ( translationTable . hasOwnProperty ( ids ) ) {
translate = translationTable [ ids ] ;
}
2019-08-15 14:09:26 +00:00
arr . push ( {
2016-10-25 10:48:31 +00:00
data : { equationType : ids } ,
tip : translate ,
allowSelected : true ,
selected : false ,
width : eqStore . get _W ( ) ,
height : eqStore . get _H ( ) ,
posX : - eq . get _X ( ) ,
posY : - eq . get _Y ( )
} ) ;
}
allItemsCount += itemsCount ;
}
2019-08-15 14:09:26 +00:00
store . add ( arr ) ;
2016-10-25 10:48:31 +00:00
width = c _oAscMathMainTypeStrings [ id ] [ 1 ] * ( width + 10 ) ; // 4px margin + 4px margin + 1px border + 1px border
var normHeight = parseInt ( 370 / ( height + 10 ) ) * ( height + 10 ) ;
equationgrouparray . push ( {
groupName : c _oAscMathMainTypeStrings [ id ] [ 0 ] ,
groupStore : store ,
groupWidth : width ,
groupHeight : c _oAscMathMainTypeStrings [ id ] [ 2 ] ? ' height:' + normHeight + 'px!important; ' : ''
} ) ;
}
}
equationsStore . add ( equationgrouparray ) ;
this . fillEquations ( ) ;
}
}
} ,
2016-03-11 00:48:53 +00:00
updateThemeColors : function ( ) {
if ( Common . Utils . ThemeColor . getEffectColors ( ) === undefined ) return ;
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 = this . toolbar . mnuFontColorPicker . currentColor . color || this . toolbar . mnuFontColorPicker . currentColor ;
2021-01-21 19:48:27 +00:00
this . toolbar . btnFontColor . setColor ( this . toolbar . btnFontColor . currentColor ) ;
2016-03-11 00:48:53 +00:00
}
if ( this . _state . clrtext _asccolor !== undefined ) {
this . _state . clrtext = undefined ;
this . onApiTextColor ( this . _state . clrtext _asccolor ) ;
}
this . _state . clrtext _asccolor = undefined ;
} ,
2019-07-17 10:36:37 +00:00
_onInitEditorThemes : function ( editorThemes /*array */ , documentThemes ) {
2016-03-11 00:48:53 +00:00
var me = this ;
window . styles _loaded = false ;
if ( ! me . toolbar . listTheme ) {
me . themes = [
editorThemes ,
documentThemes
] ;
return ;
}
var defaultThemes = editorThemes || [ ] ,
docThemes = documentThemes || [ ] ;
me . toolbar . listTheme . menuPicker . store . reset ( [ ] ) ; // remove all
2018-04-09 11:23:44 +00:00
var themeStore = this . getCollection ( 'SlideThemes' ) ,
mainController = this . getApplication ( ) . getController ( 'Main' ) ;
2017-08-07 14:20:17 +00:00
if ( themeStore ) {
2019-07-18 08:37:34 +00:00
var arr1 = [ ] , arr2 = [ ] ;
_ . each ( defaultThemes , function ( theme , index ) {
2020-01-29 08:32:22 +00:00
var tip = mainController . translationTable [ ( theme . get _Name ( ) || '' ) . toLocaleLowerCase ( ) ] || theme . get _Name ( ) ;
2019-07-18 08:37:34 +00:00
arr1 . push ( new Common . UI . DataViewModel ( {
2017-08-07 14:20:17 +00:00
uid : Common . UI . getId ( ) ,
themeId : theme . get _Index ( ) ,
2019-07-18 08:37:34 +00:00
tip : tip ,
2021-03-30 10:23:23 +00:00
offsety : index * 40
2017-08-07 14:20:17 +00:00
} ) ) ;
2019-07-18 08:37:34 +00:00
arr2 . push ( {
2017-08-07 14:20:17 +00:00
uid : Common . UI . getId ( ) ,
2018-04-09 11:23:44 +00:00
themeId : theme . get _Index ( ) ,
2019-07-18 08:37:34 +00:00
tip : tip ,
2021-03-30 10:23:23 +00:00
offsety : index * 40
2017-08-07 14:20:17 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
} ) ;
2019-07-18 08:37:34 +00:00
_ . each ( docThemes , function ( theme ) {
var image = theme . get _Image ( ) ,
2020-01-29 08:32:22 +00:00
tip = mainController . translationTable [ ( theme . get _Name ( ) || '' ) . toLocaleLowerCase ( ) ] || theme . get _Name ( ) ;
2019-07-18 08:37:34 +00:00
arr1 . push ( new Common . UI . DataViewModel ( {
imageUrl : image ,
2017-08-07 14:20:17 +00:00
uid : Common . UI . getId ( ) ,
themeId : theme . get _Index ( ) ,
2019-07-18 08:37:34 +00:00
tip : tip ,
offsety : 0
2017-08-07 14:20:17 +00:00
} ) ) ;
2019-07-18 08:37:34 +00:00
arr2 . push ( {
imageUrl : image ,
2017-08-07 14:20:17 +00:00
uid : Common . UI . getId ( ) ,
2018-04-09 11:23:44 +00:00
themeId : theme . get _Index ( ) ,
2019-07-18 08:37:34 +00:00
tip : tip ,
offsety : 0
2017-08-07 14:20:17 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
} ) ;
2019-07-18 08:37:34 +00:00
themeStore . reset ( arr1 ) ;
me . toolbar . listTheme . menuPicker . store . reset ( arr2 ) ;
2017-08-07 14:20:17 +00:00
}
2016-03-11 00:48:53 +00:00
if ( me . toolbar . listTheme . menuPicker . store . length > 0 && me . toolbar . listTheme . rendered ) {
me . toolbar . listTheme . fillComboView ( me . toolbar . listTheme . menuPicker . store . at ( 0 ) , true ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this ) ;
}
window . styles _loaded = true ;
} ,
onHideMenus : function ( e ) {
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
onSetupCopyStyleButton : function ( ) {
this . modeAlwaysSetStyle = false ;
var me = this ;
Common . NotificationCenter . on ( {
'edit:complete' : function ( ) {
if ( me . api && me . modeAlwaysSetStyle ) {
2019-02-19 12:47:50 +00:00
me . api . SetPaintFormat ( AscCommon . c _oAscFormatPainterState . kOff ) ;
2016-03-11 00:48:53 +00:00
me . toolbar . btnCopyStyle . toggle ( false , true ) ;
me . modeAlwaysSetStyle = false ;
}
}
} ) ;
$ ( me . toolbar . btnCopyStyle . cmpEl ) . dblclick ( function ( ) {
if ( me . api ) {
me . modeAlwaysSetStyle = true ;
me . toolbar . btnCopyStyle . toggle ( true , true ) ;
2019-02-19 12:47:50 +00:00
me . api . SetPaintFormat ( AscCommon . c _oAscFormatPainterState . kMultiple ) ;
2016-03-11 00:48:53 +00:00
}
} ) ;
} ,
activateControls : function ( ) {
2016-05-10 15:08:07 +00:00
this . onApiPageSize ( this . api . get _PresentationWidth ( ) , this . api . get _PresentationHeight ( ) ) ;
2016-03-11 00:48:53 +00:00
this . toolbar . lockToolbar ( PE . enumLock . disableOnStart , false , { array : this . toolbar . slideOnlyControls . concat ( this . toolbar . shapeControls ) } ) ;
this . _state . activated = true ;
} ,
2017-11-28 11:32:48 +00:00
DisableToolbar : function ( disable , viewMode ) {
if ( viewMode !== undefined ) this . editMode = ! viewMode ;
disable = disable || ! this . editMode ;
2016-03-11 00:48:53 +00:00
var mask = $ ( '.toolbar-mask' ) ;
if ( disable && mask . length > 0 || ! disable && mask . length == 0 ) return ;
var toolbar = this . toolbar ;
toolbar . $el . find ( '.toolbar' ) . toggleClass ( 'masked' , disable ) ;
2018-05-15 12:39:26 +00:00
if ( toolbar . btnsAddSlide ) // toolbar buttons are rendered
this . toolbar . lockToolbar ( PE . enumLock . menuFileOpen , disable , { array : toolbar . btnsAddSlide . concat ( toolbar . btnChangeSlide , toolbar . btnPreview ) } ) ;
2016-03-11 00:48:53 +00:00
if ( disable ) {
2017-06-15 13:18:40 +00:00
mask = $ ( "<div class='toolbar-mask'>" ) . appendTo ( toolbar . $el . find ( '.toolbar' ) ) ;
2016-03-11 00:48:53 +00:00
Common . util . Shortcuts . suspendEvents ( 'command+k, ctrl+k, alt+h, command+f5, ctrl+f5' ) ;
} else {
mask . remove ( ) ;
Common . util . Shortcuts . resumeEvents ( 'command+k, ctrl+k, alt+h, command+f5, ctrl+f5' ) ;
}
} ,
2016-10-19 13:30:26 +00:00
createDelayedElements : function ( ) {
this . toolbar . createDelayedElements ( ) ;
2017-04-24 11:41:51 +00:00
this . attachUIEvents ( this . toolbar ) ;
2016-10-19 13:30:26 +00:00
} ,
2017-04-20 13:34:39 +00:00
onAppShowed : function ( config ) {
var me = this ;
var compactview = ! config . isEdit ;
if ( config . isEdit ) {
if ( Common . localStorage . itemExists ( "pe-compact-toolbar" ) ) {
compactview = Common . localStorage . getBool ( "pe-compact-toolbar" ) ;
} else
if ( config . customization && config . customization . compactToolbar )
compactview = true ;
2021-07-30 17:22:42 +00:00
}
2019-10-29 08:30:08 +00:00
me . toolbar . render ( _ . extend ( { compactview : compactview } , config ) ) ;
2017-11-28 12:39:36 +00:00
2019-11-15 11:01:08 +00:00
var tab = { action : 'review' , caption : me . toolbar . textTabCollaboration } ;
var $panel = me . getApplication ( ) . getController ( 'Common.Controllers.ReviewChanges' ) . createToolbarPanel ( ) ;
2020-12-22 12:37:05 +00:00
if ( $panel ) {
2021-07-27 10:50:13 +00:00
me . toolbar . addTab ( tab , $panel , 4 ) ;
2020-12-22 12:37:05 +00:00
me . toolbar . setVisible ( 'review' , config . isEdit || config . canViewReview || config . canCoAuthoring && config . canComments ) ;
}
2018-05-15 12:39:26 +00:00
2019-10-29 08:30:08 +00:00
if ( config . isEdit ) {
me . toolbar . setMode ( config ) ;
2017-11-17 14:23:38 +00:00
2021-08-07 15:44:26 +00:00
var transitController = me . getApplication ( ) . getController ( 'Transitions' ) ;
2021-08-02 01:37:23 +00:00
transitController . setApi ( me . api ) . setConfig ( { toolbar : me , mode : config } ) . createToolbarPanel ( ) ;
2021-08-02 23:06:03 +00:00
Array . prototype . push . apply ( me . toolbar . lockControls , transitController . getView ( ) . getButtons ( ) ) ;
2021-08-04 22:50:25 +00:00
Array . prototype . push . apply ( me . toolbar . slideOnlyControls , transitController . getView ( ) . getButtons ( ) ) ;
2021-10-15 01:15:43 +00:00
var animationController = me . getApplication ( ) . getController ( 'Animation' ) ;
animationController . setApi ( me . api ) . setConfig ( { toolbar : me , mode : config } ) . createToolbarPanel ( ) ;
2019-10-29 08:30:08 +00:00
me . toolbar . btnSave . on ( 'disabled' , _ . bind ( me . onBtnChangeState , me , 'save:disabled' ) ) ;
2018-02-07 15:30:45 +00:00
2019-10-29 08:30:08 +00:00
if ( ! ( config . customization && config . customization . compactHeader ) ) {
// hide 'print' and 'save' buttons group and next separator
me . toolbar . btnPrint . $el . parents ( '.group' ) . hide ( ) . next ( ) . hide ( ) ;
2018-02-07 15:30:45 +00:00
2019-10-29 08:30:08 +00:00
// hide 'undo' and 'redo' buttons and get container
var $box = me . toolbar . btnUndo . $el . hide ( ) . next ( ) . hide ( ) . parent ( ) ;
2019-01-31 13:41:29 +00:00
2019-10-29 08:30:08 +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
2019-10-29 08:30:08 +00:00
if ( config . isDesktopApp ) {
if ( config . canProtect ) { // don't add protect panel to toolbar
tab = { action : 'protect' , caption : me . toolbar . textTabProtect } ;
$panel = me . getApplication ( ) . getController ( 'Common.Controllers.Protection' ) . createToolbarPanel ( ) ;
if ( $panel )
me . toolbar . addTab ( tab , $panel , 4 ) ;
2018-02-07 15:30:45 +00:00
}
2017-11-28 12:39:36 +00:00
}
2019-10-29 08:30:08 +00:00
}
2017-04-20 13:34:39 +00:00
} ,
onAppReady : function ( config ) {
var me = this ;
2018-05-16 14:41:47 +00:00
me . appOptions = config ;
2017-04-20 13:34:39 +00:00
2017-06-28 11:20:49 +00:00
this . btnsComment = [ ] ;
2017-06-15 13:18:40 +00:00
if ( config . canCoAuthoring && config . canComments ) {
2017-06-28 11:20:49 +00:00
var _set = PE . enumLock ;
2021-06-16 13:43:51 +00:00
this . btnsComment = Common . Utils . injectButtons ( this . toolbar . $el . find ( '.slot-comment' ) , 'tlbtn-addcomment-' , 'toolbar__icon btn-menu-comments' , me . toolbar . capBtnComment , [ _set . lostConnect , _set . noSlides ] , undefined , undefined , undefined , '1' , 'bottom' , 'small' ) ;
2017-04-20 13:34:39 +00:00
2017-06-28 11:20:49 +00:00
if ( this . btnsComment . length ) {
2017-04-20 13:34:39 +00:00
var _comments = PE . getController ( 'Common.Controllers.Comments' ) . getView ( ) ;
2017-06-28 11:20:49 +00:00
Array . prototype . push . apply ( me . toolbar . lockControls , this . btnsComment ) ;
this . btnsComment . forEach ( function ( btn ) {
2017-08-02 13:47:40 +00:00
btn . updateHint ( _comments . textHintAddComment ) ;
2017-04-20 13:34:39 +00:00
btn . on ( 'click' , function ( btn , e ) {
Common . NotificationCenter . trigger ( 'app:comment:add' , 'toolbar' ) ;
} ) ;
2019-11-06 14:22:12 +00:00
if ( btn . cmpEl . closest ( '#review-changes-panel' ) . length > 0 )
btn . setCaption ( me . toolbar . capBtnAddComment ) ;
2017-04-20 13:34:39 +00:00
} , this ) ;
2021-07-16 14:31:23 +00:00
2017-06-28 11:20:49 +00:00
this . toolbar . lockToolbar ( PE . enumLock . noSlides , this . _state . no _slides , { array : this . btnsComment } ) ;
2017-04-20 13:34:39 +00:00
}
}
} ,
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
} ,
2019-06-27 11:59:12 +00:00
onTextLanguage : function ( langId ) {
this . _state . lang = langId ;
} ,
2020-03-02 14:36:10 +00:00
onAddAudio : function ( ) {
this . api && this . api . asc _AddAudio ( ) ;
} ,
onAddVideo : function ( ) {
this . api && this . api . asc _AddVideo ( ) ;
} ,
2016-03-11 00:48:53 +00:00
textEmptyImgUrl : 'You need to specify image URL.' ,
textWarning : 'Warning' ,
2021-02-03 13:56:01 +00:00
textFontSizeErr : 'The entered value is incorrect.<br>Please enter a numeric value between 1 and 300' ,
2016-10-25 10:48:31 +00:00
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?' ,
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' ,
2019-11-14 08:48:58 +00:00
txtMatrix _Flat _Square : 'Sparse Matrix' ,
textInsert : 'Insert'
2016-10-25 10:48:31 +00:00
2016-03-11 00:48:53 +00:00
} , PE . Controllers . Toolbar || { } ) ) ;
} ) ;