2016-04-01 13:17:09 +00:00
/ *
*
2017-01-17 14:58:08 +00:00
* ( c ) Copyright Ascensio System Limited 2010 - 2017
2016-04-01 13:17:09 +00:00
*
* This program is a free software product . You can redistribute it and / or
* modify it under the terms of the GNU Affero General Public License ( AGPL )
* version 3 as published by the Free Software Foundation . In accordance with
* Section 7 ( a ) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non - infringement
* of any third - party rights .
*
* This program is distributed WITHOUT ANY WARRANTY ; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . For
* details , see the GNU AGPL at : http : //www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st . 125 a - 25 , Riga , Latvia ,
* EU , LV - 1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices , as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7 ( b ) of the License you must retain the original Product
* logo when distributing the program . Pursuant to Section 7 ( e ) we decline to
* grant you any rights under trademark law for use of our trademarks .
*
* All the Product ' s GUI elements , including illustrations and icon sets , as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution - ShareAlike 4.0 International . See the License
* terms at http : //creativecommons.org/licenses/by-sa/4.0/legalcode
*
* /
2016-03-11 00:48:53 +00:00
/ * *
* Toolbar . js
*
* Created by Alexander Yuzhin on 3 / 31 / 14
* Copyright ( c ) 2014 Ascensio System SIA . All rights reserved .
*
* /
define ( [
'core' ,
'common/main/lib/component/Window' ,
'common/main/lib/view/CopyWarningDialog' ,
'common/main/lib/view/ImageFromUrlDialog' ,
2016-10-21 09:33:49 +00:00
'common/main/lib/util/define' ,
2016-03-11 00:48:53 +00:00
'spreadsheeteditor/main/app/view/Toolbar' ,
'spreadsheeteditor/main/app/collection/TableTemplates' ,
2017-06-30 14:49:58 +00:00
'spreadsheeteditor/main/app/controller/PivotTable' ,
2016-03-11 00:48:53 +00:00
'spreadsheeteditor/main/app/view/HyperlinkSettingsDialog' ,
'spreadsheeteditor/main/app/view/TableOptionsDialog' ,
'spreadsheeteditor/main/app/view/NamedRangeEditDlg' ,
'spreadsheeteditor/main/app/view/NamedRangePasteDlg' ,
2017-01-16 08:48:21 +00:00
'spreadsheeteditor/main/app/view/NameManagerDlg' ,
'spreadsheeteditor/main/app/view/FormatSettingsDialog'
2016-03-11 00:48:53 +00:00
] , function ( ) { 'use strict' ;
SSE . Controllers . Toolbar = Backbone . Controller . extend ( _ . extend ( {
models : [ ] ,
collections : [ ] ,
views : [
'Toolbar'
] ,
initialize : function ( ) {
var me = this ;
this . addListeners ( {
2017-04-27 15:40:27 +00:00
'Toolbar' : {
'change:compact' : this . onClickChangeCompact . bind ( me )
} ,
'FileMenu' : {
'menu:hide' : me . onFileMenu . bind ( me , 'hide' ) ,
'menu:show' : me . onFileMenu . bind ( me , 'show' )
} ,
2016-03-11 00:48:53 +00:00
'Statusbar' : {
'sheet:changed' : _ . bind ( this . onApiSheetChanged , this )
} ,
'LeftMenu' : {
'settings:apply' : _ . bind ( this . applyFormulaSettings , this )
2017-07-21 10:41:56 +00:00
} ,
'Common.Views.Header' : {
2017-08-23 11:51:27 +00:00
'print' : function ( opts ) {
var _main = this . getApplication ( ) . getController ( 'Main' ) ;
_main . onPrint ( ) ;
} ,
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 . appOptions . spreadsheet . fileType ,
_format ;
if ( ! ! _file _type ) {
_format = Asc . c _oAscFileType [ _file _type . toUpperCase ( ) ] ;
}
var _supported = [
Asc . c _oAscFileType . XLSX ,
Asc . c _oAscFileType . ODS ,
Asc . c _oAscFileType . CSV
] ;
if ( ! _format || _supported . indexOf ( _format ) < 0 )
_format = Asc . c _oAscFileType . PDF ;
_main . api . asc _DownloadAs ( _format ) ;
} ,
2017-07-21 10:41:56 +00:00
'go:editor' : function ( ) {
Common . Gateway . requestEditRights ( ) ;
}
2016-03-11 00:48:53 +00:00
}
} ) ;
this . editMode = true ;
this . _isAddingShape = false ;
this . _state = {
prstyle : undefined ,
clrtext : undefined ,
pralign : undefined ,
clrback : undefined ,
valign : undefined ,
can _undo : undefined ,
can _redo : undefined ,
bold : undefined ,
italic : undefined ,
underline : undefined ,
wrap : undefined ,
merge : undefined ,
angle : undefined ,
controlsdisabled : {
rows : undefined ,
cols : undefined ,
cells _right : undefined ,
cells _down : undefined ,
filters : undefined
} ,
selection _type : undefined ,
2017-04-11 11:05:56 +00:00
filter : undefined ,
filterapplied : false ,
2016-03-11 00:48:53 +00:00
tablestylename : undefined ,
tablename : undefined ,
namedrange _locked : false ,
2016-11-01 12:42:46 +00:00
fontsize : undefined ,
2016-12-28 11:28:27 +00:00
multiselect : false ,
2017-01-12 14:14:51 +00:00
sparklines _disabled : false ,
2017-02-07 09:56:32 +00:00
numformatinfo : undefined ,
2017-01-17 12:58:20 +00:00
numformattype : undefined ,
2017-01-19 11:34:37 +00:00
numformat : undefined ,
2017-01-17 12:58:20 +00:00
langId : undefined
2016-03-11 00:48:53 +00:00
} ;
var checkInsertAutoshape = function ( e , action ) {
var cmp = $ ( e . target ) ,
cmp _sdk = cmp . closest ( '#editor_sdk' ) ,
btn _id = cmp . closest ( 'button' ) . attr ( 'id' ) ;
if ( btn _id === undefined )
btn _id = cmp . closest ( '.btn-group' ) . attr ( 'id' ) ;
if ( me . api && me . api . asc _isAddAutoshape ( ) ) {
if ( cmp _sdk . length <= 0 || action == 'cancel' ) {
if ( me . toolbar . btnInsertText . pressed && btn _id != me . toolbar . btnInsertText . id ||
me . toolbar . btnInsertShape . pressed && btn _id != me . toolbar . btnInsertShape . id ) {
me . _isAddingShape = false ;
me . _addAutoshape ( false ) ;
me . toolbar . btnInsertShape . toggle ( false , true ) ;
me . toolbar . btnInsertText . toggle ( false , true ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} else if ( me . toolbar . btnInsertShape . pressed && btn _id == me . toolbar . btnInsertShape . id ) {
_ . defer ( function ( ) {
me . api . asc _endAddShape ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} , 100 ) ;
}
}
}
} ;
this . checkInsertAutoshape = function ( cmp ) {
checkInsertAutoshape ( { } , cmp . action ) ;
} ;
this . _addAutoshape = function ( isstart , type ) {
if ( this . api ) {
if ( isstart ) {
this . api . asc _startAddShape ( type ) ;
$ ( document . body ) . on ( 'mouseup' , checkInsertAutoshape ) ;
} else {
this . api . asc _endAddShape ( ) ;
$ ( document . body ) . off ( 'mouseup' , checkInsertAutoshape ) ;
}
}
} ;
this . onApiEndAddShape = function ( ) {
if ( this . toolbar . btnInsertShape . pressed ) this . toolbar . btnInsertShape . toggle ( false , true ) ;
if ( this . toolbar . btnInsertText . pressed ) this . toolbar . btnInsertText . toggle ( false , true ) ;
$ ( document . body ) . off ( 'mouseup' , checkInsertAutoshape ) ;
} ;
} ,
onLaunch : function ( ) {
// Create toolbar view
this . toolbar = this . createView ( 'Toolbar' ) ;
2017-04-27 15:40:27 +00:00
Common . NotificationCenter . on ( 'app:ready' , this . onAppReady . bind ( this ) ) ;
Common . NotificationCenter . on ( 'app:face' , this . onAppShowed . bind ( this ) ) ;
2016-03-11 00:48:53 +00:00
} ,
2017-04-28 14:28:35 +00:00
attachUIEvents : function ( toolbar ) {
2016-03-11 00:48:53 +00:00
var me = this ;
/ * *
* UI Events
* /
2017-04-27 15:40:27 +00:00
if ( me . appConfig . isEditDiagram ) {
2017-08-03 14:40:28 +00:00
toolbar . btnUndo . on ( 'click' , _ . bind ( this . onUndo , this ) ) ;
toolbar . btnRedo . on ( 'click' , _ . bind ( this . onRedo , this ) ) ;
toolbar . btnCopy . on ( 'click' , _ . bind ( this . onCopyPaste , this , true ) ) ;
toolbar . btnPaste . on ( 'click' , _ . bind ( this . onCopyPaste , this , false ) ) ;
2017-04-27 15:40:27 +00:00
toolbar . btnInsertFormula . on ( 'click' , _ . bind ( this . onInsertFormulaMenu , this ) ) ;
toolbar . btnInsertFormula . menu . on ( 'item:click' , _ . bind ( this . onInsertFormulaMenu , this ) ) ;
toolbar . btnDecDecimal . on ( 'click' , _ . bind ( this . onDecrement , this ) ) ;
toolbar . btnIncDecimal . on ( 'click' , _ . bind ( this . onIncrement , this ) ) ;
toolbar . cmbNumberFormat . on ( 'selected' , _ . bind ( this . onNumberFormatSelect , this ) ) ;
toolbar . cmbNumberFormat . on ( 'show:before' , _ . bind ( this . onNumberFormatOpenBefore , this , true ) ) ;
if ( toolbar . cmbNumberFormat . cmpEl )
toolbar . cmbNumberFormat . cmpEl . on ( 'click' , '#id-toolbar-mnu-item-more-formats a' , _ . bind ( this . onNumberFormatSelect , this ) ) ;
toolbar . btnEditChart . on ( 'click' , _ . bind ( this . onEditChart , this ) ) ;
} else
if ( me . appConfig . isEditMailMerge ) {
2017-08-03 14:40:28 +00:00
toolbar . btnUndo . on ( 'click' , _ . bind ( this . onUndo , this ) ) ;
toolbar . btnRedo . on ( 'click' , _ . bind ( this . onRedo , this ) ) ;
toolbar . btnCopy . on ( 'click' , _ . bind ( this . onCopyPaste , this , true ) ) ;
toolbar . btnPaste . on ( 'click' , _ . bind ( this . onCopyPaste , this , false ) ) ;
2017-04-27 15:40:27 +00:00
toolbar . btnSearch . on ( 'click' , _ . bind ( this . onSearch , this ) ) ;
toolbar . btnSortDown . on ( 'click' , _ . bind ( this . onSortType , this , Asc . c _oAscSortOptions . Ascending ) ) ;
toolbar . btnSortUp . on ( 'click' , _ . bind ( this . onSortType , this , Asc . c _oAscSortOptions . Descending ) ) ;
toolbar . btnSetAutofilter . on ( 'click' , _ . bind ( this . onAutoFilter , this ) ) ;
toolbar . btnClearAutofilter . on ( 'click' , _ . bind ( this . onClearFilter , this ) ) ;
} else {
toolbar . btnPrint . on ( 'click' , _ . bind ( this . onPrint , this ) ) ;
toolbar . btnSave . on ( 'click' , _ . bind ( this . onSave , this ) ) ;
toolbar . btnUndo . on ( 'click' , _ . bind ( this . onUndo , this ) ) ;
toolbar . btnRedo . on ( 'click' , _ . bind ( this . onRedo , this ) ) ;
toolbar . btnCopy . on ( 'click' , _ . bind ( this . onCopyPaste , this , true ) ) ;
toolbar . btnPaste . on ( 'click' , _ . bind ( this . onCopyPaste , this , false ) ) ;
toolbar . btnIncFontSize . on ( 'click' , _ . bind ( this . onIncreaseFontSize , this ) ) ;
toolbar . btnDecFontSize . on ( 'click' , _ . bind ( this . onDecreaseFontSize , this ) ) ;
toolbar . btnBold . on ( 'click' , _ . bind ( this . onBold , this ) ) ;
toolbar . btnItalic . on ( 'click' , _ . bind ( this . onItalic , this ) ) ;
toolbar . btnUnderline . on ( 'click' , _ . bind ( this . onUnderline , this ) ) ;
toolbar . btnTextColor . on ( 'click' , _ . bind ( this . onTextColor , this ) ) ;
toolbar . btnBackColor . on ( 'click' , _ . bind ( this . onBackColor , this ) ) ;
toolbar . mnuTextColorPicker . on ( 'select' , _ . bind ( this . onTextColorSelect , this ) ) ;
toolbar . mnuBackColorPicker . on ( 'select' , _ . bind ( this . onBackColorSelect , this ) ) ;
toolbar . btnBorders . on ( 'click' , _ . bind ( this . onBorders , this ) ) ;
if ( toolbar . btnBorders . rendered ) {
toolbar . btnBorders . menu . on ( 'item:click' , _ . bind ( this . onBordersMenu , this ) ) ;
toolbar . mnuBorderWidth . on ( 'item:toggle' , _ . bind ( this . onBordersWidth , this ) ) ;
toolbar . mnuBorderColorPicker . on ( 'select' , _ . bind ( this . onBordersColor , this ) ) ;
}
2017-08-24 11:22:59 +00:00
toolbar . btnAlignLeft . on ( 'click' , _ . bind ( this . onHorizontalAlign , this , AscCommon . align _Left ) ) ;
toolbar . btnAlignCenter . on ( 'click' , _ . bind ( this . onHorizontalAlign , this , AscCommon . align _Center ) ) ;
toolbar . btnAlignRight . on ( 'click' , _ . bind ( this . onHorizontalAlign , this , AscCommon . align _Right ) ) ;
toolbar . btnAlignJust . on ( 'click' , _ . bind ( this . onHorizontalAlign , this , AscCommon . align _Justify ) ) ;
2017-04-27 15:40:27 +00:00
toolbar . btnHorizontalAlign . menu . on ( 'item:click' , _ . bind ( this . onHorizontalAlignMenu , this ) ) ;
toolbar . btnVerticalAlign . menu . on ( 'item:click' , _ . bind ( this . onVerticalAlignMenu , this ) ) ;
toolbar . btnMerge . on ( 'click' , _ . bind ( this . onMergeCellsMenu , this , toolbar . btnMerge . menu , toolbar . btnMerge . menu . items [ 0 ] ) ) ;
toolbar . btnMerge . menu . on ( 'item:click' , _ . bind ( this . onMergeCellsMenu , this ) ) ;
2017-08-24 11:22:59 +00:00
toolbar . btnAlignTop . on ( 'click' , _ . bind ( this . onVerticalAlign , this , Asc . c _oAscVAlign . Top ) ) ;
toolbar . btnAlignMiddle . on ( 'click' , _ . bind ( this . onVerticalAlign , this , Asc . c _oAscVAlign . Center ) ) ;
toolbar . btnAlignBottom . on ( 'click' , _ . bind ( this . onVerticalAlign , this , Asc . c _oAscVAlign . Bottom ) ) ;
2017-04-27 15:40:27 +00:00
toolbar . btnWrap . on ( 'click' , _ . bind ( this . onWrap , this ) ) ;
toolbar . btnTextOrient . menu . on ( 'item:click' , _ . bind ( this . onTextOrientationMenu , this ) ) ;
toolbar . btnInsertImage . menu . on ( 'item:click' , _ . bind ( this . onInsertImageMenu , this ) ) ;
toolbar . btnInsertHyperlink . on ( 'click' , _ . bind ( this . onHyperlink , this ) ) ;
toolbar . mnuInsertChartPicker . on ( 'item:click' , _ . bind ( this . onSelectChart , this ) ) ;
toolbar . btnInsertText . on ( 'click' , _ . bind ( this . onBtnInsertTextClick , this ) ) ;
toolbar . btnInsertShape . menu . on ( 'hide:after' , _ . bind ( this . onInsertShapeHide , this ) ) ;
toolbar . btnInsertEquation . on ( 'click' , _ . bind ( this . onInsertEquationClick , this ) ) ;
toolbar . btnSortDown . on ( 'click' , _ . bind ( this . onSortType , this , Asc . c _oAscSortOptions . Ascending ) ) ;
toolbar . btnSortUp . on ( 'click' , _ . bind ( this . onSortType , this , Asc . c _oAscSortOptions . Descending ) ) ;
toolbar . mnuitemSortAZ . on ( 'click' , _ . bind ( this . onSortType , this , Asc . c _oAscSortOptions . Ascending ) ) ;
toolbar . mnuitemSortZA . on ( 'click' , _ . bind ( this . onSortType , this , Asc . c _oAscSortOptions . Descending ) ) ;
toolbar . btnSetAutofilter . on ( 'click' , _ . bind ( this . onAutoFilter , this ) ) ;
toolbar . mnuitemAutoFilter . on ( 'click' , _ . bind ( this . onAutoFilter , this ) ) ;
toolbar . btnClearAutofilter . on ( 'click' , _ . bind ( this . onClearFilter , this ) ) ;
toolbar . mnuitemClearFilter . on ( 'click' , _ . bind ( this . onClearFilter , this ) ) ;
toolbar . btnTableTemplate . menu . on ( 'show:after' , _ . bind ( this . onTableTplMenuOpen , this ) ) ;
toolbar . btnPercentStyle . on ( 'click' , _ . bind ( this . onNumberFormat , this ) ) ;
toolbar . btnCurrencyStyle . on ( 'click' , _ . bind ( this . onNumberFormat , this ) ) ;
toolbar . btnDecDecimal . on ( 'click' , _ . bind ( this . onDecrement , this ) ) ;
toolbar . btnIncDecimal . on ( 'click' , _ . bind ( this . onIncrement , this ) ) ;
toolbar . btnInsertFormula . on ( 'click' , _ . bind ( this . onInsertFormulaMenu , this ) ) ;
toolbar . btnSettings . on ( 'click' , _ . bind ( this . onAdvSettingsClick , this ) ) ;
toolbar . btnInsertFormula . menu . on ( 'item:click' , _ . bind ( this . onInsertFormulaMenu , this ) ) ;
toolbar . btnNamedRange . menu . on ( 'item:click' , _ . bind ( this . onNamedRangeMenu , this ) ) ;
toolbar . btnNamedRange . menu . on ( 'show:after' , _ . bind ( this . onNamedRangeMenuOpen , this ) ) ;
toolbar . btnClearStyle . menu . on ( 'item:click' , _ . bind ( this . onClearStyleMenu , this ) ) ;
toolbar . btnAddCell . menu . on ( 'item:click' , _ . bind ( this . onCellInsertMenu , this ) ) ;
toolbar . btnCopyStyle . on ( 'toggle' , _ . bind ( this . onCopyStyleToggle , this ) ) ;
toolbar . btnDeleteCell . menu . on ( 'item:click' , _ . bind ( this . onCellDeleteMenu , this ) ) ;
toolbar . btnColorSchemas . menu . on ( 'item:click' , _ . bind ( this . onColorSchemaClick , this ) ) ;
toolbar . cmbFontName . on ( 'selected' , _ . bind ( this . onFontNameSelect , this ) ) ;
toolbar . cmbFontName . on ( 'show:after' , _ . bind ( this . onComboOpen , this , true ) ) ;
toolbar . cmbFontName . on ( 'hide:after' , _ . bind ( this . onHideMenus , this ) ) ;
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 ) ) ;
if ( toolbar . mnuZoomIn ) toolbar . mnuZoomIn . on ( 'click' , _ . bind ( this . onZoomInClick , this ) ) ;
if ( toolbar . mnuZoomOut ) toolbar . mnuZoomOut . on ( 'click' , _ . bind ( this . onZoomOutClick , this ) ) ;
if ( toolbar . btnShowMode . rendered ) toolbar . btnShowMode . menu . on ( 'item:click' , _ . bind ( this . onHideMenu , this ) ) ;
toolbar . listStyles . on ( 'click' , _ . bind ( this . onListStyleSelect , this ) ) ;
toolbar . cmbNumberFormat . on ( 'selected' , _ . bind ( this . onNumberFormatSelect , this ) ) ;
toolbar . cmbNumberFormat . on ( 'show:before' , _ . bind ( this . onNumberFormatOpenBefore , this , true ) ) ;
if ( toolbar . cmbNumberFormat . cmpEl )
toolbar . cmbNumberFormat . cmpEl . on ( 'click' , '#id-toolbar-mnu-item-more-formats a' , _ . bind ( this . onNumberFormatSelect , this ) ) ;
toolbar . btnCurrencyStyle . menu . on ( 'item:click' , _ . bind ( this . onNumberFormatMenu , this ) ) ;
if ( toolbar . mnuitemCompactToolbar ) toolbar . mnuitemCompactToolbar . on ( 'toggle' , _ . bind ( this . onChangeViewMode , this ) ) ;
$ ( '#id-toolbar-menu-new-fontcolor' ) . on ( 'click' , _ . bind ( this . onNewTextColor , this ) ) ;
$ ( '#id-toolbar-menu-new-paracolor' ) . on ( 'click' , _ . bind ( this . onNewBackColor , this ) ) ;
$ ( '#id-toolbar-menu-new-bordercolor' ) . on ( 'click' , _ . bind ( this . onNewBorderColor , this ) ) ;
this . onSetupCopyStyleButton ( ) ;
}
2016-03-11 00:48:53 +00:00
} ,
setApi : function ( api ) {
this . api = api ;
2017-04-27 15:40:27 +00:00
var config = SSE . getController ( 'Main' ) . appOptions ;
if ( ! config . isEditDiagram && ! config . isEditMailMerge ) {
this . api . asc _registerCallback ( 'asc_onSendThemeColors' , _ . bind ( this . onSendThemeColors , this ) ) ;
this . api . asc _registerCallback ( 'asc_onMathTypes' , _ . bind ( this . onMathTypes , this ) ) ;
2017-04-28 14:43:12 +00:00
this . api . asc _registerCallback ( 'asc_onContextMenu' , _ . bind ( this . onContextMenu , this ) ) ;
2017-04-27 15:40:27 +00:00
}
2016-03-11 00:48:53 +00:00
this . api . asc _registerCallback ( 'asc_onInitEditorStyles' , _ . bind ( this . onApiInitEditorStyles , this ) ) ;
2016-10-12 13:32:48 +00:00
this . api . asc _registerCallback ( 'asc_onCoAuthoringDisconnect' , _ . bind ( this . onApiCoAuthoringDisconnect , this , true ) ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . on ( 'api:disconnect' , _ . bind ( this . onApiCoAuthoringDisconnect , this ) ) ;
this . api . asc _registerCallback ( 'asc_onLockDefNameManager' , _ . bind ( this . onLockDefNameManager , this ) ) ;
2016-09-02 12:30:55 +00:00
this . api . asc _registerCallback ( 'asc_onZoomChanged' , _ . bind ( this . onApiZoomChange , this ) ) ;
2016-03-11 00:48:53 +00:00
} ,
2017-04-27 15:25:02 +00:00
// onNewDocument: function(btn, e) {
// this.api.asc_openNewDocument();
//
// Common.NotificationCenter.trigger('edit:complete', this.toolbar);
// Common.component.Analytics.trackEvent('ToolBar', 'New Document');
// },
//
// onOpenDocument: function(btn, e) {
// this.api.asc_loadDocumentFromDisk();
//
// Common.NotificationCenter.trigger('edit:complete', this.toolbar);
// Common.component.Analytics.trackEvent('ToolBar', 'Open Document');
// },
2016-03-11 00:48:53 +00:00
2017-04-28 14:43:12 +00:00
onContextMenu : function ( ) {
2017-07-18 12:59:14 +00:00
this . toolbar . collapse ( ) ;
2017-04-28 14:43:12 +00:00
} ,
2016-03-11 00:48:53 +00:00
onPrint : function ( e ) {
2016-04-04 08:17:21 +00:00
Common . NotificationCenter . trigger ( 'print' , this . toolbar ) ;
2016-03-11 00:48:53 +00:00
} ,
onSave : function ( e ) {
if ( this . api ) {
var isModified = this . api . asc _isDocumentCanSave ( ) ;
2017-04-28 14:08:11 +00:00
var isSyncButton = $ ( '.icon' , this . toolbar . btnSave . cmpEl ) . hasClass ( 'btn-synch' ) ;
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 ( ) ;
}
// Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common . component . Analytics . trackEvent ( 'Save' ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Save' ) ;
} ,
onUndo : function ( btn , e ) {
if ( this . api )
this . api . asc _Undo ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Undo' ) ;
} ,
onRedo : function ( btn , e ) {
if ( this . api )
this . api . asc _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 . asc _Copy ( ) : me . api . asc _Paste ( ) ;
if ( ! res ) {
2016-03-11 00:48:53 +00:00
var value = Common . localStorage . getItem ( "sse-hide-copywarning" ) ;
if ( ! ( value && parseInt ( value ) == 1 ) ) {
( new Common . Views . CopyWarningDialog ( {
handler : function ( dontshow ) {
if ( dontshow ) Common . localStorage . setItem ( "sse-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
} ,
onIncreaseFontSize : function ( e ) {
if ( this . api )
this . api . asc _increaseFontSize ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , { restorefocus : true } ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Font Size' ) ;
} ,
onDecreaseFontSize : function ( e ) {
if ( this . api )
this . api . asc _decreaseFontSize ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , { restorefocus : true } ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Font Size' ) ;
} ,
onBold : function ( btn , e ) {
this . _state . bold = undefined ;
if ( this . api )
this . api . asc _setCellBold ( btn . pressed ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , { restorefocus : true } ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Bold' ) ;
} ,
onItalic : function ( btn , e ) {
this . _state . italic = undefined ;
if ( this . api )
this . api . asc _setCellItalic ( btn . pressed ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , { restorefocus : true } ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Italic' ) ;
} ,
onUnderline : function ( btn , e ) {
this . _state . underline = undefined ;
if ( this . api )
this . api . asc _setCellUnderline ( btn . pressed ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , { restorefocus : true } ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Underline' ) ;
} ,
onTextColor : function ( ) {
this . toolbar . mnuTextColorPicker . trigger ( 'select' , this . toolbar . mnuTextColorPicker , this . toolbar . mnuTextColorPicker . currentColor , true ) ;
} ,
onBackColor : function ( ) {
this . toolbar . mnuBackColorPicker . trigger ( 'select' , this . toolbar . mnuBackColorPicker , this . toolbar . mnuBackColorPicker . currentColor , true ) ;
} ,
onTextColorSelect : function ( picker , color , fromBtn ) {
this . _state . clrtext _asccolor = this . _state . clrtext = undefined ;
var clr = ( typeof ( color ) == 'object' ) ? color . color : color ;
this . toolbar . btnTextColor . currentColor = color ;
$ ( '.btn-color-value-line' , this . toolbar . btnTextColor . cmpEl ) . css ( 'background-color' , '#' + clr ) ;
this . toolbar . mnuTextColorPicker . currentColor = color ;
if ( this . api ) {
this . toolbar . btnTextColor . ischanged = ( fromBtn !== true ) ;
this . api . asc _setCellTextColor ( Common . Utils . ThemeColor . getRgbColor ( color ) ) ;
this . toolbar . btnTextColor . ischanged = false ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , { restorefocus : true } ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Text Color' ) ;
} ,
onBackColorSelect : function ( picker , color , fromBtn ) {
this . _state . clrshd _asccolor = this . _state . clrback = undefined ;
var clr = ( typeof ( color ) == 'object' ) ? color . color : color ;
this . toolbar . btnBackColor . currentColor = color ;
$ ( '.btn-color-value-line' , this . toolbar . btnBackColor . cmpEl ) . css ( 'background-color' , clr == 'transparent' ? 'transparent' : '#' + clr ) ;
this . toolbar . mnuBackColorPicker . currentColor = color ;
if ( this . api ) {
this . toolbar . btnBackColor . ischanged = ( fromBtn !== true ) ;
this . api . asc _setCellBackgroundColor ( color == 'transparent' ? null : Common . Utils . ThemeColor . getRgbColor ( color ) ) ;
this . toolbar . btnBackColor . ischanged = false ;
}
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Background Color' ) ;
} ,
onNewTextColor : function ( picker , color ) {
this . toolbar . mnuTextColorPicker . addNewColor ( ) ;
} ,
onNewBackColor : function ( picker , color ) {
this . toolbar . mnuBackColorPicker . addNewColor ( ) ;
} ,
onNewBorderColor : function ( picker , color ) {
this . toolbar . btnBorders . menu . hide ( ) ;
this . toolbar . btnBorders . toggle ( false , true ) ;
this . toolbar . mnuBorderColorPicker . addNewColor ( ) ;
} ,
onBorders : function ( btn ) {
var menuItem ;
_ . each ( btn . menu . items , function ( item ) {
if ( btn . options . borderId == item . options . borderId ) {
menuItem = item ;
return false ;
}
} ) ;
if ( menuItem ) {
this . onBordersMenu ( btn . menu , menuItem ) ;
}
} ,
onBordersMenu : function ( menu , item ) {
var me = this ;
if ( me . api && ! _ . isUndefined ( item . options . borderId ) ) {
var btnBorders = me . toolbar . btnBorders ,
new _borders = [ ] ,
bordersWidth = btnBorders . options . borderswidth ,
bordersColor = btnBorders . options . borderscolor ;
if ( btnBorders . rendered ) {
2017-04-28 14:08:11 +00:00
var iconEl = $ ( '.icon' , btnBorders . cmpEl ) ;
2016-03-11 00:48:53 +00:00
if ( iconEl ) {
iconEl . removeClass ( btnBorders . options . icls ) ;
btnBorders . options . icls = item . options . icls ;
iconEl . addClass ( btnBorders . options . icls ) ;
}
}
btnBorders . options . borderId = item . options . borderId ;
if ( item . options . borderId == 'inner' ) {
2016-04-05 11:52:34 +00:00
new _borders [ Asc . c _oAscBorderOptions . InnerV ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
new _borders [ Asc . c _oAscBorderOptions . InnerH ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
2016-03-11 00:48:53 +00:00
} else if ( item . options . borderId == 'all' ) {
2016-04-05 11:52:34 +00:00
new _borders [ Asc . c _oAscBorderOptions . InnerV ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
new _borders [ Asc . c _oAscBorderOptions . InnerH ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
new _borders [ Asc . c _oAscBorderOptions . Left ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
new _borders [ Asc . c _oAscBorderOptions . Top ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
new _borders [ Asc . c _oAscBorderOptions . Right ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
new _borders [ Asc . c _oAscBorderOptions . Bottom ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
2016-03-11 00:48:53 +00:00
} else if ( item . options . borderId == 'outer' ) {
2016-04-05 11:52:34 +00:00
new _borders [ Asc . c _oAscBorderOptions . Left ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
new _borders [ Asc . c _oAscBorderOptions . Top ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
new _borders [ Asc . c _oAscBorderOptions . Right ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
new _borders [ Asc . c _oAscBorderOptions . Bottom ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
2016-03-11 00:48:53 +00:00
} else if ( item . options . borderId != 'none' ) {
new _borders [ item . options . borderId ] = new Asc . asc _CBorder ( bordersWidth , bordersColor ) ;
}
me . api . asc _setCellBorders ( new _borders ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Borders' ) ;
}
} ,
onBordersWidth : function ( menu , item , state ) {
if ( state ) {
this . toolbar . btnBorders . options . borderswidth = item . value ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Border Width' ) ;
}
} ,
onBordersColor : function ( picker , color ) {
$ ( '#id-toolbar-mnu-item-border-color .menu-item-icon' ) . css ( 'border-color' , '#' + ( ( typeof ( color ) == 'object' ) ? color . color : color ) ) ;
this . toolbar . mnuBorderColor . onUnHoverItem ( ) ;
this . toolbar . btnBorders . options . borderscolor = Common . Utils . ThemeColor . getRgbColor ( color ) ;
this . toolbar . mnuBorderColorPicker . currentColor = color ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Border Color' ) ;
} ,
onHorizontalAlign : function ( type , btn , e ) {
this . _state . pralign = undefined ;
if ( this . api ) {
2017-08-24 11:22:59 +00:00
this . api . asc _setCellAlign ( ! btn . pressed ? null : type ) ;
this . toolbar . btnWrap . allowDepress = ! ( type == AscCommon . align _Justify ) ;
2016-03-11 00:48:53 +00:00
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Horizontal align' ) ;
} ,
onHorizontalAlignMenu : function ( menu , item ) {
var btnHorizontalAlign = this . toolbar . btnHorizontalAlign ,
2017-04-28 14:08:11 +00:00
iconEl = $ ( '.icon' , btnHorizontalAlign . cmpEl ) ;
2016-03-11 00:48:53 +00:00
if ( iconEl ) {
iconEl . removeClass ( btnHorizontalAlign . options . icls ) ;
btnHorizontalAlign . options . icls = ! item . checked ? 'btn-align-left' : item . options . icls ;
iconEl . addClass ( btnHorizontalAlign . options . icls ) ;
}
this . _state . pralign = undefined ;
if ( this . api )
2017-08-24 11:22:59 +00:00
this . api . asc _setCellAlign ( ! item . checked ? null : item . value ) ;
2016-03-11 00:48:53 +00:00
2017-08-24 11:22:59 +00:00
this . toolbar . btnWrap . allowDepress = ! ( item . value == AscCommon . align _Justify ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Horizontal Align' ) ;
} ,
onVerticalAlignMenu : function ( menu , item ) {
var btnVerticalAlign = this . toolbar . btnVerticalAlign ,
2017-04-28 14:08:11 +00:00
iconEl = $ ( '.icon' , btnVerticalAlign . cmpEl ) ;
2016-03-11 00:48:53 +00:00
if ( iconEl ) {
iconEl . removeClass ( btnVerticalAlign . options . icls ) ;
btnVerticalAlign . options . icls = ! item . checked ? 'btn-valign-bottom' : item . options . icls ;
iconEl . addClass ( btnVerticalAlign . options . icls ) ;
}
this . _state . valign = undefined ;
if ( this . api )
2017-08-24 11:22:59 +00:00
this . api . asc _setCellVertAlign ( ! item . checked ? Asc . c _oAscVAlign . Bottom : item . value ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Vertical Align' ) ;
} ,
onVerticalAlign : function ( type , btn , e ) {
this . _state . valign = undefined ;
if ( this . api ) {
2017-08-24 11:22:59 +00:00
this . api . asc _setCellVertAlign ( ! btn . pressed ? Asc . c _oAscVAlign . Bottom : type ) ;
2016-03-11 00:48:53 +00:00
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Vertical align' ) ;
} ,
onMergeCellsMenu : function ( menu , item ) {
var me = this ;
function doMergeCells ( how ) {
me . _state . merge = undefined ;
me . api . asc _mergeCells ( how ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Merge' ) ;
}
if ( me . api ) {
var merged = me . api . asc _getCellInfo ( ) . asc _getFlags ( ) . asc _getMerge ( ) ;
2017-04-11 11:05:56 +00:00
if ( ( merged !== Asc . c _oAscMergeOptions . Merge ) && me . api . asc _mergeCellsDataLost ( item . value ) ) {
2016-03-11 00:48:53 +00:00
Common . UI . warning ( {
msg : me . warnMergeLostData ,
buttons : [ 'yes' , 'no' ] ,
primary : 'yes' ,
callback : function ( btn ) {
if ( btn == 'yes' ) {
doMergeCells ( item . value ) ;
} else {
me . toolbar . btnMerge . toggle ( false , true ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Merge' ) ;
}
}
} ) ;
} else {
doMergeCells ( item . value ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Merge cells' ) ;
} ,
onWrap : function ( btn , e ) {
this . _state . wrap = undefined ;
if ( this . api )
this . api . asc _setCellTextWrap ( btn . pressed ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Wrap' ) ;
} ,
onTextOrientationMenu : function ( menu , item ) {
2017-05-15 13:32:01 +00:00
if ( this . api . asc _getCellInfo ( ) . asc _getFlags ( ) . asc _getSelectionType ( ) == Asc . c _oAscSelectionType . RangeShapeText ) {
var angle = Asc . c _oAscVertDrawingText . normal ;
switch ( item . value ) {
case 'rotateup' : angle = Asc . c _oAscVertDrawingText . vert270 ; break ;
case 'rotatedown' : angle = Asc . c _oAscVertDrawingText . vert ; break ;
}
2016-03-11 00:48:53 +00:00
2017-05-15 13:32:01 +00:00
var properties = new Asc . asc _CImgProperty ( ) ;
properties . asc _putVert ( angle ) ;
this . api . asc _setGraphicObjectProps ( properties ) ;
} else {
var angle = 0 ;
2016-03-11 00:48:53 +00:00
2017-05-15 13:32:01 +00:00
switch ( item . value ) {
case 'countcw' : angle = 45 ; break ;
case 'clockwise' : angle = - 45 ; break ;
case 'rotateup' : angle = 90 ; break ;
case 'rotatedown' : angle = - 90 ; break ;
}
this . _state . angle = undefined ;
if ( this . api )
this . api . asc _setCellAngle ( angle ) ;
}
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Text orientation' ) ;
} ,
onInsertImageMenu : function ( menu , item , e ) {
if ( item . value === 'file' ) {
this . toolbar . fireEvent ( 'insertimage' , this . toolbar ) ;
if ( this . api )
this . api . asc _addImage ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Image' ) ;
} else {
var me = this ;
( new Common . Views . ImageFromUrlDialog ( {
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
var checkUrl = value . replace ( /\s/g , '' ) ;
if ( ! _ . isEmpty ( checkUrl ) ) {
me . toolbar . fireEvent ( 'insertimage' , me . toolbar ) ;
me . api . asc _addImageDrawingObject ( checkUrl ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Image' ) ;
} else {
Common . UI . warning ( {
msg : this . textEmptyImgUrl
} ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
}
}
} ) ) . show ( ) ;
}
} ,
onHyperlink : function ( btn ) {
var me = this ;
var win ,
props ;
if ( me . api ) {
var wc = me . api . asc _getWorksheetsCount ( ) ,
i = - 1 ,
items = [ ] ;
while ( ++ i < wc ) {
if ( ! this . api . asc _isWorksheetHidden ( i ) ) {
items . push ( { displayValue : me . api . asc _getWorksheetName ( i ) , value : me . api . asc _getWorksheetName ( i ) } ) ;
}
}
var handlerDlg = function ( dlg , result ) {
if ( result == 'ok' ) {
props = dlg . getSettings ( ) ;
me . api . asc _insertHyperlink ( props ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} ;
var cell = me . api . asc _getCellInfo ( ) ,
seltype = cell . asc _getFlags ( ) . asc _getSelectionType ( ) ;
props = cell . asc _getHyperlink ( ) ;
win = new SSE . Views . HyperlinkSettingsDialog ( {
api : me . api ,
handler : handlerDlg
} ) ;
win . show ( ) ;
win . setSettings ( {
sheets : items ,
currentSheet : me . api . asc _getWorksheetName ( me . api . asc _getActiveWorksheetIndex ( ) ) ,
props : props ,
text : cell . asc _getText ( ) ,
isLock : cell . asc _getFlags ( ) . asc _getLockText ( ) ,
2016-04-05 11:52:34 +00:00
allowInternal : ( seltype !== Asc . c _oAscSelectionType . RangeImage && seltype !== Asc . c _oAscSelectionType . RangeShape &&
seltype !== Asc . c _oAscSelectionType . RangeShapeText && seltype !== Asc . c _oAscSelectionType . RangeChart &&
seltype !== Asc . c _oAscSelectionType . RangeChartText )
2016-03-11 00:48:53 +00:00
} ) ;
}
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Hyperlink' ) ;
} ,
2016-12-16 08:37:57 +00:00
onEditChart : function ( btn ) {
2016-03-11 00:48:53 +00:00
if ( ! this . editMode ) return ;
var me = this , info = me . api . asc _getCellInfo ( ) ;
2016-04-05 11:52:34 +00:00
if ( info . asc _getFlags ( ) . asc _getSelectionType ( ) != Asc . c _oAscSelectionType . RangeImage ) {
2016-03-11 00:48:53 +00:00
var win , props ;
if ( me . api ) {
props = me . api . asc _getChartObject ( ) ;
2017-04-11 11:05:56 +00:00
var selectedObjects = me . api . asc _getGraphicObjectProps ( ) ,
imageSettings = null ;
for ( var i = 0 ; i < selectedObjects . length ; i ++ ) {
if ( selectedObjects [ i ] . asc _getObjectType ( ) == Asc . c _oAscTypeSelectElement . Image ) {
var elValue = selectedObjects [ i ] . asc _getObjectValue ( ) ;
if ( elValue . asc _getChartProperties ( ) )
imageSettings = elValue ;
}
}
2016-03-11 00:48:53 +00:00
if ( props ) {
2016-04-05 11:52:34 +00:00
var ischartedit = ( me . toolbar . mode . isEditDiagram || info . asc _getFlags ( ) . asc _getSelectionType ( ) == Asc . c _oAscSelectionType . RangeChart || info . asc _getFlags ( ) . asc _getSelectionType ( ) == Asc . c _oAscSelectionType . RangeChartText ) ;
2016-03-11 00:48:53 +00:00
( new SSE . Views . ChartSettingsDlg (
{
chartSettings : props ,
2017-04-11 11:05:56 +00:00
imageSettings : imageSettings ,
2016-09-14 13:34:08 +00:00
isChart : true ,
2016-03-11 00:48:53 +00:00
api : me . api ,
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
( ischartedit ) ? me . api . asc _editChartDrawingObject ( value . chartSettings ) : me . api . asc _addChartDrawingObject ( value . chartSettings ) ;
2017-04-11 11:05:56 +00:00
if ( value . imageSettings )
me . api . asc _setGraphicObjectProps ( value . imageSettings ) ;
2016-03-11 00:48:53 +00:00
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
}
} ) ) . show ( ) ;
}
}
}
} ,
2016-09-14 13:34:08 +00:00
onSelectChart : function ( picker , item , record , e ) {
2017-10-24 12:59:18 +00:00
if ( ! this . editMode || ! record ) return ;
2016-12-16 08:37:57 +00:00
var me = this ,
info = me . api . asc _getCellInfo ( ) ,
type = info . asc _getFlags ( ) . asc _getSelectionType ( ) ,
group = record . get ( 'group' ) ,
isSpark = ( group == 'menu-chart-group-sparkcolumn' || group == 'menu-chart-group-sparkline' || group == 'menu-chart-group-sparkwin' ) ;
if ( type != Asc . c _oAscSelectionType . RangeImage && me . api ) {
2016-09-14 13:34:08 +00:00
var win , props ;
2016-12-16 08:37:57 +00:00
if ( isSpark && ( type == Asc . c _oAscSelectionType . RangeCells || type == Asc . c _oAscSelectionType . RangeCol ||
type == Asc . c _oAscSelectionType . RangeRow || type == Asc . c _oAscSelectionType . RangeMax ) ) {
var sparkLineInfo = info . asc _getSparklineInfo ( ) ;
if ( ! ! sparkLineInfo ) {
var props = new Asc . sparklineGroup ( ) ;
props . asc _setType ( record . get ( 'type' ) ) ;
this . api . asc _setSparklineGroup ( sparkLineInfo . asc _getId ( ) , props ) ;
2016-09-14 13:34:08 +00:00
} else {
2016-12-16 08:37:57 +00:00
// add sparkline
2016-09-14 13:34:08 +00:00
}
2016-12-16 08:37:57 +00:00
} else if ( ! isSpark ) {
var ischartedit = ( type == Asc . c _oAscSelectionType . RangeChart || type == Asc . c _oAscSelectionType . RangeChartText ) ;
2016-09-16 13:24:46 +00:00
props = me . api . asc _getChartObject ( ) ;
if ( props ) {
props . putType ( record . get ( 'type' ) ) ;
2017-04-18 13:16:03 +00:00
var range = props . getRange ( ) ,
isvalid = me . api . asc _checkDataRange ( Asc . c _oAscSelectionDialogType . Chart , range , true , ! props . getInColumns ( ) , props . getType ( ) ) ;
if ( isvalid == Asc . c _oAscError . ID . No ) {
( ischartedit ) ? me . api . asc _editChartDrawingObject ( props ) : me . api . asc _addChartDrawingObject ( props ) ;
} else {
Common . UI . warning ( {
msg : ( isvalid == Asc . c _oAscError . ID . StockChartError ) ? me . errorStockChart : ( ( isvalid == Asc . c _oAscError . ID . MaxDataSeriesError ) ? me . errorMaxRows : me . txtInvalidRange ) ,
callback : function ( ) {
_ . defer ( function ( btn ) {
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} )
}
} ) ;
}
2016-09-14 13:34:08 +00:00
}
}
}
if ( e . type !== 'click' )
me . toolbar . btnInsertChart . menu . hide ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
2016-03-11 00:48:53 +00:00
onBtnInsertTextClick : function ( btn , e ) {
if ( this . api )
this . _addAutoshape ( btn . pressed , 'textRect' ) ;
if ( this . toolbar . btnInsertShape . pressed )
this . toolbar . btnInsertShape . toggle ( false , true ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , this . toolbar . btnInsertShape ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Text' ) ;
} ,
onInsertShapeHide : function ( btn , e ) {
if ( this . toolbar . btnInsertShape . pressed && ! this . _isAddingShape ) {
this . toolbar . btnInsertShape . toggle ( false , true ) ;
}
this . _isAddingShape = false ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
onSortType : function ( type , btn ) {
2017-02-06 14:12:59 +00:00
if ( this . api ) {
var res = this . api . asc _sortCellsRangeExpand ( ) ;
if ( res ) {
var config = {
width : 500 ,
title : this . txtSorting ,
msg : this . txtExpandSort ,
2017-02-07 09:56:32 +00:00
2017-02-06 14:12:59 +00:00
buttons : [ { caption : this . txtExpand , primary : true , value : 'expand' } ,
{ caption : this . txtSortSelected , primary : true , value : 'sort' } ,
'cancel' ] ,
callback : _ . bind ( function ( btn ) {
if ( btn == 'expand' || btn == 'sort' ) {
this . api . asc _sortColFilter ( type , '' , undefined , undefined , btn == 'expand' ) ;
}
} , this )
} ;
Common . UI . alert ( config ) ;
} else
this . api . asc _sortColFilter ( type , '' , undefined , undefined , res !== null ) ;
}
2016-03-11 00:48:53 +00:00
} ,
onSearch : function ( type , btn ) {
this . getApplication ( ) . getController ( 'LeftMenu' ) . showSearchDlg ( true ) ;
} ,
onAutoFilter : function ( btn ) {
var state = this . _state . filter ;
this . _state . filter = undefined ;
if ( this . api ) {
if ( this . _state . tablename || state )
2016-04-05 11:52:34 +00:00
this . api . asc _changeAutoFilter ( this . _state . tablename , Asc . c _oAscChangeFilterOptions . filter , ! state ) ;
2016-03-11 00:48:53 +00:00
else
this . api . asc _addAutoFilter ( ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Auto filter' ) ;
} ,
onClearFilter : function ( btn ) {
if ( this . api )
this . api . asc _clearFilter ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Clear filter' ) ;
} ,
onNumberFormat : function ( btn ) {
2016-08-24 08:35:32 +00:00
if ( this . api )
this . api . asc _setCellStyle ( btn . options . styleName ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Number Format' ) ;
} ,
onNumberFormatMenu : function ( menu , item ) {
2017-04-11 11:05:56 +00:00
if ( this . api ) {
var info = new Asc . asc _CFormatCellsInfo ( ) ;
info . asc _setType ( Asc . c _oAscNumFormatType . Accounting ) ;
info . asc _setSeparator ( false ) ;
info . asc _setSymbol ( item . value ) ;
var format = this . api . asc _getFormatCells ( info ) ;
if ( format && format . length > 0 )
this . api . asc _setCellFormat ( format [ 0 ] ) ;
}
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Number Format' ) ;
} ,
2017-01-12 14:14:51 +00:00
onNumberFormatSelect : function ( combo , record ) {
2017-01-16 08:48:21 +00:00
if ( record ) {
if ( this . api )
this . api . asc _setCellFormat ( record . format ) ;
} else {
2017-01-17 13:40:18 +00:00
this . onCustomNumberFormat ( ) ;
2017-01-16 08:48:21 +00:00
}
2017-01-12 14:14:51 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Number Format' ) ;
} ,
2017-01-17 13:40:18 +00:00
onCustomNumberFormat : function ( ) {
var me = this ,
2017-06-01 13:48:33 +00:00
value = me . api . asc _getLocale ( ) ;
( ! value ) && ( value = ( ( me . toolbar . mode . lang ) ? parseInt ( Common . util . LanguageInfo . getLocalLanguageCode ( me . toolbar . mode . lang ) ) : 0x0409 ) ) ;
2017-01-17 13:40:18 +00:00
( new SSE . Views . FormatSettingsDialog ( {
api : me . api ,
handler : function ( result , settings ) {
if ( settings ) {
me . api . asc _setCellFormat ( settings . format ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} ,
2017-02-07 09:56:32 +00:00
props : { format : me . _state . numformat , formatInfo : me . _state . numformatinfo , langId : value }
2017-01-17 13:40:18 +00:00
} ) ) . show ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Number Format' ) ;
} ,
2017-01-12 14:14:51 +00:00
onNumberFormatOpenBefore : function ( combo ) {
if ( this . api ) {
2017-06-01 13:48:33 +00:00
var me = this ,
value = me . api . asc _getLocale ( ) ;
( ! value ) && ( value = ( ( me . toolbar . mode . lang ) ? parseInt ( Common . util . LanguageInfo . getLocalLanguageCode ( me . toolbar . mode . lang ) ) : 0x0409 ) ) ;
2017-01-17 12:58:20 +00:00
if ( this . _state . langId !== value ) {
this . _state . langId = value ;
var info = new Asc . asc _CFormatCellsInfo ( ) ;
info . asc _setType ( Asc . c _oAscNumFormatType . None ) ;
info . asc _setSymbol ( this . _state . langId ) ;
var arr = this . api . asc _getFormatCells ( info ) ; // all formats
me . toolbar . numFormatData . forEach ( function ( item , index ) {
me . toolbar . numFormatData [ index ] . format = arr [ index ] ;
} ) ;
}
2017-01-12 14:14:51 +00:00
me . toolbar . numFormatData . forEach ( function ( item , index ) {
2017-01-17 10:15:36 +00:00
item . exampleval = me . api . asc _getLocaleExample ( item . format ) ;
2017-01-12 14:14:51 +00:00
} ) ;
me . toolbar . cmbNumberFormat . setData ( me . toolbar . numFormatData ) ;
me . toolbar . cmbNumberFormat . setValue ( me . _state . numformattype , me . toolbar . txtCustom ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onDecrement : function ( btn ) {
if ( this . api )
this . api . asc _decreaseCellDigitNumbers ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Decrement' ) ;
} ,
onIncrement : function ( btn ) {
if ( this . api )
this . api . asc _increaseCellDigitNumbers ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Increment' ) ;
} ,
onInsertFormulaMenu : function ( menu , item , e ) {
if ( this . api ) {
if ( item . value === 'more' ) {
var controller = this . getApplication ( ) . getController ( 'FormulaDialog' ) ;
if ( controller ) {
controller . showDialog ( ) ;
}
} else {
item . value = item . value || 'SUM' ;
2016-04-05 11:52:34 +00:00
this . api . asc _insertFormula ( this . api . asc _getFormulaLocaleName ( item . value ) , Asc . c _oAscPopUpSelectorType . Func , true ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Insert formula' ) ;
}
}
} ,
onNamedRangeMenu : function ( menu , item , e ) {
if ( this . api ) {
var me = this ;
if ( item . value === 'paste' ) {
( new SSE . Views . NamedRangePasteDlg ( {
handler : function ( result , settings ) {
if ( result == 'ok' && settings ) {
2016-04-05 11:52:34 +00:00
me . api . asc _insertFormula ( settings . asc _getName ( ) , settings . asc _getIsTable ( ) ? Asc . c _oAscPopUpSelectorType . Table : Asc . c _oAscPopUpSelectorType . Range , false ) ;
2016-03-11 00:48:53 +00:00
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Paste Named Range' ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} ,
2016-04-05 11:52:34 +00:00
ranges : me . api . asc _getDefinedNames ( Asc . c _oAscGetDefinedNamesList . WorksheetWorkbook ) // names only for current sheet and workbook
2016-03-11 00:48:53 +00:00
} ) ) . show ( ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Paste Named Range' ) ;
} else {
var wc = me . api . asc _getWorksheetsCount ( ) ,
i = - 1 ,
items = [ ] , sheetNames = [ ] ;
if ( item . value === 'new' ) {
if ( this . _state . namedrange _locked ) {
Common . NotificationCenter . trigger ( 'namedrange:locked' ) ;
return ;
}
while ( ++ i < wc ) {
if ( ! this . api . asc _isWorksheetHidden ( i ) ) {
items . push ( { displayValue : me . api . asc _getWorksheetName ( i ) , value : i } ) ;
}
}
( new SSE . Views . NamedRangeEditDlg ( {
api : me . api ,
handler : function ( result , settings ) {
if ( result == 'ok' && settings ) {
me . api . asc _setDefinedNames ( settings ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'New Named Range' ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} ,
sheets : items ,
props : me . api . asc _getDefaultDefinedName ( ) ,
isEdit : false
} ) ) . show ( ) ;
} else {
var cellEditor = this . getApplication ( ) . getController ( 'CellEditor' ) ;
while ( ++ i < wc ) {
if ( ! this . api . asc _isWorksheetHidden ( i ) ) {
sheetNames [ i ] = me . api . asc _getWorksheetName ( i ) ;
items . push ( { displayValue : sheetNames [ i ] , value : i } ) ;
}
}
( new SSE . Views . NameManagerDlg ( {
api : me . api ,
handler : function ( result ) {
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Name Manager' ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} ,
locked : me . _state . namedrange _locked ,
sheets : items ,
sheetNames : sheetNames ,
2016-04-05 11:52:34 +00:00
ranges : me . api . asc _getDefinedNames ( Asc . c _oAscGetDefinedNamesList . All ) ,
2016-03-11 00:48:53 +00:00
props : me . api . asc _getDefaultDefinedName ( ) ,
sort : cellEditor . rangeListSort
} ) ) . on ( 'close' , function ( win ) {
cellEditor . rangeListSort = win . getSettings ( ) ;
} ) . show ( ) ;
}
}
}
} ,
onNamedRangeMenuOpen : function ( ) {
if ( this . api ) {
2016-04-05 11:52:34 +00:00
var names = this . api . asc _getDefinedNames ( Asc . c _oAscGetDefinedNamesList . WorksheetWorkbook ) ;
2016-03-11 00:48:53 +00:00
this . toolbar . btnNamedRange . menu . items [ 2 ] . setDisabled ( names . length < 1 ) ;
}
} ,
onClearStyleMenu : function ( menu , item , e ) {
if ( this . api )
this . api . asc _emptyCells ( item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Clear' ) ;
} ,
onCopyStyleToggle : function ( btn , state , e ) {
if ( this . api )
this . api . asc _formatPainter ( state ? 1 : 0 ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
this . modeAlwaysSetStyle = state ;
} ,
onCellInsertMenu : function ( menu , item , e ) {
if ( this . api )
this . api . asc _insertCells ( item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Cell insert' ) ;
} ,
onCellDeleteMenu : function ( menu , item , e ) {
if ( this . api )
this . api . asc _deleteCells ( item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Cell delete' ) ;
} ,
onColorSchemaClick : function ( menu , item ) {
if ( this . api ) {
this . api . asc _ChangeColorScheme ( item . value ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Color Scheme' ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
onComboBlur : function ( ) {
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
onFontNameSelect : function ( combo , record ) {
if ( this . api ) {
if ( record . isNewFont ) {
Common . UI . warning ( {
width : 500 ,
closable : false ,
msg : this . confirmAddFontName ,
buttons : [ 'yes' , 'no' ] ,
primary : 'yes' ,
callback : _ . bind ( function ( btn ) {
if ( btn == 'yes' ) {
this . api . asc _setCellFontName ( record . name ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Font Name' ) ;
} else {
this . toolbar . cmbFontName . setValue ( this . api . asc _getCellInfo ( ) . asc _getFont ( ) . asc _getName ( ) ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , { restorefocus : true } ) ;
} , this )
} ) ;
} else {
this . api . asc _setCellFontName ( record . name ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Font Name' ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , { restorefocus : true } ) ;
} ,
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 . asc _setCellFontSize ( record . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , { restorefocus : true } ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Font Size' ) ;
} ,
onFontSizeChanged : function ( before , combo , record , e ) {
var value ,
me = this ;
if ( before ) {
var item = combo . store . findWhere ( {
displayValue : record . value
} ) ;
if ( ! item ) {
value = /^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/ . exec ( record . value ) ;
if ( ! value ) {
value = this . _getApiTextSize ( ) ;
Common . UI . warning ( {
msg : this . textFontSizeErr ,
callback : function ( ) {
_ . defer ( function ( btn ) {
$ ( 'input' , combo . cmpEl ) . focus ( ) ;
} )
}
} ) ;
combo . setRawValue ( value ) ;
e . preventDefault ( ) ;
return false ;
}
}
} else {
value = parseFloat ( record . value ) ;
value = value > 409 ? 409 :
value < 1 ? 1 : Math . floor ( ( value + 0.4 ) * 2 ) / 2 ;
combo . setRawValue ( value ) ;
this . _state . fontsize = undefined ;
if ( this . api )
this . api . asc _setCellFontSize ( value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
}
} ,
onAdvSettingsClick : function ( btn , e ) {
this . toolbar . fireEvent ( 'file:settings' , this ) ;
btn . cmpEl . blur ( ) ;
} ,
onZoomInClick : function ( btn ) {
if ( this . api ) {
var f = Math . floor ( this . api . asc _getZoom ( ) * 10 ) / 10 ;
f += . 1 ;
if ( f > 0 && ! ( f > 2. ) ) {
this . api . asc _setZoom ( f ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
onZoomOutClick : function ( btn ) {
if ( this . api ) {
var f = Math . ceil ( this . api . asc _getZoom ( ) * 10 ) / 10 ;
f -= . 1 ;
if ( ! ( f < . 5 ) ) {
this . api . asc _setZoom ( f ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
onHideMenu : function ( menu , item ) {
var params = { } ,
option ;
switch ( item . value ) {
case 'title' : params . title = item . checked ; option = 'sse-hidden-title' ; break ;
case 'formula' : params . formula = item . checked ; option = 'sse-hidden-formula' ; break ;
case 'headings' : params . headings = item . checked ; break ;
case 'gridlines' : params . gridlines = item . checked ; break ;
2016-11-18 12:36:48 +00:00
case 'freezepanes' : params . freezepanes = item . checked ; break ;
2016-03-11 00:48:53 +00:00
}
this . hideElements ( params ) ;
2017-04-27 15:40:27 +00:00
option && Common . localStorage . setBool ( option , item . checked ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
onListStyleSelect : function ( combo , record ) {
this . _state . prstyle = undefined ;
if ( this . api ) {
this . api . asc _setCellStyle ( record . get ( 'name' ) ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Style' ) ;
}
} ,
createDelayedElements : function ( ) {
var me = this ;
2016-08-24 14:46:45 +00:00
this . toolbar . createDelayedElements ( ) ;
2017-04-28 14:28:35 +00:00
this . attachUIEvents ( this . toolbar ) ;
2016-08-24 14:46:45 +00:00
2017-04-27 15:40:27 +00:00
if ( ! this . appConfig . isEditDiagram && ! this . appConfig . isEditMailMerge ) {
this . api . asc _registerCallback ( 'asc_onSheetsChanged' , _ . bind ( this . onApiSheetChanged , this ) ) ;
this . api . asc _registerCallback ( 'asc_onUpdateSheetViewSettings' , _ . bind ( this . onApiSheetChanged , this ) ) ;
2017-04-28 12:24:57 +00:00
this . api . asc _registerCallback ( 'asc_onEndAddShape' , _ . bind ( this . onApiEndAddShape , this ) ) ;
2017-04-28 13:37:28 +00:00
this . api . asc _registerCallback ( 'asc_onEditorSelectionChanged' , _ . bind ( this . onApiEditorSelectionChanged , this ) ) ;
}
if ( ! this . appConfig . isEditMailMerge ) {
this . applyFormulaSettings ( ) ;
2017-04-27 15:40:27 +00:00
}
2016-03-11 00:48:53 +00:00
this . api . asc _registerCallback ( 'asc_onShowChartDialog' , _ . bind ( this . onApiChartDblClick , this ) ) ;
this . api . asc _registerCallback ( 'asc_onCanUndoChanged' , _ . bind ( this . onApiCanRevert , this , 'undo' ) ) ;
this . api . asc _registerCallback ( 'asc_onCanRedoChanged' , _ . bind ( this . onApiCanRevert , this , 'redo' ) ) ;
this . api . asc _registerCallback ( 'asc_onEditCell' , _ . bind ( this . onApiEditCell , this ) ) ;
this . api . asc _registerCallback ( 'asc_onStopFormatPainter' , _ . bind ( this . onApiStyleChange , this ) ) ;
2017-04-28 12:24:57 +00:00
this . api . asc _registerCallback ( 'asc_onSelectionChanged' , _ . bind ( this . onApiSelectionChanged , this ) ) ;
2016-03-11 00:48:53 +00:00
Common . util . Shortcuts . delegateShortcuts ( {
shortcuts : {
'command+l,ctrl+l' : function ( e ) {
2017-10-19 10:14:12 +00:00
if ( me . editMode && ! me . _state . multiselect && me . appConfig . canModifyFilter ) {
2017-09-18 10:41:39 +00:00
var cellinfo = me . api . asc _getCellInfo ( ) ,
filterinfo = cellinfo . asc _getAutoFilterInfo ( ) ,
formattableinfo = cellinfo . asc _getFormatTableInfo ( ) ;
filterinfo = ( filterinfo ) ? filterinfo . asc _getIsAutoFilter ( ) : null ;
if ( filterinfo !== null && ! formattableinfo ) {
2017-04-11 11:05:56 +00:00
if ( _ . isUndefined ( me . toolbar . mnuTableTemplatePicker ) )
me . onApiInitTableTemplates ( me . api . asc _getTablePictures ( formattableinfo ) ) ;
var store = me . getCollection ( 'TableTemplates' ) ;
me . _setTableFormat ( store . at ( 23 ) . get ( 'name' ) ) ;
}
2016-03-15 10:53:55 +00:00
}
2016-03-11 00:48:53 +00:00
return false ;
} ,
'command+shift+l,ctrl+shift+l' : function ( e ) {
2017-10-19 10:14:12 +00:00
if ( me . editMode && me . api && ! me . _state . multiselect && me . appConfig . canModifyFilter ) {
var state = me . _state . filter ;
me . _state . filter = undefined ;
2016-03-11 00:48:53 +00:00
if ( me . _state . tablename || state )
2016-04-05 11:52:34 +00:00
me . api . asc _changeAutoFilter ( me . _state . tablename , Asc . c _oAscChangeFilterOptions . filter , ! state ) ;
2016-03-11 00:48:53 +00:00
else
me . api . asc _addAutoFilter ( ) ;
}
return false ;
} ,
'command+s,ctrl+s' : function ( e ) {
me . onSave ( ) ;
e . preventDefault ( ) ;
e . stopPropagation ( ) ;
} ,
'command+k,ctrl+k' : function ( e ) {
2016-11-01 12:42:46 +00:00
if ( me . editMode && ! me . toolbar . mode . isEditMailMerge && ! me . toolbar . mode . isEditDiagram && ! me . api . isCellEdited && ! me . _state . multiselect )
2016-03-11 00:48:53 +00:00
me . onHyperlink ( ) ;
e . preventDefault ( ) ;
2017-01-17 13:40:18 +00:00
} ,
'command+1,ctrl+1' : function ( e ) {
if ( me . editMode && ! me . toolbar . mode . isEditMailMerge && ! me . api . isCellEdited && ! me . toolbar . cmbNumberFormat . isDisabled ( ) ) {
me . onCustomNumberFormat ( ) ;
}
return false ;
2016-03-11 00:48:53 +00:00
}
}
} ) ;
2017-04-28 12:24:57 +00:00
this . onApiSelectionChanged ( this . api . asc _getCellInfo ( ) ) ;
2016-03-11 00:48:53 +00:00
this . attachToControlEvents ( ) ;
this . onApiSheetChanged ( ) ;
Common . NotificationCenter . on ( 'cells:range' , _ . bind ( this . onCellsRange , this ) ) ;
} ,
onChangeViewMode : function ( item , compact ) {
2017-04-27 15:40:27 +00:00
this . toolbar . setFolded ( compact ) ;
this . toolbar . fireEvent ( 'view:compact' , [ this , compact ] ) ;
2016-03-11 00:48:53 +00:00
2017-04-27 15:40:27 +00:00
Common . localStorage . setBool ( 'sse-compact-toolbar' , compact ) ;
Common . NotificationCenter . trigger ( 'layout:changed' , 'toolbar' ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
2016-03-11 00:48:53 +00:00
2017-04-27 15:40:27 +00:00
onClickChangeCompact : function ( from ) {
if ( from != 'file' ) {
Common . Utils . asyncCall ( function ( ) {
this . onChangeViewMode ( null , ! this . toolbar . isCompact ( ) ) ;
this . toolbar . mnuitemCompactToolbar . setChecked ( this . toolbar . isCompact ( ) , true ) ;
} , this ) ;
2016-03-11 00:48:53 +00:00
}
} ,
fillTableTemplates : function ( ) {
2016-09-23 11:24:54 +00:00
if ( ! this . toolbar . btnTableTemplate . rendered ) return ;
2016-03-11 00:48:53 +00:00
2016-09-23 11:24:54 +00:00
var me = this ;
2016-03-11 00:48:53 +00:00
function createPicker ( element , menu ) {
var picker = new Common . UI . DataView ( {
el : element ,
parentMenu : menu ,
restoreHeight : 300 ,
style : 'max-height: 300px;' ,
store : me . getCollection ( 'TableTemplates' ) ,
2017-04-11 11:05:56 +00:00
itemTemplate : _ . template ( '<div class="item-template"><img src="<%= imageUrl %>" id="<%= id %>" style="width:61px;height:46px;"></div>' )
2016-03-11 00:48:53 +00:00
} ) ;
picker . on ( 'item:click' , function ( picker , item , record ) {
if ( me . api ) {
me . _state . tablestylename = null ;
if ( ! record )
record = picker . store . at ( 23 ) ;
me . _setTableFormat ( record . get ( 'name' ) ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Table Templates' ) ;
}
} ) ;
if ( picker . scroller ) {
picker . scroller . update ( { alwaysVisibleY : true } ) ;
}
return picker ;
}
if ( _ . isUndefined ( this . toolbar . mnuTableTemplatePicker ) ) {
this . toolbar . mnuTableTemplatePicker = createPicker ( $ ( '#id-toolbar-menu-table-templates' ) , this . toolbar . btnTableTemplate . menu ) ;
}
// if (_.isUndefined(this.toolbar.mnuTableTemplatePickerShort)) {
// this.toolbar.mnuTableTemplatePickerShort = createPicker($('#id-toolbar-short-menu-table-templates'));
// }
} ,
onTableTplMenuOpen : function ( cmp ) {
2016-11-29 12:48:18 +00:00
this . onApiInitTableTemplates ( this . api . asc _getTablePictures ( this . api . asc _getCellInfo ( ) . asc _getFormatTableInfo ( ) ) ) ;
2016-03-11 00:48:53 +00:00
2016-11-29 12:48:18 +00:00
var scroller = this . toolbar . mnuTableTemplatePicker . scroller ;
2016-03-11 00:48:53 +00:00
if ( scroller ) {
scroller . update ( { alwaysVisibleY : true } ) ;
scroller . scrollTop ( 0 ) ;
}
2017-01-19 11:46:00 +00:00
var val = this . toolbar . mnuTableTemplatePicker . store . findWhere ( { name : this . _state . tablestylename } ) ;
if ( val )
this . toolbar . mnuTableTemplatePicker . selectRecord ( val ) ;
else
2017-01-19 12:08:55 +00:00
this . toolbar . mnuTableTemplatePicker . deselectAll ( ) ;
2016-03-11 00:48:53 +00:00
} ,
2016-11-29 12:48:18 +00:00
onSendThemeColors : function ( ) {
// get new table templates
if ( this . toolbar . btnTableTemplate . rendered && this . toolbar . btnTableTemplate . cmpEl . hasClass ( 'open' ) )
this . onTableTplMenuOpen ( ) ;
} ,
2016-03-11 00:48:53 +00:00
onApiInitTableTemplates : function ( images ) {
var store = this . getCollection ( 'TableTemplates' ) ;
if ( store ) {
var templates = [ ] ;
_ . each ( images , function ( item ) {
templates . push ( {
name : item . asc _getName ( ) ,
caption : item . asc _getDisplayName ( ) ,
type : item . asc _getType ( ) ,
imageUrl : item . asc _getImage ( ) ,
allowSelected : true ,
2016-11-29 12:01:29 +00:00
selected : false ,
tip : item . asc _getDisplayName ( )
2016-03-11 00:48:53 +00:00
} ) ;
} ) ;
store . reset ( ) ;
store . add ( templates ) ;
}
this . fillTableTemplates ( ) ;
} ,
onApiInitEditorStyles : function ( styles ) {
window . styles _loaded = false ;
var self = this ,
listStyles = self . toolbar . listStyles ;
if ( ! listStyles ) {
self . styles = styles ;
return ;
}
listStyles . menuPicker . store . reset ( [ ] ) ; // remove all
2017-06-27 09:52:29 +00:00
var mainController = this . getApplication ( ) . getController ( 'Main' ) ;
2016-03-11 00:48:53 +00:00
var merged _array = styles . asc _getDefaultStyles ( ) . concat ( styles . asc _getDocStyles ( ) ) ;
_ . each ( merged _array , function ( style ) {
listStyles . menuPicker . store . add ( {
imageUrl : style . asc _getImage ( ) ,
name : style . asc _getName ( ) ,
2017-06-27 09:52:29 +00:00
tip : mainController . translationTable [ style . get _Name ( ) ] || style . get _Name ( ) ,
2016-03-11 00:48:53 +00:00
uid : Common . UI . getId ( )
} ) ;
} ) ;
if ( listStyles . menuPicker . store . length > 0 && listStyles . rendered ) {
listStyles . fillComboView ( listStyles . menuPicker . store . at ( 0 ) , true ) ;
listStyles . selectByIndex ( 0 ) ;
}
window . styles _loaded = true ;
} ,
2016-10-12 13:32:48 +00:00
onApiCoAuthoringDisconnect : function ( disableDownload ) {
this . toolbar . setMode ( { isDisconnected : true , disableDownload : ! ! disableDownload } ) ;
2016-03-11 00:48:53 +00:00
this . editMode = false ;
} ,
onApiChartDblClick : function ( ) {
2016-12-16 08:37:57 +00:00
this . onEditChart ( this . btnInsertChart ) ;
2016-03-11 00:48:53 +00:00
} ,
onApiCanRevert : function ( which , can ) {
if ( which == 'undo' ) {
if ( this . _state . can _undo !== can ) {
this . toolbar . btnUndo . setDisabled ( ! can ) ;
this . _state . can _undo = can ;
}
} else {
if ( this . _state . can _redo !== can ) {
this . toolbar . btnRedo . setDisabled ( ! can ) ;
this . _state . can _redo = can ;
}
}
} ,
setDisabledComponents : function ( components , disable ) {
_ . each ( [ ] . concat ( components ) , function ( component ) {
if ( component . isDisabled ( ) !== disable ) component . setDisabled ( disable )
} ) ;
} ,
onApiEditCell : function ( state ) {
var toolbar = this . toolbar ;
if ( toolbar . mode . isEditDiagram || toolbar . mode . isEditMailMerge ) {
2016-04-05 11:52:34 +00:00
is _cell _edited = ( state == Asc . c _oAscCellEditorState . editStart ) ;
2017-01-12 14:14:51 +00:00
toolbar . lockToolbar ( SSE . enumLock . editCell , state == Asc . c _oAscCellEditorState . editStart , { array : [ toolbar . btnDecDecimal , toolbar . btnIncDecimal , toolbar . cmbNumberFormat ] } ) ;
2016-03-11 00:48:53 +00:00
} else
2016-04-05 11:52:34 +00:00
if ( state == Asc . c _oAscCellEditorState . editStart || state == Asc . c _oAscCellEditorState . editEnd ) {
toolbar . lockToolbar ( SSE . enumLock . editCell , state == Asc . c _oAscCellEditorState . editStart , {
2016-03-11 00:48:53 +00:00
array : [
toolbar . btnClearStyle . menu . items [ 1 ] ,
toolbar . btnClearStyle . menu . items [ 2 ] ,
toolbar . btnClearStyle . menu . items [ 3 ] ,
toolbar . btnClearStyle . menu . items [ 4 ] ,
toolbar . mnuitemClearFilter ,
toolbar . btnNamedRange . menu . items [ 0 ] ,
toolbar . btnNamedRange . menu . items [ 1 ]
2017-06-30 11:33:31 +00:00
] ,
2016-03-11 00:48:53 +00:00
merge : true ,
clear : [ SSE . enumLock . editFormula , SSE . enumLock . editText ]
} ) ;
2016-04-05 11:52:34 +00:00
var is _cell _edited = ( state == Asc . c _oAscCellEditorState . editStart ) ;
2017-01-17 13:40:18 +00:00
( is _cell _edited ) ? Common . util . Shortcuts . suspendEvents ( 'command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, alt+h, command+1, ctrl+1' ) :
Common . util . Shortcuts . resumeEvents ( 'command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, alt+h, command+1, ctrl+1' ) ;
2016-03-11 00:48:53 +00:00
if ( is _cell _edited ) {
toolbar . listStyles . suspendEvents ( ) ;
toolbar . listStyles . menuPicker . selectRecord ( null ) ;
toolbar . listStyles . resumeEvents ( ) ;
this . _state . prstyle = undefined ;
}
} else {
2016-04-05 11:52:34 +00:00
if ( state == Asc . c _oAscCellEditorState . editText ) var is _text = true , is _formula = false ; else
if ( state == Asc . c _oAscCellEditorState . editFormula ) is _text = ! ( is _formula = true ) ; else
if ( state == Asc . c _oAscCellEditorState . editEmptyCell ) is _text = is _formula = false ;
2016-03-11 00:48:53 +00:00
toolbar . lockToolbar ( SSE . enumLock . editFormula , is _formula ,
{ array : [ toolbar . cmbFontName , toolbar . cmbFontSize , toolbar . btnIncFontSize , toolbar . btnDecFontSize ,
toolbar . btnBold , toolbar . btnItalic , toolbar . btnUnderline , toolbar . btnTextColor ] } ) ;
toolbar . lockToolbar ( SSE . enumLock . editText , is _text , { array : [ toolbar . btnInsertFormula ] } ) ;
}
this . _state . coauthdisable = undefined ;
this . _state . selection _type = undefined ;
this . checkInsertAutoshape ( { action : 'cancel' } ) ;
} ,
onApiZoomChange : function ( zf , type ) {
switch ( type ) {
case 1 : // FitWidth
case 2 : // FitPage
case 0 :
default : {
2016-09-02 12:51:53 +00:00
this . toolbar . mnuZoom . options . value = Math . floor ( ( zf + . 005 ) * 100 ) ;
2016-03-11 00:48:53 +00:00
$ ( '.menu-zoom .zoom' , this . toolbar . el ) . html ( Math . floor ( ( zf + . 005 ) * 100 ) + '%' ) ;
}
}
} ,
onApiSheetChanged : function ( ) {
2017-06-06 08:04:04 +00:00
if ( this . api && ! this . appConfig . isEditDiagram && ! this . appConfig . isEditMailMerge ) {
2016-09-01 14:45:04 +00:00
var params = this . api . asc _getSheetViewSettings ( ) ;
this . toolbar . mnuitemHideHeadings . setChecked ( ! params . asc _getShowRowColHeaders ( ) ) ;
this . toolbar . mnuitemHideGridlines . setChecked ( ! params . asc _getShowGridLines ( ) ) ;
2016-11-18 12:36:48 +00:00
this . toolbar . mnuitemFreezePanes . setChecked ( params . asc _getIsFreezePane ( ) ) ;
2016-03-11 00:48:53 +00:00
}
} ,
onApiEditorSelectionChanged : function ( fontobj ) {
if ( ! this . editMode ) return ;
var toolbar = this . toolbar ,
val ;
/* read font name */
var fontparam = fontobj . asc _getName ( ) ;
if ( fontparam != toolbar . cmbFontName . getValue ( ) ) {
Common . NotificationCenter . trigger ( 'fonts:change' , fontobj ) ;
}
/* read font params */
if ( ! toolbar . mode . isEditMailMerge && ! toolbar . mode . isEditDiagram ) {
val = fontobj . asc _getBold ( ) ;
if ( this . _state . bold !== val ) {
toolbar . btnBold . toggle ( val === true , true ) ;
this . _state . bold = val ;
}
val = fontobj . asc _getItalic ( ) ;
if ( this . _state . italic !== val ) {
toolbar . btnItalic . toggle ( val === true , true ) ;
this . _state . italic = val ;
}
val = fontobj . asc _getUnderline ( ) ;
if ( this . _state . underline !== val ) {
toolbar . btnUnderline . toggle ( val === true , true ) ;
this . _state . underline = val ;
}
}
/* read font size */
var str _size = fontobj . asc _getSize ( ) ;
if ( this . _state . fontsize !== str _size ) {
toolbar . cmbFontSize . setValue ( ( str _size !== undefined ) ? str _size : '' ) ;
this . _state . fontsize = str _size ;
}
/* read font color */
var clr ,
color ,
fontColorPicker = this . toolbar . mnuTextColorPicker ;
if ( ! toolbar . btnTextColor . ischanged && ! fontColorPicker . isDummy ) {
color = fontobj . asc _getColor ( ) ;
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 !== undefined && this . _state . clrtext . indexOf ( clr ) < 0 ) ) {
if ( _ . isObject ( clr ) ) {
var isselected = false ;
for ( var i = 0 ; i < 10 ; i ++ ) {
if ( Common . Utils . ThemeColor . ThemeValues [ i ] == clr . effectValue ) {
fontColorPicker . select ( clr , true ) ;
isselected = true ;
break ;
}
}
if ( ! isselected ) fontColorPicker . clearSelection ( ) ;
} else {
fontColorPicker . select ( clr , true ) ;
}
this . _state . clrtext = clr ;
}
this . _state . clrtext _asccolor = color ;
}
} ,
onApiSelectionChanged : function ( info ) {
if ( ! this . editMode ) return ;
2017-04-28 12:24:57 +00:00
if ( this . toolbar . mode . isEditDiagram )
2017-04-28 13:37:28 +00:00
return this . onApiSelectionChanged _DiagramEditor ( info ) ; else
if ( this . toolbar . mode . isEditMailMerge )
return this . onApiSelectionChanged _MailMergeEditor ( info ) ;
2016-03-11 00:48:53 +00:00
2016-11-07 13:00:11 +00:00
var selectionType = info . asc _getFlags ( ) . asc _getSelectionType ( ) ,
2016-11-24 07:23:02 +00:00
coauth _disable = ( ! this . toolbar . mode . isEditMailMerge && ! this . toolbar . mode . isEditDiagram ) ? ( info . asc _getLocked ( ) === true || info . asc _getLockedTable ( ) === true ) : false ,
2016-11-07 13:00:11 +00:00
editOptionsDisabled = this . _disableEditOptions ( selectionType , coauth _disable ) ,
me = this ,
2016-03-11 00:48:53 +00:00
toolbar = this . toolbar ,
fontobj = info . asc _getFont ( ) ,
val , need _disable = false ;
/* read font name */
2017-04-28 12:24:57 +00:00
var fontparam = fontobj . asc _getName ( ) ;
if ( fontparam != toolbar . cmbFontName . getValue ( ) ) {
Common . NotificationCenter . trigger ( 'fonts:change' , fontobj ) ;
2016-03-11 00:48:53 +00:00
}
2016-11-07 13:00:11 +00:00
/* read font size */
2017-04-28 12:24:57 +00:00
var str _size = fontobj . asc _getSize ( ) ;
if ( this . _state . fontsize !== str _size ) {
toolbar . cmbFontSize . setValue ( ( str _size !== undefined ) ? str _size : '' ) ;
this . _state . fontsize = str _size ;
2016-11-07 13:00:11 +00:00
}
2016-11-23 13:38:30 +00:00
toolbar . lockToolbar ( SSE . enumLock . cantHyperlink , ( selectionType == Asc . c _oAscSelectionType . RangeShapeText ) && ( this . api . asc _canAddShapeHyperlink ( ) === false ) , { array : [ toolbar . btnInsertHyperlink ] } ) ;
2017-05-11 07:39:58 +00:00
/ *
2016-12-28 11:28:27 +00:00
need _disable = selectionType != Asc . c _oAscSelectionType . RangeCells && selectionType != Asc . c _oAscSelectionType . RangeCol &&
2017-04-28 12:24:57 +00:00
selectionType != Asc . c _oAscSelectionType . RangeRow && selectionType != Asc . c _oAscSelectionType . RangeMax ;
2016-12-28 11:28:27 +00:00
if ( this . _state . sparklines _disabled !== need _disable ) {
2017-04-28 12:22:37 +00:00
this . _state . sparklines _disabled = need _disable ;
2016-12-28 11:28:27 +00:00
var len = toolbar . mnuInsertChartPicker . store . length ;
2017-04-28 12:24:57 +00:00
for ( var i = 0 ; i < 3 ; i ++ ) {
2016-12-28 11:28:27 +00:00
toolbar . mnuInsertChartPicker . store . at ( len - i - 1 ) . set ( { disabled : need _disable } ) ;
}
}
2017-05-11 07:39:58 +00:00
* /
2016-12-28 11:28:27 +00:00
2016-11-07 13:00:11 +00:00
if ( editOptionsDisabled ) return ;
2016-03-11 00:48:53 +00:00
/* read font params */
if ( ! toolbar . mode . isEditMailMerge && ! toolbar . mode . isEditDiagram ) {
val = fontobj . asc _getBold ( ) ;
if ( this . _state . bold !== val ) {
toolbar . btnBold . toggle ( val === true , true ) ;
this . _state . bold = val ;
}
val = fontobj . asc _getItalic ( ) ;
if ( this . _state . italic !== val ) {
toolbar . btnItalic . toggle ( val === true , true ) ;
this . _state . italic = val ;
}
val = fontobj . asc _getUnderline ( ) ;
if ( this . _state . underline !== val ) {
toolbar . btnUnderline . toggle ( val === true , true ) ;
this . _state . underline = val ;
}
}
/* read font color */
var clr ,
color ,
fontColorPicker = this . toolbar . mnuTextColorPicker ,
paragraphColorPicker = this . toolbar . mnuBackColorPicker ;
if ( ! toolbar . btnTextColor . ischanged && ! fontColorPicker . isDummy ) {
color = fontobj . asc _getColor ( ) ;
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 !== undefined && this . _state . clrtext . indexOf ( clr ) < 0 ) ) {
if ( _ . isObject ( clr ) ) {
var isselected = false ;
for ( var i = 0 ; i < 10 ; i ++ ) {
if ( Common . Utils . ThemeColor . ThemeValues [ i ] == clr . effectValue ) {
fontColorPicker . select ( clr , true ) ;
isselected = true ;
break ;
}
}
if ( ! isselected ) fontColorPicker . clearSelection ( ) ;
} else {
fontColorPicker . select ( clr , true ) ;
}
this . _state . clrtext = clr ;
}
this . _state . clrtext _asccolor = color ;
}
/* read cell background color */
if ( ! toolbar . btnBackColor . ischanged && ! paragraphColorPicker . isDummy ) {
color = info . asc _getFill ( ) . asc _getColor ( ) ;
if ( color ) {
2016-04-05 11:52:34 +00:00
if ( color . get _type ( ) == Asc . c _oAscColor . COLOR _TYPE _SCHEME ) {
2016-03-11 00:48:53 +00:00
clr = { color : Common . Utils . ThemeColor . getHexColor ( color . get _r ( ) , color . get _g ( ) , color . get _b ( ) ) , effectValue : color . get _value ( ) } ;
} else {
clr = Common . Utils . ThemeColor . getHexColor ( color . get _r ( ) , color . get _g ( ) , color . get _b ( ) ) ;
}
} else {
clr = 'transparent' ;
}
type1 = typeof ( clr ) ;
type2 = typeof ( this . _state . clrback ) ;
if ( ( type1 !== type2 ) || ( type1 == 'object' &&
( clr . effectValue !== this . _state . clrback . effectValue || this . _state . clrback . color . indexOf ( clr . color ) < 0 ) ) ||
( type1 != 'object' && this . _state . clrback !== undefined && this . _state . clrback . indexOf ( clr ) < 0 ) ) {
if ( _ . isObject ( clr ) ) {
var isselected = false ;
for ( i = 0 ; i < 10 ; i ++ ) {
if ( Common . Utils . ThemeColor . ThemeValues [ i ] == clr . effectValue ) {
paragraphColorPicker . select ( clr , true ) ;
isselected = true ;
break ;
}
}
if ( ! isselected ) paragraphColorPicker . clearSelection ( ) ;
} else {
paragraphColorPicker . select ( clr , true ) ;
}
this . _state . clrback = clr ;
}
this . _state . clrshd _asccolor = color ;
}
2017-08-29 12:43:16 +00:00
var in _chart = ( selectionType == Asc . c _oAscSelectionType . RangeChart || selectionType == Asc . c _oAscSelectionType . RangeChartText ) ;
if ( in _chart !== this . _state . in _chart ) {
toolbar . btnInsertChart . updateHint ( in _chart ? toolbar . tipChangeChart : toolbar . tipInsertChart ) ;
this . _state . in _chart = in _chart ;
}
if ( in _chart ) return ;
2016-03-11 00:48:53 +00:00
if ( ! toolbar . mode . isEditDiagram )
{
// (coauth_disable !== toolbar.btnClearStyle.isDisabled()) && toolbar.btnClearStyle.setDisabled(coauth_disable);
// (coauth_disable !== toolbar.btnCopyStyle.isDisabled()) && toolbar.btnCopyStyle.setDisabled(coauth_disable);
2016-03-29 14:35:28 +00:00
var filterInfo = info . asc _getAutoFilterInfo ( ) ,
formatTableInfo = info . asc _getFormatTableInfo ( ) ;
2016-03-11 00:48:53 +00:00
if ( ! toolbar . mode . isEditMailMerge ) {
/* read cell horizontal align */
fontparam = info . asc _getHorAlign ( ) ;
if ( this . _state . pralign !== fontparam ) {
this . _state . pralign = fontparam ;
var index = - 1 , align ;
switch ( fontparam ) {
2017-08-24 11:22:59 +00:00
case AscCommon . align _Left : index = 0 ; align = 'btn-align-left' ; break ;
case AscCommon . align _Center : index = 1 ; align = 'btn-align-center' ; break ;
case AscCommon . align _Right : index = 2 ; align = 'btn-align-right' ; break ;
case AscCommon . align _Justify : index = 3 ; align = 'btn-align-just' ; break ;
2016-03-11 00:48:53 +00:00
default : index = - 255 ; align = 'btn-align-left' ; break ;
}
if ( ! ( index < 0 ) ) {
toolbar . btnAlignRight . toggle ( index === 2 , true ) ;
toolbar . btnAlignLeft . toggle ( index === 0 , true ) ;
toolbar . btnAlignCenter . toggle ( index === 1 , true ) ;
toolbar . btnAlignJust . toggle ( index === 3 , true ) ;
toolbar . btnHorizontalAlign . menu . items [ index ] . setChecked ( true , false ) ;
} else if ( index == - 255 ) {
toolbar . btnAlignRight . toggle ( false , true ) ;
toolbar . btnAlignLeft . toggle ( false , true ) ;
toolbar . btnAlignCenter . toggle ( false , true ) ;
toolbar . btnAlignJust . toggle ( false , true ) ;
2017-11-13 08:41:32 +00:00
toolbar . btnHorizontalAlign . menu . clearAll ( ) ;
2016-03-11 00:48:53 +00:00
}
var btnHorizontalAlign = this . toolbar . btnHorizontalAlign ;
if ( btnHorizontalAlign . rendered ) {
2017-04-28 14:08:11 +00:00
var hIconEl = $ ( '.icon' , btnHorizontalAlign . cmpEl ) ;
2016-03-11 00:48:53 +00:00
if ( hIconEl ) {
hIconEl . removeClass ( btnHorizontalAlign . options . icls ) ;
btnHorizontalAlign . options . icls = align ;
hIconEl . addClass ( btnHorizontalAlign . options . icls ) ;
}
}
}
2017-08-24 11:22:59 +00:00
need _disable = ( fontparam == AscCommon . align _Justify || selectionType == Asc . c _oAscSelectionType . RangeShapeText ) ;
2017-05-15 13:32:01 +00:00
toolbar . btnTextOrient . menu . items [ 1 ] . setDisabled ( need _disable ) ;
toolbar . btnTextOrient . menu . items [ 2 ] . setDisabled ( need _disable ) ;
2016-03-11 00:48:53 +00:00
/* read cell vertical align */
fontparam = info . asc _getVertAlign ( ) ;
if ( this . _state . valign !== fontparam ) {
this . _state . valign = fontparam ;
index = - 1 ; align = '' ;
switch ( fontparam ) {
2017-08-24 11:22:59 +00:00
case Asc . c _oAscVAlign . Top : index = 0 ; align = 'btn-valign-top' ; break ;
case Asc . c _oAscVAlign . Center : index = 1 ; align = 'btn-valign-middle' ; break ;
case Asc . c _oAscVAlign . Bottom : index = 2 ; align = 'btn-valign-bottom' ; break ;
2016-03-11 00:48:53 +00:00
}
if ( index > - 1 ) {
toolbar . btnAlignTop . toggle ( index === 0 , true ) ;
toolbar . btnAlignMiddle . toggle ( index === 1 , true ) ;
toolbar . btnAlignBottom . toggle ( index === 2 , true ) ;
toolbar . btnVerticalAlign . menu . items [ index ] . setChecked ( true , false ) ;
var btnVerticalAlign = this . toolbar . btnVerticalAlign ;
if ( btnVerticalAlign . rendered ) {
2017-04-28 14:08:11 +00:00
var vIconEl = $ ( '.icon' , btnVerticalAlign . cmpEl ) ;
2016-03-11 00:48:53 +00:00
if ( vIconEl ) {
vIconEl . removeClass ( btnVerticalAlign . options . icls ) ;
btnVerticalAlign . options . icls = align ;
vIconEl . addClass ( btnVerticalAlign . options . icls ) ;
}
}
}
}
2016-03-29 14:35:28 +00:00
need _disable = this . _state . controlsdisabled . filters || formatTableInfo !== null || filterInfo && filterInfo . asc _getIsAutoFilter ( ) === null ;
2016-03-11 00:48:53 +00:00
// (need_disable !== toolbar.btnMerge.isDisabled()) && toolbar.btnMerge.setDisabled(need_disable);
toolbar . lockToolbar ( SSE . enumLock . ruleMerge , need _disable , { array : [ toolbar . btnMerge ] } ) ;
val = info . asc _getFlags ( ) . asc _getMerge ( ) ;
if ( this . _state . merge !== val ) {
2017-04-11 11:05:56 +00:00
toolbar . btnMerge . toggle ( val === Asc . c _oAscMergeOptions . Merge , true ) ;
2016-03-11 00:48:53 +00:00
this . _state . merge = val ;
}
/* read cell text wrapping */
if ( ! toolbar . btnWrap . isDisabled ( ) ) {
val = info . asc _getFlags ( ) . asc _getWrapText ( ) ;
if ( this . _state . wrap !== val ) {
toolbar . btnWrap . toggle ( val === true , true ) ;
this . _state . wrap = val ;
}
}
}
val = ( filterInfo ) ? filterInfo . asc _getIsAutoFilter ( ) : null ;
if ( this . _state . filter !== val ) {
toolbar . btnSetAutofilter . toggle ( val === true , true ) ;
toolbar . mnuitemAutoFilter . setChecked ( val === true , true ) ;
this . _state . filter = val ;
}
need _disable = this . _state . controlsdisabled . filters || ( val === null ) ;
toolbar . lockToolbar ( SSE . enumLock . ruleFilter , need _disable ,
{ array : [ toolbar . btnSortDown , toolbar . btnSortUp , toolbar . mnuitemSortAZ , toolbar . mnuitemSortZA ,
toolbar . btnTableTemplate , toolbar . btnSetAutofilter , toolbar . mnuitemAutoFilter , toolbar . btnAutofilter ] } ) ;
2016-03-29 14:35:28 +00:00
val = ( formatTableInfo ) ? formatTableInfo . asc _getTableStyleName ( ) : null ;
2016-03-11 00:48:53 +00:00
if ( this . _state . tablestylename !== val && this . toolbar . mnuTableTemplatePicker ) {
val = this . toolbar . mnuTableTemplatePicker . store . findWhere ( { name : val } ) ;
if ( val ) {
this . toolbar . mnuTableTemplatePicker . selectRecord ( val ) ;
this . _state . tablestylename = val . get ( 'name' ) ;
} else {
toolbar . mnuTableTemplatePicker . deselectAll ( ) ;
this . _state . tablestylename = null ;
}
}
need _disable = this . _state . controlsdisabled . filters || ! filterInfo || ( filterInfo . asc _getIsApplyAutoFilter ( ) !== true ) ;
toolbar . lockToolbar ( SSE . enumLock . ruleDelFilter , need _disable , { array : [ toolbar . btnClearAutofilter , toolbar . mnuitemClearFilter ] } ) ;
2017-04-11 11:05:56 +00:00
var old _name = this . _state . tablename ;
this . _state . tablename = ( formatTableInfo ) ? formatTableInfo . asc _getTableName ( ) : undefined ;
var old _applied = this . _state . filterapplied ;
this . _state . filterapplied = this . _state . filter && filterInfo . asc _getIsApplyAutoFilter ( ) ;
if ( this . _state . tablename !== old _name || this . _state . filterapplied !== old _applied )
this . getApplication ( ) . getController ( 'Statusbar' ) . onApiFilterInfo ( ! need _disable ) ;
2016-11-01 12:42:46 +00:00
this . _state . multiselect = info . asc _getFlags ( ) . asc _getMultiselect ( ) ;
toolbar . lockToolbar ( SSE . enumLock . multiselect , this . _state . multiselect , { array : [ toolbar . btnTableTemplate , toolbar . btnInsertHyperlink ] } ) ;
2017-06-21 09:47:22 +00:00
need _disable = ! ! info . asc _getPivotTableInfo ( ) ;
2017-09-14 12:48:54 +00:00
toolbar . lockToolbar ( SSE . enumLock . editPivot , need _disable , { array : [ toolbar . btnMerge , toolbar . btnInsertHyperlink , toolbar . btnSetAutofilter , toolbar . btnClearAutofilter , toolbar . btnSortDown , toolbar . btnSortUp , toolbar . btnAutofilter ] } ) ;
2017-10-19 10:14:12 +00:00
need _disable = ! this . appConfig . canModifyFilter ;
toolbar . lockToolbar ( SSE . enumLock . cantModifyFilter , need _disable , { array : [ toolbar . btnSortDown , toolbar . btnSortUp , toolbar . mnuitemSortAZ , toolbar . mnuitemSortZA , toolbar . btnSetAutofilter ,
toolbar . btnAutofilter , toolbar . btnTableTemplate , toolbar . btnClearStyle . menu . items [ 0 ] , toolbar . btnClearStyle . menu . items [ 2 ] ] } ) ;
2016-03-11 00:48:53 +00:00
}
2017-01-20 10:34:52 +00:00
val = info . asc _getNumFormatInfo ( ) ;
if ( val ) {
this . _state . numformat = info . asc _getNumFormat ( ) ;
2017-02-07 09:56:32 +00:00
this . _state . numformatinfo = val ;
2017-01-20 10:34:52 +00:00
val = val . asc _getType ( ) ;
if ( this . _state . numformattype !== val ) {
toolbar . cmbNumberFormat . setValue ( val , toolbar . txtCustom ) ;
this . _state . numformattype = val ;
}
2017-01-12 14:14:51 +00:00
}
2016-03-11 00:48:53 +00:00
2017-05-15 13:32:01 +00:00
if ( selectionType == Asc . c _oAscSelectionType . RangeShapeText ) {
var SelectedObjects = this . api . asc _getGraphicObjectProps ( ) ;
for ( var i = 0 ; i < SelectedObjects . length ; ++ i )
{
if ( SelectedObjects [ i ] . asc _getObjectType ( ) == Asc . c _oAscTypeSelectElement . Image )
val = SelectedObjects [ i ] . asc _getObjectValue ( ) . asc _getVert ( ) ;
}
} else
val = info . asc _getAngle ( ) ;
2016-03-11 00:48:53 +00:00
if ( this . _state . angle !== val ) {
2017-11-13 08:41:32 +00:00
toolbar . btnTextOrient . menu . clearAll ( ) ;
2016-03-11 00:48:53 +00:00
switch ( val ) {
case 45 : toolbar . btnTextOrient . menu . items [ 1 ] . setChecked ( true , true ) ; break ;
case - 45 : toolbar . btnTextOrient . menu . items [ 2 ] . setChecked ( true , true ) ; break ;
2017-05-15 13:32:01 +00:00
case 90 : case Asc . c _oAscVertDrawingText . vert270 : toolbar . btnTextOrient . menu . items [ 3 ] . setChecked ( true , true ) ; break ;
case - 90 : case Asc . c _oAscVertDrawingText . vert : toolbar . btnTextOrient . menu . items [ 4 ] . setChecked ( true , true ) ; break ;
2016-03-11 00:48:53 +00:00
default : toolbar . btnTextOrient . menu . items [ 0 ] . setChecked ( true , true ) ; break ;
}
this . _state . angle = val ;
}
val = info . asc _getStyleName ( ) ;
if ( this . _state . prstyle != val && ! this . toolbar . listStyles . isDisabled ( ) ) {
var listStyle = this . toolbar . listStyles ,
listStylesVisible = ( listStyle . rendered ) ;
if ( listStylesVisible ) {
listStyle . suspendEvents ( ) ;
var styleRec = listStyle . menuPicker . store . findWhere ( {
name : val
} ) ;
this . _state . prstyle = ( listStyle . menuPicker . store . length > 0 ) ? val : undefined ;
listStyle . menuPicker . selectRecord ( styleRec ) ;
listStyle . resumeEvents ( ) ;
}
}
2016-04-05 11:52:34 +00:00
val = ( selectionType == Asc . c _oAscSelectionType . RangeRow ) ;
2016-03-11 00:48:53 +00:00
if ( this . _state . controlsdisabled . rows !== val ) {
this . _state . controlsdisabled . rows = val ;
toolbar . btnAddCell . menu . items [ 3 ] . setDisabled ( val ) ;
toolbar . btnDeleteCell . menu . items [ 3 ] . setDisabled ( val ) ;
}
2016-04-05 11:52:34 +00:00
val = ( selectionType == Asc . c _oAscSelectionType . RangeCol ) ;
2016-03-11 00:48:53 +00:00
if ( this . _state . controlsdisabled . cols !== val ) {
this . _state . controlsdisabled . cols = val ;
toolbar . btnAddCell . menu . items [ 2 ] . setDisabled ( val ) ;
toolbar . btnDeleteCell . menu . items [ 2 ] . setDisabled ( val ) ;
}
val = filterInfo && filterInfo . asc _getIsApplyAutoFilter ( ) ;
if ( this . _state . controlsdisabled . cells _right !== ( this . _state . controlsdisabled . rows || val ) ) {
this . _state . controlsdisabled . cells _right = ( this . _state . controlsdisabled . rows || val ) ;
toolbar . btnAddCell . menu . items [ 0 ] . setDisabled ( this . _state . controlsdisabled . cells _right ) ;
toolbar . btnDeleteCell . menu . items [ 0 ] . setDisabled ( this . _state . controlsdisabled . cells _right ) ;
}
if ( this . _state . controlsdisabled . cells _down !== ( this . _state . controlsdisabled . cols || val ) ) {
this . _state . controlsdisabled . cells _down = ( this . _state . controlsdisabled . cols || val ) ;
toolbar . btnAddCell . menu . items [ 1 ] . setDisabled ( this . _state . controlsdisabled . cells _down ) ;
toolbar . btnDeleteCell . menu . items [ 1 ] . setDisabled ( this . _state . controlsdisabled . cells _down ) ;
}
2017-06-28 11:20:49 +00:00
2017-06-30 11:33:31 +00:00
toolbar . lockToolbar ( SSE . enumLock . commentLock , ( selectionType == Asc . c _oAscSelectionType . RangeCells ) && ( info . asc _getComments ( ) . length > 0 || info . asc _getLocked ( ) ) ,
{ array : this . btnsComment } ) ;
2016-03-11 00:48:53 +00:00
} ,
2017-04-28 12:24:57 +00:00
onApiSelectionChanged _DiagramEditor : function ( info ) {
if ( ! this . editMode || this . api . isCellEdited || this . api . isRangeSelection ) return ;
var me = this ;
var _disableEditOptions = function ( seltype , coauth _disable ) {
var is _chart _text = seltype == Asc . c _oAscSelectionType . RangeChartText ,
is _chart = seltype == Asc . c _oAscSelectionType . RangeChart ,
is _shape _text = seltype == Asc . c _oAscSelectionType . RangeShapeText ,
is _shape = seltype == Asc . c _oAscSelectionType . RangeShape ,
is _image = seltype == Asc . c _oAscSelectionType . RangeImage ,
is _mode _2 = is _shape _text || is _shape || is _chart _text || is _chart ,
is _objLocked = false ;
if ( ! ( is _mode _2 || is _image ) &&
me . _state . selection _type === seltype &&
me . _state . coauthdisable === coauth _disable )
return ( seltype === Asc . c _oAscSelectionType . RangeImage ) ;
if ( is _mode _2 ) {
var selectedObjects = me . api . asc _getGraphicObjectProps ( ) ;
is _objLocked = selectedObjects . some ( function ( object ) {
return object . asc _getObjectType ( ) == Asc . c _oAscTypeSelectElement . Image && object . asc _getObjectValue ( ) . asc _getLocked ( ) ;
} ) ;
}
var _set = SSE . enumLock ;
var type = seltype ;
switch ( seltype ) {
case Asc . c _oAscSelectionType . RangeImage : type = _set . selImage ; break ;
case Asc . c _oAscSelectionType . RangeShape : type = _set . selShape ; break ;
case Asc . c _oAscSelectionType . RangeShapeText : type = _set . selShapeText ; break ;
case Asc . c _oAscSelectionType . RangeChart : type = _set . selChart ; break ;
case Asc . c _oAscSelectionType . RangeChartText : type = _set . selChartText ; break ;
}
me . toolbar . lockToolbar ( type , type != seltype , {
clear : [ _set . selImage , _set . selChart , _set . selChartText , _set . selShape , _set . selShapeText , _set . coAuth ]
} ) ;
me . toolbar . lockToolbar ( SSE . enumLock . coAuthText , is _objLocked ) ;
return is _image ;
} ;
var selectionType = info . asc _getFlags ( ) . asc _getSelectionType ( ) ,
coauth _disable = false ;
if ( _disableEditOptions ( selectionType , coauth _disable ) ) return ;
if ( selectionType == Asc . c _oAscSelectionType . RangeChart || selectionType == Asc . c _oAscSelectionType . RangeChartText )
return ;
var val = info . asc _getNumFormatInfo ( ) ;
if ( val ) {
this . _state . numformat = info . asc _getNumFormat ( ) ;
this . _state . numformatinfo = val ;
val = val . asc _getType ( ) ;
if ( this . _state . numformattype !== val ) {
me . toolbar . cmbNumberFormat . setValue ( val , me . toolbar . txtCustom ) ;
this . _state . numformattype = val ;
}
}
} ,
2017-04-28 13:37:28 +00:00
onApiSelectionChanged _MailMergeEditor : function ( info ) {
if ( ! this . editMode || this . api . isCellEdited || this . api . isRangeSelection ) return ;
var me = this ;
var _disableEditOptions = function ( seltype , coauth _disable ) {
var is _chart _text = seltype == Asc . c _oAscSelectionType . RangeChartText ,
is _chart = seltype == Asc . c _oAscSelectionType . RangeChart ,
is _shape _text = seltype == Asc . c _oAscSelectionType . RangeShapeText ,
is _shape = seltype == Asc . c _oAscSelectionType . RangeShape ,
is _image = seltype == Asc . c _oAscSelectionType . RangeImage ,
is _mode _2 = is _shape _text || is _shape || is _chart _text || is _chart ,
is _objLocked = false ;
if ( ! ( is _mode _2 || is _image ) &&
me . _state . selection _type === seltype &&
me . _state . coauthdisable === coauth _disable )
return seltype === Asc . c _oAscSelectionType . RangeImage ;
if ( is _mode _2 ) {
var selectedObjects = me . api . asc _getGraphicObjectProps ( ) ;
is _objLocked = selectedObjects . some ( function ( object ) {
return object . asc _getObjectType ( ) == Asc . c _oAscTypeSelectElement . Image && object . asc _getObjectValue ( ) . asc _getLocked ( ) ;
} ) ;
}
me . toolbar . lockToolbar ( SSE . enumLock . coAuthText , is _objLocked ) ;
return is _image ;
} ;
var selectionType = info . asc _getFlags ( ) . asc _getSelectionType ( ) ,
coauth _disable = false ,
editOptionsDisabled = _disableEditOptions ( selectionType , coauth _disable ) ,
val , need _disable = false ;
if ( editOptionsDisabled ) return ;
if ( selectionType == Asc . c _oAscSelectionType . RangeChart || selectionType == Asc . c _oAscSelectionType . RangeChartText )
return ;
if ( ! me . toolbar . mode . isEditDiagram ) {
var filterInfo = info . asc _getAutoFilterInfo ( ) ;
val = filterInfo ? filterInfo . asc _getIsAutoFilter ( ) : null ;
if ( this . _state . filter !== val ) {
me . toolbar . btnSetAutofilter . toggle ( val === true , true ) ;
// toolbar.mnuitemAutoFilter.setChecked(val===true, true);
this . _state . filter = val ;
}
need _disable = this . _state . controlsdisabled . filters || ( val === null ) ;
me . toolbar . lockToolbar ( SSE . enumLock . ruleFilter , need _disable ,
{ array : [ me . toolbar . btnSortDown , me . toolbar . btnSortUp , me . toolbar . btnSetAutofilter ] } ) ;
need _disable = this . _state . controlsdisabled . filters || ! filterInfo || ( filterInfo . asc _getIsApplyAutoFilter ( ) !== true ) ;
me . toolbar . lockToolbar ( SSE . enumLock . ruleDelFilter , need _disable , { array : [ me . toolbar . btnClearAutofilter ] } ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onApiStyleChange : function ( ) {
this . toolbar . btnCopyStyle . toggle ( false , true ) ;
this . modeAlwaysSetStyle = false ;
} ,
updateThemeColors : function ( ) {
var updateColors = function ( picker , defaultColor ) {
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 = defaultColor ;
} else if ( clr !== undefined ) {
picker . currentColor = clr ;
}
}
} ;
updateColors ( this . toolbar . mnuTextColorPicker , Common . Utils . ThemeColor . getStandartColors ( ) [ 1 ] ) ;
if ( this . toolbar . btnTextColor . currentColor === undefined ) {
this . toolbar . btnTextColor . currentColor = Common . Utils . ThemeColor . getStandartColors ( ) [ 1 ] ;
} else
this . toolbar . btnTextColor . currentColor = this . toolbar . mnuTextColorPicker . currentColor . color || this . toolbar . mnuTextColorPicker . currentColor ;
$ ( '.btn-color-value-line' , this . toolbar . btnTextColor . cmpEl ) . css ( 'background-color' , '#' + this . toolbar . btnTextColor . currentColor ) ;
updateColors ( this . toolbar . mnuBackColorPicker , Common . Utils . ThemeColor . getStandartColors ( ) [ 3 ] ) ;
if ( this . toolbar . btnBackColor . currentColor === undefined ) {
this . toolbar . btnBackColor . currentColor = Common . Utils . ThemeColor . getStandartColors ( ) [ 3 ] ;
} else
this . toolbar . btnBackColor . currentColor = this . toolbar . mnuBackColorPicker . currentColor . color || this . toolbar . mnuBackColorPicker . currentColor ;
$ ( '.btn-color-value-line' , this . toolbar . btnBackColor . cmpEl ) . css ( 'background-color' , this . toolbar . btnBackColor . currentColor == 'transparent' ? 'transparent' : '#' + this . toolbar . btnBackColor . currentColor ) ;
if ( this . _state . clrtext _asccolor !== undefined || this . _state . clrshd _asccolor !== undefined ) {
this . _state . clrtext = undefined ;
this . _state . clrback = undefined ;
this . onApiSelectionChanged ( this . api . asc _getCellInfo ( ) ) ;
2017-04-28 12:24:57 +00:00
}
2016-03-11 00:48:53 +00:00
this . _state . clrtext _asccolor = undefined ;
this . _state . clrshd _asccolor = undefined ;
2016-09-01 14:45:04 +00:00
if ( this . toolbar . mnuBorderColorPicker ) {
updateColors ( this . toolbar . mnuBorderColorPicker , Common . Utils . ThemeColor . getEffectColors ( ) [ 1 ] ) ;
this . toolbar . btnBorders . options . borderscolor = this . toolbar . mnuBorderColorPicker . currentColor . color || this . toolbar . mnuBorderColorPicker . currentColor ;
$ ( '#id-toolbar-mnu-item-border-color .menu-item-icon' ) . css ( 'border-color' , '#' + this . toolbar . btnBorders . options . borderscolor ) ;
}
2016-03-11 00:48:53 +00:00
} ,
hideElements : function ( opts ) {
if ( ! _ . isUndefined ( opts . title ) ) {
var headerView = this . getApplication ( ) . getController ( 'Viewport' ) . getView ( 'Common.Views.Header' ) ;
headerView && headerView . setVisible ( ! opts . title ) ;
Common . NotificationCenter . trigger ( 'layout:changed' , 'header' ) ;
}
if ( ! _ . isUndefined ( opts . compact ) ) {
this . onChangeViewMode ( opts . compact ) ;
}
if ( ! _ . isUndefined ( opts . formula ) ) {
var cellEditor = this . getApplication ( ) . getController ( 'CellEditor' ) . getView ( 'CellEditor' ) ;
cellEditor && cellEditor . setVisible ( ! opts . formula ) ;
Common . NotificationCenter . trigger ( 'layout:changed' , 'celleditor' , opts . formula ? 'hidden' : 'showed' ) ;
}
if ( ! _ . isUndefined ( opts . headings ) ) {
if ( this . api ) {
2016-12-14 12:23:53 +00:00
this . api . asc _setDisplayHeadings ( ! opts . headings ) ;
2016-03-11 00:48:53 +00:00
}
}
if ( ! _ . isUndefined ( opts . gridlines ) ) {
if ( this . api ) {
2016-12-14 12:23:53 +00:00
this . api . asc _setDisplayGridlines ( ! opts . gridlines ) ;
2016-03-11 00:48:53 +00:00
}
}
2016-11-18 12:36:48 +00:00
if ( ! _ . isUndefined ( opts . freezepanes ) ) {
if ( this . api ) {
this . api . asc _freezePane ( ) ;
}
}
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar ) ;
} ,
fillAutoShapes : function ( ) {
var me = this ,
shapesStore = this . getApplication ( ) . getCollection ( 'ShapeGroups' ) ;
for ( var i = 0 ; i < shapesStore . length ; i ++ ) {
var shapeGroup = shapesStore . at ( i ) ;
var menuItem = new Common . UI . MenuItem ( {
caption : shapeGroup . get ( 'groupName' ) ,
menu : new Common . UI . Menu ( {
menuAlign : 'tl-tr' ,
items : [
{ template : _ . template ( '<div id="id-toolbar-menu-shapegroup' + i + '" class="menu-shape" style="width: ' + ( shapeGroup . get ( 'groupWidth' ) - 8 ) + 'px; margin-left: 5px;"></div>' ) }
]
} )
} ) ;
me . toolbar . btnInsertShape . menu . addItem ( menuItem ) ;
var shapePicker = new Common . UI . DataView ( {
el : $ ( '#id-toolbar-menu-shapegroup' + i ) ,
store : shapeGroup . get ( 'groupStore' ) ,
parentMenu : menuItem . menu ,
showLast : false ,
itemTemplate : _ . template ( '<div class="item-shape"><img src="<%= imageUrl %>" id="<%= id %>"></div>' )
} ) ;
shapePicker . on ( 'item:click' , function ( picker , item , record , e ) {
if ( me . api ) {
2017-10-24 12:59:18 +00:00
if ( record ) {
me . _addAutoshape ( true , record . get ( 'data' ) . shapeType ) ;
me . _isAddingShape = true ;
}
2016-03-11 00:48:53 +00:00
if ( me . toolbar . btnInsertText . pressed ) {
me . toolbar . btnInsertText . toggle ( false , true ) ;
}
if ( e . type !== 'click' )
me . toolbar . btnInsertShape . menu . hide ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar , me . toolbar . btnInsertShape ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Shape' ) ;
}
} ) ;
}
} ,
fillTextArt : function ( ) {
2017-08-01 12:28:15 +00:00
if ( ! this . toolbar . btnInsertTextArt . rendered ) return ;
2016-08-23 08:50:19 +00:00
2016-03-11 00:48:53 +00:00
var me = this ;
2017-08-01 12:28:15 +00:00
if ( this . toolbar . mnuTextArtPicker ) {
2016-03-11 00:48:53 +00:00
var models = this . getApplication ( ) . getCollection ( 'Common.Collections.TextArt' ) . models ,
count = this . toolbar . mnuTextArtPicker . store . length ;
if ( count > 0 && count == models . length ) {
var data = this . toolbar . mnuTextArtPicker . store . models ;
_ . each ( models , function ( template , index ) {
data [ index ] . set ( 'imageUrl' , template . get ( 'imageUrl' ) ) ;
} ) ;
} else {
this . toolbar . mnuTextArtPicker . store . reset ( models ) ;
}
} else {
this . toolbar . mnuTextArtPicker = new Common . UI . DataView ( {
2017-08-04 11:03:02 +00:00
el : $ ( '#id-toolbar-menu-insart' ) ,
2016-03-11 00:48:53 +00:00
store : this . getApplication ( ) . getCollection ( 'Common.Collections.TextArt' ) ,
2017-08-04 11:03:02 +00:00
parentMenu : this . toolbar . btnInsertTextArt . menu ,
2016-03-11 00:48:53 +00:00
showLast : false ,
2017-04-11 11:05:56 +00:00
itemTemplate : _ . template ( '<div class="item-art"><img src="<%= imageUrl %>" id="<%= id %>" style="width:50px;height:50px;"></div>' )
2016-03-11 00:48:53 +00:00
} ) ;
2017-08-01 12:28:15 +00:00
this . toolbar . mnuTextArtPicker . on ( 'item:click' ,
function ( picker , item , record , e ) {
2017-10-24 12:59:18 +00:00
if ( record ) {
me . toolbar . fireEvent ( 'inserttextart' , me . toolbar ) ;
me . api . asc _addTextArt ( record . get ( 'data' ) ) ;
}
2017-08-01 12:28:15 +00:00
if ( me . toolbar . btnInsertShape . pressed )
2016-03-11 00:48:53 +00:00
me . toolbar . btnInsertShape . toggle ( false , true ) ;
2017-08-01 12:28:15 +00:00
if ( e . type !== 'click' )
me . toolbar . btnInsertTextArt . menu . hide ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar , me . toolbar . btnInsertTextArt ) ;
2016-03-11 00:48:53 +00:00
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Text Art' ) ;
}
2017-08-01 12:28:15 +00:00
) ;
2016-03-11 00:48:53 +00:00
}
} ,
2016-10-21 09:33:49 +00:00
fillEquations : function ( ) {
2016-10-24 10:58:34 +00:00
if ( ! this . toolbar . btnInsertEquation . rendered || this . toolbar . btnInsertEquation . menu . items . length > 0 ) return ;
2016-10-21 09:33:49 +00:00
var me = this , equationsStore = this . getApplication ( ) . getCollection ( 'EquationGroups' ) ;
me . equationPickers = [ ] ;
me . toolbar . btnInsertEquation . menu . removeAll ( ) ;
for ( var i = 0 ; i < equationsStore . length ; ++ i ) {
var equationGroup = equationsStore . at ( i ) ;
var menuItem = new Common . UI . MenuItem ( {
caption : equationGroup . get ( 'groupName' ) ,
menu : new Common . UI . Menu ( {
menuAlign : 'tl-tr' ,
items : [
{ template : _ . template ( '<div id="id-toolbar-menu-equationgroup' + i +
'" class="menu-shape" style="width:' + ( equationGroup . get ( 'groupWidth' ) + 8 ) + 'px; ' +
equationGroup . get ( 'groupHeight' ) + 'margin-left:5px;"></div>' ) }
]
} )
} ) ;
me . toolbar . btnInsertEquation . menu . addItem ( menuItem ) ;
var equationPicker = new Common . UI . DataView ( {
el : $ ( '#id-toolbar-menu-equationgroup' + i ) ,
store : equationGroup . get ( 'groupStore' ) ,
parentMenu : menuItem . menu ,
showLast : false ,
itemTemplate : _ . template ( '<div class="item-equation" ' +
'style="background-position:<%= posX %>px <%= posY %>px;" >' +
'<div style="width:<%= width %>px;height:<%= height %>px;" id="<%= id %>">' )
} ) ;
if ( equationGroup . get ( 'groupHeight' ) . length ) {
me . equationPickers . push ( equationPicker ) ;
me . toolbar . btnInsertEquation . menu . on ( 'show:after' , function ( ) {
if ( me . equationPickers . length ) {
var element = $ ( this . el ) . find ( '.over' ) . find ( '.menu-shape' ) ;
if ( element . length ) {
for ( var i = 0 ; i < me . equationPickers . length ; ++ i ) {
if ( element [ 0 ] . id == me . equationPickers [ i ] . el . id ) {
me . equationPickers [ i ] . scroller . update ( { alwaysVisibleY : true } ) ;
me . equationPickers . splice ( i , 1 ) ;
return ;
}
}
}
}
} ) ;
}
equationPicker . on ( 'item:click' , function ( picker , item , record , e ) {
if ( me . api ) {
2017-10-24 12:59:18 +00:00
if ( record )
me . api . asc _AddMath ( record . get ( 'data' ) . equationType ) ;
2016-10-21 09:33:49 +00:00
if ( me . toolbar . btnInsertText . pressed ) {
me . toolbar . btnInsertText . toggle ( false , true ) ;
}
if ( me . toolbar . btnInsertShape . pressed ) {
me . toolbar . btnInsertShape . toggle ( false , true ) ;
}
if ( e . type !== 'click' )
me . toolbar . btnInsertEquation . menu . hide ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar , me . toolbar . btnInsertEquation ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Equation' ) ;
}
} ) ;
}
} ,
onInsertEquationClick : function ( ) {
2016-10-25 10:48:31 +00:00
if ( this . api ) {
2016-10-21 09:33:49 +00:00
this . api . asc _AddMath ( ) ;
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Add Equation' ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , this . toolbar . btnInsertEquation ) ;
} ,
onMathTypes : function ( equation ) {
var equationgrouparray = [ ] ,
equationsStore = this . getCollection ( 'EquationGroups' ) ;
equationsStore . reset ( ) ;
// equations groups
var c _oAscMathMainTypeStrings = { } ;
// [translate, count cells, scroll]
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 ] ;
}
}
var i , id = 0 , count = 0 , length = 0 , width = 0 , height = 0 , store = null , list = null , eqStore = null , eq = null ;
if ( equation ) {
count = equation . get _Data ( ) . length ;
if ( count ) {
for ( var j = 0 ; j < count ; ++ j ) {
id = equation . get _Data ( ) [ j ] . get _Id ( ) ;
width = equation . get _Data ( ) [ j ] . get _W ( ) ;
height = equation . get _Data ( ) [ j ] . get _H ( ) ;
store = new Backbone . Collection ( [ ] , {
model : SSE . Models . EquationModel
} ) ;
if ( store ) {
var allItemsCount = 0 , itemsCount = 0 , ids = 0 ;
length = equation . get _Data ( ) [ j ] . get _Data ( ) . length ;
for ( i = 0 ; i < length ; ++ i ) {
eqStore = equation . get _Data ( ) [ j ] . get _Data ( ) [ i ] ;
itemsCount = eqStore . get _Data ( ) . length ;
for ( var p = 0 ; p < itemsCount ; ++ p ) {
eq = eqStore . get _Data ( ) [ p ] ;
ids = eq . get _Id ( ) ;
translate = '' ;
if ( translationTable . hasOwnProperty ( ids ) ) {
translate = translationTable [ ids ] ;
}
store . add ( {
data : { equationType : ids } ,
tip : translate ,
allowSelected : true ,
selected : false ,
width : eqStore . get _W ( ) ,
height : eqStore . get _H ( ) ,
posX : - eq . get _X ( ) ,
posY : - eq . get _Y ( )
} ) ;
}
allItemsCount += itemsCount ;
}
width = c _oAscMathMainTypeStrings [ id ] [ 1 ] * ( width + 10 ) ; // 4px margin + 4px margin + 1px border + 1px border
var normHeight = parseInt ( 370 / ( height + 10 ) ) * ( height + 10 ) ;
equationgrouparray . push ( {
groupName : c _oAscMathMainTypeStrings [ id ] [ 0 ] ,
groupStore : store ,
groupWidth : width ,
groupHeight : c _oAscMathMainTypeStrings [ id ] [ 2 ] ? ' height:' + normHeight + 'px!important; ' : ''
} ) ;
}
}
equationsStore . add ( equationgrouparray ) ;
this . fillEquations ( ) ;
}
}
} ,
2016-03-11 00:48:53 +00:00
attachToControlEvents : function ( ) {
// this.control({
// 'menu[action=table-templates]':{
// select: this._onMenuTableTemplate,
// itemmouseenter: function(obj, record, item, index, event, eOpts) {
// if (obj.tooltip) obj.tooltip.close();
// obj.tooltip = Ext.create('Ext.tip.ToolTip', {
// closeAction : 'destroy',
// dismissDelay : 2000,
// html : record.get('caption')
// });
// var xy = event.getXY();
// obj.tooltip.showAt([xy[0]+10,xy[1]+10]);
// },
// itemmouseleave: function(obj, record, item, index, e, eOpts) {
// if (obj.tooltip) obj.tooltip.close();
// },
// hide: function() {
// this.getToolbar().fireEvent('editcomplete', this.getToolbar());
// }
// },
// 'menu[action=number-format]': {
// click: this._handleNumberFormatMenu
// }
// });
} ,
onSheetChanged : function ( ) {
if ( this . api ) {
var params = this . api . asc _getSheetViewSettings ( ) ;
var menu = this . getMenuHideOptions ( ) ;
if ( menu ) {
menu . items . getAt ( 3 ) . setChecked ( ! params . asc _getShowRowColHeaders ( ) ) ;
menu . items . getAt ( 4 ) . setChecked ( ! params . asc _getShowGridLines ( ) ) ;
}
}
} ,
_disableEditOptions : function ( seltype , coauth _disable ) {
if ( this . api . isCellEdited ) return true ;
if ( this . api . isRangeSelection ) return true ;
var toolbar = this . toolbar ,
2016-04-05 11:52:34 +00:00
is _chart _text = seltype == Asc . c _oAscSelectionType . RangeChartText ,
is _chart = seltype == Asc . c _oAscSelectionType . RangeChart ,
is _shape _text = seltype == Asc . c _oAscSelectionType . RangeShapeText ,
is _shape = seltype == Asc . c _oAscSelectionType . RangeShape ,
is _image = seltype == Asc . c _oAscSelectionType . RangeImage ,
2016-11-24 08:36:52 +00:00
is _mode _2 = is _shape _text || is _shape || is _chart _text || is _chart ,
is _objLocked = false ;
if ( ! ( is _mode _2 || is _image ) && this . _state . selection _type === seltype && this . _state . coauthdisable === coauth _disable ) return ( seltype === Asc . c _oAscSelectionType . RangeImage ) ;
if ( is _mode _2 ) {
var SelectedObjects = this . api . asc _getGraphicObjectProps ( ) ;
for ( var i = 0 ; i < SelectedObjects . length ; ++ i )
{
if ( SelectedObjects [ i ] . asc _getObjectType ( ) == Asc . c _oAscTypeSelectElement . Image )
is _objLocked = is _objLocked || SelectedObjects [ i ] . asc _getObjectValue ( ) . asc _getLocked ( ) ;
}
}
2016-03-11 00:48:53 +00:00
if ( coauth _disable ) {
toolbar . lockToolbar ( SSE . enumLock . coAuth , coauth _disable ) ;
} else {
var _set = SSE . enumLock ;
var type = seltype ;
switch ( seltype ) {
2016-04-05 11:52:34 +00:00
case Asc . c _oAscSelectionType . RangeImage : type = _set . selImage ; break ;
case Asc . c _oAscSelectionType . RangeShape : type = _set . selShape ; break ;
case Asc . c _oAscSelectionType . RangeShapeText : type = _set . selShapeText ; break ;
case Asc . c _oAscSelectionType . RangeChart : type = _set . selChart ; break ;
case Asc . c _oAscSelectionType . RangeChartText : type = _set . selChartText ; break ;
2016-03-11 00:48:53 +00:00
}
2017-04-27 15:40:27 +00:00
if ( ! this . appConfig . isEditDiagram && ! this . appConfig . isEditMailMerge )
toolbar . lockToolbar ( type , type != seltype , {
array : [
toolbar . btnClearStyle . menu . items [ 1 ] ,
toolbar . btnClearStyle . menu . items [ 2 ] ,
toolbar . btnClearStyle . menu . items [ 3 ] ,
toolbar . btnClearStyle . menu . items [ 4 ] ,
toolbar . mnuitemSortAZ ,
toolbar . mnuitemSortZA ,
toolbar . mnuitemAutoFilter ,
toolbar . mnuitemClearFilter
2017-06-30 11:33:31 +00:00
] ,
2017-04-27 15:40:27 +00:00
merge : true ,
clear : [ _set . selImage , _set . selChart , _set . selChartText , _set . selShape , _set . selShapeText , _set . coAuth ]
} ) ;
2016-11-24 08:36:52 +00:00
toolbar . lockToolbar ( SSE . enumLock . coAuthText , is _objLocked ) ;
2016-12-28 11:54:48 +00:00
toolbar . lockToolbar ( SSE . enumLock . coAuthText , is _objLocked && ( seltype == Asc . c _oAscSelectionType . RangeChart || seltype == Asc . c _oAscSelectionType . RangeChartText ) , { array : [ toolbar . btnInsertChart ] } ) ;
2016-03-11 00:48:53 +00:00
}
this . _state . controlsdisabled . filters = is _image || is _mode _2 || coauth _disable ;
if ( is _image || is _mode _2 || coauth _disable ) {
2017-04-27 15:40:27 +00:00
if ( toolbar . listStyles ) {
toolbar . listStyles . suspendEvents ( ) ;
toolbar . listStyles . menuPicker . selectRecord ( null ) ;
toolbar . listStyles . resumeEvents ( ) ;
}
2016-03-11 00:48:53 +00:00
this . _state . prstyle = undefined ;
}
this . _state . selection _type = seltype ;
this . _state . coauthdisable = coauth _disable ; // need to redisable coAuthControls
return is _image ;
} ,
_getApiTextSize : function ( ) {
var cellInfo = this . api . asc _getCellInfo ( ) ;
return cellInfo ? cellInfo . asc _getFont ( ) . asc _getSize ( ) : 12 ;
} ,
_setTableFormat : function ( fmtname ) {
var me = this ;
if ( me . api . isRangeSelection !== true ) {
2016-10-05 15:53:56 +00:00
if ( ! me . api . asc _getCellInfo ( ) . asc _getFormatTableInfo ( ) ) {
2016-03-11 00:48:53 +00:00
var handlerDlg = function ( dlg , result ) {
if ( result == 'ok' ) {
me . _state . filter = undefined ;
2016-04-05 11:52:34 +00:00
me . api . asc _setSelectionDialogMode ( Asc . c _oAscSelectionDialogType . None ) ;
2016-03-11 00:48:53 +00:00
if ( me . _state . tablename )
2016-04-05 11:52:34 +00:00
me . api . asc _changeAutoFilter ( me . _state . tablename , Asc . c _oAscChangeFilterOptions . style , fmtname ) ;
2017-04-11 11:05:56 +00:00
else {
var settings = dlg . getSettings ( ) ;
if ( settings . selectionType == Asc . c _oAscSelectionType . RangeMax || settings . selectionType == Asc . c _oAscSelectionType . RangeRow ||
settings . selectionType == Asc . c _oAscSelectionType . RangeCol )
Common . UI . warning ( {
title : me . textLongOperation ,
msg : me . warnLongOperation ,
buttons : [ 'ok' , 'cancel' ] ,
callback : function ( btn ) {
if ( btn == 'ok' )
setTimeout ( function ( ) { me . api . asc _addAutoFilter ( fmtname , settings . range ) } , 1 ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
}
} ) ;
else
me . api . asc _addAutoFilter ( fmtname , settings . range ) ;
}
2016-03-11 00:48:53 +00:00
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
} ;
var win = new SSE . Views . TableOptionsDialog ( {
handler : handlerDlg
} ) ;
win . show ( ) ;
win . setSettings ( {
2017-04-11 11:05:56 +00:00
api : me . api ,
selectionType : me . api . asc _getCellInfo ( ) . asc _getFlags ( ) . asc _getSelectionType ( )
2016-03-11 00:48:53 +00:00
} ) ;
} else {
me . _state . filter = undefined ;
if ( me . _state . tablename )
2016-04-05 11:52:34 +00:00
me . api . asc _changeAutoFilter ( me . _state . tablename , Asc . c _oAscChangeFilterOptions . style , fmtname ) ;
2017-04-11 11:05:56 +00:00
else {
var selectionType = me . api . asc _getCellInfo ( ) . asc _getFlags ( ) . asc _getSelectionType ( ) ;
if ( selectionType == Asc . c _oAscSelectionType . RangeMax || selectionType == Asc . c _oAscSelectionType . RangeRow ||
selectionType == Asc . c _oAscSelectionType . RangeCol )
Common . UI . warning ( {
title : me . textLongOperation ,
msg : me . warnLongOperation ,
buttons : [ 'ok' , 'cancel' ] ,
callback : function ( btn ) {
if ( btn == 'ok' )
setTimeout ( function ( ) { me . api . asc _addAutoFilter ( fmtname ) } , 1 ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . toolbar ) ;
}
} ) ;
else
me . api . asc _addAutoFilter ( fmtname ) ;
}
2016-03-11 00:48:53 +00:00
}
}
} ,
onHideMenus : function ( e ) {
Common . NotificationCenter . trigger ( 'edit:complete' , this . toolbar , { restorefocus : true } ) ;
} ,
onSetupCopyStyleButton : function ( ) {
this . modeAlwaysSetStyle = false ;
var acsCopyFmtStyleState = {
kOff : 0 ,
kOn : 1 ,
kMultiple : 2
} ;
var me = this ;
Common . NotificationCenter . on ( {
'edit:complete' : function ( ) {
if ( me . api && me . modeAlwaysSetStyle ) {
me . api . asc _formatPainter ( acsCopyFmtStyleState . kOff ) ;
me . toolbar . btnCopyStyle . toggle ( false , true ) ;
me . modeAlwaysSetStyle = false ;
}
}
} ) ;
$ ( me . toolbar . btnCopyStyle . cmpEl ) . dblclick ( function ( ) {
if ( me . api ) {
me . modeAlwaysSetStyle = true ;
me . toolbar . btnCopyStyle . toggle ( true , true ) ;
me . api . asc _formatPainter ( acsCopyFmtStyleState . kMultiple ) ;
}
} ) ;
} ,
onCellsRange : function ( status ) {
2016-04-05 11:52:34 +00:00
this . api . isRangeSelection = ( status != Asc . c _oAscSelectionDialogType . None ) ;
this . onApiEditCell ( this . api . isRangeSelection ? Asc . c _oAscCellEditorState . editStart : Asc . c _oAscCellEditorState . editEnd ) ;
2016-03-11 00:48:53 +00:00
var toolbar = this . toolbar ;
toolbar . lockToolbar ( SSE . enumLock . selRange , this . api . isRangeSelection ) ;
this . setDisabledComponents ( [ toolbar . btnUndo ] , this . api . isRangeSelection || ! this . api . asc _getCanUndo ( ) ) ;
this . setDisabledComponents ( [ toolbar . btnRedo ] , this . api . isRangeSelection || ! this . api . asc _getCanRedo ( ) ) ;
this . onApiSelectionChanged ( this . api . asc _getCellInfo ( ) ) ;
} ,
onLockDefNameManager : function ( state ) {
2016-04-05 11:52:34 +00:00
this . _state . namedrange _locked = ( state == Asc . c _oAscDefinedNameReason . LockDefNameManager ) ;
2016-03-11 00:48:53 +00:00
} ,
2017-11-10 07:50:01 +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 ) ;
this . toolbar . lockToolbar ( SSE . enumLock . menuFileOpen , disable , { array : [ toolbar . btnShowMode ] } ) ;
if ( disable ) {
2017-06-15 13:18:40 +00:00
mask = $ ( "<div class='toolbar-mask'>" ) . appendTo ( toolbar . $el . find ( '.toolbar' ) ) ;
2017-01-17 13:40:18 +00:00
Common . util . Shortcuts . suspendEvents ( 'command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h, command+1, ctrl+1' ) ;
2016-03-11 00:48:53 +00:00
} else {
mask . remove ( ) ;
2017-01-17 13:40:18 +00:00
Common . util . Shortcuts . resumeEvents ( 'command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h, command+1, ctrl+1' ) ;
2016-03-11 00:48:53 +00:00
}
} ,
applyFormulaSettings : function ( ) {
2017-06-14 11:53:29 +00:00
if ( this . toolbar . rendered ) {
var formulas = this . toolbar . btnInsertFormula . menu . items ;
for ( var i = 0 ; i < Math . min ( 4 , formulas . length ) ; i ++ ) {
formulas [ i ] . setCaption ( this . api . asc _getFormulaLocaleName ( formulas [ i ] . value ) ) ;
}
2016-03-11 00:48:53 +00:00
}
} ,
2017-04-27 15:40:27 +00:00
onAppShowed : function ( config ) {
var me = this ;
me . appConfig = config ;
var compactview = ! config . isEdit ;
2017-05-01 11:29:38 +00:00
if ( config . isEdit && ! config . isEditDiagram && ! config . isEditMailMerge ) {
2017-04-27 15:40:27 +00:00
if ( Common . localStorage . itemExists ( "sse-compact-toolbar" ) ) {
compactview = Common . localStorage . getBool ( "sse-compact-toolbar" ) ;
} else
if ( config . customization && config . customization . compactToolbar )
compactview = true ;
}
me . toolbar . applyLayout ( config ) ;
me . toolbar . render ( _ . extend ( { isCompactView : compactview } , config ) ) ;
Common . Utils . asyncCall ( function ( ) {
me . toolbar . setMode ( config ) ;
2017-11-03 12:08:29 +00:00
if ( config . isEdit ) {
2017-04-27 15:40:27 +00:00
me . toolbar . setApi ( me . api ) ;
2017-06-30 14:49:58 +00:00
2017-11-03 12:08:29 +00:00
if ( ! config . isEditDiagram && ! config . isEditMailMerge ) {
var tab = { action : 'pivot' , caption : me . textPivot } ;
var $panel = me . getApplication ( ) . getController ( 'PivotTable' ) . createToolbarPanel ( ) ;
if ( $panel ) {
me . toolbar . addTab ( tab , $panel , 3 ) ;
me . toolbar . setVisible ( 'pivot' , true ) ;
}
2017-10-27 13:03:03 +00:00
2017-11-03 12:08:29 +00:00
tab = { action : 'review' , caption : me . toolbar . textTabCollaboration } ;
2017-11-15 07:59:06 +00:00
$panel = me . getApplication ( ) . getController ( 'Common.Controllers.ReviewChanges' ) . createToolbarPanel ( ) ;
if ( $panel )
2017-11-03 12:08:29 +00:00
me . toolbar . addTab ( tab , $panel , 4 ) ;
2017-11-17 14:35:40 +00:00
if ( config . isDesktopApp && config . isOffline ) {
tab = { action : 'protect' , caption : me . toolbar . textTabProtect } ;
var $panel = me . getApplication ( ) . getController ( 'Common.Controllers.Protection' ) . createToolbarPanel ( ) ;
if ( $panel )
me . toolbar . addTab ( tab , $panel , 5 ) ;
}
2017-10-12 10:43:23 +00:00
}
2017-06-30 14:49:58 +00:00
}
2017-04-27 15:40:27 +00:00
} ) ;
} ,
onAppReady : function ( config ) {
var me = this ;
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 = SSE . enumLock ;
2017-04-27 15:40:27 +00:00
var slots = me . toolbar . $el . find ( '.slot-comment' ) ;
slots . each ( function ( index , el ) {
var _cls = 'btn-toolbar' ;
/x-huge/ . test ( el . className ) && ( _cls += ' x-huge icon-top' ) ;
var button = new Common . UI . Button ( {
2017-08-08 15:00:55 +00:00
id : 'tlbtn-addcomment-' + index ,
2017-04-27 15:40:27 +00:00
cls : _cls ,
2017-06-28 11:16:09 +00:00
iconCls : 'btn-menu-comments' ,
2017-06-30 11:33:31 +00:00
lock : [ _set . lostConnect , _set . commentLock ] ,
2017-06-15 13:18:40 +00:00
caption : me . toolbar . capBtnComment
2017-04-27 15:40:27 +00:00
} ) . render ( slots . eq ( index ) ) ;
2017-06-28 11:20:49 +00:00
me . btnsComment . push ( button ) ;
2017-04-27 15:40:27 +00:00
} ) ;
2017-06-28 11:20:49 +00:00
if ( this . btnsComment . length ) {
2017-04-27 15:40:27 +00:00
var _comments = SSE . 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-27 15:40:27 +00:00
btn . on ( 'click' , function ( btn , e ) {
2017-06-30 11:33:31 +00:00
Common . NotificationCenter . trigger ( 'app:comment:add' , 'toolbar' , me . api . asc _getCellInfo ( ) . asc _getFlags ( ) . asc _getSelectionType ( ) != Asc . c _oAscSelectionType . RangeCells ) ;
2017-04-27 15:40:27 +00:00
} ) ;
} , this ) ;
}
}
Common . Utils . asyncCall ( function ( ) {
if ( config . isEdit ) {
me . toolbar . onAppReady ( config ) ;
}
} ) ;
} ,
onFileMenu : function ( opts ) {
this . toolbar . setTab ( opts == 'show' ? 'file' : undefined ) ;
} ,
2016-03-11 00:48:53 +00:00
textEmptyImgUrl : 'You need to specify image URL.' ,
warnMergeLostData : 'Operation can destroy data in the selected cells.<br>Continue?' ,
textWarning : 'Warning' ,
textFontSizeErr : 'The entered value is incorrect.<br>Please enter a numeric value between 1 and 409' ,
textCancel : 'Cancel' ,
2016-10-21 09:33:49 +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' ,
2017-02-06 14:12:59 +00:00
txtMatrix _Flat _Square : 'Sparse Matrix' ,
txtExpandSort : 'The data next to the selection will not be sorted. Do you want to expand the selection to include the adjacent data or continue with sorting the currently selected cells only?' ,
txtExpand : 'Expand and sort' ,
txtSorting : 'Sorting' ,
2017-04-11 11:05:56 +00:00
txtSortSelected : 'Sort selected' ,
textLongOperation : 'Long operation' ,
2017-04-18 13:16:03 +00:00
warnLongOperation : 'The operation you are about to perform might take rather much time to complete.<br>Are you sure you want to continue?' ,
txtInvalidRange : 'ERROR! Invalid cells range' ,
errorMaxRows : 'ERROR! The maximum number of data series per chart is 255.' ,
2017-06-30 14:49:58 +00:00
errorStockChart : 'Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.' ,
textPivot : 'Pivot Table'
2017-02-06 14:12:59 +00:00
2016-03-11 00:48:53 +00:00
} , SSE . Controllers . Toolbar || { } ) ) ;
} ) ;