2016-04-01 13:17:09 +00:00
/ *
*
2019-01-17 13:05:03 +00:00
* ( c ) Copyright Ascensio System SIA 2010 - 2019
2016-04-01 13:17:09 +00:00
*
* This program is a free software product . You can redistribute it and / or
* modify it under the terms of the GNU Affero General Public License ( AGPL )
* version 3 as published by the Free Software Foundation . In accordance with
* Section 7 ( a ) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non - infringement
* of any third - party rights .
*
* This program is distributed WITHOUT ANY WARRANTY ; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . For
* details , see the GNU AGPL at : http : //www.gnu.org/licenses/agpl-3.0.html
*
2019-01-17 13:00:34 +00:00
* You can contact Ascensio System SIA at 20 A - 12 Ernesta Birznieka - Upisha
* street , Riga , Latvia , EU , LV - 1050.
2016-04-01 13:17:09 +00:00
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices , as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7 ( b ) of the License you must retain the original Product
* logo when distributing the program . Pursuant to Section 7 ( e ) we decline to
* grant you any rights under trademark law for use of our trademarks .
*
* All the Product ' s GUI elements , including illustrations and icon sets , as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution - ShareAlike 4.0 International . See the License
* terms at http : //creativecommons.org/licenses/by-sa/4.0/legalcode
*
* /
2016-03-11 00:48:53 +00:00
/ * *
* DocumentHolder . js
*
* DocumentHolder controller
*
* Created by Julia Radzhabova on 3 / 28 / 14
2018-03-01 12:16:38 +00:00
* Copyright ( c ) 2018 Ascensio System SIA . All rights reserved .
2016-03-11 00:48:53 +00:00
*
* /
2019-08-07 09:17:08 +00:00
var c _paragraphLinerule = {
LINERULE _AUTO : 1 ,
LINERULE _EXACT : 2
} ;
var c _paragraphTextAlignment = {
RIGHT : 0 ,
LEFT : 1 ,
CENTERED : 2 ,
JUSTIFIED : 3
} ;
var c _paragraphSpecial = {
NONE _SPECIAL : 0 ,
FIRST _LINE : 1 ,
HANGING : 2
} ;
2016-03-11 00:48:53 +00:00
define ( [
'core' ,
'common/main/lib/util/utils' ,
2018-09-26 13:05:00 +00:00
'common/main/lib/util/Shortcuts' ,
2016-03-11 00:48:53 +00:00
'common/main/lib/view/CopyWarningDialog' ,
2019-04-17 13:16:02 +00:00
'common/main/lib/view/OpenDialog' ,
2019-11-07 11:01:07 +00:00
'common/main/lib/view/ListSettingsDialog' ,
2016-03-11 00:48:53 +00:00
'spreadsheeteditor/main/app/view/DocumentHolder' ,
'spreadsheeteditor/main/app/view/HyperlinkSettingsDialog' ,
'spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced' ,
2017-04-11 11:05:56 +00:00
'spreadsheeteditor/main/app/view/ImageSettingsAdvanced' ,
2016-03-11 00:48:53 +00:00
'spreadsheeteditor/main/app/view/SetValueDialog' ,
2020-02-28 13:30:58 +00:00
'spreadsheeteditor/main/app/view/AutoFilterDialog' ,
2020-05-25 17:25:16 +00:00
'spreadsheeteditor/main/app/view/SpecialPasteDialog' ,
2021-03-04 20:15:29 +00:00
'spreadsheeteditor/main/app/view/SlicerSettingsAdvanced' ,
2021-04-16 20:29:20 +00:00
'spreadsheeteditor/main/app/view/PivotGroupDialog' ,
'spreadsheeteditor/main/app/view/MacroDialog'
2016-03-11 00:48:53 +00:00
] , function ( ) {
'use strict' ;
SSE . Controllers . DocumentHolder = Backbone . Controller . extend ( _ . extend ( {
models : [ ] ,
collections : [ ] ,
views : [
'DocumentHolder'
] ,
initialize : function ( ) {
var me = this ;
me . tooltips = {
hyperlink : { } ,
/** coauthoring begin **/
comment : { } ,
/** coauthoring end **/
coauth : {
ttHeight : 20
} ,
row _column : {
ttHeight : 20
2018-05-31 07:27:38 +00:00
} ,
2020-05-28 10:58:38 +00:00
slicer : {
ttHeight : 20
} ,
2019-03-07 12:13:46 +00:00
filter : { ttHeight : 40 } ,
2019-07-30 12:24:47 +00:00
func _arg : { } ,
2021-07-28 19:13:08 +00:00
input _msg : { } ,
foreignSelect : {
ttHeight : 20
}
2016-03-11 00:48:53 +00:00
} ;
me . mouse = { } ;
me . popupmenu = false ;
me . rangeSelectionMode = false ;
me . namedrange _locked = false ;
2016-10-24 11:56:11 +00:00
me . _currentMathObj = undefined ;
me . _currentParaObjDisabled = false ;
2017-11-10 07:50:01 +00:00
me . _isDisabled = false ;
2021-09-06 23:02:15 +00:00
me . _state = { wsLock : false , wsProps : [ ] } ;
2021-06-28 11:51:32 +00:00
me . fastcoauthtips = [ ] ;
me . _TtHeight = 20 ;
2022-06-07 14:43:17 +00:00
me . externalData = {
stackRequests : [ ] ,
stackResponse : [ ] ,
callback : undefined
} ;
2016-03-11 00:48:53 +00:00
/** coauthoring begin **/
this . wrapEvents = {
2022-06-03 12:32:57 +00:00
apiHideComment : _ . bind ( this . onApiHideComment , this ) ,
onKeyUp : _ . bind ( this . onKeyUp , this )
2016-03-11 00:48:53 +00:00
} ;
/** coauthoring end **/
this . addListeners ( {
'DocumentHolder' : {
'createdelayedelements' : this . onCreateDelayedElements
}
} ) ;
var keymap = { } ;
this . hkComments = 'alt+h' ;
keymap [ this . hkComments ] = function ( ) {
me . onAddComment ( ) ;
2017-09-19 11:13:07 +00:00
return false ;
2016-03-11 00:48:53 +00:00
} ;
Common . util . Shortcuts . delegateShortcuts ( { shortcuts : keymap } ) ;
} ,
onLaunch : function ( ) {
var me = this ;
me . documentHolder = this . createView ( 'DocumentHolder' ) ;
// me.documentHolder.on('render:after', _.bind(me.onAfterRender, me));
me . documentHolder . render ( ) ;
me . documentHolder . el . tabIndex = - 1 ;
$ ( document ) . on ( 'mousedown' , _ . bind ( me . onDocumentRightDown , me ) ) ;
$ ( document ) . on ( 'mouseup' , _ . bind ( me . onDocumentRightUp , me ) ) ;
$ ( document ) . on ( 'keydown' , _ . bind ( me . onDocumentKeyDown , me ) ) ;
2019-04-03 13:03:20 +00:00
$ ( document ) . on ( 'mousemove' , _ . bind ( me . onDocumentMouseMove , me ) ) ;
2016-03-11 00:48:53 +00:00
$ ( window ) . on ( 'resize' , _ . bind ( me . onDocumentResize , me ) ) ;
var viewport = SSE . getController ( 'Viewport' ) . getView ( 'Viewport' ) ;
viewport . hlayout . on ( 'layout:resizedrag' , _ . bind ( me . onDocumentResize , me ) ) ;
Common . NotificationCenter . on ( {
'window:show' : function ( e ) {
me . hideHyperlinkTip ( ) ;
2020-03-05 11:38:25 +00:00
me . permissions && me . permissions . isDesktopApp && me . api && me . api . asc _onShowPopupWindow ( ) ;
2016-03-11 00:48:53 +00:00
} ,
'modal:show' : function ( e ) {
me . hideCoAuthTips ( ) ;
2021-07-28 19:13:08 +00:00
me . hideForeignSelectTips ( ) ;
2016-03-11 00:48:53 +00:00
} ,
'layout:changed' : function ( e ) {
me . hideHyperlinkTip ( ) ;
me . hideCoAuthTips ( ) ;
2021-07-28 19:13:08 +00:00
me . hideForeignSelectTips ( ) ;
2016-03-11 00:48:53 +00:00
me . onDocumentResize ( ) ;
2022-01-24 18:17:01 +00:00
if ( me . api && ! me . tooltips . input _msg . isHidden && me . tooltips . input _msg . text ) {
me . changeInputMessagePosition ( me . tooltips . input _msg ) ;
}
2016-03-11 00:48:53 +00:00
} ,
'cells:range' : function ( status ) {
me . onCellsRange ( status ) ;
2020-02-25 11:37:43 +00:00
} ,
2021-07-17 23:11:58 +00:00
'tabs:dragend' : _ . bind ( me . onDragEndMouseUp , me ) ,
'protect:wslock' : _ . bind ( me . onChangeProtectSheet , me )
2016-03-11 00:48:53 +00:00
} ) ;
2017-11-02 08:13:24 +00:00
Common . Gateway . on ( 'processmouse' , _ . bind ( me . onProcessMouse , me ) ) ;
2022-06-15 14:35:51 +00:00
Common . Gateway . on ( 'setactionlink' , _ . bind ( me . onSetActionLink , me ) ) ;
2016-03-11 00:48:53 +00:00
} ,
onCreateDelayedElements : function ( view ) {
var me = this ;
2021-09-14 20:26:45 +00:00
if ( me . permissions . isEdit && ! me . _isDisabled ) {
2017-06-06 08:04:04 +00:00
view . pmiCut . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
view . pmiCopy . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
view . pmiPaste . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
view . pmiImgCut . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
view . pmiImgCopy . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
view . pmiImgPaste . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
view . pmiTextCut . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
view . pmiTextCopy . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
view . pmiTextPaste . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
2019-07-23 10:24:38 +00:00
view . pmiCommonCut . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
view . pmiCommonCopy . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
view . pmiCommonPaste . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
2017-06-06 08:04:04 +00:00
view . pmiInsertEntire . on ( 'click' , _ . bind ( me . onInsertEntire , me ) ) ;
view . pmiDeleteEntire . on ( 'click' , _ . bind ( me . onDeleteEntire , me ) ) ;
view . pmiInsertCells . menu . on ( 'item:click' , _ . bind ( me . onInsertCells , me ) ) ;
view . pmiDeleteCells . menu . on ( 'item:click' , _ . bind ( me . onDeleteCells , me ) ) ;
view . pmiSparklines . menu . on ( 'item:click' , _ . bind ( me . onClear , me ) ) ;
view . pmiSortCells . menu . on ( 'item:click' , _ . bind ( me . onSortCells , me ) ) ;
view . pmiFilterCells . menu . on ( 'item:click' , _ . bind ( me . onFilterCells , me ) ) ;
view . pmiReapply . on ( 'click' , _ . bind ( me . onReapply , me ) ) ;
2021-03-11 20:11:07 +00:00
view . pmiCondFormat . on ( 'click' , _ . bind ( me . onCondFormat , me ) ) ;
2022-10-25 12:50:27 +00:00
view . mnuRefreshPivot . on ( 'click' , _ . bind ( me . onRefreshPivot , me ) ) ;
2021-03-04 20:15:29 +00:00
view . mnuGroupPivot . on ( 'click' , _ . bind ( me . onGroupPivot , me ) ) ;
view . mnuUnGroupPivot . on ( 'click' , _ . bind ( me . onGroupPivot , me ) ) ;
2017-06-06 08:04:04 +00:00
view . pmiClear . menu . on ( 'item:click' , _ . bind ( me . onClear , me ) ) ;
view . pmiSelectTable . menu . on ( 'item:click' , _ . bind ( me . onSelectTable , me ) ) ;
view . pmiInsertTable . menu . on ( 'item:click' , _ . bind ( me . onInsertTable , me ) ) ;
view . pmiDeleteTable . menu . on ( 'item:click' , _ . bind ( me . onDeleteTable , me ) ) ;
view . pmiInsFunction . on ( 'click' , _ . bind ( me . onInsFunction , me ) ) ;
view . menuAddHyperlink . on ( 'click' , _ . bind ( me . onInsHyperlink , me ) ) ;
view . menuEditHyperlink . on ( 'click' , _ . bind ( me . onInsHyperlink , me ) ) ;
view . menuRemoveHyperlink . on ( 'click' , _ . bind ( me . onDelHyperlink , me ) ) ;
view . pmiRowHeight . menu . on ( 'item:click' , _ . bind ( me . onSetSize , me ) ) ;
view . pmiColumnWidth . menu . on ( 'item:click' , _ . bind ( me . onSetSize , me ) ) ;
view . pmiEntireHide . on ( 'click' , _ . bind ( me . onEntireHide , me ) ) ;
view . pmiEntireShow . on ( 'click' , _ . bind ( me . onEntireShow , me ) ) ;
view . pmiFreezePanes . on ( 'click' , _ . bind ( me . onFreezePanes , me ) ) ;
view . pmiEntriesList . on ( 'click' , _ . bind ( me . onEntriesList , me ) ) ;
/** coauthoring begin **/
view . pmiAddComment . on ( 'click' , _ . bind ( me . onAddComment , me ) ) ;
/** coauthoring end **/
view . pmiAddNamedRange . on ( 'click' , _ . bind ( me . onAddNamedRange , me ) ) ;
2019-02-27 09:52:19 +00:00
view . menuImageArrange . menu . on ( 'item:click' , _ . bind ( me . onImgMenu , me ) ) ;
view . menuImgRotate . menu . on ( 'item:click' , _ . bind ( me . onImgMenu , me ) ) ;
2019-04-09 11:29:51 +00:00
view . menuImgCrop . menu . on ( 'item:click' , _ . bind ( me . onImgCrop , me ) ) ;
2019-02-27 09:52:19 +00:00
view . menuImageAlign . menu . on ( 'item:click' , _ . bind ( me . onImgMenuAlign , me ) ) ;
2017-06-06 08:04:04 +00:00
view . menuParagraphVAlign . menu . on ( 'item:click' , _ . bind ( me . onParagraphVAlign , me ) ) ;
view . menuParagraphDirection . menu . on ( 'item:click' , _ . bind ( me . onParagraphDirection , me ) ) ;
2019-11-07 11:01:07 +00:00
view . menuParagraphBullets . menu . on ( 'item:click' , _ . bind ( me . onSelectBulletMenu , me ) ) ;
2022-05-12 19:06:23 +00:00
// view.menuParagraphBullets.menu.on('render:after', _.bind(me.onBulletMenuShowAfter, me));
2021-04-03 07:53:38 +00:00
view . menuParagraphBullets . menu . on ( 'show:after' , _ . bind ( me . onBulletMenuShowAfter , me ) ) ;
2017-06-06 08:04:04 +00:00
view . menuAddHyperlinkShape . on ( 'click' , _ . bind ( me . onInsHyperlink , me ) ) ;
view . menuEditHyperlinkShape . on ( 'click' , _ . bind ( me . onInsHyperlink , me ) ) ;
2021-08-08 20:10:52 +00:00
view . menuRemoveHyperlinkShape . on ( 'click' , _ . bind ( me . onDelHyperlink , me ) ) ;
2017-06-06 08:04:04 +00:00
view . pmiTextAdvanced . on ( 'click' , _ . bind ( me . onTextAdvanced , me ) ) ;
view . mnuShapeAdvanced . on ( 'click' , _ . bind ( me . onShapeAdvanced , me ) ) ;
view . mnuChartEdit . on ( 'click' , _ . bind ( me . onChartEdit , me ) ) ;
2022-03-16 15:39:50 +00:00
view . mnuChartData . on ( 'click' , _ . bind ( me . onChartData , me ) ) ;
view . mnuChartType . on ( 'click' , _ . bind ( me . onChartType , me ) ) ;
2017-06-06 08:04:04 +00:00
view . mnuImgAdvanced . on ( 'click' , _ . bind ( me . onImgAdvanced , me ) ) ;
2020-05-25 17:25:16 +00:00
view . mnuSlicerAdvanced . on ( 'click' , _ . bind ( me . onSlicerAdvanced , me ) ) ;
2017-06-06 08:04:04 +00:00
view . textInShapeMenu . on ( 'render:after' , _ . bind ( me . onTextInShapeAfterRender , me ) ) ;
2017-11-22 08:41:47 +00:00
view . menuSignatureEditSign . on ( 'click' , _ . bind ( me . onSignatureClick , me ) ) ;
view . menuSignatureEditSetup . on ( 'click' , _ . bind ( me . onSignatureClick , me ) ) ;
2018-04-11 13:46:44 +00:00
view . menuImgOriginalSize . on ( 'click' , _ . bind ( me . onOriginalSizeClick , me ) ) ;
view . menuImgReplace . menu . on ( 'item:click' , _ . bind ( me . onImgReplace , me ) ) ;
2018-04-13 13:29:31 +00:00
view . pmiNumFormat . menu . on ( 'item:click' , _ . bind ( me . onNumberFormatSelect , me ) ) ;
view . pmiNumFormat . menu . on ( 'show:after' , _ . bind ( me . onNumberFormatOpenAfter , me ) ) ;
view . pmiAdvancedNumFormat . on ( 'click' , _ . bind ( me . onCustomNumberFormat , me ) ) ;
2020-06-29 12:30:24 +00:00
view . tableTotalMenu . on ( 'item:click' , _ . bind ( me . onTotalMenuClick , me ) ) ;
2021-04-16 20:29:20 +00:00
view . menuImgMacro . on ( 'click' , _ . bind ( me . onImgMacro , me ) ) ;
2021-09-21 10:34:31 +00:00
view . menuImgEditPoints . on ( 'click' , _ . bind ( me . onImgEditPoints , me ) ) ;
2022-06-15 14:35:51 +00:00
view . pmiGetRangeList . on ( 'click' , _ . bind ( me . onGetLink , me ) ) ;
2022-11-01 19:48:39 +00:00
view . menuParagraphEquation . menu . on ( 'item:click' , _ . bind ( me . convertEquation , me ) ) ;
2022-03-28 16:41:59 +00:00
if ( ! me . permissions . isEditMailMerge && ! me . permissions . isEditDiagram && ! me . permissions . isEditOle ) {
var oleEditor = me . getApplication ( ) . getController ( 'Common.Controllers.ExternalOleEditor' ) . getView ( 'Common.Views.ExternalOleEditor' ) ;
if ( oleEditor ) {
oleEditor . on ( 'internalmessage' , _ . bind ( function ( cmp , message ) {
var command = message . data . command ;
var data = message . data . data ;
if ( me . api ) {
if ( oleEditor . isEditMode ( ) )
me . api . asc _editTableOleObject ( data ) ;
}
} , me ) ) ;
oleEditor . on ( 'hide' , _ . bind ( function ( cmp , message ) {
if ( me . api ) {
me . api . asc _enableKeyEvents ( true ) ;
2022-08-07 20:38:31 +00:00
me . api . asc _onCloseChartFrame ( ) ;
2022-03-28 16:41:59 +00:00
}
setTimeout ( function ( ) {
view . fireEvent ( 'editcomplete' , view ) ;
} , 10 ) ;
} , me ) ) ;
}
}
2017-06-06 08:04:04 +00:00
} else {
view . menuViewCopy . on ( 'click' , _ . bind ( me . onCopyPaste , me ) ) ;
view . menuViewUndo . on ( 'click' , _ . bind ( me . onUndo , me ) ) ;
view . menuViewAddComment . on ( 'click' , _ . bind ( me . onAddComment , me ) ) ;
2017-11-22 08:41:47 +00:00
view . menuSignatureViewSign . on ( 'click' , _ . bind ( me . onSignatureClick , me ) ) ;
view . menuSignatureDetails . on ( 'click' , _ . bind ( me . onSignatureClick , me ) ) ;
view . menuSignatureViewSetup . on ( 'click' , _ . bind ( me . onSignatureClick , me ) ) ;
view . menuSignatureRemove . on ( 'click' , _ . bind ( me . onSignatureClick , me ) ) ;
2017-06-06 08:04:04 +00:00
}
2016-03-11 00:48:53 +00:00
2020-04-30 10:36:02 +00:00
var addEvent = function ( elem , type , fn , options ) {
elem . addEventListener ? elem . addEventListener ( type , fn , options ) : elem . attachEvent ( "on" + type , fn ) ;
} ;
2016-03-11 00:48:53 +00:00
2020-04-30 10:36:02 +00:00
var documentHolderEl = view . cmpEl ;
2016-03-11 00:48:53 +00:00
if ( documentHolderEl ) {
documentHolderEl . on ( {
mousedown : function ( e ) {
if ( e . target . localName == 'canvas' && e . button != 2 ) {
Common . UI . Menu . Manager . hideAll ( ) ;
}
} ,
click : function ( e ) {
if ( me . api ) {
me . api . isTextAreaBlur = false ;
2020-05-18 11:00:10 +00:00
if ( e . target . localName == 'canvas' && ( ! me . isEditFormula || me . rangeSelectionMode ) ) {
2020-03-16 12:36:47 +00:00
if ( me . _preventClick )
me . _preventClick = false ;
else
documentHolderEl . focus ( ) ;
2016-03-11 00:48:53 +00:00
}
}
}
} ) ;
//NOTE: set mouse wheel handler
var eventname = ( /Firefox/i . test ( navigator . userAgent ) ) ? 'DOMMouseScroll' : 'mousewheel' ;
2020-04-30 10:36:02 +00:00
addEvent ( view . el , eventname , _ . bind ( this . onDocumentWheel , this ) , false ) ;
2016-03-11 00:48:53 +00:00
me . cellEditor = $ ( '#ce-cell-content' ) ;
}
2020-04-30 10:36:02 +00:00
Common . Utils . isChrome ? addEvent ( document , 'mousewheel' , _ . bind ( this . onDocumentWheel , this ) , { passive : false } ) :
$ ( document ) . on ( 'mousewheel' , _ . bind ( this . onDocumentWheel , this ) ) ;
2021-07-17 23:11:58 +00:00
this . onChangeProtectSheet ( ) ;
2016-03-11 00:48:53 +00:00
} ,
loadConfig : function ( data ) {
this . editorConfig = data . config ;
} ,
setMode : function ( permissions ) {
this . permissions = permissions ;
/** coauthoring begin **/
2017-06-14 11:53:29 +00:00
! ( this . permissions . canCoAuthoring && this . permissions . canComments )
2016-03-11 00:48:53 +00:00
? Common . util . Shortcuts . suspendEvents ( this . hkComments )
: Common . util . Shortcuts . resumeEvents ( this . hkComments ) ;
/** coauthoring end **/
} ,
setApi : function ( api ) {
this . api = api ;
this . api . asc _registerCallback ( 'asc_onContextMenu' , _ . bind ( this . onApiContextMenu , this ) ) ;
this . api . asc _registerCallback ( 'asc_onMouseMove' , _ . bind ( this . onApiMouseMove , this ) ) ;
/** coauthoring begin **/
this . api . asc _registerCallback ( 'asc_onHideComment' , this . wrapEvents . apiHideComment ) ;
// this.api.asc_registerCallback('asc_onShowComment', this.wrapEvents.apiShowComment);
/** coauthoring end **/
this . api . asc _registerCallback ( 'asc_onHyperlinkClick' , _ . bind ( this . onApiHyperlinkClick , this ) ) ;
this . api . asc _registerCallback ( 'asc_onCoAuthoringDisconnect' , _ . bind ( this . onApiCoAuthoringDisconnect , this ) ) ;
Common . NotificationCenter . on ( 'api:disconnect' , _ . bind ( this . onApiCoAuthoringDisconnect , this ) ) ;
2017-06-14 11:53:29 +00:00
this . api . asc _registerCallback ( 'asc_onSelectionChanged' , _ . bind ( this . onSelectionChanged , this ) ) ;
if ( this . permissions . isEdit === true ) {
this . api . asc _registerCallback ( 'asc_onSetAFDialog' , _ . bind ( this . onApiAutofilter , this ) ) ;
this . api . asc _registerCallback ( 'asc_onEditCell' , _ . bind ( this . onApiEditCell , this ) ) ;
this . api . asc _registerCallback ( 'asc_onLockDefNameManager' , _ . bind ( this . onLockDefNameManager , this ) ) ;
2020-03-16 12:06:56 +00:00
this . api . asc _registerCallback ( 'asc_onEntriesListMenu' , _ . bind ( this . onEntriesListMenu , this , false ) ) ; // Alt + Down
this . api . asc _registerCallback ( 'asc_onValidationListMenu' , _ . bind ( this . onEntriesListMenu , this , true ) ) ;
2017-06-14 11:53:29 +00:00
this . api . asc _registerCallback ( 'asc_onFormulaCompleteMenu' , _ . bind ( this . onFormulaCompleteMenu , this ) ) ;
this . api . asc _registerCallback ( 'asc_onShowSpecialPasteOptions' , _ . bind ( this . onShowSpecialPasteOptions , this ) ) ;
this . api . asc _registerCallback ( 'asc_onHideSpecialPasteOptions' , _ . bind ( this . onHideSpecialPasteOptions , this ) ) ;
2017-12-01 09:20:06 +00:00
this . api . asc _registerCallback ( 'asc_onToggleAutoCorrectOptions' , _ . bind ( this . onToggleAutoCorrectOptions , this ) ) ;
2019-03-07 12:13:46 +00:00
this . api . asc _registerCallback ( 'asc_onFormulaInfo' , _ . bind ( this . onFormulaInfo , this ) ) ;
2019-04-09 11:29:51 +00:00
this . api . asc _registerCallback ( 'asc_ChangeCropState' , _ . bind ( this . onChangeCropState , this ) ) ;
2019-07-30 12:24:47 +00:00
this . api . asc _registerCallback ( 'asc_onInputMessage' , _ . bind ( this . onInputMessage , this ) ) ;
2020-06-29 12:30:24 +00:00
this . api . asc _registerCallback ( 'asc_onTableTotalMenu' , _ . bind ( this . onTableTotalMenu , this ) ) ;
2021-03-04 20:15:29 +00:00
this . api . asc _registerCallback ( 'asc_onShowPivotGroupDialog' , _ . bind ( this . onShowPivotGroupDialog , this ) ) ;
2022-03-28 16:41:59 +00:00
if ( ! this . permissions . isEditMailMerge && ! this . permissions . isEditDiagram && ! this . permissions . isEditOle )
this . api . asc _registerCallback ( 'asc_doubleClickOnTableOleObject' , _ . bind ( this . onDoubleClickOnTableOleObject , this ) ) ;
2022-06-07 14:43:17 +00:00
if ( this . permissions . canRequestReferenceData ) {
2022-06-07 20:29:14 +00:00
this . api . asc _registerCallback ( 'asc_onUpdateExternalReference' , _ . bind ( this . onUpdateExternalReference , this ) ) ;
2022-06-07 14:43:17 +00:00
Common . Gateway . on ( 'setreferencedata' , _ . bind ( this . setReferenceData , this ) ) ;
}
2022-11-01 21:27:17 +00:00
this . api . asc _registerCallback ( 'asc_onShowMathTrack' , _ . bind ( this . onShowMathTrack , this ) ) ;
this . api . asc _registerCallback ( 'asc_onHideMathTrack' , _ . bind ( this . onHideMathTrack , this ) ) ;
2017-06-14 11:53:29 +00:00
}
2021-06-28 11:51:32 +00:00
this . api . asc _registerCallback ( 'asc_onShowForeignCursorLabel' , _ . bind ( this . onShowForeignCursorLabel , this ) ) ;
this . api . asc _registerCallback ( 'asc_onHideForeignCursorLabel' , _ . bind ( this . onHideForeignCursorLabel , this ) ) ;
2016-03-11 00:48:53 +00:00
return this ;
} ,
resetApi : function ( api ) {
/** coauthoring begin **/
this . api . asc _unregisterCallback ( 'asc_onHideComment' , this . wrapEvents . apiHideComment ) ;
// this.api.asc_unregisterCallback('asc_onShowComment', this.wrapEvents.apiShowComment);
this . api . asc _registerCallback ( 'asc_onHideComment' , this . wrapEvents . apiHideComment ) ;
// this.api.asc_registerCallback('asc_onShowComment', this.wrapEvents.apiShowComment);
/** coauthoring end **/
} ,
onCopyPaste : function ( item ) {
var me = this ;
if ( me . api ) {
2016-07-26 14:46:42 +00:00
var res = ( item . value == 'cut' ) ? me . api . asc _Cut ( ) : ( ( item . value == '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 . documentHolder ) ;
}
} ) ) . show ( ) ;
}
2016-07-26 14:46:42 +00:00
} else
2016-03-11 00:48:53 +00:00
Common . component . Analytics . trackEvent ( 'ToolBar' , 'Copy Warning' ) ;
}
2016-07-26 14:46:42 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , me . documentHolder ) ;
2016-03-11 00:48:53 +00:00
} ,
onInsertEntire : function ( item ) {
if ( this . api ) {
2020-05-14 08:39:04 +00:00
switch ( this . api . asc _getCellInfo ( ) . asc _getSelectionType ( ) ) {
2016-04-05 11:52:34 +00:00
case Asc . c _oAscSelectionType . RangeRow :
this . api . asc _insertCells ( Asc . c _oAscInsertOptions . InsertRows ) ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscSelectionType . RangeCol :
this . api . asc _insertCells ( Asc . c _oAscInsertOptions . InsertColumns ) ;
2016-03-11 00:48:53 +00:00
break ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Insert Entire' ) ;
}
} ,
onInsertCells : function ( menu , item ) {
if ( this . api ) {
this . api . asc _insertCells ( item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Insert Cells' ) ;
}
} ,
onDeleteEntire : function ( item ) {
if ( this . api ) {
2020-05-14 08:39:04 +00:00
switch ( this . api . asc _getCellInfo ( ) . asc _getSelectionType ( ) ) {
2016-04-05 11:52:34 +00:00
case Asc . c _oAscSelectionType . RangeRow :
this . api . asc _deleteCells ( Asc . c _oAscDeleteOptions . DeleteRows ) ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscSelectionType . RangeCol :
this . api . asc _deleteCells ( Asc . c _oAscDeleteOptions . DeleteColumns ) ;
2016-03-11 00:48:53 +00:00
break ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Delete Entire' ) ;
}
} ,
onDeleteCells : function ( menu , item ) {
if ( this . api ) {
this . api . asc _deleteCells ( item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Delete Cells' ) ;
}
} ,
onSortCells : function ( menu , item ) {
2021-07-19 21:02:30 +00:00
Common . NotificationCenter . trigger ( 'protect:check' , this . onSortCellsCallback , this , [ menu , item ] ) ;
} ,
onSortCellsCallback : function ( menu , item ) {
2020-11-26 21:25:44 +00:00
if ( item . value == 'advanced' ) {
Common . NotificationCenter . trigger ( 'data:sortcustom' , this ) ;
return ;
}
2016-03-11 00:48:53 +00:00
if ( this . api ) {
2017-02-06 14:12:59 +00:00
var res = this . api . asc _sortCellsRangeExpand ( ) ;
2021-08-10 21:24:12 +00:00
switch ( res ) {
case Asc . c _oAscSelectionSortExpand . showExpandMessage :
var config = {
width : 500 ,
title : this . txtSorting ,
msg : this . txtExpandSort ,
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 ( item . value , '' , undefined , ( item . value == Asc . c _oAscSortOptions . ByColorFill ) ? this . documentHolder . ssMenu . cellColor : this . documentHolder . ssMenu . fontColor , btn == 'expand' ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Sort Cells' ) ;
} , this )
} ;
Common . UI . alert ( config ) ;
break ;
case Asc . c _oAscSelectionSortExpand . showLockMessage :
var config = {
width : 500 ,
title : this . txtSorting ,
msg : this . txtLockSort ,
buttons : [ 'yes' , 'no' ] ,
primary : 'yes' ,
callback : _ . bind ( function ( btn ) {
( btn == 'yes' ) && this . api . asc _sortColFilter ( item . value , '' , undefined , ( item . value == Asc . c _oAscSortOptions . ByColorFill ) ? this . documentHolder . ssMenu . cellColor : this . documentHolder . ssMenu . fontColor , false ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Sort Cells' ) ;
} , this )
} ;
Common . UI . alert ( config ) ;
break ;
case Asc . c _oAscSelectionSortExpand . expandAndNotShowMessage :
case Asc . c _oAscSelectionSortExpand . notExpandAndNotShowMessage :
this . api . asc _sortColFilter ( item . value , '' , undefined , ( item . value == Asc . c _oAscSortOptions . ByColorFill ) ? this . documentHolder . ssMenu . cellColor : this . documentHolder . ssMenu . fontColor , res === Asc . c _oAscSelectionSortExpand . expandAndNotShowMessage ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Sort Cells' ) ;
break ;
2017-02-06 14:12:59 +00:00
}
2016-03-11 00:48:53 +00:00
}
} ,
2016-05-17 08:01:41 +00:00
onFilterCells : function ( menu , item ) {
if ( this . api ) {
var autoFilterObject = new Asc . AutoFiltersOptions ( ) ,
filterObj = new Asc . AutoFilterObj ( ) ;
if ( item . value > 0 ) {
filterObj . asc _setFilter ( new Asc . ColorFilter ( ) ) ;
filterObj . asc _setType ( Asc . c _oAscAutoFilterTypes . ColorFilter ) ;
var colorFilter = filterObj . asc _getFilter ( ) ;
colorFilter . asc _setCellColor ( ( item . value == 1 ) ? null : false ) ;
colorFilter . asc _setCColor ( ( item . value == 1 ) ? this . documentHolder . ssMenu . cellColor : this . documentHolder . ssMenu . fontColor ) ;
} else {
filterObj . asc _setFilter ( new Asc . CustomFilters ( ) ) ;
filterObj . asc _setType ( Asc . c _oAscAutoFilterTypes . CustomFilters ) ;
var customFilter = filterObj . asc _getFilter ( ) ;
customFilter . asc _setCustomFilters ( [ new Asc . CustomFilter ( ) ] ) ;
customFilter . asc _setAnd ( true ) ;
var customFilters = customFilter . asc _getCustomFilters ( ) ;
customFilters [ 0 ] . asc _setOperator ( Asc . c _oAscCustomAutoFilter . equals ) ;
// customFilters[0].asc_setVal('');
}
autoFilterObject . asc _setFilterObj ( filterObj ) ;
this . api . asc _applyAutoFilterByType ( autoFilterObject ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Filter Cells' ) ;
}
} ,
onReapply : function ( ) {
2016-05-17 09:34:10 +00:00
this . api . asc _reapplyAutoFilter ( this . documentHolder . ssMenu . formatTableName ) ;
2016-05-17 08:01:41 +00:00
} ,
2021-03-11 20:11:07 +00:00
onCondFormat : function ( ) {
var me = this ,
value = me . api . asc _getLocale ( ) ;
( ! value ) && ( value = ( ( me . permissions . lang ) ? parseInt ( Common . util . LanguageInfo . getLocalLanguageCode ( me . permissions . lang ) ) : 0x0409 ) ) ;
( new SSE . Views . FormatRulesEditDlg ( {
api : me . api ,
props : null ,
isEdit : false ,
langId : value ,
handler : function ( result , settings ) {
if ( result == 'ok' && settings ) {
me . api . asc _setCF ( [ settings ] , [ ] ) ;
}
}
} ) ) . show ( ) ;
} ,
2022-10-25 12:50:27 +00:00
onRefreshPivot : function ( ) {
if ( this . api ) {
this . propsPivot . asc _refresh ( this . api ) ;
}
} ,
2021-03-04 20:15:29 +00:00
onGroupPivot : function ( item ) {
item . value == 'grouping' ? this . api . asc _groupPivot ( ) : this . api . asc _ungroupPivot ( ) ;
} ,
2021-03-05 08:49:58 +00:00
onShowPivotGroupDialog : function ( rangePr , dateTypes , defRangePr ) {
2021-03-04 20:15:29 +00:00
var win , props ,
me = this ;
win = new SSE . Views . PivotGroupDialog ( {
date : ! ! dateTypes ,
handler : function ( dlg , result ) {
if ( result == 'ok' ) {
props = dlg . getSettings ( ) ;
me . api . asc _groupPivot ( props [ 0 ] , props [ 1 ] ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . documentHolder ) ;
}
}
} ) ;
win . show ( ) ;
2021-03-09 11:43:05 +00:00
win . setSettings ( rangePr , dateTypes , defRangePr ) ;
2021-03-04 20:15:29 +00:00
} ,
2021-07-20 10:03:44 +00:00
onClear : function ( menu , item , e ) {
2021-08-10 14:49:40 +00:00
if ( item . value == Asc . c _oAscCleanOptions . Format && ! this . _state . wsProps [ 'FormatCells' ] || item . value == Asc . c _oAscCleanOptions . All && ! this . api . asc _checkLockedCells ( ) )
this . onClearCallback ( menu , item ) ;
else if ( item . value == Asc . c _oAscCleanOptions . Comments ) {
this . _state . wsProps [ 'Objects' ] ? Common . NotificationCenter . trigger ( 'showerror' , Asc . c _oAscError . ID . ChangeOnProtectedSheet , Asc . c _oAscError . Level . NoCritical ) : this . onClearCallback ( menu , item ) ;
} else
Common . NotificationCenter . trigger ( 'protect:check' , this . onClearCallback , this , [ menu , item ] ) ;
2021-07-20 10:03:44 +00:00
} ,
onClearCallback : function ( menu , item ) {
2016-03-11 00:48:53 +00:00
if ( this . api ) {
2021-03-23 15:16:31 +00:00
if ( item . value == Asc . c _oAscCleanOptions . Comments ) {
this . api . asc _RemoveAllComments ( ! this . permissions . canDeleteComments , true ) ; // 1 param = true if remove only my comments, 2 param - remove current comments
} else
this . api . asc _emptyCells ( item . value , item . value == Asc . c _oAscCleanOptions . All && ! this . permissions . canDeleteComments ) ;
2016-03-11 00:48:53 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Clear' ) ;
}
} ,
2016-03-30 12:27:16 +00:00
onSelectTable : function ( menu , item ) {
if ( this . api && this . documentHolder . ssMenu . formatTableName ) {
this . api . asc _changeSelectionFormatTable ( this . documentHolder . ssMenu . formatTableName , item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Select Table' ) ;
}
} ,
onInsertTable : function ( menu , item ) {
if ( this . api && this . documentHolder . ssMenu . formatTableName ) {
this . api . asc _insertCellsInTable ( this . documentHolder . ssMenu . formatTableName , item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Insert to Table' ) ;
}
} ,
onDeleteTable : function ( menu , item ) {
if ( this . api && this . documentHolder . ssMenu . formatTableName ) {
this . api . asc _deleteCellsInTable ( this . documentHolder . ssMenu . formatTableName , item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Delete from Table' ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onInsFunction : function ( item ) {
var controller = this . getApplication ( ) . getController ( 'FormulaDialog' ) ;
if ( controller && this . api ) {
2020-06-30 19:16:55 +00:00
controller . showDialog ( undefined , item . value == Asc . ETotalsRowFunction . totalrowfunctionCustom ) ;
2016-03-11 00:48:53 +00:00
}
} ,
onInsHyperlink : function ( item ) {
2021-07-19 20:50:45 +00:00
Common . NotificationCenter . trigger ( 'protect:check' , this . onInsHyperlinkCallback , this , [ item ] ) ;
} ,
onInsHyperlinkCallback : function ( item ) {
2016-03-11 00:48:53 +00:00
var me = this ;
var win ,
props ;
if ( me . api ) {
var wc = me . api . asc _getWorksheetsCount ( ) ,
i = - 1 ,
items = [ ] ;
while ( ++ i < wc ) {
2020-03-16 10:30:51 +00:00
items . push ( { name : me . api . asc _getWorksheetName ( i ) , hidden : me . api . asc _isWorksheetHidden ( i ) } ) ;
2016-03-11 00:48:53 +00:00
}
var handlerDlg = function ( dlg , result ) {
if ( result == 'ok' ) {
props = dlg . getSettings ( ) ;
me . api . asc _insertHyperlink ( props ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . documentHolder ) ;
} ;
var cell = me . api . asc _getCellInfo ( ) ;
props = cell . asc _getHyperlink ( ) ;
win = new SSE . Views . HyperlinkSettingsDialog ( {
api : me . api ,
2020-03-20 12:29:47 +00:00
appOptions : me . permissions ,
2016-03-11 00:48:53 +00:00
handler : handlerDlg
} ) ;
win . show ( ) ;
win . setSettings ( {
sheets : items ,
2020-08-20 08:14:36 +00:00
ranges : me . api . asc _getDefinedNames ( Asc . c _oAscGetDefinedNamesList . All , true ) ,
2016-03-11 00:48:53 +00:00
currentSheet : me . api . asc _getWorksheetName ( me . api . asc _getActiveWorksheetIndex ( ) ) ,
props : props ,
text : cell . asc _getText ( ) ,
2020-05-14 08:50:34 +00:00
isLock : cell . asc _getLockText ( ) ,
2016-03-11 00:48:53 +00:00
allowInternal : item . options . inCell
} ) ;
}
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Add Hyperlink' ) ;
} ,
onDelHyperlink : function ( item ) {
2021-08-08 20:10:52 +00:00
Common . NotificationCenter . trigger ( 'protect:check' , this . onDelHyperlinkCallback , this ) ;
} ,
onDelHyperlinkCallback : function ( item ) {
2016-03-11 00:48:53 +00:00
if ( this . api ) {
this . api . asc _removeHyperlink ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Remove Hyperlink' ) ;
}
} ,
2016-07-26 12:47:48 +00:00
onSetSize : function ( menu , item ) {
if ( item . value == 'row-height' || item . value == 'column-width' ) {
var me = this ;
( new SSE . Views . SetValueDialog ( {
title : item . caption ,
startvalue : item . value == 'row-height' ? me . api . asc _getRowHeight ( ) : me . api . asc _getColumnWidth ( ) ,
maxvalue : item . value == 'row-height' ? Asc . c _oAscMaxRowHeight : Asc . c _oAscMaxColumnWidth ,
step : item . value == 'row-height' ? 0.75 : 1 ,
2018-06-08 14:51:40 +00:00
rounding : ( item . value == 'row-height' ) ,
2016-07-26 12:47:48 +00:00
defaultUnit : item . value == 'row-height' ? Common . Utils . Metric . getMetricName ( Common . Utils . Metric . c _MetricUnits . pt ) : me . textSym ,
handler : function ( dlg , result ) {
if ( result == 'ok' ) {
var val = dlg . getSettings ( ) ;
if ( ! isNaN ( val ) )
( item . value == 'row-height' ) ? me . api . asc _setRowHeight ( val ) : me . api . asc _setColumnWidth ( val ) ;
}
2016-03-11 00:48:53 +00:00
2016-07-26 12:47:48 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , me . documentHolder ) ;
}
} ) ) . show ( ) ;
} else {
( item . value == 'auto-row-height' ) ? this . api . asc _autoFitRowHeight ( ) : this . api . asc _autoFitColumnWidth ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
}
2016-03-11 00:48:53 +00:00
} ,
onEntireHide : function ( item ) {
if ( this . api )
this . api [ item . isrowmenu ? 'asc_hideRows' : 'asc_hideColumns' ] ( ) ;
} ,
onEntireShow : function ( item ) {
if ( this . api )
this . api [ item . isrowmenu ? 'asc_showRows' : 'asc_showColumns' ] ( ) ;
} ,
onFreezePanes : function ( item ) {
if ( this . api )
this . api . asc _freezePane ( ) ;
} ,
2016-10-25 13:22:22 +00:00
onEntriesList : function ( item ) {
if ( this . api ) {
var me = this ;
setTimeout ( function ( ) {
me . api . asc _showAutoComplete ( ) ;
} , 10 ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onAddComment : function ( item ) {
2021-08-08 22:00:41 +00:00
if ( this . _state . wsProps [ 'Objects' ] ) return ;
2017-06-14 11:53:29 +00:00
if ( this . api && this . permissions . canCoAuthoring && this . permissions . canComments ) {
2016-03-11 00:48:53 +00:00
var controller = SSE . getController ( 'Common.Controllers.Comments' ) ,
cellinfo = this . api . asc _getCellInfo ( ) ;
if ( controller ) {
var comments = cellinfo . asc _getComments ( ) ;
2021-07-29 12:12:38 +00:00
if ( comments ) {
if ( comments . length ) {
controller . onEditComments ( comments ) ;
} else if ( this . permissions . canCoAuthoring ) {
controller . addDummyComment ( ) ;
}
2016-03-11 00:48:53 +00:00
}
}
}
} ,
onAddNamedRange : function ( item ) {
if ( this . namedrange _locked ) {
Common . NotificationCenter . trigger ( 'namedrange:locked' ) ;
return ;
}
var me = this ,
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 : i } ) ;
}
}
var handlerDlg = function ( result , settings ) {
if ( result == 'ok' && settings ) {
me . api . asc _setDefinedNames ( settings ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'New Named Range' ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . documentHolder ) ;
} ;
( new SSE . Views . NamedRangeEditDlg ( {
api : me . api ,
handler : handlerDlg ,
sheets : items ,
currentSheet : me . api . asc _getActiveWorksheetIndex ( ) ,
props : me . api . asc _getDefaultDefinedName ( ) ,
isEdit : false
} ) ) . show ( ) ;
} ,
onImgMenu : function ( menu , item ) {
if ( this . api ) {
if ( item . options . type == 'arrange' ) {
this . api . asc _setSelectedDrawingObjectLayer ( item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Arrange' ) ;
} else if ( item . options . type == 'group' ) {
this . api [ ( item . value == 'grouping' ) ? 'asc_groupGraphicsObjects' : 'asc_unGroupGraphicsObjects' ] ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , ( item . value == 'grouping' ) ? 'Grouping' : 'Ungrouping' ) ;
2019-02-27 09:52:19 +00:00
} else if ( item . options . type == 'rotate' ) {
var properties = new Asc . asc _CImgProperty ( ) ;
properties . asc _putRotAdd ( ( item . value == 1 ? 90 : 270 ) * 3.14159265358979 / 180 ) ;
this . api . asc _setGraphicObjectProps ( properties ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Rotate' ) ;
} else if ( item . options . type == 'flip' ) {
var properties = new Asc . asc _CImgProperty ( ) ;
if ( item . value == 1 )
properties . asc _putFlipHInvert ( true ) ;
else
properties . asc _putFlipVInvert ( true ) ;
this . api . asc _setGraphicObjectProps ( properties ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Flip' ) ;
}
}
} ,
2019-04-09 11:29:51 +00:00
onImgCrop : function ( menu , item ) {
if ( this . api ) {
if ( item . value == 1 ) {
this . api . asc _cropFill ( ) ;
} else if ( item . value == 2 ) {
this . api . asc _cropFit ( ) ;
} else {
item . checked ? this . api . asc _startEditCrop ( ) : this . api . asc _endEditCrop ( ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
} ,
2019-02-27 09:52:19 +00:00
onImgMenuAlign : function ( menu , item ) {
if ( this . api ) {
if ( item . value > - 1 && item . value < 6 ) {
this . api . asc _setSelectedDrawingObjectAlign ( item . value ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Objects Align' ) ;
} else if ( item . value == 6 ) {
this . api . asc _DistributeSelectedDrawingObjectHor ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Distribute' ) ;
} else if ( item . value == 7 ) {
this . api . asc _DistributeSelectedDrawingObjectVer ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Distribute' ) ;
2016-03-11 00:48:53 +00:00
}
}
} ,
onParagraphVAlign : function ( menu , item ) {
if ( this . api ) {
var properties = new Asc . asc _CImgProperty ( ) ;
properties . asc _putVerticalTextAlign ( item . value ) ;
this . api . asc _setGraphicObjectProps ( properties ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Paragraph Vertical Align' ) ;
}
} ,
onParagraphDirection : function ( menu , item ) {
if ( this . api ) {
var properties = new Asc . asc _CImgProperty ( ) ;
properties . asc _putVert ( item . options . direction ) ;
this . api . asc _setGraphicObjectProps ( properties ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
2017-05-15 13:32:01 +00:00
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Text Direction' ) ;
2016-03-11 00:48:53 +00:00
}
} ,
2019-11-07 11:01:07 +00:00
onSelectBulletMenu : function ( menu , item ) {
if ( this . api ) {
if ( item . options . value == - 1 ) {
2020-06-25 14:28:38 +00:00
this . api . asc _setListType ( 0 , item . options . value ) ;
2019-11-07 11:01:07 +00:00
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'List Type' ) ;
} else if ( item . options . value == 'settings' ) {
var me = this ,
props ;
var selectedObjects = me . api . asc _getGraphicObjectProps ( ) ;
for ( var i = 0 ; i < selectedObjects . length ; i ++ ) {
if ( selectedObjects [ i ] . asc _getObjectType ( ) == Asc . c _oAscTypeSelectElement . Paragraph ) {
props = selectedObjects [ i ] . asc _getObjectValue ( ) ;
break ;
}
}
if ( props ) {
2020-06-17 13:55:01 +00:00
var listtype = me . api . asc _getCurrentListType ( ) ;
2019-11-07 11:01:07 +00:00
( new Common . Views . ListSettingsDialog ( {
2019-11-19 14:05:02 +00:00
api : me . api ,
2019-11-07 11:01:07 +00:00
props : props ,
2020-06-26 11:02:09 +00:00
type : 0 ,
2022-04-13 11:20:11 +00:00
storage : me . permissions . canRequestInsertImage || me . permissions . fileChoiceUrl && me . permissions . fileChoiceUrl . indexOf ( "{documentType}" ) > - 1 ,
2019-11-19 14:05:02 +00:00
interfaceLang : me . permissions . lang ,
2019-11-07 11:01:07 +00:00
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
2020-06-25 14:28:38 +00:00
props . asc _putBullet ( value ) ;
me . api . asc _setGraphicObjectProps ( props ) ;
2019-11-07 11:01:07 +00:00
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . documentHolder ) ;
}
} ) ) . show ( ) ;
}
}
2017-05-18 07:31:18 +00:00
}
} ,
onSelectBullets : function ( picker , itemView , record , e ) {
var rawData = { } ,
isPickerSelect = _ . isFunction ( record . toJSON ) ;
if ( isPickerSelect ) {
if ( record . get ( 'selected' ) ) {
rawData = record . toJSON ( ) ;
} else {
// record deselected
return ;
}
} else {
rawData = record ;
}
2022-05-12 19:06:23 +00:00
if ( rawData . type === 0 && rawData . subtype === 0x1000 ) { // custom bullet
var bullet = new Asc . asc _CBullet ( ) ;
if ( rawData . drawdata . type === Asc . asc _PreviewBulletType . char ) {
bullet . asc _putSymbol ( rawData . drawdata . char ) ;
bullet . asc _putFont ( rawData . drawdata . specialFont ) ;
} else if ( rawData . drawdata . type === Asc . asc _PreviewBulletType . image )
bullet . asc _fillBulletImage ( rawData . drawdata . imageId ) ;
var props ;
var selectedObjects = this . api . asc _getGraphicObjectProps ( ) ;
for ( var i = 0 ; i < selectedObjects . length ; i ++ ) {
if ( selectedObjects [ i ] . asc _getObjectType ( ) == Asc . c _oAscTypeSelectElement . Paragraph ) {
props = selectedObjects [ i ] . asc _getObjectValue ( ) ;
props . asc _putBullet ( bullet ) ;
this . api . asc _setGraphicObjectProps ( props ) ;
break ;
}
}
} else
2017-05-18 11:28:09 +00:00
this . api . asc _setListType ( rawData . type , rawData . subtype ) ;
2017-05-18 07:31:18 +00:00
if ( e . type !== 'click' )
this . documentHolder . textInShapeMenu . hide ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'List Type' ) ;
} ,
2016-03-11 00:48:53 +00:00
onTextAdvanced : function ( item ) {
var me = this ;
( new SSE . Views . ParagraphSettingsAdvanced ( {
paragraphProps : item . textInfo ,
api : me . api ,
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
me . api . asc _setGraphicObjectProps ( value . paragraphProps ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Apply advanced paragraph settings' ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me ) ;
}
} ) ) . show ( ) ;
} ,
onShapeAdvanced : function ( item ) {
var me = this ;
( new SSE . Views . ShapeSettingsAdvanced ( {
shapeProps : item . shapeInfo ,
api : me . api ,
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
me . api . asc _setGraphicObjectProps ( value . shapeProps ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Apply advanced shape settings' ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me ) ;
}
} ) ) . show ( ) ;
} ,
2017-04-11 11:05:56 +00:00
onImgAdvanced : function ( item ) {
var me = this ;
( new SSE . Views . ImageSettingsAdvanced ( {
imageProps : item . imageInfo ,
api : me . api ,
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
me . api . asc _setGraphicObjectProps ( value . imageProps ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Apply advanced image settings' ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me ) ;
}
} ) ) . show ( ) ;
} ,
2020-05-25 17:25:16 +00:00
onSlicerAdvanced : function ( item ) {
var me = this ;
2020-05-26 14:14:58 +00:00
( new SSE . Views . SlicerSettingsAdvanced ( {
2020-05-27 20:28:27 +00:00
imageProps : item . imageInfo ,
api : me . api ,
styles : item . imageInfo . asc _getSlicerProperties ( ) . asc _getStylesPictures ( ) ,
handler : function ( result , value ) {
2020-05-25 17:25:16 +00:00
if ( result == 'ok' ) {
if ( me . api ) {
2020-05-27 13:33:34 +00:00
me . api . asc _setGraphicObjectProps ( value . imageProps ) ;
2020-05-25 17:25:16 +00:00
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Apply slicer settings' ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me ) ;
}
} ) ) . show ( ) ;
} ,
2016-03-11 00:48:53 +00:00
onChartEdit : function ( item ) {
var me = this ;
var win , props ;
if ( me . api ) {
props = me . api . asc _getChartObject ( ) ;
if ( props ) {
( new SSE . Views . ChartSettingsDlg (
{
chartSettings : props ,
2017-04-11 11:05:56 +00:00
imageSettings : item . chartInfo ,
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 ) {
me . api . asc _editChartDrawingObject ( 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 ) ;
}
} ) ) . show ( ) ;
}
}
} ,
2022-03-16 15:39:50 +00:00
onChartData : function ( btn ) {
var me = this ;
var props ;
if ( me . api ) {
props = me . api . asc _getChartObject ( ) ;
if ( props ) {
me . _isEditRanges = true ;
props . startEdit ( ) ;
var win = new SSE . Views . ChartDataDialog ( {
chartSettings : props ,
api : me . api ,
handler : function ( result , value ) {
if ( result == 'ok' ) {
props . endEdit ( ) ;
me . _isEditRanges = false ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , me ) ;
}
} ) . on ( 'close' , function ( ) {
me . _isEditRanges && props . cancelEdit ( ) ;
me . _isEditRanges = false ;
} ) ;
win . show ( ) ;
}
}
} ,
onChartType : function ( btn ) {
var me = this ;
var props ;
if ( me . api ) {
props = me . api . asc _getChartObject ( ) ;
if ( props ) {
me . _isEditType = true ;
props . startEdit ( ) ;
var win = new SSE . Views . ChartTypeDialog ( {
chartSettings : props ,
api : me . api ,
handler : function ( result , value ) {
if ( result == 'ok' ) {
props . endEdit ( ) ;
me . _isEditType = false ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , me ) ;
}
} ) . on ( 'close' , function ( ) {
me . _isEditType && props . cancelEdit ( ) ;
me . _isEditType = false ;
} ) ;
win . show ( ) ;
}
}
} ,
2021-04-16 20:29:20 +00:00
onImgMacro : function ( item ) {
var me = this ;
( new SSE . Views . MacroDialog ( {
props : { macroList : me . api . asc _getAllMacrosNames ( ) , current : me . api . asc _getCurrentDrawingMacrosName ( ) } ,
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
me . api . asc _assignMacrosToCurrentDrawing ( value ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me ) ;
}
} ) ) . show ( ) ;
} ,
2021-09-21 10:34:31 +00:00
onImgEditPoints : function ( item ) {
this . api && this . api . asc _editPointsGeometry ( ) ;
} ,
2022-06-15 14:35:51 +00:00
onGetLink : function ( item ) {
if ( this . api ) {
var range = this . api . asc _getActiveRangeStr ( Asc . referenceType . A , false , true ) ,
name = this . api . asc _getEscapeSheetName ( this . api . asc _getWorksheetName ( this . api . asc _getActiveWorksheetIndex ( ) ) ) ;
name = ( name + ( ( name !== '' && range !== '' ) ? '!' : '' ) + range ) ;
name && Common . Gateway . requestMakeActionLink ( {
action : {
type : "internallink" , data : name
}
} ) ;
}
} ,
onSetActionLink : function ( url ) {
2022-06-15 17:56:13 +00:00
if ( Common . Utils . InternalSettings . get ( "sse-dialog-link-visible" ) )
return ;
2022-06-15 14:35:51 +00:00
var me = this ;
navigator . clipboard && navigator . clipboard . writeText ( url )
. then ( function ( ) {
2022-06-15 19:09:53 +00:00
Common . NotificationCenter . trigger ( 'showmessage' , { msg : me . txtCopySuccess } , { timeout : 3000 , hideCloseTip : true } ) ;
2022-06-15 14:35:51 +00:00
} )
. catch ( function ( err ) {
console . log ( err ) ;
} ) ;
} ,
2016-03-11 00:48:53 +00:00
onApiCoAuthoringDisconnect : function ( ) {
this . permissions . isEdit = false ;
} ,
hideCoAuthTips : function ( ) {
if ( this . tooltips . coauth . ref ) {
$ ( this . tooltips . coauth . ref ) . remove ( ) ;
this . tooltips . coauth . ref = undefined ;
this . tooltips . coauth . x _point = undefined ;
this . tooltips . coauth . y _point = undefined ;
}
} ,
2021-07-28 19:13:08 +00:00
hideForeignSelectTips : function ( ) {
if ( this . tooltips . foreignSelect . ref ) {
$ ( this . tooltips . foreignSelect . ref ) . remove ( ) ;
this . tooltips . foreignSelect . ref = undefined ;
2021-11-16 11:19:07 +00:00
this . tooltips . foreignSelect . userId = undefined ;
2021-07-28 19:13:08 +00:00
this . tooltips . foreignSelect . x _point = undefined ;
this . tooltips . foreignSelect . y _point = undefined ;
}
} ,
2019-03-15 13:11:37 +00:00
hideHyperlinkTip : function ( ) {
2016-03-11 00:48:53 +00:00
if ( ! this . tooltips . hyperlink . isHidden && this . tooltips . hyperlink . ref ) {
2019-03-15 13:11:37 +00:00
this . tooltips . hyperlink . ref . hide ( ) ;
this . tooltips . hyperlink . ref = undefined ;
this . tooltips . hyperlink . text = '' ;
2016-03-11 00:48:53 +00:00
this . tooltips . hyperlink . isHidden = true ;
}
} ,
onApiMouseMove : function ( dataarray ) {
if ( ! this . _isFullscreenMenu && dataarray . length ) {
var index _hyperlink ,
/** coauthoring begin **/
index _comments ,
/** coauthoring end **/
index _locked ,
2018-05-31 07:27:38 +00:00
index _column , index _row ,
2020-05-28 10:58:38 +00:00
index _filter ,
2021-07-28 19:13:08 +00:00
index _slicer ,
index _foreign ;
2016-03-11 00:48:53 +00:00
for ( var i = dataarray . length ; i > 0 ; i -- ) {
switch ( dataarray [ i - 1 ] . asc _getType ( ) ) {
2016-04-05 11:52:34 +00:00
case Asc . c _oAscMouseMoveType . Hyperlink :
2016-03-11 00:48:53 +00:00
index _hyperlink = i ;
break ;
/** coauthoring begin **/
2016-04-05 11:52:34 +00:00
case Asc . c _oAscMouseMoveType . Comment :
2016-03-11 00:48:53 +00:00
index _comments = i ;
break ;
/** coauthoring end **/
2016-04-05 11:52:34 +00:00
case Asc . c _oAscMouseMoveType . LockedObject :
2016-03-11 00:48:53 +00:00
index _locked = i ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscMouseMoveType . ResizeColumn :
2016-03-11 00:48:53 +00:00
index _column = i ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscMouseMoveType . ResizeRow :
2016-03-11 00:48:53 +00:00
index _row = i ;
break ;
2018-05-31 07:27:38 +00:00
case Asc . c _oAscMouseMoveType . Filter :
index _filter = i ;
break ;
2020-05-28 10:58:38 +00:00
case Asc . c _oAscMouseMoveType . Tooltip :
index _slicer = i ;
break ;
2021-07-28 19:13:08 +00:00
case Asc . c _oAscMouseMoveType . ForeignSelect :
index _foreign = i ;
break ;
2016-03-11 00:48:53 +00:00
}
}
var me = this ,
showPoint = [ 0 , 0 ] ,
/** coauthoring begin **/
coAuthTip = me . tooltips . coauth ,
commentTip = me . tooltips . comment ,
/** coauthoring end **/
hyperlinkTip = me . tooltips . hyperlink ,
2018-05-31 07:27:38 +00:00
row _columnTip = me . tooltips . row _column ,
filterTip = me . tooltips . filter ,
2020-05-28 10:58:38 +00:00
slicerTip = me . tooltips . slicer ,
2021-07-28 19:13:08 +00:00
foreignSelect = me . tooltips . foreignSelect ,
2016-03-11 00:48:53 +00:00
pos = [
me . documentHolder . cmpEl . offset ( ) . left - $ ( window ) . scrollLeft ( ) ,
me . documentHolder . cmpEl . offset ( ) . top - $ ( window ) . scrollTop ( )
2019-03-15 13:11:37 +00:00
] ;
//close all tooltips
if ( ! index _hyperlink ) {
me . hideHyperlinkTip ( ) ;
}
if ( index _column === undefined && index _row === undefined ) {
if ( ! row _columnTip . isHidden && row _columnTip . ref ) {
row _columnTip . ref . hide ( ) ;
row _columnTip . ref = undefined ;
row _columnTip . text = '' ;
row _columnTip . isHidden = true ;
2019-03-06 13:41:54 +00:00
}
2019-03-15 13:11:37 +00:00
}
2022-08-30 10:06:51 +00:00
if ( ! index _foreign ) {
me . hideForeignSelectTips ( ) ;
}
2019-03-15 13:11:37 +00:00
if ( me . permissions . isEdit || me . permissions . canViewComments ) {
if ( ! index _comments || this . popupmenu ) {
commentTip . moveCommentId = undefined ;
if ( commentTip . viewCommentId != undefined ) {
commentTip = { } ;
var commentsController = this . getApplication ( ) . getController ( 'Common.Controllers.Comments' ) ;
if ( commentsController ) {
if ( this . permissions . canCoAuthoring && this . permissions . canViewComments )
setTimeout ( function ( ) { commentsController . onApiHideComment ( true ) ; } , 200 ) ;
else
commentsController . onApiHideComment ( true ) ;
2019-03-06 13:41:54 +00:00
}
}
}
2019-03-15 13:11:37 +00:00
}
if ( me . permissions . isEdit ) {
if ( ! index _locked ) {
me . hideCoAuthTips ( ) ;
2019-03-06 13:41:54 +00:00
}
2020-05-28 10:58:38 +00:00
if ( index _slicer === undefined ) {
if ( ! slicerTip . isHidden && slicerTip . ref ) {
slicerTip . ref . hide ( ) ;
slicerTip . ref = undefined ;
slicerTip . text = '' ;
slicerTip . isHidden = true ;
}
}
2019-03-15 13:11:37 +00:00
}
if ( index _filter === undefined || ( me . dlgFilter && me . dlgFilter . isVisible ( ) ) || ( me . currentMenu && me . currentMenu . isVisible ( ) ) ) {
if ( ! filterTip . isHidden && filterTip . ref ) {
filterTip . ref . hide ( ) ;
filterTip . ref = undefined ;
filterTip . text = '' ;
filterTip . isHidden = true ;
2019-03-06 13:41:54 +00:00
}
}
2019-03-15 13:11:37 +00:00
// show tooltips
2016-03-11 00:48:53 +00:00
if ( index _hyperlink ) {
2019-03-21 08:09:11 +00:00
if ( ! hyperlinkTip . parentEl ) {
hyperlinkTip . parentEl = $ ( '<div id="tip-container-hyperlinktip" style="position: absolute; z-index: 10000;"></div>' ) ;
me . documentHolder . cmpEl . append ( hyperlinkTip . parentEl ) ;
}
2016-03-11 00:48:53 +00:00
var data = dataarray [ index _hyperlink - 1 ] ,
props = data . asc _getHyperlink ( ) ;
2016-04-05 11:52:34 +00:00
if ( props . asc _getType ( ) == Asc . c _oAscHyperlinkType . WebLink ) {
2016-03-11 00:48:53 +00:00
var linkstr = props . asc _getTooltip ( ) ;
2021-03-26 20:46:57 +00:00
linkstr = ( linkstr ) ? linkstr : props . asc _getHyperlinkUrl ( ) ;
if ( linkstr . length > 256 )
linkstr = linkstr . substr ( 0 , 256 ) + '...' ;
linkstr = Common . Utils . String . htmlEncode ( linkstr ) + '<br><b>' + me . textCtrlClick + '</b>' ;
2016-03-11 00:48:53 +00:00
} else {
2020-03-13 13:26:27 +00:00
linkstr = Common . Utils . String . htmlEncode ( props . asc _getTooltip ( ) || ( props . asc _getLocation ( ) ) ) ;
2017-11-24 09:26:56 +00:00
linkstr += '<br><b>' + me . textCtrlClick + '</b>' ;
2016-03-11 00:48:53 +00:00
}
if ( hyperlinkTip . ref && hyperlinkTip . ref . isVisible ( ) ) {
if ( hyperlinkTip . text != linkstr ) {
hyperlinkTip . ref . hide ( ) ;
2019-03-15 13:11:37 +00:00
hyperlinkTip . ref = undefined ;
hyperlinkTip . text = '' ;
2016-03-11 00:48:53 +00:00
hyperlinkTip . isHidden = true ;
}
}
if ( ! hyperlinkTip . ref || ! hyperlinkTip . ref . isVisible ( ) ) {
hyperlinkTip . text = linkstr ;
hyperlinkTip . ref = new Common . UI . Tooltip ( {
2019-03-21 08:09:11 +00:00
owner : hyperlinkTip . parentEl ,
2016-03-11 00:48:53 +00:00
html : true ,
title : linkstr
} ) ;
hyperlinkTip . ref . show ( [ - 10000 , - 10000 ] ) ;
hyperlinkTip . isHidden = false ;
2019-03-06 13:41:54 +00:00
showPoint = [ data . asc _getX ( ) , data . asc _getY ( ) ] ;
showPoint [ 0 ] += ( pos [ 0 ] + 6 ) ;
showPoint [ 1 ] += ( pos [ 1 ] - 20 ) ;
showPoint [ 1 ] -= hyperlinkTip . ref . getBSTip ( ) . $tip . height ( ) ;
var tipwidth = hyperlinkTip . ref . getBSTip ( ) . $tip . width ( ) ;
if ( showPoint [ 0 ] + tipwidth > me . tooltips . coauth . bodyWidth )
showPoint [ 0 ] = me . tooltips . coauth . bodyWidth - tipwidth ;
hyperlinkTip . ref . getBSTip ( ) . $tip . css ( {
top : showPoint [ 1 ] + 'px' ,
left : showPoint [ 0 ] + 'px'
} ) ;
2016-03-11 00:48:53 +00:00
}
}
if ( index _column !== undefined || index _row !== undefined ) {
2019-03-21 08:09:11 +00:00
if ( ! row _columnTip . parentEl ) {
row _columnTip . parentEl = $ ( '<div id="tip-container-rowcolumntip" style="position: absolute; z-index: 10000;"></div>' ) ;
me . documentHolder . cmpEl . append ( row _columnTip . parentEl ) ;
}
2016-03-11 00:48:53 +00:00
var data = dataarray [ ( index _column !== undefined ) ? ( index _column - 1 ) : ( index _row - 1 ) ] ;
2016-11-11 08:47:22 +00:00
var str = Common . Utils . String . format ( ( index _column !== undefined ) ? this . textChangeColumnWidth : this . textChangeRowHeight , data . asc _getSizeCCOrPt ( ) . toFixed ( 2 ) , data . asc _getSizePx ( ) . toFixed ( ) ) ;
2016-03-11 00:48:53 +00:00
if ( row _columnTip . ref && row _columnTip . ref . isVisible ( ) ) {
if ( row _columnTip . text != str ) {
row _columnTip . text = str ;
row _columnTip . ref . setTitle ( str ) ;
row _columnTip . ref . updateTitle ( ) ;
}
}
if ( ! row _columnTip . ref || ! row _columnTip . ref . isVisible ( ) ) {
row _columnTip . text = str ;
row _columnTip . ref = new Common . UI . Tooltip ( {
2019-03-21 08:09:11 +00:00
owner : row _columnTip . parentEl ,
2016-03-11 00:48:53 +00:00
html : true ,
title : str
} ) ;
row _columnTip . ref . show ( [ - 10000 , - 10000 ] ) ;
row _columnTip . isHidden = false ;
showPoint = [ data . asc _getX ( ) , data . asc _getY ( ) ] ;
showPoint [ 0 ] += ( pos [ 0 ] + 6 ) ;
showPoint [ 1 ] += ( pos [ 1 ] - 20 - row _columnTip . ttHeight ) ;
var tipwidth = row _columnTip . ref . getBSTip ( ) . $tip . width ( ) ;
if ( showPoint [ 0 ] + tipwidth > me . tooltips . coauth . bodyWidth )
showPoint [ 0 ] = me . tooltips . coauth . bodyWidth - tipwidth - 20 ;
row _columnTip . ref . getBSTip ( ) . $tip . css ( {
top : showPoint [ 1 ] + 'px' ,
left : showPoint [ 0 ] + 'px'
} ) ;
}
2019-03-15 13:11:37 +00:00
}
2016-03-11 00:48:53 +00:00
2018-12-17 08:37:43 +00:00
if ( me . permissions . isEdit || me . permissions . canViewComments ) {
2016-03-11 00:48:53 +00:00
if ( index _comments && ! this . popupmenu ) {
data = dataarray [ index _comments - 1 ] ;
if ( ! commentTip . editCommentId && commentTip . moveCommentId != data . asc _getCommentIndexes ( ) [ 0 ] ) {
commentTip . moveCommentId = data . asc _getCommentIndexes ( ) [ 0 ] ;
if ( commentTip . moveCommentTimer ) {
clearTimeout ( commentTip . moveCommentTimer ) ;
}
var idxs = data . asc _getCommentIndexes ( ) ,
x = data . asc _getX ( ) ,
y = data . asc _getY ( ) ,
leftx = data . asc _getReverseX ( ) ;
commentTip . moveCommentTimer = setTimeout ( function ( ) {
if ( commentTip . moveCommentId && ! commentTip . editCommentId ) {
commentTip . viewCommentId = commentTip . moveCommentId ;
var commentsController = me . getApplication ( ) . getController ( 'Common.Controllers.Comments' ) ;
if ( commentsController ) {
if ( ! commentsController . isSelectedComment ) {
commentsController . onApiShowComment ( idxs , x , y , leftx , false , true ) ;
}
}
}
} , 400 ) ;
}
}
2017-06-14 11:53:29 +00:00
}
2016-03-11 00:48:53 +00:00
2017-06-14 11:53:29 +00:00
if ( me . permissions . isEdit ) {
2021-11-08 22:01:49 +00:00
if ( index _locked && me . isUserVisible ( dataarray [ index _locked - 1 ] . asc _getUserId ( ) ) ) {
2016-03-11 00:48:53 +00:00
data = dataarray [ index _locked - 1 ] ;
if ( ! coAuthTip . XY )
me . onDocumentResize ( ) ;
if ( coAuthTip . x _point != data . asc _getX ( ) || coAuthTip . y _point != data . asc _getY ( ) ) {
me . hideCoAuthTips ( ) ;
coAuthTip . x _point = data . asc _getX ( ) ;
coAuthTip . y _point = data . asc _getY ( ) ;
var src = $ ( document . createElement ( "div" ) ) ,
2016-04-05 11:52:34 +00:00
is _sheet _lock = data . asc _getLockedObjectType ( ) == Asc . c _oAscMouseMoveLockedObjectType . Sheet ||
data . asc _getLockedObjectType ( ) == Asc . c _oAscMouseMoveLockedObjectType . TableProperties ;
2016-03-11 00:48:53 +00:00
coAuthTip . ref = src ;
src . addClass ( 'username-tip' ) ;
src . css ( {
height : coAuthTip . ttHeight + 'px' ,
position : 'absolute' ,
zIndex : '900' ,
visibility : 'visible'
} ) ;
$ ( document . body ) . append ( src ) ;
showPoint = [
2016-11-24 12:30:38 +00:00
( is _sheet _lock ) ? ( coAuthTip . x _point + coAuthTip . rightMenuWidth ) : ( coAuthTip . bodyWidth - ( coAuthTip . x _point + coAuthTip . XY [ 0 ] ) ) ,
2016-03-11 00:48:53 +00:00
coAuthTip . y _point + coAuthTip . XY [ 1 ]
] ;
2018-07-19 13:40:19 +00:00
if ( showPoint [ 1 ] >= coAuthTip . XY [ 1 ] &&
2016-03-11 00:48:53 +00:00
showPoint [ 1 ] + coAuthTip . ttHeight < coAuthTip . XY [ 1 ] + coAuthTip . apiHeight ) {
2021-06-28 11:51:32 +00:00
src . text ( me . getUserName ( data . asc _getUserId ( ) ) ) ;
2021-07-30 14:41:35 +00:00
if ( coAuthTip . bodyWidth - showPoint [ 0 ] < coAuthTip . ref . outerWidth ( ) ) {
2016-03-11 00:48:53 +00:00
src . css ( {
visibility : 'visible' ,
left : '0px' ,
top : ( showPoint [ 1 ] - coAuthTip . ttHeight ) + 'px'
} ) ;
} else
src . css ( {
visibility : 'visible' ,
right : showPoint [ 0 ] + 'px' ,
top : showPoint [ 1 ] + 'px'
} ) ;
}
}
}
2022-08-30 10:06:51 +00:00
}
if ( index _foreign && me . isUserVisible ( dataarray [ index _foreign - 1 ] . asc _getUserId ( ) ) ) {
data = dataarray [ index _foreign - 1 ] ;
2021-07-28 19:13:08 +00:00
2022-08-30 10:06:51 +00:00
if ( ! coAuthTip . XY )
me . onDocumentResize ( ) ;
2021-07-28 19:13:08 +00:00
2022-08-30 10:06:51 +00:00
if ( foreignSelect . x _point != data . asc _getX ( ) || foreignSelect . y _point != data . asc _getY ( ) ) {
me . hideForeignSelectTips ( ) ;
2021-07-28 19:13:08 +00:00
2022-08-30 10:06:51 +00:00
foreignSelect . x _point = data . asc _getX ( ) ;
foreignSelect . y _point = data . asc _getY ( ) ;
var src = $ ( document . createElement ( "div" ) ) ,
color = data . asc _getColor ( ) ;
foreignSelect . ref = src ;
foreignSelect . userId = data . asc _getUserId ( ) ;
src . addClass ( 'username-tip' ) ;
src . css ( {
height : foreignSelect . ttHeight + 'px' ,
position : 'absolute' ,
zIndex : '900' ,
visibility : 'visible' ,
'background-color' : '#' + Common . Utils . ThemeColor . getHexColor ( color . get _r ( ) , color . get _g ( ) , color . get _b ( ) )
} ) ;
$ ( document . body ) . append ( src ) ;
showPoint = [
foreignSelect . x _point + coAuthTip . XY [ 0 ] ,
foreignSelect . y _point + coAuthTip . XY [ 1 ] - foreignSelect . ttHeight
] ;
src . text ( me . getUserName ( data . asc _getUserId ( ) ) ) ;
src . css ( {
visibility : 'visible' ,
left : ( ( showPoint [ 0 ] + foreignSelect . ref . outerWidth ( ) > coAuthTip . bodyWidth - coAuthTip . rightMenuWidth ) ? coAuthTip . bodyWidth - coAuthTip . rightMenuWidth - foreignSelect . ref . outerWidth ( ) : showPoint [ 0 ] ) + 'px' ,
top : showPoint [ 1 ] + 'px'
} ) ;
2021-07-28 19:13:08 +00:00
}
2016-03-11 00:48:53 +00:00
}
2021-01-21 09:39:17 +00:00
if ( index _filter !== undefined && ! ( me . dlgFilter && me . dlgFilter . isVisible ( ) ) && ! ( me . currentMenu && me . currentMenu . isVisible ( ) ) && ! dataarray [ index _filter - 1 ] . asc _getFilter ( ) . asc _getPivotObj ( ) ) {
2019-03-21 08:09:11 +00:00
if ( ! filterTip . parentEl ) {
filterTip . parentEl = $ ( '<div id="tip-container-filtertip" style="position: absolute; z-index: 10000;"></div>' ) ;
me . documentHolder . cmpEl . append ( filterTip . parentEl ) ;
}
2018-05-31 07:27:38 +00:00
var data = dataarray [ index _filter - 1 ] ,
str = me . makeFilterTip ( data . asc _getFilter ( ) ) ;
if ( filterTip . ref && filterTip . ref . isVisible ( ) ) {
if ( filterTip . text != str ) {
filterTip . text = str ;
filterTip . ref . setTitle ( str ) ;
filterTip . ref . updateTitle ( ) ;
}
}
if ( ! filterTip . ref || ! filterTip . ref . isVisible ( ) ) {
filterTip . text = str ;
filterTip . ref = new Common . UI . Tooltip ( {
2019-03-21 08:09:11 +00:00
owner : filterTip . parentEl ,
2018-05-31 07:27:38 +00:00
html : true ,
title : str ,
cls : 'auto-tooltip'
} ) ;
filterTip . ref . show ( [ - 10000 , - 10000 ] ) ;
filterTip . isHidden = false ;
showPoint = [ data . asc _getX ( ) + pos [ 0 ] - 10 , data . asc _getY ( ) + pos [ 1 ] + 20 ] ;
var tipheight = filterTip . ref . getBSTip ( ) . $tip . width ( ) ;
if ( showPoint [ 1 ] + filterTip . ttHeight > me . tooltips . coauth . bodyHeight ) {
showPoint [ 1 ] = me . tooltips . coauth . bodyHeight - filterTip . ttHeight - 5 ;
showPoint [ 0 ] += 20 ;
}
var tipwidth = filterTip . ref . getBSTip ( ) . $tip . width ( ) ;
if ( showPoint [ 0 ] + tipwidth > me . tooltips . coauth . bodyWidth )
showPoint [ 0 ] = me . tooltips . coauth . bodyWidth - tipwidth - 20 ;
filterTip . ref . getBSTip ( ) . $tip . css ( {
top : showPoint [ 1 ] + 'px' ,
left : showPoint [ 0 ] + 'px'
} ) ;
}
}
2020-05-28 10:58:38 +00:00
if ( index _slicer !== undefined && me . permissions . isEdit ) {
if ( ! slicerTip . parentEl ) {
slicerTip . parentEl = $ ( '<div id="tip-container-slicertip" style="position: absolute; z-index: 10000;"></div>' ) ;
me . documentHolder . cmpEl . append ( slicerTip . parentEl ) ;
}
var data = dataarray [ index _slicer - 1 ] ,
str = data . asc _getTooltip ( ) ;
if ( slicerTip . ref && slicerTip . ref . isVisible ( ) ) {
if ( slicerTip . text != str ) {
slicerTip . text = str ;
slicerTip . ref . setTitle ( str ) ;
slicerTip . ref . updateTitle ( ) ;
}
}
if ( ! slicerTip . ref || ! slicerTip . ref . isVisible ( ) ) {
slicerTip . text = str ;
slicerTip . ref = new Common . UI . Tooltip ( {
owner : slicerTip . parentEl ,
html : true ,
title : str
} ) ;
slicerTip . ref . show ( [ - 10000 , - 10000 ] ) ;
slicerTip . isHidden = false ;
showPoint = [ data . asc _getX ( ) , data . asc _getY ( ) ] ;
showPoint [ 0 ] += ( pos [ 0 ] + 6 ) ;
showPoint [ 1 ] += ( pos [ 1 ] - 20 - slicerTip . ttHeight ) ;
var tipwidth = slicerTip . ref . getBSTip ( ) . $tip . width ( ) ;
if ( showPoint [ 0 ] + tipwidth > me . tooltips . coauth . bodyWidth )
showPoint [ 0 ] = me . tooltips . coauth . bodyWidth - tipwidth - 20 ;
slicerTip . ref . getBSTip ( ) . $tip . css ( {
top : showPoint [ 1 ] + 'px' ,
left : showPoint [ 0 ] + 'px'
} ) ;
}
}
2016-03-11 00:48:53 +00:00
}
} ,
onApiHideComment : function ( ) {
this . tooltips . comment . viewCommentId =
this . tooltips . comment . editCommentId =
this . tooltips . comment . moveCommentId = undefined ;
} ,
onApiHyperlinkClick : function ( url ) {
2016-08-05 11:40:47 +00:00
if ( ! url ) {
Common . UI . alert ( {
msg : this . errorInvalidLink ,
title : this . notcriticalErrorTitle ,
iconCls : 'warn' ,
buttons : [ 'ok' ] ,
callback : _ . bind ( function ( btn ) {
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
} , this )
} ) ;
return ;
}
2022-06-16 17:50:54 +00:00
var type = this . api . asc _getUrlType ( url ) ;
if ( type === AscCommon . c _oAscUrlType . Http || type === AscCommon . c _oAscUrlType . Email )
2021-09-03 11:39:20 +00:00
window . open ( url , '_blank' ) ;
else
Common . UI . warning ( {
msg : this . txtWarnUrl ,
buttons : [ 'yes' , 'no' ] ,
primary : 'yes' ,
callback : function ( btn ) {
( btn == 'yes' ) && window . open ( url , '_blank' ) ;
}
} ) ;
2016-03-11 00:48:53 +00:00
} ,
onApiAutofilter : function ( config ) {
var me = this ;
2018-05-31 07:27:38 +00:00
if ( ! me . tooltips . filter . isHidden && me . tooltips . filter . ref ) {
me . tooltips . filter . ref . hide ( ) ;
2019-03-15 13:11:37 +00:00
me . tooltips . filter . ref = undefined ;
me . tooltips . filter . text = '' ;
2018-05-31 07:27:38 +00:00
me . tooltips . filter . isHidden = true ;
}
2020-03-25 15:03:35 +00:00
if ( me . permissions . isEdit ) {
if ( ! me . dlgFilter ) {
2021-07-19 13:43:58 +00:00
if ( me . _state . wsProps [ 'PivotTables' ] && config . asc _getPivotObj ( ) || me . _state . wsProps [ 'AutoFilter' ] && ! config . asc _getPivotObj ( ) ) return ;
2020-03-25 15:03:35 +00:00
me . dlgFilter = new SSE . Views . AutoFilterDialog ( { api : this . api } ) . on ( {
2016-03-11 00:48:53 +00:00
'close' : function ( ) {
if ( me . api ) {
me . api . asc _enableKeyEvents ( true ) ;
}
2016-05-20 11:28:40 +00:00
me . dlgFilter = undefined ;
2016-03-11 00:48:53 +00:00
}
} ) ;
2020-03-25 15:03:35 +00:00
if ( me . api ) {
me . api . asc _enableKeyEvents ( false ) ;
}
2016-03-11 00:48:53 +00:00
2020-03-25 15:03:35 +00:00
Common . UI . Menu . Manager . hideAll ( ) ;
me . dlgFilter . setSettings ( config ) ;
var offset = me . documentHolder . cmpEl . offset ( ) ,
rect = config . asc _getCellCoord ( ) ,
x = rect . asc _getX ( ) + rect . asc _getWidth ( ) + offset . left ,
y = rect . asc _getY ( ) + rect . asc _getHeight ( ) + offset . top ;
var docwidth = Common . Utils . innerWidth ( ) ,
docheight = Common . Utils . innerHeight ( ) ;
if ( x + me . dlgFilter . options . width > docwidth )
x = docwidth - me . dlgFilter . options . width - 5 ;
if ( y + me . dlgFilter . options . height > docheight )
y = docheight - me . dlgFilter . options . height - 5 ;
me . dlgFilter . show ( x , y ) ;
} else
me . dlgFilter . close ( ) ;
2016-03-11 00:48:53 +00:00
}
} ,
2018-05-31 07:27:38 +00:00
makeFilterTip : function ( props ) {
var filterObj = props . asc _getFilterObj ( ) ,
filterType = filterObj . asc _getType ( ) ,
isTextFilter = props . asc _getIsTextFilter ( ) ,
colorsFill = props . asc _getColorsFill ( ) ,
colorsFont = props . asc _getColorsFont ( ) ,
str = "" ;
if ( filterType === Asc . c _oAscAutoFilterTypes . CustomFilters ) {
var customFilter = filterObj . asc _getFilter ( ) ,
customFilters = customFilter . asc _getCustomFilters ( ) ;
str = this . getFilterName ( Asc . c _oAscAutoFilterTypes . CustomFilters , customFilters [ 0 ] . asc _getOperator ( ) ) + " \"" + customFilters [ 0 ] . asc _getVal ( ) + "\"" ;
if ( customFilters . length > 1 ) {
2018-08-03 11:06:29 +00:00
str = str + " " + ( customFilter . asc _getAnd ( ) ? this . txtAnd : this . txtOr ) ;
2018-05-31 07:27:38 +00:00
str = str + " " + this . getFilterName ( Asc . c _oAscAutoFilterTypes . CustomFilters , customFilters [ 1 ] . asc _getOperator ( ) ) + " \"" + customFilters [ 1 ] . asc _getVal ( ) + "\"" ;
}
} else if ( filterType === Asc . c _oAscAutoFilterTypes . ColorFilter ) {
var colorFilter = filterObj . asc _getFilter ( ) ;
if ( colorFilter . asc _getCellColor ( ) === null ) { // cell color
str = this . txtEqualsToCellColor ;
} else if ( colorFilter . asc _getCellColor ( ) === false ) { // font color
str = this . txtEqualsToFontColor ;
}
} else if ( filterType === Asc . c _oAscAutoFilterTypes . DynamicFilter ) {
str = this . getFilterName ( Asc . c _oAscAutoFilterTypes . DynamicFilter , filterObj . asc _getFilter ( ) . asc _getType ( ) ) ;
} else if ( filterType === Asc . c _oAscAutoFilterTypes . Top10 ) {
var top10Filter = filterObj . asc _getFilter ( ) ,
percent = top10Filter . asc _getPercent ( ) ;
str = this . getFilterName ( Asc . c _oAscAutoFilterTypes . Top10 , top10Filter . asc _getTop ( ) ) ;
str += " " + top10Filter . asc _getVal ( ) + " " + ( ( percent || percent === null ) ? this . txtPercent : this . txtItems ) ;
} else if ( filterType === Asc . c _oAscAutoFilterTypes . Filters ) {
var strlen = 0 , visibleItems = 0 , isBlankVisible = undefined ,
values = props . asc _getValues ( ) ;
values . forEach ( function ( item ) {
if ( item . asc _getVisible ( ) ) {
visibleItems ++ ;
if ( strlen < 100 && item . asc _getText ( ) ) {
str += item . asc _getText ( ) + "; " ;
strlen = str . length ;
}
}
if ( ! item . asc _getText ( ) )
isBlankVisible = item . asc _getVisible ( ) ;
} ) ;
if ( visibleItems == values . length )
str = this . txtAll ;
else if ( visibleItems == 1 && isBlankVisible )
str = this . txtEquals + " \"" + this . txtBlanks + "\"" ;
else if ( visibleItems == values . length - 1 && ( isBlankVisible == false ) )
str = this . txtNotEquals + " \"" + this . txtBlanks + "\"" ;
else {
isBlankVisible && ( str += this . txtBlanks + "; " ) ;
str = this . txtEquals + " \"" + str . substring ( 0 , str . length - 2 ) + "\"" ;
}
} else if ( filterType === Asc . c _oAscAutoFilterTypes . None ) {
str = this . txtAll ;
}
if ( str . length > 100 )
str = str . substring ( 0 , 100 ) + '...' ;
2018-07-26 14:03:47 +00:00
str = "<b>" + ( props . asc _getColumnName ( ) || '(' + this . txtColumn + ' ' + props . asc _getSheetColumnName ( ) + ')' ) + ":</b><br>" + str ;
2018-05-31 07:27:38 +00:00
return str ;
} ,
getFilterName : function ( type , subtype ) {
var str = '' ;
if ( type == Asc . c _oAscAutoFilterTypes . CustomFilters ) {
switch ( subtype ) {
case Asc . c _oAscCustomAutoFilter . equals : str = this . txtEquals ; break ;
case Asc . c _oAscCustomAutoFilter . isGreaterThan : str = this . txtGreater ; break ;
case Asc . c _oAscCustomAutoFilter . isGreaterThanOrEqualTo : str = this . txtGreaterEquals ; break ;
case Asc . c _oAscCustomAutoFilter . isLessThan : str = this . txtLess ; break ;
case Asc . c _oAscCustomAutoFilter . isLessThanOrEqualTo : str = this . txtLessEquals ; break ;
case Asc . c _oAscCustomAutoFilter . doesNotEqual : str = this . txtNotEquals ; break ;
case Asc . c _oAscCustomAutoFilter . beginsWith : str = this . txtBegins ; break ;
case Asc . c _oAscCustomAutoFilter . doesNotBeginWith : str = this . txtNotBegins ; break ;
case Asc . c _oAscCustomAutoFilter . endsWith : str = this . txtEnds ; break ;
case Asc . c _oAscCustomAutoFilter . doesNotEndWith : str = this . txtNotEnds ; break ;
case Asc . c _oAscCustomAutoFilter . contains : str = this . txtContains ; break ;
case Asc . c _oAscCustomAutoFilter . doesNotContain : str = this . txtNotContains ; break ;
}
} else if ( type == Asc . c _oAscAutoFilterTypes . DynamicFilter ) {
switch ( subtype ) {
case Asc . c _oAscDynamicAutoFilter . aboveAverage : str = this . txtAboveAve ; break ;
case Asc . c _oAscDynamicAutoFilter . belowAverage : str = this . txtBelowAve ; break ;
}
} else if ( type == Asc . c _oAscAutoFilterTypes . Top10 ) {
str = ( subtype || subtype === null ) ? this . txtFilterTop : this . txtFilterBottom ;
}
return str ;
} ,
2017-06-06 08:04:04 +00:00
onUndo : function ( ) {
if ( this . api ) {
this . api . asc _Undo ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onApiContextMenu : function ( event ) {
2021-07-15 14:20:58 +00:00
if ( Common . UI . HintManager . isHintVisible ( ) )
Common . UI . HintManager . clearHints ( ) ;
2016-03-11 00:48:53 +00:00
var me = this ;
_ . delay ( function ( ) {
me . showObjectMenu . call ( me , event ) ;
} , 10 ) ;
} ,
onAfterRender : function ( view ) {
} ,
onDocumentResize : function ( e ) {
var me = this ;
if ( me . documentHolder ) {
me . tooltips . coauth . XY = [
me . documentHolder . cmpEl . offset ( ) . left - $ ( window ) . scrollLeft ( ) ,
me . documentHolder . cmpEl . offset ( ) . top - $ ( window ) . scrollTop ( )
] ;
me . tooltips . coauth . apiHeight = me . documentHolder . cmpEl . height ( ) ;
2022-10-31 22:23:02 +00:00
me . tooltips . coauth . apiWidth = me . documentHolder . cmpEl . width ( ) ;
2022-08-30 10:06:51 +00:00
var rightMenu = $ ( '#right-menu' ) ;
me . tooltips . coauth . rightMenuWidth = rightMenu . is ( ':visible' ) ? rightMenu . width ( ) : 0 ;
2016-03-11 00:48:53 +00:00
me . tooltips . coauth . bodyWidth = $ ( window ) . width ( ) ;
2018-05-31 07:27:38 +00:00
me . tooltips . coauth . bodyHeight = $ ( window ) . height ( ) ;
2016-03-11 00:48:53 +00:00
}
} ,
onDocumentWheel : function ( e ) {
if ( this . api && ! this . isEditCell ) {
var delta = ( _ . isUndefined ( e . originalEvent ) ) ? e . wheelDelta : e . originalEvent . wheelDelta ;
if ( _ . isUndefined ( delta ) ) {
delta = e . deltaY ;
}
2022-05-19 14:12:28 +00:00
if ( e . ctrlKey && ! e . altKey ) {
2016-03-11 00:48:53 +00:00
var factor = this . api . asc _getZoom ( ) ;
if ( delta < 0 ) {
factor = Math . ceil ( factor * 10 ) / 10 ;
factor -= 0.1 ;
2022-07-25 10:29:50 +00:00
if ( ! ( factor < . 1 ) ) {
2016-03-11 00:48:53 +00:00
this . api . asc _setZoom ( factor ) ;
}
} else if ( delta > 0 ) {
factor = Math . floor ( factor * 10 ) / 10 ;
factor += 0.1 ;
2021-12-01 09:24:07 +00:00
if ( factor > 0 && ! ( factor > 5. ) ) {
2016-03-11 00:48:53 +00:00
this . api . asc _setZoom ( factor ) ;
}
}
e . preventDefault ( ) ;
e . stopPropagation ( ) ;
}
}
} ,
onDocumentKeyDown : function ( event ) {
if ( this . api ) {
var key = event . keyCode ;
2022-06-03 12:32:57 +00:00
if ( this . hkSpecPaste ) {
this . _needShowSpecPasteMenu = ! event . shiftKey && ! event . altKey && event . keyCode == Common . UI . Keys . CTRL ;
}
2016-03-11 00:48:53 +00:00
if ( ( event . ctrlKey || event . metaKey ) && ! event . shiftKey && ! event . altKey ) {
2017-09-19 14:26:09 +00:00
if ( key === Common . UI . Keys . NUM _PLUS || key === Common . UI . Keys . EQUALITY || ( Common . Utils . isGecko && key === Common . UI . Keys . EQUALITY _FF ) || ( Common . Utils . isOpera && key == 43 ) ) {
2016-03-11 00:48:53 +00:00
if ( ! this . api . isCellEdited ) {
var factor = Math . floor ( this . api . asc _getZoom ( ) * 10 ) / 10 ;
factor += . 1 ;
2021-12-01 09:24:07 +00:00
if ( factor > 0 && ! ( factor > 5. ) ) {
2016-03-11 00:48:53 +00:00
this . api . asc _setZoom ( factor ) ;
}
2022-09-01 17:56:11 +00:00
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
return false ;
} else if ( this . permissions . isEditMailMerge || this . permissions . isEditDiagram || this . permissions . isEditOle ) {
2016-03-11 00:48:53 +00:00
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
return false ;
}
2017-09-19 14:26:09 +00:00
} else if ( key === Common . UI . Keys . NUM _MINUS || key === Common . UI . Keys . MINUS || ( Common . Utils . isGecko && key === Common . UI . Keys . MINUS _FF ) || ( Common . Utils . isOpera && key == 45 ) ) {
2016-03-11 00:48:53 +00:00
if ( ! this . api . isCellEdited ) {
factor = Math . ceil ( this . api . asc _getZoom ( ) * 10 ) / 10 ;
factor -= . 1 ;
2022-07-25 10:29:50 +00:00
if ( ! ( factor < . 1 ) ) {
2016-03-11 00:48:53 +00:00
this . api . asc _setZoom ( factor ) ;
}
2022-09-01 17:56:11 +00:00
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
return false ;
} else if ( this . permissions . isEditMailMerge || this . permissions . isEditDiagram || this . permissions . isEditOle ) {
2020-04-09 15:35:36 +00:00
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
return false ;
}
} else if ( key === 48 || key === 96 ) { // 0
if ( ! this . api . isCellEdited ) {
this . api . asc _setZoom ( 1 ) ;
2016-03-11 00:48:53 +00:00
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
return false ;
}
}
} else
if ( key == Common . UI . Keys . F10 && event . shiftKey ) {
this . showObjectMenu ( event ) ;
event . preventDefault ( ) ;
event . stopPropagation ( ) ;
return false ;
2022-05-05 14:37:25 +00:00
} else if ( key == Common . UI . Keys . ESC && ! this . tooltips . input _msg . isHidden && this . tooltips . input _msg . text ) {
this . onInputMessage ( ) ;
2016-03-11 00:48:53 +00:00
}
}
} ,
onDocumentRightDown : function ( event ) {
event . button == 0 && ( this . mouse . isLeftButtonDown = true ) ;
// event.button == 2 && (this.mouse.isRightButtonDown = true);
} ,
onDocumentRightUp : function ( event ) {
event . button == 0 && ( this . mouse . isLeftButtonDown = false ) ;
} ,
2017-11-02 08:13:24 +00:00
onProcessMouse : function ( data ) {
( data . type == 'mouseup' ) && ( this . mouse . isLeftButtonDown = false ) ;
} ,
2020-02-25 11:37:43 +00:00
onDragEndMouseUp : function ( ) {
this . mouse . isLeftButtonDown = false ;
} ,
2019-04-03 13:03:20 +00:00
onDocumentMouseMove : function ( e ) {
2021-03-27 21:42:42 +00:00
if ( e && e . target . localName !== 'canvas' ) {
2019-04-03 13:03:20 +00:00
this . hideHyperlinkTip ( ) ;
}
} ,
2016-03-11 00:48:53 +00:00
showObjectMenu : function ( event ) {
2017-06-06 08:04:04 +00:00
if ( this . api && ! this . mouse . isLeftButtonDown && ! this . rangeSelectionMode ) {
2017-11-10 07:50:01 +00:00
( this . permissions . isEdit && ! this . _isDisabled ) ? this . fillMenuProps ( this . api . asc _getCellInfo ( ) , true , event ) : this . fillViewMenuProps ( this . api . asc _getCellInfo ( ) , true , event ) ;
2016-03-11 00:48:53 +00:00
}
} ,
onSelectionChanged : function ( info ) {
2017-06-06 08:04:04 +00:00
if ( ! this . mouse . isLeftButtonDown && ! this . rangeSelectionMode &&
2016-03-11 00:48:53 +00:00
this . currentMenu && this . currentMenu . isVisible ( ) ) {
2017-11-10 07:50:01 +00:00
( this . permissions . isEdit && ! this . _isDisabled ) ? this . fillMenuProps ( info , true ) : this . fillViewMenuProps ( info , true ) ;
2016-03-11 00:48:53 +00:00
}
2022-10-31 22:23:02 +00:00
if ( ! this . mouse . isLeftButtonDown ) return ;
2022-11-01 21:27:17 +00:00
if ( this . permissions && this . permissions . isEdit ) {
var selectedObjects = this . api . asc _getGraphicObjectProps ( ) ,
i = - 1 ,
in _equation = false ,
locked = false ;
while ( ++ i < selectedObjects . length ) {
var type = selectedObjects [ i ] . asc _getObjectType ( ) ;
if ( type === Asc . c _oAscTypeSelectElement . Math ) {
in _equation = true ;
} else if ( type === Asc . c _oAscTypeSelectElement . Paragraph ) {
var value = selectedObjects [ i ] . asc _getObjectValue ( ) ;
value && ( locked = locked || value . asc _getLocked ( ) ) ;
}
}
if ( in _equation ) {
this . _state . equationLocked = locked ;
this . disableEquationBar ( ) ;
2022-10-31 22:23:02 +00:00
}
}
2016-03-11 00:48:53 +00:00
} ,
fillMenuProps : function ( cellinfo , showMenu , event ) {
2022-10-28 14:02:42 +00:00
if ( ! cellinfo ) return ;
2020-05-26 14:27:49 +00:00
var iscellmenu , isrowmenu , iscolmenu , isallmenu , ischartmenu , isimagemenu , istextshapemenu , isshapemenu , istextchartmenu , isimageonly , isslicermenu ,
2016-03-11 00:48:53 +00:00
documentHolder = this . documentHolder ,
2020-05-14 08:39:04 +00:00
seltype = cellinfo . asc _getSelectionType ( ) ,
2016-03-11 00:48:53 +00:00
isCellLocked = cellinfo . asc _getLocked ( ) ,
2016-11-24 07:23:02 +00:00
isTableLocked = cellinfo . asc _getLockedTable ( ) === true ,
2021-03-04 20:15:29 +00:00
isPivotLocked = cellinfo . asc _getLockedPivotTable ( ) === true ,
2016-03-11 00:48:53 +00:00
isObjLocked = false ,
commentsController = this . getApplication ( ) . getController ( 'Common.Controllers.Comments' ) ,
2022-03-11 10:58:15 +00:00
internaleditor = this . permissions . isEditMailMerge || this . permissions . isEditDiagram || this . permissions . isEditOle ,
2022-03-18 18:41:25 +00:00
diagramOrMergeEditor = this . permissions . isEditMailMerge || this . permissions . isEditDiagram ,
2021-11-09 18:22:00 +00:00
xfs = cellinfo . asc _getXfs ( ) ,
isSmartArt = false ,
isSmartArtInternal = false ;
2017-09-28 13:56:10 +00:00
switch ( seltype ) {
case Asc . c _oAscSelectionType . RangeCells : iscellmenu = true ; break ;
case Asc . c _oAscSelectionType . RangeRow : isrowmenu = true ; break ;
case Asc . c _oAscSelectionType . RangeCol : iscolmenu = true ; break ;
case Asc . c _oAscSelectionType . RangeMax : isallmenu = true ; break ;
2020-06-05 16:28:11 +00:00
case Asc . c _oAscSelectionType . RangeSlicer :
2022-03-16 15:39:50 +00:00
case Asc . c _oAscSelectionType . RangeImage : isimagemenu = ! ( this . permissions . isEditMailMerge || this . permissions . isEditDiagram ) ; break ;
case Asc . c _oAscSelectionType . RangeShape : isshapemenu = ! ( this . permissions . isEditMailMerge || this . permissions . isEditDiagram ) ; break ;
case Asc . c _oAscSelectionType . RangeChart : ischartmenu = ! ( this . permissions . isEditMailMerge || this . permissions . isEditDiagram ) ; break ;
case Asc . c _oAscSelectionType . RangeChartText : istextchartmenu = ! ( this . permissions . isEditMailMerge || this . permissions . isEditDiagram ) ; break ;
case Asc . c _oAscSelectionType . RangeShapeText : istextshapemenu = ! ( this . permissions . isEditMailMerge || this . permissions . isEditDiagram ) ; break ;
2016-03-11 00:48:53 +00:00
}
2019-07-23 10:24:38 +00:00
if ( this . api . asc _getHeaderFooterMode ( ) ) {
if ( ! documentHolder . copyPasteMenu || ! showMenu && ! documentHolder . copyPasteMenu . isVisible ( ) ) return ;
if ( showMenu ) this . showPopupMenu ( documentHolder . copyPasteMenu , { } , event ) ;
} else if ( isimagemenu || isshapemenu || ischartmenu ) {
2021-12-11 10:39:35 +00:00
if ( ! documentHolder . imgMenu || ! showMenu && ! documentHolder . imgMenu . isVisible ( ) ) return ;
2016-03-11 00:48:53 +00:00
2020-05-26 14:27:49 +00:00
isimagemenu = isshapemenu = ischartmenu = isslicermenu = false ;
2019-02-27 11:51:52 +00:00
documentHolder . mnuImgAdvanced . imageInfo = undefined ;
2017-11-22 08:41:47 +00:00
var has _chartprops = false ,
signGuid ;
2016-03-11 00:48:53 +00:00
var selectedObjects = this . api . asc _getGraphicObjectProps ( ) ;
for ( var i = 0 ; i < selectedObjects . length ; i ++ ) {
2016-04-05 11:52:34 +00:00
if ( selectedObjects [ i ] . asc _getObjectType ( ) == Asc . c _oAscTypeSelectElement . Image ) {
2016-03-11 00:48:53 +00:00
var elValue = selectedObjects [ i ] . asc _getObjectValue ( ) ;
isObjLocked = isObjLocked || elValue . asc _getLocked ( ) ;
2021-12-11 10:39:35 +00:00
if ( this . _state . wsProps [ 'Objects' ] && elValue . asc _getProtectionLocked ( ) ) // don't show menu for locked shape
return ;
2016-03-11 00:48:53 +00:00
var shapeprops = elValue . asc _getShapeProperties ( ) ;
if ( shapeprops ) {
if ( shapeprops . asc _getFromChart ( ) )
ischartmenu = true ;
2018-02-06 08:56:13 +00:00
else if ( shapeprops . asc _getFromImage ( ) )
isimageonly = true ;
2016-03-11 00:48:53 +00:00
else {
documentHolder . mnuShapeAdvanced . shapeInfo = elValue ;
isshapemenu = true ;
2021-11-09 18:22:00 +00:00
if ( shapeprops . asc _getFromSmartArt ( ) )
isSmartArt = true ;
if ( shapeprops . asc _getFromSmartArtInternal ( ) )
isSmartArtInternal = true ;
2016-03-11 00:48:53 +00:00
}
} else if ( elValue . asc _getChartProperties ( ) ) {
2017-04-11 11:05:56 +00:00
documentHolder . mnuChartEdit . chartInfo = elValue ;
2016-03-11 00:48:53 +00:00
ischartmenu = true ;
has _chartprops = true ;
2020-08-20 16:58:03 +00:00
} else if ( elValue . asc _getSlicerProperties ( ) ) {
2020-05-26 14:27:49 +00:00
documentHolder . mnuSlicerAdvanced . imageInfo = elValue ;
isslicermenu = true ;
2017-04-11 11:05:56 +00:00
} else {
documentHolder . mnuImgAdvanced . imageInfo = elValue ;
2016-03-11 00:48:53 +00:00
isimagemenu = true ;
2017-04-11 11:05:56 +00:00
}
2018-09-24 09:18:00 +00:00
if ( this . permissions . isSignatureSupport )
2017-11-23 11:29:41 +00:00
signGuid = elValue . asc _getSignatureId ( ) ;
2016-03-11 00:48:53 +00:00
}
}
2021-11-09 18:22:00 +00:00
documentHolder . mnuBringToFront . setDisabled ( isSmartArtInternal ) ;
documentHolder . mnuSendToBack . setDisabled ( isSmartArtInternal ) ;
documentHolder . mnuBringForward . setDisabled ( isSmartArtInternal ) ;
documentHolder . mnuSendBackward . setDisabled ( isSmartArtInternal ) ;
2019-02-27 09:52:19 +00:00
var cangroup = this . api . asc _canGroupGraphicsObjects ( ) ;
2016-03-11 00:48:53 +00:00
documentHolder . mnuUnGroupImg . setDisabled ( isObjLocked || ! this . api . asc _canUnGroupGraphicsObjects ( ) ) ;
2019-02-27 09:52:19 +00:00
documentHolder . mnuGroupImg . setDisabled ( isObjLocked || ! cangroup ) ;
documentHolder . menuImageAlign . setDisabled ( isObjLocked || ! cangroup ) ;
var objcount = this . api . asc _getSelectedDrawingObjectsCount ( ) ;
documentHolder . menuImageAlign . menu . items [ 7 ] . setDisabled ( objcount < 3 ) ;
documentHolder . menuImageAlign . menu . items [ 8 ] . setDisabled ( objcount < 3 ) ;
2016-03-11 00:48:53 +00:00
documentHolder . mnuShapeAdvanced . setVisible ( isshapemenu && ! isimagemenu && ! ischartmenu ) ;
documentHolder . mnuShapeAdvanced . setDisabled ( isObjLocked ) ;
documentHolder . mnuChartEdit . setVisible ( ischartmenu && ! isimagemenu && ! isshapemenu && has _chartprops ) ;
documentHolder . mnuChartEdit . setDisabled ( isObjLocked ) ;
2022-03-16 15:39:50 +00:00
documentHolder . mnuChartData . setVisible ( this . permissions . isEditOle && ischartmenu && ! isimagemenu && ! isshapemenu && has _chartprops ) ;
documentHolder . mnuChartData . setDisabled ( isObjLocked ) ;
documentHolder . mnuChartType . setVisible ( this . permissions . isEditOle && ischartmenu && ! isimagemenu && ! isshapemenu && has _chartprops ) ;
documentHolder . mnuChartType . setDisabled ( isObjLocked ) ;
2016-03-11 00:48:53 +00:00
documentHolder . pmiImgCut . setDisabled ( isObjLocked ) ;
documentHolder . pmiImgPaste . setDisabled ( isObjLocked ) ;
2018-02-06 08:56:13 +00:00
documentHolder . mnuImgAdvanced . setVisible ( isimagemenu && ( ! isshapemenu || isimageonly ) && ! ischartmenu ) ;
2017-04-11 11:05:56 +00:00
documentHolder . mnuImgAdvanced . setDisabled ( isObjLocked ) ;
2018-04-11 13:46:44 +00:00
documentHolder . menuImgOriginalSize . setVisible ( isimagemenu && ( ! isshapemenu || isimageonly ) && ! ischartmenu ) ;
if ( documentHolder . mnuImgAdvanced . imageInfo )
documentHolder . menuImgOriginalSize . setDisabled ( isObjLocked || documentHolder . mnuImgAdvanced . imageInfo . get _ImageUrl ( ) === null || documentHolder . mnuImgAdvanced . imageInfo . get _ImageUrl ( ) === undefined ) ;
2020-05-26 14:27:49 +00:00
documentHolder . mnuSlicerAdvanced . setVisible ( isslicermenu ) ;
2020-05-25 17:25:16 +00:00
documentHolder . mnuSlicerAdvanced . setDisabled ( isObjLocked ) ;
2018-04-11 13:46:44 +00:00
var pluginGuid = ( documentHolder . mnuImgAdvanced . imageInfo ) ? documentHolder . mnuImgAdvanced . imageInfo . asc _getPluginGuid ( ) : null ;
documentHolder . menuImgReplace . setVisible ( isimageonly && ( pluginGuid === null || pluginGuid === undefined ) ) ;
documentHolder . menuImgReplace . setDisabled ( isObjLocked || pluginGuid === null ) ;
2020-05-13 14:43:45 +00:00
documentHolder . menuImgReplace . menu . items [ 2 ] . setVisible ( this . permissions . canRequestInsertImage || this . permissions . fileChoiceUrl && this . permissions . fileChoiceUrl . indexOf ( "{documentType}" ) > - 1 ) ;
2019-02-27 09:52:19 +00:00
documentHolder . menuImageArrange . setDisabled ( isObjLocked ) ;
2020-05-26 14:27:49 +00:00
documentHolder . menuImgRotate . setVisible ( ! ischartmenu && ( pluginGuid === null || pluginGuid === undefined ) && ! isslicermenu ) ;
2021-11-09 18:22:00 +00:00
documentHolder . menuImgRotate . setDisabled ( isObjLocked || isSmartArt ) ;
2022-03-28 12:31:59 +00:00
documentHolder . menuImgRotate . menu . items [ 3 ] . setDisabled ( isSmartArtInternal ) ;
documentHolder . menuImgRotate . menu . items [ 4 ] . setDisabled ( isSmartArtInternal ) ;
2017-11-22 08:41:47 +00:00
2019-04-09 11:29:51 +00:00
documentHolder . menuImgCrop . setVisible ( this . api . asc _canEditCrop ( ) ) ;
2021-02-24 13:50:28 +00:00
documentHolder . menuImgCrop . setDisabled ( isObjLocked ) ;
2019-04-09 11:29:51 +00:00
2017-11-24 11:47:48 +00:00
var isInSign = ! ! signGuid ;
2017-11-22 08:41:47 +00:00
documentHolder . menuSignatureEditSign . setVisible ( isInSign ) ;
documentHolder . menuSignatureEditSetup . setVisible ( isInSign ) ;
documentHolder . menuEditSignSeparator . setVisible ( isInSign ) ;
2022-03-16 15:39:50 +00:00
documentHolder . menuImgMacro . setVisible ( ! internaleditor ) ;
2021-04-16 20:29:20 +00:00
documentHolder . menuImgMacro . setDisabled ( isObjLocked ) ;
2021-09-21 10:34:31 +00:00
var canEditPoints = this . api && this . api . asc _canEditGeometry ( ) ;
documentHolder . menuImgEditPoints . setVisible ( canEditPoints ) ;
documentHolder . menuImgEditPointsSeparator . setVisible ( canEditPoints ) ;
canEditPoints && documentHolder . menuImgEditPoints . setDisabled ( isObjLocked ) ;
2021-04-16 20:29:20 +00:00
2016-03-11 00:48:53 +00:00
if ( showMenu ) this . showPopupMenu ( documentHolder . imgMenu , { } , event ) ;
2017-04-11 11:05:56 +00:00
documentHolder . mnuShapeSeparator . setVisible ( documentHolder . mnuShapeAdvanced . isVisible ( ) || documentHolder . mnuChartEdit . isVisible ( ) || documentHolder . mnuImgAdvanced . isVisible ( ) ) ;
2020-05-25 17:25:16 +00:00
documentHolder . mnuSlicerSeparator . setVisible ( documentHolder . mnuSlicerAdvanced . isVisible ( ) ) ;
2021-02-24 13:50:28 +00:00
if ( isInSign ) {
documentHolder . menuSignatureEditSign . cmpEl . attr ( 'data-value' , signGuid ) ; // sign
documentHolder . menuSignatureEditSetup . cmpEl . attr ( 'data-value' , signGuid ) ; // edit signature settings
}
2016-03-11 00:48:53 +00:00
} else if ( istextshapemenu || istextchartmenu ) {
2021-12-11 10:39:35 +00:00
if ( ! documentHolder . textInShapeMenu || ! showMenu && ! documentHolder . textInShapeMenu . isVisible ( ) ) return ;
2016-03-11 00:48:53 +00:00
documentHolder . pmiTextAdvanced . textInfo = undefined ;
2016-10-24 11:56:11 +00:00
var selectedObjects = this . api . asc _getGraphicObjectProps ( ) ,
isEquation = false ;
2016-03-11 00:48:53 +00:00
for ( var i = 0 ; i < selectedObjects . length ; i ++ ) {
var elType = selectedObjects [ i ] . asc _getObjectType ( ) ;
2016-04-05 11:52:34 +00:00
if ( elType == Asc . c _oAscTypeSelectElement . Image ) {
2016-03-11 00:48:53 +00:00
var value = selectedObjects [ i ] . asc _getObjectValue ( ) ,
align = value . asc _getVerticalTextAlign ( ) ,
2017-05-18 07:31:18 +00:00
direct = value . asc _getVert ( ) ,
2021-11-09 18:22:00 +00:00
listtype = this . api . asc _getCurrentListType ( ) ,
shapeProps = value ? value . asc _getShapeProperties ( ) : null ;
2021-12-11 10:39:35 +00:00
if ( this . _state . wsProps [ 'Objects' ] && value . asc _getProtectionLockText ( ) ) // don't show menu for locked text
return ;
2016-03-11 00:48:53 +00:00
isObjLocked = isObjLocked || value . asc _getLocked ( ) ;
2021-11-09 18:22:00 +00:00
isSmartArt = shapeProps ? shapeProps . asc _getFromSmartArt ( ) : false ;
isSmartArtInternal = shapeProps ? shapeProps . asc _getFromSmartArtInternal ( ) : false ;
2020-08-20 18:03:07 +00:00
var cls = '' ;
switch ( align ) {
case Asc . c _oAscVAlign . Top :
cls = 'menu__icon btn-align-top' ;
break ;
case Asc . c _oAscVAlign . Center :
cls = 'menu__icon btn-align-middle' ;
break ;
case Asc . c _oAscVAlign . Bottom :
cls = 'menu__icon btn-align-bottom' ;
break ;
}
documentHolder . menuParagraphVAlign . setIconCls ( cls ) ;
2016-11-10 11:24:18 +00:00
documentHolder . menuParagraphTop . setChecked ( align == Asc . c _oAscVAlign . Top ) ;
documentHolder . menuParagraphCenter . setChecked ( align == Asc . c _oAscVAlign . Center ) ;
documentHolder . menuParagraphBottom . setChecked ( align == Asc . c _oAscVAlign . Bottom ) ;
2016-04-05 11:52:34 +00:00
2020-08-20 18:03:07 +00:00
cls = '' ;
switch ( direct ) {
case Asc . c _oAscVertDrawingText . normal :
cls = 'menu__icon text-orient-hor' ;
break ;
case Asc . c _oAscVertDrawingText . vert :
cls = 'menu__icon text-orient-rdown' ;
break ;
case Asc . c _oAscVertDrawingText . vert270 :
2020-10-21 13:28:47 +00:00
cls = 'menu__icon text-orient-rup' ;
2020-08-20 18:03:07 +00:00
break ;
}
documentHolder . menuParagraphDirection . setIconCls ( cls ) ;
2016-04-05 11:52:34 +00:00
documentHolder . menuParagraphDirectH . setChecked ( direct == Asc . c _oAscVertDrawingText . normal ) ;
documentHolder . menuParagraphDirect90 . setChecked ( direct == Asc . c _oAscVertDrawingText . vert ) ;
documentHolder . menuParagraphDirect270 . setChecked ( direct == Asc . c _oAscVertDrawingText . vert270 ) ;
2017-05-18 07:31:18 +00:00
2017-05-18 11:28:09 +00:00
documentHolder . menuParagraphBulletNone . setChecked ( listtype . get _ListType ( ) == - 1 ) ;
2022-05-12 19:06:23 +00:00
var type = listtype . get _ListType ( ) ,
subtype = listtype . get _ListSubType ( ) ,
rec ,
defrec = documentHolder . paraBulletsPicker . store . at ( 7 ) ,
drawDefBullet = ( defrec . get ( 'subtype' ) === 0x1000 ) && ( type === 1 || subtype !== 0x1000 ) ;
if ( type === 1 || subtype !== 0x1000 ) {
rec = documentHolder . paraBulletsPicker . store . findWhere ( { type : type , subtype : subtype } ) ;
} else {
var bullet = listtype . asc _getListCustom ( ) ;
if ( bullet ) {
var bullettype = bullet . asc _getType ( ) ;
if ( bullettype === Asc . asc _PreviewBulletType . char ) {
var symbol = bullet . asc _getChar ( ) ;
if ( symbol ) {
rec = defrec ;
rec . set ( 'subtype' , 0x1000 ) ;
rec . set ( 'drawdata' , { type : bullettype , char : symbol , specialFont : bullet . asc _getSpecialFont ( ) } ) ;
2022-05-12 21:07:26 +00:00
rec . set ( 'tip' , '' ) ;
2022-05-13 09:56:47 +00:00
documentHolder . paraBulletsPicker . dataViewItems && this . updateBulletTip ( documentHolder . paraBulletsPicker . dataViewItems [ 7 ] , '' ) ;
2022-05-12 19:06:23 +00:00
drawDefBullet = false ;
}
} else if ( bullettype === Asc . asc _PreviewBulletType . image ) {
var id = bullet . asc _getImageId ( ) ;
if ( id ) {
rec = defrec ;
rec . set ( 'subtype' , 0x1000 ) ;
rec . set ( 'drawdata' , { type : bullettype , imageId : id } ) ;
2022-05-12 21:07:26 +00:00
rec . set ( 'tip' , '' ) ;
2022-05-13 09:56:47 +00:00
documentHolder . paraBulletsPicker . dataViewItems && this . updateBulletTip ( documentHolder . paraBulletsPicker . dataViewItems [ 7 ] , '' ) ;
2022-05-12 19:06:23 +00:00
drawDefBullet = false ;
}
}
}
}
2017-05-18 07:31:18 +00:00
documentHolder . paraBulletsPicker . selectRecord ( rec , true ) ;
2022-05-12 19:06:23 +00:00
if ( drawDefBullet ) {
defrec . set ( 'subtype' , 8 ) ;
defrec . set ( 'drawdata' , documentHolder . _markersArr [ 7 ] ) ;
2022-05-12 21:07:26 +00:00
defrec . set ( 'tip' , documentHolder . tipMarkersDash ) ;
2022-05-13 09:56:47 +00:00
documentHolder . paraBulletsPicker . dataViewItems && this . updateBulletTip ( documentHolder . paraBulletsPicker . dataViewItems [ 7 ] , documentHolder . tipMarkersDash ) ;
2022-05-12 19:06:23 +00:00
}
2016-04-05 11:52:34 +00:00
} else if ( elType == Asc . c _oAscTypeSelectElement . Paragraph ) {
2016-03-11 00:48:53 +00:00
documentHolder . pmiTextAdvanced . textInfo = selectedObjects [ i ] . asc _getObjectValue ( ) ;
isObjLocked = isObjLocked || documentHolder . pmiTextAdvanced . textInfo . asc _getLocked ( ) ;
2016-10-24 11:56:11 +00:00
} else if ( elType == Asc . c _oAscTypeSelectElement . Math ) {
this . _currentMathObj = selectedObjects [ i ] . asc _getObjectValue ( ) ;
isEquation = true ;
2016-03-11 00:48:53 +00:00
}
}
var hyperinfo = cellinfo . asc _getHyperlink ( ) ,
can _add _hyperlink = this . api . asc _canAddShapeHyperlink ( ) ;
2019-11-20 08:36:05 +00:00
documentHolder . menuParagraphBullets . setVisible ( istextchartmenu !== true ) ;
2016-03-11 00:48:53 +00:00
documentHolder . menuHyperlinkShape . setVisible ( istextshapemenu && can _add _hyperlink !== false && hyperinfo ) ;
documentHolder . menuAddHyperlinkShape . setVisible ( istextshapemenu && can _add _hyperlink !== false && ! hyperinfo ) ;
2016-10-24 11:56:11 +00:00
documentHolder . menuParagraphVAlign . setVisible ( istextchartmenu !== true && ! isEquation ) ; // убрать после того, как заголовок можно будет растягивать по вертикали!!
documentHolder . menuParagraphDirection . setVisible ( istextchartmenu !== true && ! isEquation ) ; // убрать после того, как заголовок можно будет растягивать по вертикали!!
2019-11-20 08:36:05 +00:00
documentHolder . textInShapeMenu . items [ 3 ] . setVisible ( istextchartmenu !== true || istextshapemenu && can _add _hyperlink !== false ) ;
2016-03-11 00:48:53 +00:00
documentHolder . pmiTextAdvanced . setVisible ( documentHolder . pmiTextAdvanced . textInfo !== undefined ) ;
2016-10-24 11:56:11 +00:00
2016-03-11 00:48:53 +00:00
_ . each ( documentHolder . textInShapeMenu . items , function ( item ) {
item . setDisabled ( isObjLocked ) ;
} ) ;
documentHolder . pmiTextCopy . setDisabled ( false ) ;
2021-07-19 13:43:58 +00:00
documentHolder . menuHyperlinkShape . setDisabled ( isObjLocked || this . _state . wsProps [ 'InsertHyperlinks' ] ) ;
documentHolder . menuAddHyperlinkShape . setDisabled ( isObjLocked || this . _state . wsProps [ 'InsertHyperlinks' ] ) ;
2016-10-24 11:56:11 +00:00
//equation menu
var eqlen = 0 ;
this . _currentParaObjDisabled = isObjLocked ;
if ( isEquation ) {
eqlen = this . addEquationMenu ( 4 ) ;
} else
this . clearEquationMenu ( 4 ) ;
2022-11-01 19:48:39 +00:00
documentHolder . menuParagraphEquation . setVisible ( isEquation ) ;
documentHolder . menuParagraphEquation . setDisabled ( isObjLocked ) ;
if ( isEquation ) {
var eq = this . api . asc _GetMathInputType ( ) ;
documentHolder . menuParagraphEquation . menu . items [ 0 ] . setChecked ( eq === Asc . c _oAscMathInputType . Unicode ) ;
documentHolder . menuParagraphEquation . menu . items [ 1 ] . setChecked ( eq === Asc . c _oAscMathInputType . LaTeX ) ;
}
2016-03-11 00:48:53 +00:00
if ( showMenu ) this . showPopupMenu ( documentHolder . textInShapeMenu , { } , event ) ;
2021-11-09 18:22:00 +00:00
documentHolder . menuParagraphBullets . setDisabled ( isSmartArt || isSmartArtInternal ) ;
2022-03-11 10:58:15 +00:00
} else if ( ! this . permissions . isEditMailMerge && ! this . permissions . isEditDiagram && ! this . permissions . isEditOle ||
( seltype !== Asc . c _oAscSelectionType . RangeImage && seltype !== Asc . c _oAscSelectionType . RangeShape &&
seltype !== Asc . c _oAscSelectionType . RangeChart && seltype !== Asc . c _oAscSelectionType . RangeChartText &&
seltype !== Asc . c _oAscSelectionType . RangeShapeText && seltype !== Asc . c _oAscSelectionType . RangeSlicer ) ) {
2018-12-06 11:00:25 +00:00
if ( ! documentHolder . ssMenu || ! showMenu && ! documentHolder . ssMenu . isVisible ( ) ) return ;
2022-10-25 12:50:27 +00:00
this . propsPivot = cellinfo . asc _getPivotTableInfo ( ) ;
2016-03-30 12:27:16 +00:00
var iscelledit = this . api . isCellEdited ,
formatTableInfo = cellinfo . asc _getFormatTableInfo ( ) ,
2016-11-25 12:58:57 +00:00
isinsparkline = ( cellinfo . asc _getSparklineInfo ( ) !== null ) ,
2016-11-01 15:04:35 +00:00
isintable = ( formatTableInfo !== null ) ,
2021-03-04 20:15:29 +00:00
ismultiselect = cellinfo . asc _getMultiselect ( ) ,
2022-10-25 12:50:27 +00:00
inPivot = ! ! this . propsPivot ;
2016-03-30 12:27:16 +00:00
documentHolder . ssMenu . formatTableName = ( isintable ) ? formatTableInfo . asc _getTableName ( ) : null ;
2020-05-15 10:52:52 +00:00
documentHolder . ssMenu . cellColor = xfs . asc _getFillColor ( ) ;
documentHolder . ssMenu . fontColor = xfs . asc _getFontColor ( ) ;
2016-03-11 00:48:53 +00:00
documentHolder . pmiInsertEntire . setVisible ( isrowmenu || iscolmenu ) ;
documentHolder . pmiInsertEntire . setCaption ( ( isrowmenu ) ? this . textInsertTop : this . textInsertLeft ) ;
documentHolder . pmiDeleteEntire . setVisible ( isrowmenu || iscolmenu ) ;
2021-03-04 20:15:29 +00:00
documentHolder . pmiInsertCells . setVisible ( iscellmenu && ! iscelledit && ! isintable && ! inPivot ) ;
documentHolder . pmiDeleteCells . setVisible ( iscellmenu && ! iscelledit && ! isintable && ! inPivot ) ;
2016-03-30 12:27:16 +00:00
documentHolder . pmiSelectTable . setVisible ( iscellmenu && ! iscelledit && isintable ) ;
documentHolder . pmiInsertTable . setVisible ( iscellmenu && ! iscelledit && isintable ) ;
documentHolder . pmiDeleteTable . setVisible ( iscellmenu && ! iscelledit && isintable ) ;
2016-11-25 12:58:57 +00:00
documentHolder . pmiSparklines . setVisible ( isinsparkline ) ;
2021-03-04 20:15:29 +00:00
documentHolder . pmiSortCells . setVisible ( ( iscellmenu || isallmenu ) && ! iscelledit && ! inPivot ) ;
2022-03-18 18:41:25 +00:00
documentHolder . pmiSortCells . menu . items [ 2 ] . setVisible ( ! diagramOrMergeEditor ) ;
documentHolder . pmiSortCells . menu . items [ 3 ] . setVisible ( ! diagramOrMergeEditor ) ;
2020-11-26 21:25:44 +00:00
documentHolder . pmiSortCells . menu . items [ 4 ] . setVisible ( ! internaleditor ) ;
2022-03-18 18:41:25 +00:00
documentHolder . pmiFilterCells . setVisible ( iscellmenu && ! iscelledit && ! diagramOrMergeEditor && ! inPivot ) ;
documentHolder . pmiReapply . setVisible ( ( iscellmenu || isallmenu ) && ! iscelledit && ! diagramOrMergeEditor && ! inPivot ) ;
documentHolder . pmiCondFormat . setVisible ( ! iscelledit && ! diagramOrMergeEditor ) ;
2022-10-25 12:50:27 +00:00
documentHolder . mnuRefreshPivot . setVisible ( iscellmenu && ! iscelledit && ! diagramOrMergeEditor && inPivot ) ;
2022-03-18 18:41:25 +00:00
documentHolder . mnuGroupPivot . setVisible ( iscellmenu && ! iscelledit && ! diagramOrMergeEditor && inPivot ) ;
documentHolder . mnuUnGroupPivot . setVisible ( iscellmenu && ! iscelledit && ! diagramOrMergeEditor && inPivot ) ;
2017-09-28 13:56:10 +00:00
documentHolder . ssMenu . items [ 12 ] . setVisible ( ( iscellmenu || isallmenu || isinsparkline ) && ! iscelledit ) ;
2021-03-04 20:15:29 +00:00
documentHolder . pmiInsFunction . setVisible ( iscellmenu && ! iscelledit && ! inPivot ) ;
2017-09-28 13:56:10 +00:00
documentHolder . pmiAddNamedRange . setVisible ( iscellmenu && ! iscelledit && ! internaleditor ) ;
2016-03-11 00:48:53 +00:00
2016-04-01 13:30:53 +00:00
if ( isintable ) {
documentHolder . pmiInsertTable . menu . items [ 0 ] . setDisabled ( ! formatTableInfo . asc _getIsInsertRowAbove ( ) ) ;
documentHolder . pmiInsertTable . menu . items [ 1 ] . setDisabled ( ! formatTableInfo . asc _getIsInsertRowBelow ( ) ) ;
documentHolder . pmiInsertTable . menu . items [ 2 ] . setDisabled ( ! formatTableInfo . asc _getIsInsertColumnLeft ( ) ) ;
documentHolder . pmiInsertTable . menu . items [ 3 ] . setDisabled ( ! formatTableInfo . asc _getIsInsertColumnRight ( ) ) ;
documentHolder . pmiDeleteTable . menu . items [ 0 ] . setDisabled ( ! formatTableInfo . asc _getIsDeleteRow ( ) ) ;
documentHolder . pmiDeleteTable . menu . items [ 1 ] . setDisabled ( ! formatTableInfo . asc _getIsDeleteColumn ( ) ) ;
documentHolder . pmiDeleteTable . menu . items [ 2 ] . setDisabled ( ! formatTableInfo . asc _getIsDeleteTable ( ) ) ;
}
2016-03-11 00:48:53 +00:00
var hyperinfo = cellinfo . asc _getHyperlink ( ) ;
2022-03-18 18:41:25 +00:00
documentHolder . menuHyperlink . setVisible ( iscellmenu && hyperinfo && ! iscelledit && ! ismultiselect && ! diagramOrMergeEditor && ! inPivot ) ;
documentHolder . menuAddHyperlink . setVisible ( iscellmenu && ! hyperinfo && ! iscelledit && ! ismultiselect && ! diagramOrMergeEditor && ! inPivot ) ;
2016-03-11 00:48:53 +00:00
documentHolder . pmiRowHeight . setVisible ( isrowmenu || isallmenu ) ;
documentHolder . pmiColumnWidth . setVisible ( iscolmenu || isallmenu ) ;
documentHolder . pmiEntireHide . setVisible ( iscolmenu || isrowmenu ) ;
documentHolder . pmiEntireShow . setVisible ( iscolmenu || isrowmenu ) ;
documentHolder . pmiFreezePanes . setVisible ( ! iscelledit ) ;
documentHolder . pmiFreezePanes . setCaption ( this . api . asc _getSheetViewSettings ( ) . asc _getIsFreezePane ( ) ? documentHolder . textUnFreezePanes : documentHolder . textFreezePanes ) ;
/** coauthoring begin **/
2021-07-29 12:12:38 +00:00
var celcomments = cellinfo . asc _getComments ( ) ; // celcomments===null - has comment, but no permissions to view it
2022-10-25 12:50:27 +00:00
documentHolder . ssMenu . items [ 20 ] . setVisible ( iscellmenu && ! iscelledit && this . permissions . canCoAuthoring && this . permissions . canComments && celcomments && ( celcomments . length < 1 ) ) ;
2021-07-29 12:12:38 +00:00
documentHolder . pmiAddComment . setVisible ( iscellmenu && ! iscelledit && this . permissions . canCoAuthoring && this . permissions . canComments && celcomments && ( celcomments . length < 1 ) ) ;
2016-03-11 00:48:53 +00:00
/** coauthoring end **/
2018-03-28 14:02:30 +00:00
documentHolder . pmiCellMenuSeparator . setVisible ( iscellmenu && ! iscelledit || isrowmenu || iscolmenu || isallmenu ) ;
2016-03-11 00:48:53 +00:00
documentHolder . pmiEntireHide . isrowmenu = isrowmenu ;
documentHolder . pmiEntireShow . isrowmenu = isrowmenu ;
commentsController && commentsController . blockPopover ( true ) ;
2017-10-19 10:14:12 +00:00
documentHolder . pmiClear . menu . items [ 0 ] . setDisabled ( ! this . permissions . canModifyFilter ) ;
2016-03-11 00:48:53 +00:00
documentHolder . pmiClear . menu . items [ 1 ] . setDisabled ( iscelledit ) ;
2017-10-19 10:14:12 +00:00
documentHolder . pmiClear . menu . items [ 2 ] . setDisabled ( iscelledit || ! this . permissions . canModifyFilter ) ;
2016-03-11 00:48:53 +00:00
documentHolder . pmiClear . menu . items [ 3 ] . setDisabled ( iscelledit ) ;
documentHolder . pmiClear . menu . items [ 4 ] . setDisabled ( iscelledit ) ;
documentHolder . pmiClear . menu . items [ 3 ] . setVisible ( ! this . permissions . isEditDiagram ) ;
documentHolder . pmiClear . menu . items [ 4 ] . setVisible ( ! this . permissions . isEditDiagram ) ;
2016-05-17 08:01:41 +00:00
var filterInfo = cellinfo . asc _getAutoFilterInfo ( ) ,
isApplyAutoFilter = ( filterInfo ) ? filterInfo . asc _getIsApplyAutoFilter ( ) : false ;
filterInfo = ( filterInfo ) ? filterInfo . asc _getIsAutoFilter ( ) : null ;
documentHolder . pmiInsertCells . menu . items [ 0 ] . setDisabled ( isApplyAutoFilter ) ;
documentHolder . pmiDeleteCells . menu . items [ 0 ] . setDisabled ( isApplyAutoFilter ) ;
documentHolder . pmiInsertCells . menu . items [ 1 ] . setDisabled ( isApplyAutoFilter ) ;
documentHolder . pmiDeleteCells . menu . items [ 1 ] . setDisabled ( isApplyAutoFilter ) ;
2016-03-11 00:48:53 +00:00
2017-09-18 13:53:29 +00:00
documentHolder . pmiEntriesList . setVisible ( ! iscelledit && ! inPivot ) ;
2018-04-13 13:29:31 +00:00
documentHolder . pmiNumFormat . setVisible ( ! iscelledit ) ;
2020-05-15 10:52:52 +00:00
documentHolder . pmiAdvancedNumFormat . options . numformatinfo = documentHolder . pmiNumFormat . menu . options . numformatinfo = xfs . asc _getNumFormatInfo ( ) ;
documentHolder . pmiAdvancedNumFormat . options . numformat = xfs . asc _getNumFormat ( ) ;
2018-04-13 13:29:31 +00:00
2022-06-15 14:35:51 +00:00
documentHolder . pmiGetRangeList . setVisible ( ! Common . Utils . isIE && iscellmenu && ! iscelledit && ! ismultiselect && ! internaleditor && this . permissions . canMakeActionLink && ! ! navigator . clipboard ) ;
2016-03-11 00:48:53 +00:00
_ . each ( documentHolder . ssMenu . items , function ( item ) {
item . setDisabled ( isCellLocked ) ;
} ) ;
documentHolder . pmiCopy . setDisabled ( false ) ;
2021-07-17 23:11:58 +00:00
documentHolder . pmiSelectTable . setDisabled ( this . _state . wsLock ) ;
documentHolder . pmiInsertEntire . setDisabled ( isCellLocked || isTableLocked || isrowmenu && this . _state . wsProps [ 'InsertRows' ] || iscolmenu && this . _state . wsProps [ 'InsertColumns' ] ) ;
documentHolder . pmiInsertCells . setDisabled ( isCellLocked || isTableLocked || inPivot || this . _state . wsLock ) ;
documentHolder . pmiInsertTable . setDisabled ( isCellLocked || isTableLocked || this . _state . wsLock ) ;
documentHolder . pmiDeleteEntire . setDisabled ( isCellLocked || isTableLocked || isrowmenu && this . _state . wsProps [ 'DeleteRows' ] || iscolmenu && this . _state . wsProps [ 'DeleteColumns' ] ) ;
documentHolder . pmiDeleteCells . setDisabled ( isCellLocked || isTableLocked || inPivot || this . _state . wsLock ) ;
documentHolder . pmiDeleteTable . setDisabled ( isCellLocked || isTableLocked || this . _state . wsLock ) ;
2018-02-16 11:18:20 +00:00
documentHolder . pmiClear . setDisabled ( isCellLocked || inPivot ) ;
2021-07-17 23:11:58 +00:00
documentHolder . pmiFilterCells . setDisabled ( isCellLocked || isTableLocked || ( filterInfo == null ) || inPivot || ! filterInfo && ! this . permissions . canModifyFilter || this . _state . wsLock ) ;
documentHolder . pmiSortCells . setDisabled ( isCellLocked || isTableLocked || ( filterInfo == null ) || inPivot || ! this . permissions . canModifyFilter || this . _state . wsProps [ 'Sort' ] ) ;
2016-11-24 07:23:02 +00:00
documentHolder . pmiReapply . setDisabled ( isCellLocked || isTableLocked || ( isApplyAutoFilter !== true ) ) ;
2021-07-17 23:11:58 +00:00
documentHolder . pmiCondFormat . setDisabled ( isCellLocked || isTableLocked || this . _state . wsProps [ 'FormatCells' ] ) ;
documentHolder . menuHyperlink . setDisabled ( isCellLocked || inPivot || this . _state . wsProps [ 'InsertHyperlinks' ] ) ;
documentHolder . menuAddHyperlink . setDisabled ( isCellLocked || inPivot || this . _state . wsProps [ 'InsertHyperlinks' ] ) ;
2018-03-20 12:35:17 +00:00
documentHolder . pmiInsFunction . setDisabled ( isCellLocked || inPivot ) ;
2020-07-10 13:36:22 +00:00
documentHolder . pmiFreezePanes . setDisabled ( this . api . asc _isWorksheetLockedOrDeleted ( this . api . asc _getActiveWorksheetIndex ( ) ) ) ;
2021-07-17 23:11:58 +00:00
documentHolder . pmiRowHeight . setDisabled ( isCellLocked || this . _state . wsProps [ 'FormatRows' ] ) ;
documentHolder . pmiColumnWidth . setDisabled ( isCellLocked || this . _state . wsProps [ 'FormatColumns' ] ) ;
documentHolder . pmiEntireHide . setDisabled ( isCellLocked || iscolmenu && this . _state . wsProps [ 'FormatColumns' ] || isrowmenu && this . _state . wsProps [ 'FormatRows' ] ) ;
documentHolder . pmiEntireShow . setDisabled ( isCellLocked || iscolmenu && this . _state . wsProps [ 'FormatColumns' ] || isrowmenu && this . _state . wsProps [ 'FormatRows' ] ) ;
documentHolder . pmiNumFormat . setDisabled ( isCellLocked || this . _state . wsProps [ 'FormatCells' ] ) ;
documentHolder . pmiSparklines . setDisabled ( isCellLocked || this . _state . wsLock ) ;
documentHolder . pmiEntriesList . setDisabled ( isCellLocked || this . _state . wsLock ) ;
documentHolder . pmiAddNamedRange . setDisabled ( isCellLocked || this . _state . wsLock ) ;
2021-08-08 22:00:41 +00:00
documentHolder . pmiAddComment . setDisabled ( isCellLocked || this . _state . wsProps [ 'Objects' ] ) ;
2022-06-15 14:35:51 +00:00
documentHolder . pmiGetRangeList . setDisabled ( false ) ;
2017-06-21 09:47:22 +00:00
2021-03-04 20:15:29 +00:00
if ( inPivot ) {
var canGroup = this . api . asc _canGroupPivot ( ) ;
2021-07-17 23:11:58 +00:00
documentHolder . mnuGroupPivot . setDisabled ( isPivotLocked || ! canGroup || this . _state . wsLock ) ;
documentHolder . mnuUnGroupPivot . setDisabled ( isPivotLocked || ! canGroup || this . _state . wsLock ) ;
2022-10-25 12:50:27 +00:00
documentHolder . mnuRefreshPivot . setDisabled ( isPivotLocked || this . _state . wsLock ) ;
2021-03-04 20:15:29 +00:00
}
2016-03-11 00:48:53 +00:00
if ( showMenu ) this . showPopupMenu ( documentHolder . ssMenu , { } , event ) ;
2022-06-15 14:35:51 +00:00
documentHolder . pmiFunctionSeparator . setVisible ( documentHolder . pmiInsFunction . isVisible ( ) || documentHolder . menuAddHyperlink . isVisible ( ) || documentHolder . menuHyperlink . isVisible ( ) ||
isrowmenu || iscolmenu || isallmenu ) ;
documentHolder . pmiFreezeSeparator . setVisible ( documentHolder . pmiFreezePanes . isVisible ( ) ) ;
2016-04-05 11:52:34 +00:00
} else if ( this . permissions . isEditDiagram && seltype == Asc . c _oAscSelectionType . RangeChartText ) {
2016-03-11 00:48:53 +00:00
if ( ! showMenu && ! documentHolder . textInShapeMenu . isVisible ( ) ) return ;
documentHolder . pmiTextAdvanced . textInfo = undefined ;
documentHolder . menuHyperlinkShape . setVisible ( false ) ;
documentHolder . menuAddHyperlinkShape . setVisible ( false ) ;
documentHolder . menuParagraphVAlign . setVisible ( false ) ; // убрать после того, как заголовок можно будет растягивать по вертикали!!
documentHolder . menuParagraphDirection . setVisible ( false ) ; // убрать после того, как заголовок можно будет растягивать по вертикали!!
documentHolder . pmiTextAdvanced . setVisible ( false ) ;
2022-11-01 21:27:17 +00:00
documentHolder . menuParagraphEquation . setVisible ( false ) ;
2018-02-28 10:47:39 +00:00
documentHolder . textInShapeMenu . items [ 9 ] . setVisible ( false ) ;
2019-11-20 08:20:05 +00:00
documentHolder . menuParagraphBullets . setVisible ( false ) ;
documentHolder . textInShapeMenu . items [ 3 ] . setVisible ( false ) ;
2016-03-11 00:48:53 +00:00
documentHolder . pmiTextCopy . setDisabled ( false ) ;
if ( showMenu ) this . showPopupMenu ( documentHolder . textInShapeMenu , { } , event ) ;
}
} ,
2017-06-06 08:04:04 +00:00
fillViewMenuProps : function ( cellinfo , showMenu , event ) {
2022-10-28 14:02:42 +00:00
if ( ! cellinfo ) return ;
2017-06-06 08:04:04 +00:00
var documentHolder = this . documentHolder ,
2020-05-14 08:39:04 +00:00
seltype = cellinfo . asc _getSelectionType ( ) ,
2017-06-06 08:04:04 +00:00
isCellLocked = cellinfo . asc _getLocked ( ) ,
isTableLocked = cellinfo . asc _getLockedTable ( ) === true ,
commentsController = this . getApplication ( ) . getController ( 'Common.Controllers.Comments' ) ,
2022-03-11 10:58:15 +00:00
iscellmenu = ( seltype == Asc . c _oAscSelectionType . RangeCells ) && ! this . permissions . isEditMailMerge && ! this . permissions . isEditDiagram && ! this . permissions . isEditOle ,
2017-11-22 08:41:47 +00:00
iscelledit = this . api . isCellEdited ,
2022-03-11 10:58:15 +00:00
isimagemenu = ( seltype == Asc . c _oAscSelectionType . RangeShape || seltype == Asc . c _oAscSelectionType . RangeImage ) && ! this . permissions . isEditMailMerge && ! this . permissions . isEditDiagram && ! this . permissions . isEditOle ,
2017-11-22 08:41:47 +00:00
signGuid ;
2017-06-06 08:04:04 +00:00
2017-11-10 07:50:01 +00:00
if ( ! documentHolder . viewModeMenu )
documentHolder . createDelayedElementsViewer ( ) ;
2017-06-06 08:04:04 +00:00
if ( ! showMenu && ! documentHolder . viewModeMenu . isVisible ( ) ) return ;
2018-09-24 09:18:00 +00:00
if ( isimagemenu && this . permissions . isSignatureSupport ) {
2017-11-22 08:41:47 +00:00
var selectedObjects = this . api . asc _getGraphicObjectProps ( ) ;
for ( var i = 0 ; i < selectedObjects . length ; i ++ ) {
if ( selectedObjects [ i ] . asc _getObjectType ( ) == Asc . c _oAscTypeSelectElement . Image ) {
2017-11-23 11:29:41 +00:00
signGuid = selectedObjects [ i ] . asc _getObjectValue ( ) . asc _getSignatureId ( ) ;
2017-11-22 08:41:47 +00:00
}
}
}
2017-11-23 11:29:41 +00:00
var signProps = ( signGuid ) ? this . api . asc _getSignatureSetup ( signGuid ) : null ,
2017-11-22 08:41:47 +00:00
isInSign = ! ! signProps && this . _canProtect ,
2021-07-29 12:12:38 +00:00
canComment = iscellmenu && ! iscelledit && this . permissions . canCoAuthoring && this . permissions . canComments && ! this . _isDisabled && cellinfo . asc _getComments ( ) && cellinfo . asc _getComments ( ) . length < 1 ;
2017-11-22 08:41:47 +00:00
2017-11-10 07:50:01 +00:00
documentHolder . menuViewUndo . setVisible ( this . permissions . canCoAuthoring && this . permissions . canComments && ! this . _isDisabled ) ;
2022-05-04 19:34:10 +00:00
documentHolder . menuViewUndo . setDisabled ( ! this . api . asc _getCanUndo ( ) ) ;
2017-11-22 08:41:47 +00:00
documentHolder . menuViewCopySeparator . setVisible ( isInSign ) ;
var isRequested = ( signProps ) ? signProps . asc _getRequested ( ) : false ;
documentHolder . menuSignatureViewSign . setVisible ( isInSign && isRequested ) ;
documentHolder . menuSignatureDetails . setVisible ( isInSign && ! isRequested ) ;
documentHolder . menuSignatureViewSetup . setVisible ( isInSign ) ;
documentHolder . menuSignatureRemove . setVisible ( isInSign && ! isRequested ) ;
documentHolder . menuViewSignSeparator . setVisible ( canComment ) ;
2021-02-24 13:50:28 +00:00
documentHolder . menuViewAddComment . setVisible ( canComment ) ;
commentsController && commentsController . blockPopover ( true ) ;
2021-08-08 22:00:41 +00:00
documentHolder . menuViewAddComment . setDisabled ( isCellLocked || isTableLocked || this . _state . wsProps [ 'Objects' ] ) ;
2021-02-24 13:50:28 +00:00
if ( showMenu ) this . showPopupMenu ( documentHolder . viewModeMenu , { } , event ) ;
2017-11-22 08:41:47 +00:00
if ( isInSign ) {
documentHolder . menuSignatureViewSign . cmpEl . attr ( 'data-value' , signGuid ) ; // sign
2017-11-23 11:29:41 +00:00
documentHolder . menuSignatureDetails . cmpEl . attr ( 'data-value' , signProps . asc _getId ( ) ) ; // view certificate
2017-11-22 08:41:47 +00:00
documentHolder . menuSignatureViewSetup . cmpEl . attr ( 'data-value' , signGuid ) ; // view signature settings
documentHolder . menuSignatureRemove . cmpEl . attr ( 'data-value' , signGuid ) ;
}
2017-06-06 08:04:04 +00:00
} ,
2016-03-11 00:48:53 +00:00
showPopupMenu : function ( menu , value , event ) {
2017-09-18 13:00:10 +00:00
if ( ! _ . isUndefined ( menu ) && menu !== null && event ) {
2016-03-11 00:48:53 +00:00
Common . UI . Menu . Manager . hideAll ( ) ;
var me = this ,
documentHolderView = me . documentHolder ,
2016-08-19 13:41:48 +00:00
showPoint = [ event . pageX * Common . Utils . zoom ( ) - documentHolderView . cmpEl . offset ( ) . left , event . pageY * Common . Utils . zoom ( ) - documentHolderView . cmpEl . offset ( ) . top ] ,
2016-03-11 00:48:53 +00:00
menuContainer = documentHolderView . cmpEl . find ( Common . Utils . String . format ( '#menu-container-{0}' , menu . id ) ) ;
if ( ! menu . rendered ) {
// Prepare menu container
if ( menuContainer . length < 1 ) {
menuContainer = $ ( Common . Utils . String . format ( '<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>' , menu . id ) ) ;
documentHolderView . cmpEl . append ( menuContainer ) ;
}
menu . render ( menuContainer ) ;
menu . cmpEl . attr ( { tabindex : "-1" } ) ;
}
if ( /*!this.mouse.isRightButtonDown &&*/ event . button !== 2 ) {
var coord = me . api . asc _getActiveCellCoord ( ) ,
offset = { left : 0 , top : 0 } /*documentHolderView.cmpEl.offset()*/ ;
showPoint [ 0 ] = coord . asc _getX ( ) + coord . asc _getWidth ( ) + offset . left ;
showPoint [ 1 ] = ( coord . asc _getY ( ) < 0 ? 0 : coord . asc _getY ( ) ) + coord . asc _getHeight ( ) + offset . top ;
}
menuContainer . css ( {
left : showPoint [ 0 ] ,
top : showPoint [ 1 ]
} ) ;
if ( _ . isFunction ( menu . options . initMenu ) ) {
menu . options . initMenu ( value ) ;
menu . alignPosition ( ) ;
}
_ . delay ( function ( ) {
menu . cmpEl . focus ( ) ;
} , 10 ) ;
menu . show ( ) ;
me . currentMenu = menu ;
}
} ,
2020-04-03 15:36:43 +00:00
onEntriesListMenu : function ( validation , textarr , addarr ) {
2016-03-11 00:48:53 +00:00
if ( textarr && textarr . length > 0 ) {
var me = this ,
documentHolderView = me . documentHolder ,
menu = documentHolderView . entriesMenu ,
menuContainer = documentHolderView . cmpEl . find ( Common . Utils . String . format ( '#menu-container-{0}' , menu . id ) ) ;
2020-03-16 12:06:56 +00:00
if ( validation && menu . isVisible ( ) ) {
menu . hide ( ) ;
return ;
}
2016-03-11 00:48:53 +00:00
for ( var i = 0 ; i < menu . items . length ; i ++ ) {
menu . removeItem ( menu . items [ i ] ) ;
i -- ;
}
_ . each ( textarr , function ( menuItem , index ) {
var mnu = new Common . UI . MenuItem ( {
2020-03-30 14:03:46 +00:00
caption : menuItem ,
2020-04-03 15:36:43 +00:00
value : addarr ? addarr [ index ] : menuItem ,
2020-03-30 14:03:46 +00:00
style : ( typeof menuItem == 'string' && _ . isEmpty ( menuItem . trim ( ) ) ) ? 'min-height: 25px;' : ''
2016-03-11 00:48:53 +00:00
} ) . on ( 'click' , function ( item , e ) {
2020-04-23 10:10:34 +00:00
me . api . asc _insertInCell ( item . value , Asc . c _oAscPopUpSelectorType . None , false ) ;
2016-03-11 00:48:53 +00:00
} ) ;
menu . addItem ( mnu ) ;
} ) ;
Common . UI . Menu . Manager . hideAll ( ) ;
if ( ! menu . rendered ) {
// Prepare menu container
if ( menuContainer . length < 1 ) {
menuContainer = $ ( Common . Utils . String . format ( '<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>' , menu . id ) ) ;
documentHolderView . cmpEl . append ( menuContainer ) ;
}
menu . render ( menuContainer ) ;
menu . cmpEl . attr ( { tabindex : "-1" } ) ;
}
2022-03-18 10:23:22 +00:00
var coord = me . api . asc _getActiveCellCoord ( validation ) , // get merged cell for validation
2016-03-11 00:48:53 +00:00
offset = { left : 0 , top : 0 } ,
2022-03-18 10:23:22 +00:00
showPoint = [ coord . asc _getX ( ) + offset . left + ( validation ? coord . asc _getWidth ( ) : 0 ) , ( coord . asc _getY ( ) < 0 ? 0 : coord . asc _getY ( ) ) + coord . asc _getHeight ( ) + offset . top ] ;
2016-03-11 00:48:53 +00:00
menuContainer . css ( { left : showPoint [ 0 ] , top : showPoint [ 1 ] } ) ;
2022-03-18 10:23:22 +00:00
menu . menuAlign = validation ? 'tr-br' : 'tl-bl' ;
2016-03-11 00:48:53 +00:00
2020-03-16 12:36:47 +00:00
me . _preventClick = validation ;
validation && menuContainer . attr ( 'data-value' , 'prevent-canvas-click' ) ;
2016-03-11 00:48:53 +00:00
menu . show ( ) ;
menu . alignPosition ( ) ;
_ . delay ( function ( ) {
menu . cmpEl . focus ( ) ;
} , 10 ) ;
} else {
this . documentHolder . entriesMenu . hide ( ) ;
2020-03-16 12:06:56 +00:00
! validation && Common . UI . warning ( {
2016-11-11 13:22:35 +00:00
title : this . notcriticalErrorTitle ,
maxwidth : 600 ,
msg : this . txtNoChoices ,
callback : _ . bind ( function ( btn ) {
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
} , this )
} ) ;
2016-03-11 00:48:53 +00:00
}
} ,
2020-06-29 12:30:24 +00:00
onTableTotalMenu : function ( current ) {
if ( current !== undefined ) {
var me = this ,
documentHolderView = me . documentHolder ,
menu = documentHolderView . tableTotalMenu ,
menuContainer = documentHolderView . cmpEl . find ( Common . Utils . String . format ( '#menu-container-{0}' , menu . id ) ) ;
if ( menu . isVisible ( ) ) {
menu . hide ( ) ;
return ;
}
Common . UI . Menu . Manager . hideAll ( ) ;
if ( ! menu . rendered ) {
// Prepare menu container
if ( menuContainer . length < 1 ) {
menuContainer = $ ( Common . Utils . String . format ( '<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>' , menu . id ) ) ;
documentHolderView . cmpEl . append ( menuContainer ) ;
}
menu . render ( menuContainer ) ;
menu . cmpEl . attr ( { tabindex : "-1" } ) ;
}
menu . clearAll ( ) ;
var func = _ . find ( menu . items , function ( item ) { return item . value == current ; } ) ;
if ( func )
func . setChecked ( true , true ) ;
var coord = me . api . asc _getActiveCellCoord ( ) ,
offset = { left : 0 , top : 0 } ,
2022-03-18 11:47:11 +00:00
showPoint = [ coord . asc _getX ( ) + offset . left + coord . asc _getWidth ( ) , ( coord . asc _getY ( ) < 0 ? 0 : coord . asc _getY ( ) ) + coord . asc _getHeight ( ) + offset . top ] ;
2020-06-29 12:30:24 +00:00
menuContainer . css ( { left : showPoint [ 0 ] , top : showPoint [ 1 ] } ) ;
me . _preventClick = true ;
menuContainer . attr ( 'data-value' , 'prevent-canvas-click' ) ;
menu . show ( ) ;
menu . alignPosition ( ) ;
_ . delay ( function ( ) {
menu . cmpEl . focus ( ) ;
} , 10 ) ;
} else {
this . documentHolder . tableTotalMenu . hide ( ) ;
}
} ,
onTotalMenuClick : function ( menu , item ) {
if ( item . value == Asc . ETotalsRowFunction . totalrowfunctionCustom ) {
this . onInsFunction ( item ) ;
} else {
this . api . asc _insertInCell ( item . value , Asc . c _oAscPopUpSelectorType . TotalRowFunc ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
} ,
2021-05-28 11:26:54 +00:00
onFormulaCompleteMenu : function ( funcarr , offset ) {
2020-05-18 11:00:10 +00:00
if ( ! this . documentHolder . funcMenu || Common . Utils . ModalWindow . isVisible ( ) || this . rangeSelectionMode ) return ;
2018-11-08 12:08:55 +00:00
2016-03-11 00:48:53 +00:00
if ( funcarr ) {
var me = this ,
documentHolderView = me . documentHolder ,
menu = documentHolderView . funcMenu ,
2019-03-04 09:18:01 +00:00
menuContainer = documentHolderView . cmpEl . find ( '#menu-formula-selection' ) ,
2019-05-17 08:40:40 +00:00
funcdesc = me . getApplication ( ) . getController ( 'FormulaDialog' ) . getDescription ( Common . Utils . InternalSettings . get ( "sse-settings-func-locale" ) ) ;
2016-03-11 00:48:53 +00:00
for ( var i = 0 ; i < menu . items . length ; i ++ ) {
2019-03-04 09:18:01 +00:00
var tip = menu . items [ i ] . cmpEl . data ( 'bs.tooltip' ) ;
if ( tip )
tip . hide ( ) ;
2016-03-11 00:48:53 +00:00
menu . removeItem ( menu . items [ i ] ) ;
i -- ;
}
2018-08-14 07:52:03 +00:00
funcarr . sort ( function ( a , b ) {
2021-09-09 14:02:07 +00:00
var atype = a . asc _getType ( ) ,
2022-03-23 15:53:40 +00:00
btype = b . asc _getType ( ) ;
if ( atype === btype && ( atype === Asc . c _oAscPopUpSelectorType . TableColumnName ) )
return 0 ;
2021-09-09 14:02:07 +00:00
if ( atype === Asc . c _oAscPopUpSelectorType . TableThisRow ) return - 1 ;
if ( btype === Asc . c _oAscPopUpSelectorType . TableThisRow ) return 1 ;
if ( ( atype === Asc . c _oAscPopUpSelectorType . TableColumnName || btype === Asc . c _oAscPopUpSelectorType . TableColumnName ) && atype !== btype )
return atype === Asc . c _oAscPopUpSelectorType . TableColumnName ? - 1 : 1 ;
2022-03-23 15:53:40 +00:00
var aname = a . asc _getName ( true ) . toLocaleUpperCase ( ) ,
bname = b . asc _getName ( true ) . toLocaleUpperCase ( ) ;
2018-08-14 07:52:03 +00:00
if ( aname < bname ) return - 1 ;
if ( aname > bname ) return 1 ;
return 0 ;
} ) ;
2016-03-11 00:48:53 +00:00
_ . each ( funcarr , function ( menuItem , index ) {
var type = menuItem . asc _getType ( ) ,
2019-03-06 08:47:46 +00:00
name = menuItem . asc _getName ( true ) ,
2019-03-04 09:18:01 +00:00
origname = me . api . asc _getFormulaNameByLocale ( name ) ,
2021-09-09 14:02:07 +00:00
iconCls = '' ,
caption = name ,
hint = '' ;
2020-06-10 12:32:23 +00:00
switch ( type ) {
case Asc . c _oAscPopUpSelectorType . Func :
2021-09-09 14:02:07 +00:00
iconCls = 'menu__icon btn-function' ;
hint = ( funcdesc && funcdesc [ origname ] ) ? funcdesc [ origname ] . d : '' ;
2020-06-10 12:32:23 +00:00
break ;
case Asc . c _oAscPopUpSelectorType . Table :
2021-09-09 14:02:07 +00:00
iconCls = 'menu__icon btn-menu-table' ;
2020-06-10 12:32:23 +00:00
break ;
case Asc . c _oAscPopUpSelectorType . Slicer :
2021-09-09 14:02:07 +00:00
iconCls = 'menu__icon btn-slicer' ;
break ;
case Asc . c _oAscPopUpSelectorType . Range :
iconCls = 'menu__icon btn-named-range' ;
break ;
case Asc . c _oAscPopUpSelectorType . TableColumnName :
caption = '(...) ' + name ;
break ;
case Asc . c _oAscPopUpSelectorType . TableThisRow :
hint = me . txtThisRowHint ;
break ;
case Asc . c _oAscPopUpSelectorType . TableAll :
hint = me . txtAllTableHint ;
break ;
case Asc . c _oAscPopUpSelectorType . TableData :
hint = me . txtDataTableHint ;
break ;
case Asc . c _oAscPopUpSelectorType . TableHeaders :
hint = me . txtHeadersTableHint ;
break ;
case Asc . c _oAscPopUpSelectorType . TableTotals :
hint = me . txtTotalsTableHint ;
2020-06-10 12:32:23 +00:00
break ;
}
var mnu = new Common . UI . MenuItem ( {
2021-09-09 14:02:07 +00:00
iconCls : iconCls ,
caption : caption ,
name : name ,
hint : hint
2016-03-11 00:48:53 +00:00
} ) . on ( 'click' , function ( item , e ) {
2021-09-09 14:02:07 +00:00
setTimeout ( function ( ) { me . api . asc _insertInCell ( item . options . name , type , false ) ; } , 10 ) ;
2016-03-11 00:48:53 +00:00
} ) ;
menu . addItem ( mnu ) ;
} ) ;
if ( ! menu . rendered ) {
// Prepare menu container
if ( menuContainer . length < 1 ) {
menuContainer = $ ( Common . Utils . String . format ( '<div id="menu-formula-selection" style="position: absolute; z-index: 10000;" class="no-stop-propagate"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>' ) ) ;
documentHolderView . cmpEl . append ( menuContainer ) ;
}
2016-03-14 14:59:38 +00:00
menu . onAfterKeydownMenu = function ( e ) {
if ( e . keyCode == Common . UI . Keys . RETURN && ( e . ctrlKey || e . altKey ) ) return ;
2016-07-06 13:15:13 +00:00
// Common.UI.Menu.prototype.onAfterKeydownMenu.call(menu, e);
2016-03-11 00:48:53 +00:00
var li ;
2016-07-22 14:16:08 +00:00
if ( arguments . length > 1 && arguments [ 1 ] instanceof KeyboardEvent ) // when typing in cell editor
2016-03-11 00:48:53 +00:00
e = arguments [ 1 ] ;
2016-07-06 13:15:13 +00:00
if ( menuContainer . hasClass ( 'open' ) ) {
if ( e . keyCode == Common . UI . Keys . TAB || e . keyCode == Common . UI . Keys . RETURN && ! e . ctrlKey && ! e . altKey )
li = menuContainer . find ( 'a.focus' ) . closest ( 'li' ) ;
else if ( e . keyCode == Common . UI . Keys . UP || e . keyCode == Common . UI . Keys . DOWN ) {
var innerEl = menu . cmpEl ,
2021-02-18 17:38:46 +00:00
li _focused = menuContainer . find ( 'a.focus' ) . closest ( 'li' ) ,
innerHeight = innerEl . innerHeight ( ) ,
padding = ( innerHeight - innerEl . height ( ) ) / 2 ,
pos = li _focused . position ( ) . top ,
itemHeight = li _focused . outerHeight ( ) ,
newpos ;
if ( pos < 0 )
newpos = innerEl . scrollTop ( ) + pos - padding ;
else if ( pos + itemHeight > innerHeight )
newpos = innerEl . scrollTop ( ) + pos + itemHeight - innerHeight + padding ;
if ( newpos !== undefined ) {
menu . scroller ? menu . scroller . scrollTop ( newpos , 0 ) : innerEl . scrollTop ( newpos ) ;
2016-03-11 00:48:53 +00:00
}
}
2016-07-06 13:15:13 +00:00
}
// } else if (e.keyCode == Common.UI.Keys.TAB)
// li = $(e.target).closest('li');
2016-03-14 14:59:38 +00:00
2016-03-11 00:48:53 +00:00
if ( li ) {
if ( li . length > 0 ) li . click ( ) ;
Common . UI . Menu . Manager . hideAll ( ) ;
}
2016-03-14 14:59:38 +00:00
} ;
2019-03-04 09:18:01 +00:00
menu . on ( 'hide:after' , function ( ) {
for ( var i = 0 ; i < menu . items . length ; i ++ ) {
var tip = menu . items [ i ] . cmpEl . data ( 'bs.tooltip' ) ;
if ( tip )
tip . hide ( ) ;
}
} ) ;
2016-03-14 14:59:38 +00:00
menu . render ( menuContainer ) ;
menu . cmpEl . attr ( { tabindex : "-1" } ) ;
2016-03-11 00:48:53 +00:00
}
2021-09-08 11:55:00 +00:00
var infocus = me . cellEditor . is ( ":focus" ) ;
if ( infocus ) {
menu . menuAlignEl = me . cellEditor ;
me . focusInCellEditor = true ;
} else {
menu . menuAlignEl = undefined ;
me . focusInCellEditor = false ;
var coord = me . api . asc _getActiveCellCoord ( ) ,
showPoint = [ coord . asc _getX ( ) + ( offset ? offset [ 0 ] : 0 ) , ( coord . asc _getY ( ) < 0 ? 0 : coord . asc _getY ( ) ) + coord . asc _getHeight ( ) + ( offset ? offset [ 1 ] : 0 ) ] ;
menuContainer . css ( { left : showPoint [ 0 ] , top : showPoint [ 1 ] } ) ;
}
2016-03-11 00:48:53 +00:00
menu . alignPosition ( ) ;
2016-03-14 14:59:38 +00:00
if ( ! menu . isVisible ( ) )
Common . UI . Menu . Manager . hideAll ( ) ;
2016-03-11 00:48:53 +00:00
_ . delay ( function ( ) {
2016-03-14 14:59:38 +00:00
if ( ! menu . isVisible ( ) ) menu . show ( ) ;
if ( menu . scroller ) {
menu . scroller . update ( { alwaysVisibleY : true } ) ;
menu . scroller . scrollTop ( 0 ) ;
}
2016-07-06 13:15:13 +00:00
if ( infocus )
2016-03-11 00:48:53 +00:00
me . cellEditor . focus ( ) ;
2016-07-22 14:16:08 +00:00
menu . cmpEl . toggleClass ( 'from-cell-edit' , infocus ) ;
2016-07-06 13:15:13 +00:00
_ . delay ( function ( ) {
2019-03-04 09:18:01 +00:00
var a = menu . cmpEl . find ( 'li:first a' ) ;
a . addClass ( 'focus' ) ;
var tip = a . parent ( ) . data ( 'bs.tooltip' ) ;
if ( tip )
tip . show ( ) ;
2016-07-06 13:15:13 +00:00
} , 10 ) ;
2016-11-18 14:17:20 +00:00
if ( ! infocus )
_ . delay ( function ( ) {
menu . cmpEl . focus ( ) ;
} , 10 ) ;
2016-03-11 00:48:53 +00:00
} , 1 ) ;
} else {
this . documentHolder . funcMenu . hide ( ) ;
}
} ,
2019-03-07 12:13:46 +00:00
onFormulaInfo : function ( name ) {
var functip = this . tooltips . func _arg ;
if ( name ) {
2019-03-21 08:09:11 +00:00
if ( ! functip . parentEl ) {
functip . parentEl = $ ( '<div id="tip-container-functip" style="position: absolute; z-index: 10000;"></div>' ) ;
this . documentHolder . cmpEl . append ( functip . parentEl ) ;
}
2019-05-17 08:40:40 +00:00
var funcdesc = this . getApplication ( ) . getController ( 'FormulaDialog' ) . getDescription ( Common . Utils . InternalSettings . get ( "sse-settings-func-locale" ) ) ,
2019-03-07 12:13:46 +00:00
hint = ( ( funcdesc && funcdesc [ name ] ) ? ( this . api . asc _getFormulaLocaleName ( name ) + funcdesc [ name ] . a ) : '' ) . replace ( /[,;]/g , this . api . asc _getFunctionArgumentSeparator ( ) ) ;
if ( functip . ref && functip . ref . isVisible ( ) ) {
if ( functip . text != hint ) {
functip . ref . hide ( ) ;
2019-03-15 13:11:37 +00:00
functip . ref = undefined ;
functip . text = '' ;
2019-03-07 12:13:46 +00:00
functip . isHidden = true ;
}
}
2019-03-26 11:23:03 +00:00
if ( ! hint ) return ;
2019-03-07 12:13:46 +00:00
if ( ! functip . ref || ! functip . ref . isVisible ( ) ) {
functip . text = hint ;
functip . ref = new Common . UI . Tooltip ( {
2019-03-21 08:09:11 +00:00
owner : functip . parentEl ,
2019-03-07 12:13:46 +00:00
html : true ,
title : hint ,
cls : 'auto-tooltip'
} ) ;
functip . ref . show ( [ - 10000 , - 10000 ] ) ;
functip . isHidden = false ;
}
2021-09-08 11:55:00 +00:00
var infocus = this . cellEditor . is ( ":focus" ) ,
showPoint ;
if ( infocus || this . focusInCellEditor ) {
var offset = this . cellEditor . offset ( ) ;
showPoint = [ offset . left , offset . top + this . cellEditor . height ( ) + 3 ] ;
} else {
var pos = [
this . documentHolder . cmpEl . offset ( ) . left - $ ( window ) . scrollLeft ( ) ,
this . documentHolder . cmpEl . offset ( ) . top - $ ( window ) . scrollTop ( )
] ,
coord = this . api . asc _getActiveCellCoord ( ) ;
2019-03-07 12:13:46 +00:00
showPoint = [ coord . asc _getX ( ) + pos [ 0 ] - 3 , coord . asc _getY ( ) + pos [ 1 ] - functip . ref . getBSTip ( ) . $tip . height ( ) - 5 ] ;
2021-09-08 11:55:00 +00:00
}
2019-03-07 12:13:46 +00:00
var tipwidth = functip . ref . getBSTip ( ) . $tip . width ( ) ;
if ( showPoint [ 0 ] + tipwidth > this . tooltips . coauth . bodyWidth )
showPoint [ 0 ] = this . tooltips . coauth . bodyWidth - tipwidth ;
functip . ref . getBSTip ( ) . $tip . css ( {
top : showPoint [ 1 ] + 'px' ,
left : showPoint [ 0 ] + 'px'
} ) ;
} else {
if ( ! functip . isHidden && functip . ref ) {
functip . ref . hide ( ) ;
2019-03-15 13:11:37 +00:00
functip . ref = undefined ;
functip . text = '' ;
2019-03-07 12:13:46 +00:00
functip . isHidden = true ;
}
}
} ,
2022-01-24 18:17:01 +00:00
changeInputMessagePosition : function ( inputTip ) {
var pos = [
this . documentHolder . cmpEl . offset ( ) . left - $ ( window ) . scrollLeft ( ) ,
this . documentHolder . cmpEl . offset ( ) . top - $ ( window ) . scrollTop ( )
] ,
coord = this . api . asc _getActiveCellCoord ( ) ,
showPoint = [ coord . asc _getX ( ) + pos [ 0 ] - 3 , coord . asc _getY ( ) + pos [ 1 ] - inputTip . ref . getBSTip ( ) . $tip . height ( ) - 5 ] ;
var tipwidth = inputTip . ref . getBSTip ( ) . $tip . width ( ) ;
if ( showPoint [ 0 ] + tipwidth > this . tooltips . coauth . bodyWidth )
showPoint [ 0 ] = this . tooltips . coauth . bodyWidth - tipwidth ;
2022-05-05 17:54:22 +00:00
if ( showPoint [ 1 ] < pos [ 1 ] )
showPoint [ 1 ] = pos [ 1 ] + coord . asc _getY ( ) + coord . asc _getHeight ( ) + 5 ;
2022-01-24 18:17:01 +00:00
inputTip . ref . getBSTip ( ) . $tip . css ( {
top : showPoint [ 1 ] + 'px' ,
left : showPoint [ 0 ] + 'px' ,
'z-index' : 900
} ) ;
} ,
2019-07-30 12:24:47 +00:00
onInputMessage : function ( title , message ) {
var inputtip = this . tooltips . input _msg ;
if ( message ) {
if ( ! inputtip . parentEl ) {
inputtip . parentEl = $ ( '<div id="tip-container-inputtip" style="position: absolute; z-index: 10000;"></div>' ) ;
this . documentHolder . cmpEl . append ( inputtip . parentEl ) ;
}
2020-04-10 10:14:55 +00:00
var hint = title ? ( '<b>' + ( Common . Utils . String . htmlEncode ( title || '' ) ) + '</b><br>' ) : '' ;
hint += ( Common . Utils . String . htmlEncode ( message || '' ) ) ;
2019-07-30 12:24:47 +00:00
if ( inputtip . ref && inputtip . ref . isVisible ( ) ) {
if ( inputtip . text != hint ) {
inputtip . ref . hide ( ) ;
inputtip . ref = undefined ;
inputtip . text = '' ;
inputtip . isHidden = true ;
}
}
if ( ! inputtip . ref || ! inputtip . ref . isVisible ( ) ) {
inputtip . text = hint ;
inputtip . ref = new Common . UI . Tooltip ( {
owner : inputtip . parentEl ,
html : true ,
2022-01-24 18:17:01 +00:00
title : hint ,
keepvisible : true
2019-07-30 12:24:47 +00:00
} ) ;
inputtip . ref . show ( [ - 10000 , - 10000 ] ) ;
2022-05-05 14:37:25 +00:00
var $tip = inputtip . ref . getBSTip ( ) . $tip ;
$tip . on ( 'click' , function ( ) {
inputtip . ref . hide ( ) ;
inputtip . ref = undefined ;
inputtip . text = '' ;
inputtip . isHidden = true ;
} ) ;
2019-07-30 12:24:47 +00:00
inputtip . isHidden = false ;
}
2022-01-24 18:17:01 +00:00
this . changeInputMessagePosition ( inputtip ) ;
2019-07-30 12:24:47 +00:00
} else {
if ( ! inputtip . isHidden && inputtip . ref ) {
inputtip . ref . hide ( ) ;
inputtip . ref = undefined ;
inputtip . text = '' ;
inputtip . isHidden = true ;
}
}
} ,
2017-04-11 11:05:56 +00:00
onShowSpecialPasteOptions : function ( specialPasteShowOptions ) {
var me = this ,
documentHolderView = me . documentHolder ,
coord = specialPasteShowOptions . asc _getCellCoord ( ) ,
pasteContainer = documentHolderView . cmpEl . find ( '#special-paste-container' ) ,
2020-03-03 11:01:20 +00:00
pasteItems = specialPasteShowOptions . asc _getOptions ( ) ,
isTable = ! ! specialPasteShowOptions . asc _getContainTables ( ) ;
2018-11-13 15:06:00 +00:00
if ( ! pasteItems ) return ;
2017-04-11 11:05:56 +00:00
// Prepare menu container
if ( pasteContainer . length < 1 ) {
me . _arrSpecialPaste = [ ] ;
2019-04-16 12:28:07 +00:00
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . paste ] = [ me . txtPaste , 0 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . pasteOnlyFormula ] = [ me . txtPasteFormulas , 0 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . formulaNumberFormat ] = [ me . txtPasteFormulaNumFormat , 0 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . formulaAllFormatting ] = [ me . txtPasteKeepSourceFormat , 0 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . formulaWithoutBorders ] = [ me . txtPasteBorders , 0 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . formulaColumnWidth ] = [ me . txtPasteColWidths , 0 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . mergeConditionalFormating ] = [ me . txtPasteMerge , 0 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . transpose ] = [ me . txtPasteTranspose , 0 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . pasteOnlyValues ] = [ me . txtPasteValues , 1 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . valueNumberFormat ] = [ me . txtPasteValNumFormat , 1 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . valueAllFormating ] = [ me . txtPasteValFormat , 1 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . pasteOnlyFormating ] = [ me . txtPasteFormat , 2 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . link ] = [ me . txtPasteLink , 2 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . picture ] = [ me . txtPastePicture , 2 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . linkedPicture ] = [ me . txtPasteLinkPicture , 2 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . sourceformatting ] = [ me . txtPasteSourceFormat , 2 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . destinationFormatting ] = [ me . txtPasteDestFormat , 2 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . keepTextOnly ] = [ me . txtKeepTextOnly , 2 ] ;
me . _arrSpecialPaste [ Asc . c _oSpecialPasteProps . useTextImport ] = [ me . txtUseTextImport , 3 ] ;
2017-04-11 11:05:56 +00:00
pasteContainer = $ ( '<div id="special-paste-container" style="position: absolute;"><div id="id-document-holder-btn-special-paste"></div></div>' ) ;
2022-07-18 16:40:20 +00:00
documentHolderView . cmpEl . find ( '#ws-canvas-outer' ) . append ( pasteContainer ) ;
2017-04-11 11:05:56 +00:00
me . btnSpecialPaste = new Common . UI . Button ( {
2020-04-29 07:36:53 +00:00
parentEl : $ ( '#id-document-holder-btn-special-paste' ) ,
2017-04-11 11:05:56 +00:00
cls : 'btn-toolbar' ,
2019-12-10 13:49:35 +00:00
iconCls : 'toolbar__icon btn-paste' ,
2022-06-03 12:32:57 +00:00
caption : Common . Utils . String . platformKey ( 'Ctrl' , '({0})' ) ,
2017-04-11 11:05:56 +00:00
menu : new Common . UI . Menu ( { items : [ ] } )
} ) ;
2022-06-03 12:32:57 +00:00
me . initSpecialPasteEvents ( ) ;
2017-04-11 11:05:56 +00:00
}
if ( pasteItems . length > 0 ) {
var menu = me . btnSpecialPaste . menu ;
for ( var i = 0 ; i < menu . items . length ; i ++ ) {
menu . removeItem ( menu . items [ i ] ) ;
i -- ;
}
2019-04-16 12:28:07 +00:00
var groups = [ ] ;
for ( var i = 0 ; i < 3 ; i ++ ) {
groups [ i ] = [ ] ;
}
2017-04-11 11:05:56 +00:00
2019-04-16 12:28:07 +00:00
var importText ;
2017-04-11 11:05:56 +00:00
_ . each ( pasteItems , function ( menuItem , index ) {
2019-04-16 12:28:07 +00:00
if ( menuItem == Asc . c _oSpecialPasteProps . useTextImport ) {
importText = new Common . UI . MenuItem ( {
2022-06-03 12:32:57 +00:00
caption : me . _arrSpecialPaste [ menuItem ] [ 0 ] + ( me . hkSpecPaste [ menuItem ] ? ' (' + me . hkSpecPaste [ menuItem ] + ')' : '' ) ,
2019-04-17 12:58:55 +00:00
value : menuItem ,
checkable : true ,
toggleGroup : 'specialPasteGroup'
2022-06-03 12:32:57 +00:00
} ) . on ( 'click' , _ . bind ( me . onSpecialPasteItemClick , me ) ) ;
2020-02-28 13:30:58 +00:00
me . _arrSpecialPaste [ menuItem ] [ 2 ] = importText ;
2020-02-28 14:23:06 +00:00
} else if ( me . _arrSpecialPaste [ menuItem ] ) {
2019-04-16 12:28:07 +00:00
var mnu = new Common . UI . MenuItem ( {
2022-06-03 12:32:57 +00:00
caption : me . _arrSpecialPaste [ menuItem ] [ 0 ] + ( me . hkSpecPaste [ menuItem ] ? ' (' + me . hkSpecPaste [ menuItem ] + ')' : '' ) ,
2019-04-16 12:28:07 +00:00
value : menuItem ,
checkable : true ,
toggleGroup : 'specialPasteGroup'
2022-06-03 12:32:57 +00:00
} ) . on ( 'click' , _ . bind ( me . onSpecialPasteItemClick , me ) ) ;
2019-04-16 12:28:07 +00:00
groups [ me . _arrSpecialPaste [ menuItem ] [ 1 ] ] . push ( mnu ) ;
2020-02-28 13:30:58 +00:00
me . _arrSpecialPaste [ menuItem ] [ 2 ] = mnu ;
2019-04-16 12:28:07 +00:00
}
} ) ;
var newgroup = false ;
for ( var i = 0 ; i < 3 ; i ++ ) {
if ( newgroup && groups [ i ] . length > 0 ) {
2017-04-11 11:05:56 +00:00
menu . addItem ( new Common . UI . MenuItem ( { caption : '--' } ) ) ;
2019-04-16 12:28:07 +00:00
newgroup = false ;
}
_ . each ( groups [ i ] , function ( menuItem , index ) {
menu . addItem ( menuItem ) ;
newgroup = true ;
2017-04-11 11:05:56 +00:00
} ) ;
2019-04-16 12:28:07 +00:00
}
2017-04-11 11:05:56 +00:00
( menu . items . length > 0 ) && menu . items [ 0 ] . setChecked ( true , true ) ;
2019-04-17 12:58:55 +00:00
me . _state . lastSpecPasteChecked = ( menu . items . length > 0 ) ? menu . items [ 0 ] : null ;
2019-04-16 12:28:07 +00:00
if ( importText ) {
menu . addItem ( new Common . UI . MenuItem ( { caption : '--' } ) ) ;
menu . addItem ( importText ) ;
}
2020-02-28 13:30:58 +00:00
if ( menu . items . length > 0 && specialPasteShowOptions . asc _getShowPasteSpecial ( ) ) {
menu . addItem ( new Common . UI . MenuItem ( { caption : '--' } ) ) ;
var mnu = new Common . UI . MenuItem ( {
caption : me . textPasteSpecial ,
value : 'special'
} ) . on ( 'click' , function ( item , e ) {
( new SSE . Views . SpecialPasteDialog ( {
2020-03-03 11:01:20 +00:00
props : pasteItems ,
isTable : isTable ,
2020-02-28 13:30:58 +00:00
handler : function ( result , settings ) {
if ( result == 'ok' ) {
me . _state . lastSpecPasteChecked && me . _state . lastSpecPasteChecked . setChecked ( false , true ) ;
me . _state . lastSpecPasteChecked = settings && me . _arrSpecialPaste [ settings . asc _getProps ( ) ] ? me . _arrSpecialPaste [ settings . asc _getProps ( ) ] [ 2 ] : null ;
me . _state . lastSpecPasteChecked && me . _state . lastSpecPasteChecked . setChecked ( true , true ) ;
2020-03-03 11:01:20 +00:00
if ( me && me . api ) {
me . api . asc _SpecialPaste ( settings ) ;
}
2020-02-28 13:30:58 +00:00
}
}
} ) ) . show ( ) ;
setTimeout ( function ( ) { menu . hide ( ) ; } , 100 ) ;
} ) ;
menu . addItem ( mnu ) ;
}
2017-04-11 11:05:56 +00:00
}
2017-11-07 11:42:51 +00:00
2017-11-07 13:23:40 +00:00
if ( coord [ 0 ] . asc _getX ( ) < 0 || coord [ 0 ] . asc _getY ( ) < 0 ) {
2017-04-11 11:05:56 +00:00
if ( pasteContainer . is ( ':visible' ) ) pasteContainer . hide ( ) ;
2022-06-03 12:32:57 +00:00
$ ( document ) . off ( 'keyup' , this . wrapEvents . onKeyUp ) ;
2017-11-07 13:23:40 +00:00
return ;
2017-04-11 11:05:56 +00:00
}
2017-11-07 13:23:40 +00:00
2017-11-07 11:42:51 +00:00
var rightBottom = coord [ 0 ] ,
leftTop = coord [ 1 ] ,
width = me . tooltips . coauth . bodyWidth - me . tooltips . coauth . XY [ 0 ] - me . tooltips . coauth . rightMenuWidth - 15 ,
height = me . tooltips . coauth . apiHeight - 15 , // height - scrollbar height
showPoint = [ ] ,
2017-11-07 13:23:40 +00:00
btnSize = [ 31 , 20 ] ,
right = rightBottom . asc _getX ( ) + rightBottom . asc _getWidth ( ) + 3 + btnSize [ 0 ] ,
2017-11-07 11:42:51 +00:00
bottom = rightBottom . asc _getY ( ) + rightBottom . asc _getHeight ( ) + 3 + btnSize [ 1 ] ;
2017-11-07 13:23:40 +00:00
2017-11-07 11:42:51 +00:00
if ( right > width ) {
2018-08-30 14:30:38 +00:00
showPoint [ 0 ] = ( leftTop !== undefined ) ? leftTop . asc _getX ( ) : ( width - btnSize [ 0 ] - 3 ) ; // leftTop is undefined when paste to text box
2017-11-07 11:42:51 +00:00
if ( bottom > height )
showPoint [ 0 ] -= ( btnSize [ 0 ] + 3 ) ;
if ( showPoint [ 0 ] < 0 ) showPoint [ 0 ] = width - 3 - btnSize [ 0 ] ;
} else
showPoint [ 0 ] = right - btnSize [ 0 ] ;
showPoint [ 1 ] = ( bottom > height ) ? height - 3 - btnSize [ 1 ] : bottom - btnSize [ 1 ] ;
pasteContainer . css ( { left : showPoint [ 0 ] , top : showPoint [ 1 ] } ) ;
pasteContainer . show ( ) ;
2022-06-03 12:32:57 +00:00
setTimeout ( function ( ) {
$ ( document ) . on ( 'keyup' , me . wrapEvents . onKeyUp ) ;
} , 10 ) ;
2017-04-11 11:05:56 +00:00
} ,
onHideSpecialPasteOptions : function ( ) {
var pasteContainer = this . documentHolder . cmpEl . find ( '#special-paste-container' ) ;
2022-06-03 12:32:57 +00:00
if ( pasteContainer . is ( ':visible' ) ) {
2017-04-11 11:05:56 +00:00
pasteContainer . hide ( ) ;
2022-06-03 12:32:57 +00:00
$ ( document ) . off ( 'keyup' , this . wrapEvents . onKeyUp ) ;
}
} ,
onSpecialPasteItemClick : function ( item , e ) {
var me = this ,
menu = this . btnSpecialPaste . menu ;
if ( item . value == Asc . c _oSpecialPasteProps . useTextImport ) {
( new Common . Views . OpenDialog ( {
title : me . txtImportWizard ,
closable : true ,
type : Common . Utils . importTextType . Paste ,
preview : true ,
api : me . api ,
handler : function ( result , settings ) {
if ( result == 'ok' ) {
if ( me && me . api ) {
var props = new Asc . SpecialPasteProps ( ) ;
props . asc _setProps ( Asc . c _oSpecialPasteProps . useTextImport ) ;
props . asc _setAdvancedOptions ( settings . textOptions ) ;
me . api . asc _SpecialPaste ( props ) ;
}
me . _state . lastSpecPasteChecked = item ;
} else if ( item . cmpEl ) {
item . setChecked ( false , true ) ;
me . _state . lastSpecPasteChecked && me . _state . lastSpecPasteChecked . setChecked ( true , true ) ;
}
}
} ) ) . show ( ) ;
setTimeout ( function ( ) { menu . hide ( ) ; } , 100 ) ;
} else {
me . _state . lastSpecPasteChecked = item ;
var props = new Asc . SpecialPasteProps ( ) ;
props . asc _setProps ( item . value ) ;
me . api . asc _SpecialPaste ( props ) ;
setTimeout ( function ( ) { menu . hide ( ) ; } , 100 ) ;
}
if ( ! item . cmpEl && me . _state . lastSpecPasteChecked ) {
for ( var i = 0 ; i < menu . items . length ; i ++ ) {
menu . items [ i ] . setChecked ( menu . items [ i ] . value === me . _state . lastSpecPasteChecked . value , true ) ;
2022-09-29 08:36:46 +00:00
if ( menu . items [ i ] . value === me . _state . lastSpecPasteChecked . value )
me . _state . lastSpecPasteChecked = menu . items [ i ] ;
2022-06-03 12:32:57 +00:00
}
}
return false ;
} ,
onKeyUp : function ( e ) {
if ( e . keyCode == Common . UI . Keys . CTRL && this . _needShowSpecPasteMenu && ! this . btnSpecialPaste . menu . isVisible ( ) && /area_id/ . test ( e . target . id ) ) {
$ ( 'button' , this . btnSpecialPaste . cmpEl ) . click ( ) ;
e . preventDefault ( ) ;
}
this . _needShowSpecPasteMenu = false ;
} ,
initSpecialPasteEvents : function ( ) {
var me = this ;
me . hkSpecPaste = [ ] ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . paste ] = 'P' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . pasteOnlyFormula ] = 'F' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . formulaNumberFormat ] = 'O' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . formulaAllFormatting ] = 'K' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . formulaWithoutBorders ] = 'B' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . formulaColumnWidth ] = 'W' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . mergeConditionalFormating ] = 'G' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . transpose ] = 'T' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . pasteOnlyValues ] = 'V' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . valueNumberFormat ] = 'A' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . valueAllFormating ] = 'E' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . pasteOnlyFormating ] = 'R' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . link ] = 'N' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . picture ] = 'U' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . linkedPicture ] = 'I' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . sourceformatting ] = 'K' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . destinationFormatting ] = 'M' ;
me . hkSpecPaste [ Asc . c _oSpecialPasteProps . keepTextOnly ] = 'T' ;
// me.hkSpecPaste[Asc.c_oSpecialPasteProps.useTextImport] = '';
var str = '' ;
for ( var key in me . hkSpecPaste ) {
if ( me . hkSpecPaste . hasOwnProperty ( key ) ) {
if ( str . indexOf ( me . hkSpecPaste [ key ] ) < 0 )
str += me . hkSpecPaste [ key ] + ',' ;
}
}
str = str . substring ( 0 , str . length - 1 )
var keymap = { } ;
keymap [ str ] = _ . bind ( function ( e ) {
var menu = this . btnSpecialPaste . menu ;
for ( var i = 0 ; i < menu . items . length ; i ++ ) {
if ( this . hkSpecPaste [ menu . items [ i ] . value ] === String . fromCharCode ( e . keyCode ) ) {
return me . onSpecialPasteItemClick ( { value : menu . items [ i ] . value } ) ;
}
}
} , me ) ;
Common . util . Shortcuts . delegateShortcuts ( { shortcuts : keymap } ) ;
Common . util . Shortcuts . suspendEvents ( str , undefined , true ) ;
me . btnSpecialPaste . menu . on ( 'show:after' , function ( menu ) {
Common . util . Shortcuts . resumeEvents ( str ) ;
} ) . on ( 'hide:after' , function ( menu ) {
Common . util . Shortcuts . suspendEvents ( str , undefined , true ) ;
} ) ;
2017-04-11 11:05:56 +00:00
} ,
2017-12-01 09:20:06 +00:00
onToggleAutoCorrectOptions : function ( autoCorrectOptions ) {
if ( ! autoCorrectOptions ) {
var pasteContainer = this . documentHolder . cmpEl . find ( '#autocorrect-paste-container' ) ;
if ( pasteContainer . is ( ':visible' ) )
pasteContainer . hide ( ) ;
return ;
}
2017-11-28 10:22:25 +00:00
var me = this ,
documentHolderView = me . documentHolder ,
coord = autoCorrectOptions . asc _getCellCoord ( ) ,
pasteContainer = documentHolderView . cmpEl . find ( '#autocorrect-paste-container' ) ,
pasteItems = autoCorrectOptions . asc _getOptions ( ) ;
// Prepare menu container
if ( pasteContainer . length < 1 ) {
me . _arrAutoCorrectPaste = [ ] ;
2020-10-21 18:59:30 +00:00
me . _arrAutoCorrectPaste [ Asc . c _oAscAutoCorrectOptions . UndoTableAutoExpansion ] = { caption : me . txtUndoExpansion , icon : 'menu__icon btn-undo' } ;
me . _arrAutoCorrectPaste [ Asc . c _oAscAutoCorrectOptions . RedoTableAutoExpansion ] = { caption : me . txtRedoExpansion , icon : 'menu__icon btn-redo' } ;
2017-11-28 10:22:25 +00:00
pasteContainer = $ ( '<div id="autocorrect-paste-container" style="position: absolute;"><div id="id-document-holder-btn-autocorrect-paste"></div></div>' ) ;
documentHolderView . cmpEl . append ( pasteContainer ) ;
me . btnAutoCorrectPaste = new Common . UI . Button ( {
2020-04-29 07:36:53 +00:00
parentEl : $ ( '#id-document-holder-btn-autocorrect-paste' ) ,
2017-11-28 10:22:25 +00:00
cls : 'btn-toolbar' ,
2020-10-21 18:59:30 +00:00
iconCls : 'toolbar__icon btn-autocorrect' ,
menu : new Common . UI . Menu ( { cls : 'shifted-right' , items : [ ] } )
2017-11-28 10:22:25 +00:00
} ) ;
2020-10-21 18:59:30 +00:00
me . btnAutoCorrectPaste . menu . on ( 'show:after' , _ . bind ( me . onAutoCorrectOpenAfter , me ) ) ;
2017-11-28 10:22:25 +00:00
}
if ( pasteItems . length > 0 ) {
var menu = me . btnAutoCorrectPaste . menu ;
for ( var i = 0 ; i < menu . items . length ; i ++ ) {
menu . removeItem ( menu . items [ i ] ) ;
i -- ;
}
var group _prev = - 1 ;
_ . each ( pasteItems , function ( menuItem , index ) {
var mnu = new Common . UI . MenuItem ( {
2020-10-21 18:59:30 +00:00
caption : me . _arrAutoCorrectPaste [ menuItem ] . caption ,
value : menuItem ,
iconCls : me . _arrAutoCorrectPaste [ menuItem ] . icon
2017-11-28 10:22:25 +00:00
} ) . on ( 'click' , function ( item , e ) {
me . api . asc _applyAutoCorrectOptions ( item . value ) ;
setTimeout ( function ( ) { menu . hide ( ) ; } , 100 ) ;
} ) ;
menu . addItem ( mnu ) ;
} ) ;
2020-10-21 18:59:30 +00:00
me . mnuAutoCorrectStop = new Common . UI . MenuItem ( {
caption : me . textStopExpand ,
checkable : true ,
allowDepress : true ,
checked : ! Common . Utils . InternalSettings . get ( "sse-settings-autoformat-new-rows" )
} ) . on ( 'click' , function ( item ) {
Common . localStorage . setBool ( "sse-settings-autoformat-new-rows" , ! item . checked ) ;
Common . Utils . InternalSettings . set ( "sse-settings-autoformat-new-rows" , ! item . checked ) ;
me . api . asc _setIncludeNewRowColTable ( ! item . checked ) ;
setTimeout ( function ( ) { menu . hide ( ) ; } , 100 ) ;
} ) ;
menu . addItem ( me . mnuAutoCorrectStop ) ;
menu . addItem ( { caption : '--' } ) ;
var mnu = new Common . UI . MenuItem ( {
caption : me . textAutoCorrectSettings
} ) . on ( 'click' , _ . bind ( me . onAutoCorrectOptions , me ) ) ;
menu . addItem ( mnu ) ;
2017-11-28 10:22:25 +00:00
}
2017-12-01 10:28:41 +00:00
var width = me . tooltips . coauth . bodyWidth - me . tooltips . coauth . XY [ 0 ] - me . tooltips . coauth . rightMenuWidth - 15 ,
height = me . tooltips . coauth . apiHeight - 15 , // height - scrollbar height
btnSize = [ 31 , 20 ] ,
right = coord . asc _getX ( ) + coord . asc _getWidth ( ) + 2 + btnSize [ 0 ] ,
bottom = coord . asc _getY ( ) + coord . asc _getHeight ( ) + 1 + btnSize [ 1 ] ;
if ( right > width || bottom > height || coord . asc _getX ( ) < 0 || coord . asc _getY ( ) < 0 ) {
2017-11-28 10:22:25 +00:00
if ( pasteContainer . is ( ':visible' ) ) pasteContainer . hide ( ) ;
} else {
2017-12-01 10:28:41 +00:00
pasteContainer . css ( { left : right - btnSize [ 0 ] , top : bottom - btnSize [ 1 ] } ) ;
2017-11-28 10:22:25 +00:00
pasteContainer . show ( ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onCellsRange : function ( status ) {
2016-04-05 11:52:34 +00:00
this . rangeSelectionMode = ( status != Asc . c _oAscSelectionDialogType . None ) ;
2016-03-11 00:48:53 +00:00
} ,
onApiEditCell : function ( state ) {
2016-04-05 11:52:34 +00:00
this . isEditFormula = ( state == Asc . c _oAscCellEditorState . editFormula ) ;
this . isEditCell = ( state != Asc . c _oAscCellEditorState . editEnd ) ;
2016-03-11 00:48:53 +00:00
} ,
onLockDefNameManager : function ( state ) {
2016-04-05 11:52:34 +00:00
this . namedrange _locked = ( state == Asc . c _oAscDefinedNameReason . LockDefNameManager ) ;
2016-03-11 00:48:53 +00:00
} ,
2019-04-09 11:29:51 +00:00
onChangeCropState : function ( state ) {
2022-10-28 10:50:58 +00:00
this . documentHolder . menuImgCrop && this . documentHolder . menuImgCrop . menu . items [ 0 ] . setChecked ( state , true ) ;
2019-04-09 11:29:51 +00:00
} ,
2016-10-24 11:56:11 +00:00
initEquationMenu : function ( ) {
2016-10-24 13:40:06 +00:00
if ( ! this . _currentMathObj ) return ;
2016-10-24 11:56:11 +00:00
var me = this ,
type = me . _currentMathObj . get _Type ( ) ,
value = me . _currentMathObj ,
mnu , arr = [ ] ;
switch ( type ) {
case Asc . c _oAscMathInterfaceType . Accent :
mnu = new Common . UI . MenuItem ( {
caption : me . txtRemoveAccentChar ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'remove_AccentCharacter' }
} ) ;
arr . push ( mnu ) ;
break ;
case Asc . c _oAscMathInterfaceType . BorderBox :
mnu = new Common . UI . MenuItem ( {
caption : me . txtBorderProps ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
menu : new Common . UI . Menu ( {
2020-08-20 16:58:03 +00:00
cls : 'shifted-right' ,
2016-10-24 11:56:11 +00:00
menuAlign : 'tl-tr' ,
items : [
{
caption : value . get _HideTop ( ) ? me . txtAddTop : me . txtHideTop ,
equationProps : { type : type , callback : 'put_HideTop' , value : ! value . get _HideTop ( ) }
} ,
{
caption : value . get _HideBottom ( ) ? me . txtAddBottom : me . txtHideBottom ,
equationProps : { type : type , callback : 'put_HideBottom' , value : ! value . get _HideBottom ( ) }
} ,
{
caption : value . get _HideLeft ( ) ? me . txtAddLeft : me . txtHideLeft ,
equationProps : { type : type , callback : 'put_HideLeft' , value : ! value . get _HideLeft ( ) }
} ,
{
caption : value . get _HideRight ( ) ? me . txtAddRight : me . txtHideRight ,
equationProps : { type : type , callback : 'put_HideRight' , value : ! value . get _HideRight ( ) }
} ,
{
caption : value . get _HideHor ( ) ? me . txtAddHor : me . txtHideHor ,
equationProps : { type : type , callback : 'put_HideHor' , value : ! value . get _HideHor ( ) }
} ,
{
caption : value . get _HideVer ( ) ? me . txtAddVer : me . txtHideVer ,
equationProps : { type : type , callback : 'put_HideVer' , value : ! value . get _HideVer ( ) }
} ,
{
caption : value . get _HideTopLTR ( ) ? me . txtAddLT : me . txtHideLT ,
equationProps : { type : type , callback : 'put_HideTopLTR' , value : ! value . get _HideTopLTR ( ) }
} ,
{
caption : value . get _HideTopRTL ( ) ? me . txtAddLB : me . txtHideLB ,
equationProps : { type : type , callback : 'put_HideTopRTL' , value : ! value . get _HideTopRTL ( ) }
}
]
} )
} ) ;
arr . push ( mnu ) ;
break ;
case Asc . c _oAscMathInterfaceType . Bar :
mnu = new Common . UI . MenuItem ( {
caption : me . txtRemoveBar ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'remove_Bar' }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : ( value . get _Pos ( ) == Asc . c _oAscMathInterfaceBarPos . Top ) ? me . txtUnderbar : me . txtOverbar ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_Pos' , value : ( value . get _Pos ( ) == Asc . c _oAscMathInterfaceBarPos . Top ) ? Asc . c _oAscMathInterfaceBarPos . Bottom : Asc . c _oAscMathInterfaceBarPos . Top }
} ) ;
arr . push ( mnu ) ;
break ;
case Asc . c _oAscMathInterfaceType . Script :
var scripttype = value . get _ScriptType ( ) ;
if ( scripttype == Asc . c _oAscMathInterfaceScript . PreSubSup ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtScriptsAfter ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_ScriptType' , value : Asc . c _oAscMathInterfaceScript . SubSup }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . txtRemScripts ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_ScriptType' , value : Asc . c _oAscMathInterfaceScript . None }
} ) ;
arr . push ( mnu ) ;
} else {
if ( scripttype == Asc . c _oAscMathInterfaceScript . SubSup ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtScriptsBefore ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_ScriptType' , value : Asc . c _oAscMathInterfaceScript . PreSubSup }
} ) ;
arr . push ( mnu ) ;
}
if ( scripttype == Asc . c _oAscMathInterfaceScript . SubSup || scripttype == Asc . c _oAscMathInterfaceScript . Sub ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtRemSubscript ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_ScriptType' , value : ( scripttype == Asc . c _oAscMathInterfaceScript . SubSup ) ? Asc . c _oAscMathInterfaceScript . Sup : Asc . c _oAscMathInterfaceScript . None }
} ) ;
arr . push ( mnu ) ;
}
if ( scripttype == Asc . c _oAscMathInterfaceScript . SubSup || scripttype == Asc . c _oAscMathInterfaceScript . Sup ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtRemSuperscript ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_ScriptType' , value : ( scripttype == Asc . c _oAscMathInterfaceScript . SubSup ) ? Asc . c _oAscMathInterfaceScript . Sub : Asc . c _oAscMathInterfaceScript . None }
} ) ;
arr . push ( mnu ) ;
}
}
break ;
case Asc . c _oAscMathInterfaceType . Fraction :
var fraction = value . get _FractionType ( ) ;
if ( fraction == Asc . c _oAscMathInterfaceFraction . Skewed || fraction == Asc . c _oAscMathInterfaceFraction . Linear ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtFractionStacked ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_FractionType' , value : Asc . c _oAscMathInterfaceFraction . Bar }
} ) ;
arr . push ( mnu ) ;
}
if ( fraction == Asc . c _oAscMathInterfaceFraction . Bar || fraction == Asc . c _oAscMathInterfaceFraction . Linear ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtFractionSkewed ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_FractionType' , value : Asc . c _oAscMathInterfaceFraction . Skewed }
} ) ;
arr . push ( mnu ) ;
}
if ( fraction == Asc . c _oAscMathInterfaceFraction . Bar || fraction == Asc . c _oAscMathInterfaceFraction . Skewed ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtFractionLinear ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_FractionType' , value : Asc . c _oAscMathInterfaceFraction . Linear }
} ) ;
arr . push ( mnu ) ;
}
if ( fraction == Asc . c _oAscMathInterfaceFraction . Bar || fraction == Asc . c _oAscMathInterfaceFraction . NoBar ) {
mnu = new Common . UI . MenuItem ( {
caption : ( fraction == Asc . c _oAscMathInterfaceFraction . Bar ) ? me . txtRemFractionBar : me . txtAddFractionBar ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_FractionType' , value : ( fraction == Asc . c _oAscMathInterfaceFraction . Bar ) ? Asc . c _oAscMathInterfaceFraction . NoBar : Asc . c _oAscMathInterfaceFraction . Bar }
} ) ;
arr . push ( mnu ) ;
}
break ;
case Asc . c _oAscMathInterfaceType . Limit :
mnu = new Common . UI . MenuItem ( {
caption : ( value . get _Pos ( ) == Asc . c _oAscMathInterfaceLimitPos . Top ) ? me . txtLimitUnder : me . txtLimitOver ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_Pos' , value : ( value . get _Pos ( ) == Asc . c _oAscMathInterfaceLimitPos . Top ) ? Asc . c _oAscMathInterfaceLimitPos . Bottom : Asc . c _oAscMathInterfaceLimitPos . Top }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . txtRemLimit ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_Pos' , value : Asc . c _oAscMathInterfaceLimitPos . None }
} ) ;
arr . push ( mnu ) ;
break ;
case Asc . c _oAscMathInterfaceType . Matrix :
mnu = new Common . UI . MenuItem ( {
caption : value . get _HidePlaceholder ( ) ? me . txtShowPlaceholder : me . txtHidePlaceholder ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_HidePlaceholder' , value : ! value . get _HidePlaceholder ( ) }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . insertText ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
menu : new Common . UI . Menu ( {
2020-08-20 16:58:03 +00:00
cls : 'shifted-right' ,
2016-10-24 11:56:11 +00:00
menuAlign : 'tl-tr' ,
items : [
{
caption : me . insertRowAboveText ,
equationProps : { type : type , callback : 'insert_MatrixRow' , value : true }
} ,
{
caption : me . insertRowBelowText ,
equationProps : { type : type , callback : 'insert_MatrixRow' , value : false }
} ,
{
caption : me . insertColumnLeftText ,
equationProps : { type : type , callback : 'insert_MatrixColumn' , value : true }
} ,
{
caption : me . insertColumnRightText ,
equationProps : { type : type , callback : 'insert_MatrixColumn' , value : false }
}
]
} )
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . deleteText ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
menu : new Common . UI . Menu ( {
2020-08-20 16:58:03 +00:00
cls : 'shifted-right' ,
2016-10-24 11:56:11 +00:00
menuAlign : 'tl-tr' ,
items : [
{
caption : me . deleteRowText ,
equationProps : { type : type , callback : 'delete_MatrixRow' }
} ,
{
caption : me . deleteColumnText ,
equationProps : { type : type , callback : 'delete_MatrixColumn' }
}
]
} )
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . txtMatrixAlign ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
menu : new Common . UI . Menu ( {
2020-08-20 16:58:03 +00:00
cls : 'shifted-right' ,
2016-10-24 11:56:11 +00:00
menuAlign : 'tl-tr' ,
items : [
{
caption : me . txtTop ,
checkable : true ,
checked : ( value . get _MatrixAlign ( ) == Asc . c _oAscMathInterfaceMatrixMatrixAlign . Top ) ,
equationProps : { type : type , callback : 'put_MatrixAlign' , value : Asc . c _oAscMathInterfaceMatrixMatrixAlign . Top }
} ,
{
caption : me . centerText ,
checkable : true ,
checked : ( value . get _MatrixAlign ( ) == Asc . c _oAscMathInterfaceMatrixMatrixAlign . Center ) ,
equationProps : { type : type , callback : 'put_MatrixAlign' , value : Asc . c _oAscMathInterfaceMatrixMatrixAlign . Center }
} ,
{
caption : me . txtBottom ,
checkable : true ,
checked : ( value . get _MatrixAlign ( ) == Asc . c _oAscMathInterfaceMatrixMatrixAlign . Bottom ) ,
equationProps : { type : type , callback : 'put_MatrixAlign' , value : Asc . c _oAscMathInterfaceMatrixMatrixAlign . Bottom }
}
]
} )
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . txtColumnAlign ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
menu : new Common . UI . Menu ( {
2020-08-20 16:58:03 +00:00
cls : 'shifted-right' ,
2016-10-24 11:56:11 +00:00
menuAlign : 'tl-tr' ,
items : [
{
caption : me . leftText ,
checkable : true ,
checked : ( value . get _ColumnAlign ( ) == Asc . c _oAscMathInterfaceMatrixColumnAlign . Left ) ,
equationProps : { type : type , callback : 'put_ColumnAlign' , value : Asc . c _oAscMathInterfaceMatrixColumnAlign . Left }
} ,
{
caption : me . centerText ,
checkable : true ,
checked : ( value . get _ColumnAlign ( ) == Asc . c _oAscMathInterfaceMatrixColumnAlign . Center ) ,
equationProps : { type : type , callback : 'put_ColumnAlign' , value : Asc . c _oAscMathInterfaceMatrixColumnAlign . Center }
} ,
{
caption : me . rightText ,
checkable : true ,
checked : ( value . get _ColumnAlign ( ) == Asc . c _oAscMathInterfaceMatrixColumnAlign . Right ) ,
equationProps : { type : type , callback : 'put_ColumnAlign' , value : Asc . c _oAscMathInterfaceMatrixColumnAlign . Right }
}
]
} )
} ) ;
arr . push ( mnu ) ;
break ;
case Asc . c _oAscMathInterfaceType . EqArray :
mnu = new Common . UI . MenuItem ( {
caption : me . txtInsertEqBefore ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'insert_Equation' , value : true }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . txtInsertEqAfter ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'insert_Equation' , value : false }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . txtDeleteEq ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'delete_Equation' }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . alignmentText ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
menu : new Common . UI . Menu ( {
2020-08-20 16:58:03 +00:00
cls : 'shifted-right' ,
2016-10-24 11:56:11 +00:00
menuAlign : 'tl-tr' ,
items : [
{
caption : me . txtTop ,
checkable : true ,
checked : ( value . get _Align ( ) == Asc . c _oAscMathInterfaceEqArrayAlign . Top ) ,
equationProps : { type : type , callback : 'put_Align' , value : Asc . c _oAscMathInterfaceEqArrayAlign . Top }
} ,
{
caption : me . centerText ,
checkable : true ,
checked : ( value . get _Align ( ) == Asc . c _oAscMathInterfaceEqArrayAlign . Center ) ,
equationProps : { type : type , callback : 'put_Align' , value : Asc . c _oAscMathInterfaceEqArrayAlign . Center }
} ,
{
caption : me . txtBottom ,
checkable : true ,
checked : ( value . get _Align ( ) == Asc . c _oAscMathInterfaceEqArrayAlign . Bottom ) ,
equationProps : { type : type , callback : 'put_Align' , value : Asc . c _oAscMathInterfaceEqArrayAlign . Bottom }
}
]
} )
} ) ;
arr . push ( mnu ) ;
break ;
case Asc . c _oAscMathInterfaceType . LargeOperator :
mnu = new Common . UI . MenuItem ( {
caption : me . txtLimitChange ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_LimitLocation' , value : ( value . get _LimitLocation ( ) == Asc . c _oAscMathInterfaceNaryLimitLocation . UndOvr ) ? Asc . c _oAscMathInterfaceNaryLimitLocation . SubSup : Asc . c _oAscMathInterfaceNaryLimitLocation . UndOvr }
} ) ;
arr . push ( mnu ) ;
if ( value . get _HideUpper ( ) !== undefined ) {
mnu = new Common . UI . MenuItem ( {
caption : value . get _HideUpper ( ) ? me . txtShowTopLimit : me . txtHideTopLimit ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_HideUpper' , value : ! value . get _HideUpper ( ) }
} ) ;
arr . push ( mnu ) ;
}
if ( value . get _HideLower ( ) !== undefined ) {
mnu = new Common . UI . MenuItem ( {
caption : value . get _HideLower ( ) ? me . txtShowBottomLimit : me . txtHideBottomLimit ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_HideLower' , value : ! value . get _HideLower ( ) }
} ) ;
arr . push ( mnu ) ;
}
break ;
case Asc . c _oAscMathInterfaceType . Delimiter :
mnu = new Common . UI . MenuItem ( {
caption : me . txtInsertArgBefore ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'insert_DelimiterArgument' , value : true }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . txtInsertArgAfter ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'insert_DelimiterArgument' , value : false }
} ) ;
arr . push ( mnu ) ;
if ( value . can _DeleteArgument ( ) ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtDeleteArg ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'delete_DelimiterArgument' }
} ) ;
arr . push ( mnu ) ;
}
mnu = new Common . UI . MenuItem ( {
caption : value . has _Separators ( ) ? me . txtDeleteCharsAndSeparators : me . txtDeleteChars ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'remove_DelimiterCharacters' }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : value . get _HideOpeningBracket ( ) ? me . txtShowOpenBracket : me . txtHideOpenBracket ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_HideOpeningBracket' , value : ! value . get _HideOpeningBracket ( ) }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : value . get _HideClosingBracket ( ) ? me . txtShowCloseBracket : me . txtHideCloseBracket ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_HideClosingBracket' , value : ! value . get _HideClosingBracket ( ) }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . txtStretchBrackets ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
checkable : true ,
checked : value . get _StretchBrackets ( ) ,
equationProps : { type : type , callback : 'put_StretchBrackets' , value : ! value . get _StretchBrackets ( ) }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . txtMatchBrackets ,
equation : true ,
disabled : ( ! value . get _StretchBrackets ( ) || me . _currentParaObjDisabled ) ,
checkable : true ,
checked : value . get _StretchBrackets ( ) && value . get _MatchBrackets ( ) ,
equationProps : { type : type , callback : 'put_MatchBrackets' , value : ! value . get _MatchBrackets ( ) }
} ) ;
arr . push ( mnu ) ;
break ;
case Asc . c _oAscMathInterfaceType . GroupChar :
if ( value . can _ChangePos ( ) ) {
mnu = new Common . UI . MenuItem ( {
caption : ( value . get _Pos ( ) == Asc . c _oAscMathInterfaceGroupCharPos . Top ) ? me . txtGroupCharUnder : me . txtGroupCharOver ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_Pos' , value : ( value . get _Pos ( ) == Asc . c _oAscMathInterfaceGroupCharPos . Top ) ? Asc . c _oAscMathInterfaceGroupCharPos . Bottom : Asc . c _oAscMathInterfaceGroupCharPos . Top }
} ) ;
arr . push ( mnu ) ;
mnu = new Common . UI . MenuItem ( {
caption : me . txtDeleteGroupChar ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_Pos' , value : Asc . c _oAscMathInterfaceGroupCharPos . None }
} ) ;
arr . push ( mnu ) ;
}
break ;
case Asc . c _oAscMathInterfaceType . Radical :
if ( value . get _HideDegree ( ) !== undefined ) {
mnu = new Common . UI . MenuItem ( {
caption : value . get _HideDegree ( ) ? me . txtShowDegree : me . txtHideDegree ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'put_HideDegree' , value : ! value . get _HideDegree ( ) }
} ) ;
arr . push ( mnu ) ;
}
mnu = new Common . UI . MenuItem ( {
caption : me . txtDeleteRadical ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'remove_Radical' }
} ) ;
arr . push ( mnu ) ;
break ;
}
if ( value . can _IncreaseArgumentSize ( ) ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtIncreaseArg ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'increase_ArgumentSize' }
} ) ;
arr . push ( mnu ) ;
}
if ( value . can _DecreaseArgumentSize ( ) ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtDecreaseArg ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'decrease_ArgumentSize' }
} ) ;
arr . push ( mnu ) ;
}
if ( value . can _InsertManualBreak ( ) ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtInsertBreak ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'insert_ManualBreak' }
} ) ;
arr . push ( mnu ) ;
}
if ( value . can _DeleteManualBreak ( ) ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtDeleteBreak ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'delete_ManualBreak' }
} ) ;
arr . push ( mnu ) ;
}
if ( value . can _AlignToCharacter ( ) ) {
mnu = new Common . UI . MenuItem ( {
caption : me . txtAlignToChar ,
equation : true ,
disabled : me . _currentParaObjDisabled ,
equationProps : { type : type , callback : 'align_ToCharacter' }
} ) ;
arr . push ( mnu ) ;
}
return arr ;
} ,
addEquationMenu : function ( insertIdx ) {
var me = this ;
me . clearEquationMenu ( insertIdx ) ;
var equationMenu = me . documentHolder . textInShapeMenu ,
menuItems = me . initEquationMenu ( ) ;
if ( menuItems . length > 0 ) {
_ . each ( menuItems , function ( menuItem , index ) {
if ( menuItem . menu ) {
_ . each ( menuItem . menu . items , function ( item ) {
item . on ( 'click' , _ . bind ( me . equationCallback , me , item . options . equationProps ) ) ;
} ) ;
} else
menuItem . on ( 'click' , _ . bind ( me . equationCallback , me , menuItem . options . equationProps ) ) ;
equationMenu . insertItem ( insertIdx , menuItem ) ;
insertIdx ++ ;
} ) ;
}
return menuItems . length ;
} ,
clearEquationMenu : function ( insertIdx ) {
var me = this ;
var equationMenu = me . documentHolder . textInShapeMenu ;
for ( var i = insertIdx ; i < equationMenu . items . length ; i ++ ) {
if ( equationMenu . items [ i ] . options . equation ) {
if ( equationMenu . items [ i ] . menu ) {
_ . each ( equationMenu . items [ i ] . menu . items , function ( item ) {
item . off ( 'click' ) ;
} ) ;
} else
equationMenu . items [ i ] . off ( 'click' ) ;
equationMenu . removeItem ( equationMenu . items [ i ] ) ;
i -- ;
} else
break ;
}
} ,
equationCallback : function ( eqProps ) {
var me = this ;
if ( eqProps ) {
var eqObj ;
switch ( eqProps . type ) {
case Asc . c _oAscMathInterfaceType . Accent :
eqObj = new CMathMenuAccent ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . BorderBox :
eqObj = new CMathMenuBorderBox ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . Box :
eqObj = new CMathMenuBox ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . Bar :
eqObj = new CMathMenuBar ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . Script :
eqObj = new CMathMenuScript ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . Fraction :
eqObj = new CMathMenuFraction ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . Limit :
eqObj = new CMathMenuLimit ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . Matrix :
eqObj = new CMathMenuMatrix ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . EqArray :
eqObj = new CMathMenuEqArray ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . LargeOperator :
eqObj = new CMathMenuNary ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . Delimiter :
eqObj = new CMathMenuDelimiter ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . GroupChar :
eqObj = new CMathMenuGroupCharacter ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . Radical :
eqObj = new CMathMenuRadical ( ) ;
break ;
case Asc . c _oAscMathInterfaceType . Common :
eqObj = new CMathMenuBase ( ) ;
break ;
}
if ( eqObj ) {
eqObj [ eqProps . callback ] ( eqProps . value ) ;
me . api . asc _SetMathProps ( eqObj ) ;
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . documentHolder ) ;
} ,
2017-05-18 07:31:18 +00:00
onTextInShapeAfterRender : function ( cmp ) {
var view = this . documentHolder ,
_conf = view . paraBulletsPicker . conf ;
view . paraBulletsPicker = new Common . UI . DataView ( {
el : $ ( '#id-docholder-menu-bullets' ) ,
parentMenu : view . menuParagraphBullets . menu ,
2021-09-20 14:38:41 +00:00
outerMenu : { menu : view . menuParagraphBullets . menu , index : 0 } ,
2021-04-03 07:44:20 +00:00
groups : view . paraBulletsPicker . groups ,
2017-05-18 07:31:18 +00:00
store : view . paraBulletsPicker . store ,
2022-05-13 10:47:53 +00:00
delayRenderTips : true ,
2021-04-03 07:44:20 +00:00
itemTemplate : _ . template ( '<% if (type==0) { %>' +
'<div id="<%= id %>" class="item-markerlist"></div>' +
'<% } else if (type==1) { %>' +
'<div id="<%= id %>" class="item-multilevellist"></div>' +
'<% } %>' )
2017-05-18 07:31:18 +00:00
} ) ;
view . paraBulletsPicker . on ( 'item:click' , _ . bind ( this . onSelectBullets , this ) ) ;
2021-09-20 14:38:41 +00:00
view . menuParagraphBullets . menu . setInnerMenu ( [ { menu : view . paraBulletsPicker , index : 0 } ] ) ;
2017-05-18 07:31:18 +00:00
_conf && view . paraBulletsPicker . selectRecord ( _conf . rec , true ) ;
} ,
2021-04-03 07:53:38 +00:00
onBulletMenuShowAfter : function ( ) {
var store = this . documentHolder . paraBulletsPicker . store ;
var arrNum = [ ] , arrMarker = [ ] ;
store . each ( function ( item ) {
2022-05-12 19:06:23 +00:00
var data = item . get ( 'drawdata' ) ;
data [ 'divId' ] = item . get ( 'id' ) ;
if ( item . get ( 'group' ) === 'menu-list-bullet-group' )
arrMarker . push ( data ) ;
2021-04-03 07:53:38 +00:00
else
2022-05-12 19:06:23 +00:00
arrNum . push ( data ) ;
2021-04-03 07:53:38 +00:00
} ) ;
2022-05-12 19:06:23 +00:00
2021-04-03 07:53:38 +00:00
if ( this . api && this . api . SetDrawImagePreviewBulletForMenu ) {
this . api . SetDrawImagePreviewBulletForMenu ( arrMarker , 0 ) ;
this . api . SetDrawImagePreviewBulletForMenu ( arrNum , 1 ) ;
}
} ,
2022-05-12 21:07:26 +00:00
updateBulletTip : function ( view , title ) {
if ( view ) {
var tip = $ ( view . el ) . data ( 'bs.tooltip' ) ;
if ( tip ) {
tip . options . title = title ;
tip . $tip . find ( '.tooltip-inner' ) . text ( title ) ;
}
}
} ,
2017-11-24 11:47:48 +00:00
onSignatureClick : function ( item ) {
2017-11-22 08:41:47 +00:00
var datavalue = item . cmpEl . attr ( 'data-value' ) ;
switch ( item . value ) {
case 0 :
Common . NotificationCenter . trigger ( 'protect:sign' , datavalue ) ; //guid
break ;
case 1 :
this . api . asc _ViewCertificate ( datavalue ) ; //certificate id
break ;
case 2 :
2017-11-24 11:47:48 +00:00
Common . NotificationCenter . trigger ( 'protect:signature' , 'visible' , this . _isDisabled , datavalue ) ; //guid, can edit settings for requested signature
2017-11-22 08:41:47 +00:00
break ;
case 3 :
2021-08-19 12:50:54 +00:00
var me = this ;
Common . UI . warning ( {
title : this . notcriticalErrorTitle ,
msg : this . txtRemoveWarning ,
buttons : [ 'ok' , 'cancel' ] ,
primary : 'ok' ,
callback : function ( btn ) {
if ( btn == 'ok' ) {
me . api . asc _RemoveSignature ( datavalue ) ;
}
}
} ) ;
2017-11-22 08:41:47 +00:00
break ;
}
} ,
2018-04-11 13:46:44 +00:00
onOriginalSizeClick : function ( item ) {
if ( this . api ) {
var imgsize = this . api . asc _getOriginalImageSize ( ) ;
var w = imgsize . asc _getImageWidth ( ) ;
var h = imgsize . asc _getImageHeight ( ) ;
var properties = new Asc . asc _CImgProperty ( ) ;
properties . asc _putWidth ( w ) ;
properties . asc _putHeight ( h ) ;
2019-04-11 10:09:28 +00:00
properties . put _ResetCrop ( true ) ;
2021-06-22 12:42:21 +00:00
properties . put _Rot ( 0 ) ;
2018-04-11 13:46:44 +00:00
this . api . asc _setGraphicObjectProps ( properties ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
Common . component . Analytics . trackEvent ( 'DocumentHolder' , 'Set Image Original Size' ) ;
}
} ,
onImgReplace : function ( menu , item ) {
var me = this ;
if ( this . api ) {
if ( item . value == 'file' ) {
setTimeout ( function ( ) {
if ( me . api ) me . api . asc _changeImageFromFile ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , me . documentHolder ) ;
} , 10 ) ;
2020-05-13 14:43:45 +00:00
} else if ( item . value == 'storage' ) {
Common . NotificationCenter . trigger ( 'storage:image-load' , 'change' ) ;
2018-04-11 13:46:44 +00:00
} else {
( new Common . Views . ImageFromUrlDialog ( {
handler : function ( result , value ) {
if ( result == 'ok' ) {
if ( me . api ) {
var checkUrl = value . replace ( / /g , '' ) ;
if ( ! _ . isEmpty ( checkUrl ) ) {
var props = new Asc . asc _CImgProperty ( ) ;
props . asc _putImageUrl ( checkUrl ) ;
me . api . asc _setGraphicObjectProps ( props ) ;
}
}
}
Common . NotificationCenter . trigger ( 'edit:complete' , me . documentHolder ) ;
}
} ) ) . show ( ) ;
}
}
} ,
2018-04-13 13:29:31 +00:00
onNumberFormatSelect : function ( menu , item ) {
if ( item . value !== undefined && item . value !== 'advanced' ) {
if ( this . api )
this . api . asc _setCellFormat ( item . options . format ) ;
}
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
} ,
onCustomNumberFormat : function ( item ) {
var me = this ,
value = me . api . asc _getLocale ( ) ;
( ! value ) && ( value = ( ( me . permissions . lang ) ? parseInt ( Common . util . LanguageInfo . getLocalLanguageCode ( me . permissions . lang ) ) : 0x0409 ) ) ;
( 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 . documentHolder ) ;
} ,
props : { format : item . options . numformat , formatInfo : item . options . numformatinfo , langId : value }
} ) ) . show ( ) ;
Common . NotificationCenter . trigger ( 'edit:complete' , this . documentHolder ) ;
} ,
onNumberFormatOpenAfter : function ( menu ) {
if ( this . api ) {
var me = this ,
value = me . api . asc _getLocale ( ) ;
( ! value ) && ( value = ( ( me . permissions . lang ) ? parseInt ( Common . util . LanguageInfo . getLocalLanguageCode ( me . permissions . lang ) ) : 0x0409 ) ) ;
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
for ( var i = 0 ; i < menu . items . length - 2 ; i ++ ) {
menu . items [ i ] . options . format = arr [ i ] ;
}
}
var val = menu . options . numformatinfo ;
val = ( val ) ? val . asc _getType ( ) : - 1 ;
for ( var i = 0 ; i < menu . items . length - 2 ; i ++ ) {
var mnu = menu . items [ i ] ;
mnu . options . exampleval = me . api . asc _getLocaleExample ( mnu . options . format ) ;
$ ( mnu . el ) . find ( 'label' ) . text ( mnu . options . exampleval ) ;
mnu . setChecked ( val == mnu . value ) ;
}
}
} ,
2020-10-21 18:59:30 +00:00
onAutoCorrectOpenAfter : function ( menu ) {
this . mnuAutoCorrectStop && this . mnuAutoCorrectStop . setChecked ( ! Common . Utils . InternalSettings . get ( "sse-settings-autoformat-new-rows" ) ) ;
} ,
onAutoCorrectOptions : function ( ) {
var win = ( new Common . Views . AutoCorrectDialog ( {
api : this . api
} ) ) ;
if ( win ) {
win . show ( ) ;
win . setActiveCategory ( 2 ) ;
}
} ,
2021-06-28 11:51:32 +00:00
2021-07-17 23:11:58 +00:00
onChangeProtectSheet : function ( props ) {
if ( ! props ) {
var wbprotect = this . getApplication ( ) . getController ( 'WBProtection' ) ;
props = wbprotect ? wbprotect . getWSProps ( ) : null ;
}
if ( props ) {
this . _state . wsProps = props . wsProps ;
this . _state . wsLock = props . wsLock ;
}
} ,
2021-06-28 11:51:32 +00:00
onShowForeignCursorLabel : function ( UserId , X , Y , color ) {
2021-11-08 22:01:49 +00:00
if ( ! this . isUserVisible ( UserId ) ) return ;
2021-06-28 11:51:32 +00:00
/** coauthoring begin **/
var src ;
var me = this ;
2021-11-16 11:19:07 +00:00
if ( me . tooltips && me . tooltips . foreignSelect && ( me . tooltips . foreignSelect . userId == UserId ) ) {
me . hideForeignSelectTips ( ) ;
}
2021-06-28 11:51:32 +00:00
for ( var i = 0 ; i < me . fastcoauthtips . length ; i ++ ) {
if ( me . fastcoauthtips [ i ] . attr ( 'userid' ) == UserId ) {
src = me . fastcoauthtips [ i ] ;
break ;
}
}
2021-07-30 14:41:35 +00:00
var coAuthTip = this . tooltips . coauth ;
if ( X < 0 || X + coAuthTip . XY [ 0 ] > coAuthTip . bodyWidth - coAuthTip . rightMenuWidth || Y < 0 || Y > coAuthTip . apiHeight ) {
src && this . onHideForeignCursorLabel ( UserId ) ;
return ;
}
2021-06-28 11:51:32 +00:00
if ( ! src ) {
src = $ ( document . createElement ( "div" ) ) ;
src . addClass ( 'username-tip' ) ;
src . attr ( 'userid' , UserId ) ;
src . css ( { height : me . _TtHeight + 'px' , position : 'absolute' , zIndex : '900' , display : 'none' , 'pointer-events' : 'none' ,
'background-color' : '#' + Common . Utils . ThemeColor . getHexColor ( color . get _r ( ) , color . get _g ( ) , color . get _b ( ) ) } ) ;
src . text ( me . getUserName ( UserId ) ) ;
$ ( '#editor_sdk' ) . append ( src ) ;
me . fastcoauthtips . push ( src ) ;
src . fadeIn ( 150 ) ;
}
2021-07-30 14:41:35 +00:00
src . css ( {
left : ( ( X + coAuthTip . XY [ 0 ] + src . outerWidth ( ) > coAuthTip . bodyWidth - coAuthTip . rightMenuWidth ) ? coAuthTip . bodyWidth - coAuthTip . rightMenuWidth - src . outerWidth ( ) - coAuthTip . XY [ 0 ] : X ) + 'px' ,
top : ( Y - me . _TtHeight ) + 'px'
} ) ;
2021-06-28 11:51:32 +00:00
/** coauthoring end **/
} ,
onHideForeignCursorLabel : function ( UserId ) {
var me = this ;
for ( var i = 0 ; i < me . fastcoauthtips . length ; i ++ ) {
if ( me . fastcoauthtips [ i ] . attr ( 'userid' ) == UserId ) {
var src = me . fastcoauthtips [ i ] ;
me . fastcoauthtips [ i ] . fadeOut ( 150 , function ( ) { src . remove ( ) } ) ;
me . fastcoauthtips . splice ( i , 1 ) ;
break ;
}
}
} ,
2022-03-28 16:41:59 +00:00
onDoubleClickOnTableOleObject : function ( obj ) {
if ( this . permissions . isEdit && ! this . _isDisabled ) {
var oleEditor = SSE . getController ( 'Common.Controllers.ExternalOleEditor' ) . getView ( 'Common.Views.ExternalOleEditor' ) ;
if ( oleEditor && obj ) {
oleEditor . setEditMode ( true ) ;
oleEditor . show ( ) ;
oleEditor . setOleData ( Asc . asc _putBinaryDataToFrameFromTableOleObject ( obj ) ) ;
}
}
} ,
2022-06-07 20:29:14 +00:00
onUpdateExternalReference : function ( arr , callback ) {
2022-06-07 14:43:17 +00:00
if ( this . permissions . isEdit && ! this . _isDisabled ) {
var me = this ;
me . externalData = {
stackRequests : [ ] ,
stackResponse : [ ] ,
callback : undefined
} ;
arr && arr . length > 0 && arr . forEach ( function ( item ) {
2022-06-07 21:06:44 +00:00
var data ;
2022-06-07 20:29:14 +00:00
switch ( item . asc _getType ( ) ) {
case Asc . c _oAscExternalReferenceType . link :
2022-06-07 21:06:44 +00:00
data = { link : item . asc _getData ( ) } ;
2022-06-07 14:43:17 +00:00
break ;
2022-06-07 20:29:14 +00:00
case Asc . c _oAscExternalReferenceType . path :
2022-06-07 21:06:44 +00:00
data = { path : item . asc _getData ( ) } ;
2022-06-07 14:43:17 +00:00
break ;
2022-06-07 20:29:14 +00:00
case Asc . c _oAscExternalReferenceType . referenceData :
2022-06-07 21:06:44 +00:00
data = { referenceData : item . asc _getData ( ) } ;
2022-06-07 14:43:17 +00:00
break ;
}
2022-06-07 21:06:44 +00:00
data && me . externalData . stackRequests . push ( data ) ;
2022-06-07 14:43:17 +00:00
} ) ;
me . externalData . callback = callback ;
me . requestReferenceData ( ) ;
}
} ,
requestReferenceData : function ( ) {
if ( this . externalData . stackRequests . length > 0 ) {
var data = this . externalData . stackRequests . shift ( ) ;
Common . Gateway . requestReferenceData ( data ) ;
}
} ,
setReferenceData : function ( data ) {
if ( this . permissions . isEdit && ! this . _isDisabled ) {
data && this . externalData . stackResponse . push ( data ) ;
if ( this . externalData . stackRequests . length > 0 )
this . requestReferenceData ( ) ;
else if ( this . externalData . callback )
this . externalData . callback ( this . externalData . stackResponse ) ;
}
} ,
2022-11-01 21:27:17 +00:00
onShowMathTrack : function ( bounds ) {
if ( bounds [ 3 ] < 0 ) {
this . onHideMathTrack ( ) ;
return ;
}
2022-10-31 22:23:02 +00:00
var me = this ,
documentHolder = me . documentHolder ,
eqContainer = documentHolder . cmpEl . find ( '#equation-container' ) ;
// Prepare menu container
if ( eqContainer . length < 1 ) {
var equationsStore = me . getApplication ( ) . getCollection ( 'EquationGroups' ) ,
eqStr = '<div id="equation-container" style="position: absolute;">' ;
me . getApplication ( ) . getController ( 'Toolbar' ) . onMathTypes ( ) ;
me . equationBtns = [ ] ;
for ( var i = 0 ; i < equationsStore . length ; ++ i ) {
var style = 'margin-right: 8px;' + ( i == 0 ? 'margin-left: 5px;' : '' ) ;
eqStr += '<span id="id-document-holder-btn-equation-' + i + '" style="' + style + '"></span>' ;
}
2022-11-01 19:48:39 +00:00
eqStr += '<div class="separator"></div>' ;
eqStr += '<span id="id-document-holder-btn-equation-settings" style="margin-right: 5px; margin-left: 8px;"></span>' ;
2022-10-31 22:23:02 +00:00
eqStr += '</div>' ;
eqContainer = $ ( eqStr ) ;
documentHolder . cmpEl . append ( eqContainer ) ;
var onShowBefore = function ( menu ) {
var index = menu . options . value ,
group = equationsStore . at ( index ) ;
var equationPicker = new Common . UI . DataViewSimple ( {
el : $ ( '#id-document-holder-btn-equation-menu-' + index , menu . cmpEl ) ,
parentMenu : menu ,
store : group . get ( 'groupStore' ) ,
scrollAlwaysVisible : true ,
showLast : false ,
2022-11-10 18:04:20 +00:00
restoreHeight : 450 ,
2022-10-31 22:23:02 +00:00
itemTemplate : _ . template (
'<div class="item-equation" style="" >' +
'<div class="equation-icon" style="background-position:<%= posX %>px <%= posY %>px;width:<%= width %>px;height:<%= height %>px;" id="<%= id %>"></div>' +
'</div>' )
} ) ;
equationPicker . on ( 'item:click' , function ( picker , item , record , e ) {
if ( me . api ) {
if ( record )
me . api . asc _AddMath ( record . get ( 'data' ) . equationType ) ;
}
} ) ;
menu . off ( 'show:before' , onShowBefore ) ;
} ;
2022-11-10 18:04:20 +00:00
var bringForward = function ( menu ) {
eqContainer . addClass ( 'has-open-menu' ) ;
} ;
var sendBackward = function ( menu ) {
eqContainer . removeClass ( 'has-open-menu' ) ;
} ;
2022-10-31 22:23:02 +00:00
for ( var i = 0 ; i < equationsStore . length ; ++ i ) {
var equationGroup = equationsStore . at ( i ) ;
var btn = new Common . UI . Button ( {
parentEl : $ ( '#id-document-holder-btn-equation-' + i , documentHolder . cmpEl ) ,
cls : 'btn-toolbar no-caret' ,
iconCls : 'svgicon ' + equationGroup . get ( 'groupIcon' ) ,
hint : equationGroup . get ( 'groupName' ) ,
menu : new Common . UI . Menu ( {
cls : 'menu-shapes' ,
value : i ,
2022-11-01 19:48:39 +00:00
restoreHeight : equationGroup . get ( 'groupHeight' ) ? parseInt ( equationGroup . get ( 'groupHeight' ) ) : true ,
2022-10-31 22:23:02 +00:00
items : [
{ template : _ . template ( '<div id="id-document-holder-btn-equation-menu-' + i +
'" class="menu-shape" style="width:' + ( equationGroup . get ( 'groupWidth' ) + 8 ) + 'px; ' +
equationGroup . get ( 'groupHeightStr' ) + 'margin-left:5px;"></div>' ) }
]
} )
} ) ;
btn . menu . on ( 'show:before' , onShowBefore ) ;
2022-11-10 18:04:20 +00:00
btn . menu . on ( 'show:before' , bringForward ) ;
btn . menu . on ( 'hide:after' , sendBackward ) ;
2022-10-31 22:23:02 +00:00
me . equationBtns . push ( btn ) ;
}
me . equationSettingsBtn = new Common . UI . Button ( {
parentEl : $ ( '#id-document-holder-btn-equation-settings' , documentHolder . cmpEl ) ,
cls : 'btn-toolbar no-caret' ,
iconCls : 'toolbar__icon more-vertical' ,
hint : me . documentHolder . advancedEquationText ,
menu : me . documentHolder . createEquationMenu ( 'popuptbeqinput' , 'tl-bl' )
} ) ;
me . equationSettingsBtn . menu . options . initMenu = function ( ) {
var eq = me . api . asc _GetMathInputType ( ) ;
var menu = me . equationSettingsBtn . menu ;
menu . items [ 0 ] . setChecked ( eq === Asc . c _oAscMathInputType . Unicode ) ;
menu . items [ 1 ] . setChecked ( eq === Asc . c _oAscMathInputType . LaTeX ) ;
} ;
me . equationSettingsBtn . menu . on ( 'item:click' , _ . bind ( me . convertEquation , me ) ) ;
me . equationSettingsBtn . menu . on ( 'show:before' , function ( menu ) {
menu . options . initMenu ( ) ;
} ) ;
}
if ( ! me . tooltips . coauth . XY )
me . onDocumentResize ( ) ;
2022-11-01 21:27:17 +00:00
var showPoint = [ ( bounds [ 0 ] + bounds [ 2 ] ) / 2 - eqContainer . outerWidth ( ) / 2 , bounds [ 1 ] - eqContainer . outerHeight ( ) - 10 ] ;
if ( showPoint [ 1 ] < 0 ) {
showPoint [ 1 ] = bounds [ 3 ] + 10 ;
}
2022-11-10 18:04:20 +00:00
showPoint [ 1 ] = Math . min ( me . tooltips . coauth . apiHeight - eqContainer . outerHeight ( ) , Math . max ( 0 , showPoint [ 1 ] ) ) ;
eqContainer . css ( { left : showPoint [ 0 ] , top : showPoint [ 1 ] } ) ;
var menuAlign = ( me . tooltips . coauth . apiHeight - showPoint [ 1 ] - eqContainer . outerHeight ( ) < 220 ) ? 'bl-tl' : 'tl-bl' ;
me . equationBtns . forEach ( function ( item ) {
item && ( item . menu . menuAlign = menuAlign ) ;
} ) ;
me . equationSettingsBtn . menu . menuAlign = menuAlign ;
2022-10-31 22:23:02 +00:00
if ( eqContainer . is ( ':visible' ) ) {
2022-11-01 19:48:39 +00:00
if ( me . equationSettingsBtn . menu . isVisible ( ) ) {
me . equationSettingsBtn . menu . options . initMenu ( ) ;
me . equationSettingsBtn . menu . alignPosition ( ) ;
}
2022-10-31 22:23:02 +00:00
} else {
eqContainer . show ( ) ;
}
2022-11-01 21:27:17 +00:00
me . disableEquationBar ( ) ;
2022-10-31 22:23:02 +00:00
} ,
2022-11-01 21:27:17 +00:00
onHideMathTrack : function ( ) {
2022-10-31 22:23:02 +00:00
var eqContainer = this . documentHolder . cmpEl . find ( '#equation-container' ) ;
if ( eqContainer . is ( ':visible' ) ) {
eqContainer . hide ( ) ;
}
} ,
2022-11-01 21:27:17 +00:00
disableEquationBar : function ( ) {
var eqContainer = this . documentHolder . cmpEl . find ( '#equation-container' ) ,
disabled = this . _isDisabled || this . _state . equationLocked ;
if ( eqContainer . length > 0 && eqContainer . is ( ':visible' ) ) {
this . equationBtns . forEach ( function ( item ) {
item && item . setDisabled ( ! ! disabled ) ;
} ) ;
this . equationSettingsBtn . setDisabled ( ! ! disabled ) ;
}
} ,
2022-11-01 19:48:39 +00:00
convertEquation : function ( menu , item , e ) {
if ( this . api ) {
if ( item . options . type == 'input' )
this . api . asc _SetMathInputType ( item . value ) ;
else if ( item . options . type == 'view' )
this . api . asc _ConvertMathView ( item . value . linear , item . value . all ) ;
}
} ,
2021-06-28 11:51:32 +00:00
getUserName : function ( id ) {
var usersStore = SSE . getCollection ( 'Common.Collections.Users' ) ;
if ( usersStore ) {
var rec = usersStore . findUser ( id ) ;
if ( rec )
return AscCommon . UserInfoParser . getParsedName ( rec . get ( 'username' ) ) ;
}
return this . guestText ;
} ,
2021-11-08 22:01:49 +00:00
isUserVisible : function ( id ) {
var usersStore = SSE . getCollection ( 'Common.Collections.Users' ) ;
if ( usersStore ) {
var rec = usersStore . findUser ( id ) ;
if ( rec )
return ! rec . get ( 'hidden' ) ;
}
return true ;
} ,
2017-11-22 08:41:47 +00:00
SetDisabled : function ( state , canProtect ) {
2017-11-10 07:50:01 +00:00
this . _isDisabled = state ;
2017-11-22 08:41:47 +00:00
this . _canProtect = canProtect ;
2022-11-01 21:27:17 +00:00
this . disableEquationBar ( ) ;
2017-11-10 07:50:01 +00:00
} ,
2017-06-06 08:04:04 +00:00
guestText : 'Guest' ,
2019-04-02 14:17:30 +00:00
textCtrlClick : 'Click the link to open it or click and hold the mouse button to select the cell.' ,
2016-03-11 00:48:53 +00:00
txtHeight : 'Height' ,
txtWidth : 'Width' ,
tipIsLocked : 'This element is being edited by another user.' ,
textChangeColumnWidth : 'Column Width {0} symbols ({1} pixels)' ,
textChangeRowHeight : 'Row Height {0} points ({1} pixels)' ,
textInsertLeft : 'Insert Left' ,
2016-04-06 13:38:54 +00:00
textInsertTop : 'Insert Top' ,
2016-08-05 11:40:47 +00:00
textSym : 'sym' ,
notcriticalErrorTitle : 'Warning' ,
2016-10-24 11:56:11 +00:00
errorInvalidLink : 'The link reference does not exist. Please correct the link or delete it.' ,
txtRemoveAccentChar : 'Remove accent character' ,
txtBorderProps : 'Borders property' ,
txtHideTop : 'Hide top border' ,
txtHideBottom : 'Hide bottom border' ,
txtHideLeft : 'Hide left border' ,
txtHideRight : 'Hide right border' ,
txtHideHor : 'Hide horizontal line' ,
txtHideVer : 'Hide vertical line' ,
txtHideLT : 'Hide left top line' ,
txtHideLB : 'Hide left bottom line' ,
txtAddTop : 'Add top border' ,
txtAddBottom : 'Add bottom border' ,
txtAddLeft : 'Add left border' ,
txtAddRight : 'Add right border' ,
txtAddHor : 'Add horizontal line' ,
txtAddVer : 'Add vertical line' ,
txtAddLT : 'Add left top line' ,
txtAddLB : 'Add left bottom line' ,
txtRemoveBar : 'Remove bar' ,
txtOverbar : 'Bar over text' ,
txtUnderbar : 'Bar under text' ,
txtRemScripts : 'Remove scripts' ,
txtRemSubscript : 'Remove subscript' ,
txtRemSuperscript : 'Remove superscript' ,
txtScriptsAfter : 'Scripts after text' ,
txtScriptsBefore : 'Scripts before text' ,
txtFractionStacked : 'Change to stacked fraction' ,
txtFractionSkewed : 'Change to skewed fraction' ,
txtFractionLinear : 'Change to linear fraction' ,
txtRemFractionBar : 'Remove fraction bar' ,
txtAddFractionBar : 'Add fraction bar' ,
txtRemLimit : 'Remove limit' ,
txtLimitOver : 'Limit over text' ,
txtLimitUnder : 'Limit under text' ,
txtHidePlaceholder : 'Hide placeholder' ,
txtShowPlaceholder : 'Show placeholder' ,
txtMatrixAlign : 'Matrix alignment' ,
txtColumnAlign : 'Column alignment' ,
txtTop : 'Top' ,
txtBottom : 'Bottom' ,
txtInsertEqBefore : 'Insert equation before' ,
txtInsertEqAfter : 'Insert equation after' ,
txtDeleteEq : 'Delete equation' ,
txtLimitChange : 'Change limits location' ,
txtHideTopLimit : 'Hide top limit' ,
txtShowTopLimit : 'Show top limit' ,
txtHideBottomLimit : 'Hide bottom limit' ,
txtShowBottomLimit : 'Show bottom limit' ,
txtInsertArgBefore : 'Insert argument before' ,
txtInsertArgAfter : 'Insert argument after' ,
txtDeleteArg : 'Delete argument' ,
txtHideOpenBracket : 'Hide opening bracket' ,
txtShowOpenBracket : 'Show opening bracket' ,
txtHideCloseBracket : 'Hide closing bracket' ,
txtShowCloseBracket : 'Show closing bracket' ,
txtStretchBrackets : 'Stretch brackets' ,
txtMatchBrackets : 'Match brackets to argument height' ,
txtGroupCharOver : 'Char over text' ,
txtGroupCharUnder : 'Char under text' ,
txtDeleteGroupChar : 'Delete char' ,
txtHideDegree : 'Hide degree' ,
txtShowDegree : 'Show degree' ,
txtIncreaseArg : 'Increase argument size' ,
txtDecreaseArg : 'Decrease argument size' ,
txtInsertBreak : 'Insert manual break' ,
txtDeleteBreak : 'Delete manual break' ,
txtAlignToChar : 'Align to character' ,
txtDeleteRadical : 'Delete radical' ,
txtDeleteChars : 'Delete enclosing characters' ,
2016-10-26 13:20:51 +00:00
txtDeleteCharsAndSeparators : 'Delete enclosing characters and separators' ,
insertText : 'Insert' ,
alignmentText : 'Alignment' ,
leftText : 'Left' ,
rightText : 'Right' ,
centerText : 'Center' ,
insertRowAboveText : 'Row Above' ,
insertRowBelowText : 'Row Below' ,
insertColumnLeftText : 'Column Left' ,
insertColumnRightText : 'Column Right' ,
deleteText : 'Delete' ,
deleteRowText : 'Delete Row' ,
2016-11-11 13:22:35 +00:00
deleteColumnText : 'Delete Column' ,
2017-02-06 14:12:59 +00:00
txtNoChoices : 'There are no choices for filling the cell.<br>Only text values from the column can be selected for replacement.' ,
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' ,
txtPaste : 'Paste' ,
2020-02-28 13:30:58 +00:00
txtPasteFormulas : 'Formulas' ,
txtPasteFormulaNumFormat : 'Formulas & number formats' ,
txtPasteKeepSourceFormat : 'Formulas & formatting' ,
txtPasteBorders : 'All except borders' ,
txtPasteColWidths : 'Formulas & column widths' ,
2017-04-11 11:05:56 +00:00
txtPasteMerge : 'Merge conditional formatting' ,
txtPasteTranspose : 'Transpose' ,
2020-02-28 13:30:58 +00:00
txtPasteValues : 'Values' ,
txtPasteValNumFormat : 'Values & number formats' ,
txtPasteValFormat : 'Values & formatting' ,
2017-04-11 11:05:56 +00:00
txtPasteFormat : 'Paste only formatting' ,
txtPasteLink : 'Paste Link' ,
txtPastePicture : 'Picture' ,
txtPasteLinkPicture : 'Linked Picture' ,
txtPasteSourceFormat : 'Source formatting' ,
2017-11-28 10:22:25 +00:00
txtPasteDestFormat : 'Destination formatting' ,
2019-04-16 12:28:07 +00:00
txtKeepTextOnly : 'Keep text only' ,
txtUseTextImport : 'Use text import wizard' ,
2017-11-28 10:22:25 +00:00
txtUndoExpansion : 'Undo table autoexpansion' ,
2018-05-31 07:27:38 +00:00
txtRedoExpansion : 'Redo table autoexpansion' ,
txtAnd : 'and' ,
txtOr : 'or' ,
txtEquals : "Equals" ,
txtNotEquals : "Does not equal" ,
txtGreater : "Greater than" ,
txtGreaterEquals : "Greater than or equal to" ,
txtLess : "Less than" ,
txtLessEquals : "Less than or equal to" ,
txtAboveAve : 'Above average' ,
txtBelowAve : 'Below average' ,
txtBegins : "Begins with" ,
txtNotBegins : "Does not begin with" ,
txtEnds : "Ends with" ,
txtNotEnds : "Does not end with" ,
txtContains : "Contains" ,
txtNotContains : "Does not contain" ,
txtFilterTop : 'Top' ,
txtFilterBottom : 'Bottom' ,
txtItems : 'items' ,
txtPercent : 'percent' ,
txtEqualsToCellColor : 'Equals to cell color' ,
txtEqualsToFontColor : 'Equals to font color' ,
txtAll : '(All)' ,
2018-07-26 14:03:47 +00:00
txtBlanks : '(Blanks)' ,
2019-04-17 09:01:20 +00:00
txtColumn : 'Column' ,
2020-02-28 13:30:58 +00:00
txtImportWizard : 'Text Import Wizard' ,
2020-10-21 18:59:30 +00:00
textPasteSpecial : 'Paste special' ,
textStopExpand : 'Stop automatically expanding tables' ,
2021-08-10 21:24:12 +00:00
textAutoCorrectSettings : 'AutoCorrect options' ,
2021-08-25 16:02:44 +00:00
txtLockSort : 'Data is found next to your selection, but you do not have sufficient permissions to change those cells.<br>Do you wish to continue with the current selection?' ,
2021-09-03 11:39:20 +00:00
txtRemoveWarning : 'Do you want to remove this signature?<br>It can\'t be undone.' ,
2021-09-09 14:02:07 +00:00
txtWarnUrl : 'Clicking this link can be harmful to your device and data.<br>Are you sure you want to continue?' ,
txtThisRowHint : 'Choose only this row of the specified column' ,
txtAllTableHint : 'Returns the entire contents of the table or specified table columns including column headers, data and total rows' ,
txtDataTableHint : 'Returns the data cells of the table or specified table columns' ,
txtHeadersTableHint : 'Returns the column headers for the table or specified table columns' ,
2022-06-15 19:09:53 +00:00
txtTotalsTableHint : 'Returns the total rows for the table or specified table columns' ,
txtCopySuccess : 'Link copied to the clipboard'
2016-03-11 00:48:53 +00:00
} , SSE . Controllers . DocumentHolder || { } ) ) ;
} ) ;