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 view
*
* Created by Alexander Yuzhin on 1 / 11 / 14
2018-03-01 12:16:38 +00:00
* Copyright ( c ) 2018 Ascensio System SIA . All rights reserved .
2016-03-11 00:48:53 +00:00
*
* /
define ( [
'jquery' ,
'underscore' ,
'backbone' ,
'gateway' ,
'common/main/lib/util/utils' ,
'common/main/lib/component/Menu' ,
2019-12-05 10:48:48 +00:00
'common/main/lib/component/Calendar' ,
2016-03-11 00:48:53 +00:00
'common/main/lib/view/InsertTableDialog' ,
'common/main/lib/view/CopyWarningDialog' ,
2020-10-15 12:50:39 +00:00
'common/main/lib/view/OptionsDialog' ,
2016-03-11 00:48:53 +00:00
'documenteditor/main/app/view/DropcapSettingsAdvanced' ,
'documenteditor/main/app/view/HyperlinkSettingsDialog' ,
'documenteditor/main/app/view/ParagraphSettingsAdvanced' ,
2017-12-13 13:52:14 +00:00
'documenteditor/main/app/view/TableSettingsAdvanced' ,
2018-07-20 09:00:30 +00:00
'documenteditor/main/app/view/ControlSettingsDialog' ,
2019-09-05 11:38:34 +00:00
'documenteditor/main/app/view/NumberingValueDialog' ,
2019-09-06 11:37:43 +00:00
'documenteditor/main/app/view/CellsAddDialog'
2016-03-11 00:48:53 +00:00
] , function ( $ , _ , Backbone , gateway ) { 'use strict' ;
DE . Views . DocumentHolder = Backbone . View . extend ( _ . extend ( {
el : '#editor_sdk' ,
// Compile our stats template
template : null ,
// Delegated events for creating new items, and clearing completed ones.
events : {
} ,
initialize : function ( ) {
2022-04-27 19:24:39 +00:00
this . _currentMathObj = undefined ;
this . _currentSpellObj = undefined ;
this . _currentParaObjDisabled = false ;
this . _currLang = { } ;
2022-04-28 21:06:04 +00:00
this . _isDisabled = false ;
2022-04-27 19:24:39 +00:00
} ,
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
render : function ( ) {
this . fireEvent ( 'render:before' , this ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
this . cmpEl = $ ( this . el ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
this . fireEvent ( 'render:after' , this ) ;
return this ;
} ,
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
setApi : function ( o ) {
this . api = o ;
return this ;
} ,
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
setMode : function ( m ) {
this . mode = m ;
this . _fillFormMode = ! this . mode . isEdit && this . mode . canFillForms ;
return this ;
} ,
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
createDelayedElementsViewer : function ( ) {
var me = this ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuViewCopy = new Common . UI . MenuItem ( {
iconCls : 'menu__icon btn-copy' ,
caption : me . textCopy ,
value : 'copy'
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuViewPaste = new Common . UI . MenuItem ( {
iconCls : 'menu__icon btn-paste' ,
caption : me . textPaste ,
value : 'paste'
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuViewCut = new Common . UI . MenuItem ( {
iconCls : 'menu__icon btn-cut' ,
caption : me . textCut ,
value : 'cut'
} ) ;
2017-06-06 08:04:04 +00:00
2022-04-27 19:24:39 +00:00
me . menuViewUndo = new Common . UI . MenuItem ( {
iconCls : 'menu__icon btn-undo' ,
caption : me . textUndo
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuViewCopySeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-02-02 15:12:20 +00:00
2022-04-27 19:24:39 +00:00
me . menuViewAddComment = new Common . UI . MenuItem ( {
iconCls : 'menu__icon btn-menu-comments' ,
caption : me . addCommentText
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuSignatureViewSign = new Common . UI . MenuItem ( { caption : this . strSign , value : 0 } ) ;
me . menuSignatureDetails = new Common . UI . MenuItem ( { caption : this . strDetails , value : 1 } ) ;
me . menuSignatureViewSetup = new Common . UI . MenuItem ( { caption : this . strSetup , value : 2 } ) ;
me . menuSignatureRemove = new Common . UI . MenuItem ( { caption : this . strDelete , value : 3 } ) ;
me . menuViewSignSeparator = new Common . UI . MenuItem ( { caption : '--' } ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuViewPrint = new Common . UI . MenuItem ( {
iconCls : 'menu__icon btn-print' ,
caption : me . txtPrintSelection
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
this . viewModeMenu = new Common . UI . Menu ( {
cls : 'shifted-right' ,
initMenu : function ( value ) {
var isInChart = ( value . imgProps && value . imgProps . value && ! _ . isNull ( value . imgProps . value . get _ChartProperties ( ) ) ) ,
isInShape = ( value . imgProps && value . imgProps . value && ! _ . isNull ( value . imgProps . value . get _ShapeProperties ( ) ) ) ,
signGuid = ( value . imgProps && value . imgProps . value && me . mode . isSignatureSupport ) ? value . imgProps . value . asc _getSignatureId ( ) : undefined ,
signProps = ( signGuid ) ? me . api . asc _getSignatureSetup ( signGuid ) : null ,
isInSign = ! ! signProps && me . _canProtect ,
control _lock = ( value . paraProps ) ? ( ! value . paraProps . value . can _DeleteBlockContentControl ( ) || ! value . paraProps . value . can _EditBlockContentControl ( ) ||
! value . paraProps . value . can _DeleteInlineContentControl ( ) || ! value . paraProps . value . can _EditInlineContentControl ( ) ) : false ,
canComment = ! isInChart && me . api . can _AddQuotedComment ( ) !== false && me . mode . canCoAuthoring && me . mode . canComments && ! me . _isDisabled && ! control _lock ,
canEditControl = false ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
if ( me . mode . compatibleFeatures )
canComment = canComment && ! isInShape ;
if ( me . api . asc _IsContentControl ( ) ) {
var control _props = me . api . asc _GetContentControlProperties ( ) ,
spectype = control _props ? control _props . get _SpecificType ( ) : Asc . c _oAscContentControlSpecificType . None ;
canComment = canComment && ! ( spectype == Asc . c _oAscContentControlSpecificType . CheckBox || spectype == Asc . c _oAscContentControlSpecificType . Picture ||
spectype == Asc . c _oAscContentControlSpecificType . ComboBox || spectype == Asc . c _oAscContentControlSpecificType . DropDownList || spectype == Asc . c _oAscContentControlSpecificType . DateTime ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
canEditControl = spectype !== undefined && ( spectype === Asc . c _oAscContentControlSpecificType . None || spectype === Asc . c _oAscContentControlSpecificType . ComboBox ) && ! control _lock ;
2016-03-11 00:48:53 +00:00
}
2022-04-27 19:24:39 +00:00
me . menuViewUndo . setVisible ( me . mode . canCoAuthoring && me . mode . canComments && ! me . _isDisabled ) ;
2022-05-04 19:34:10 +00:00
me . menuViewUndo . setDisabled ( ! me . api . asc _getCanUndo ( ) ) ;
2022-04-27 19:24:39 +00:00
me . menuViewCopySeparator . setVisible ( isInSign ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
var isRequested = ( signProps ) ? signProps . asc _getRequested ( ) : false ;
me . menuSignatureViewSign . setVisible ( isInSign && isRequested ) ;
me . menuSignatureDetails . setVisible ( isInSign && ! isRequested ) ;
me . menuSignatureViewSetup . setVisible ( isInSign ) ;
me . menuSignatureRemove . setVisible ( isInSign && ! isRequested ) ;
me . menuViewSignSeparator . setVisible ( canComment ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
if ( isInSign ) {
me . menuSignatureViewSign . cmpEl . attr ( 'data-value' , signGuid ) ; // sign
me . menuSignatureDetails . cmpEl . attr ( 'data-value' , signProps . asc _getId ( ) ) ; // view certificate
me . menuSignatureViewSetup . cmpEl . attr ( 'data-value' , signGuid ) ; // view signature settings
me . menuSignatureRemove . cmpEl . attr ( 'data-value' , signGuid ) ;
2016-03-11 00:48:53 +00:00
}
2022-04-27 19:24:39 +00:00
me . menuViewAddComment . setVisible ( canComment ) ;
me . menuViewAddComment . setDisabled ( value . paraProps && value . paraProps . locked === true ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
var disabled = value . paraProps && value . paraProps . locked === true ;
var cancopy = me . api && me . api . can _CopyCut ( ) ;
me . menuViewCopy . setDisabled ( ! cancopy ) ;
me . menuViewCut . setVisible ( me . _fillFormMode && canEditControl ) ;
me . menuViewCut . setDisabled ( disabled || ! cancopy ) ;
me . menuViewPaste . setVisible ( me . _fillFormMode && canEditControl ) ;
me . menuViewPaste . setDisabled ( disabled ) ;
2022-04-29 12:55:24 +00:00
me . menuViewPrint . setVisible ( me . mode . canPrint && ! me . _fillFormMode ) ;
2022-04-27 19:24:39 +00:00
me . menuViewPrint . setDisabled ( ! cancopy ) ;
2020-03-05 11:38:25 +00:00
2016-03-11 00:48:53 +00:00
} ,
2022-04-27 19:24:39 +00:00
items : [
me . menuViewCut ,
me . menuViewCopy ,
me . menuViewPaste ,
me . menuViewUndo ,
me . menuViewPrint ,
me . menuViewCopySeparator ,
me . menuSignatureViewSign ,
me . menuSignatureDetails ,
me . menuSignatureViewSetup ,
me . menuSignatureRemove ,
me . menuViewSignSeparator ,
me . menuViewAddComment
]
} ) . on ( 'hide:after' , function ( menu , e , isFromInputControl ) {
if ( me . suppressEditComplete ) {
me . suppressEditComplete = false ;
return ;
2016-03-11 00:48:53 +00:00
}
2022-04-27 19:24:39 +00:00
if ( ! isFromInputControl ) me . fireEvent ( 'editcomplete' , me ) ;
me . currentMenu = null ;
2016-03-11 00:48:53 +00:00
} ) ;
2022-04-27 19:24:39 +00:00
this . fireEvent ( 'createdelayedelements' , [ this , 'view' ] ) ;
} ,
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
createDelayedElementsPDFViewer : function ( ) {
var me = this ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuPDFViewCopy = new Common . UI . MenuItem ( {
iconCls : 'menu__icon btn-copy' ,
caption : me . textCopy ,
value : 'copy'
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
this . viewPDFModeMenu = new Common . UI . Menu ( {
cls : 'shifted-right' ,
initMenu : function ( value ) {
me . menuPDFViewCopy . setDisabled ( ! ( me . api && me . api . can _CopyCut ( ) ) ) ;
} ,
items : [
me . menuPDFViewCopy
]
} ) . on ( 'hide:after' , function ( menu , e , isFromInputControl ) {
if ( me . suppressEditComplete ) {
me . suppressEditComplete = false ;
return ;
2016-03-11 00:48:53 +00:00
}
2022-04-27 19:24:39 +00:00
if ( ! isFromInputControl ) me . fireEvent ( 'editcomplete' , me ) ;
me . currentMenu = null ;
} ) ;
2016-12-26 14:07:50 +00:00
2022-04-27 19:24:39 +00:00
this . fireEvent ( 'createdelayedelements' , [ this , 'pdf' ] ) ;
} ,
2016-12-26 14:07:50 +00:00
2022-04-27 19:24:39 +00:00
createDelayedElements : function ( ) {
var me = this ;
2016-12-26 14:07:50 +00:00
2022-04-27 19:24:39 +00:00
me . menuInsertCaption = new Common . UI . MenuItem ( {
caption : me . txtInsertCaption
} ) ;
var menuInsertCaptionSeparator = new Common . UI . MenuItem ( { caption : '--' } ) ;
2016-12-26 14:07:50 +00:00
2022-04-27 19:24:39 +00:00
me . menuEquationInsertCaption = new Common . UI . MenuItem ( {
caption : me . txtInsertCaption
} ) ;
var menuEquationInsertCaptionSeparator = new Common . UI . MenuItem ( { caption : '--' } ) ;
2016-12-26 14:07:50 +00:00
2022-05-04 13:51:53 +00:00
me . menuImageAlign = new Common . UI . MenuItem ( {
2022-04-27 19:24:39 +00:00
caption : me . textAlign ,
2022-05-04 13:51:53 +00:00
menu : new Common . UI . Menu ( {
cls : 'ppm-toolbar shifted-right' ,
menuAlign : 'tl-tr' ,
items : [
new Common . UI . MenuItem ( {
caption : me . textShapeAlignLeft ,
iconCls : 'menu__icon shape-align-left' ,
value : Asc . c _oAscAlignShapeType . ALIGN _LEFT
} ) ,
new Common . UI . MenuItem ( {
caption : me . textShapeAlignCenter ,
iconCls : 'menu__icon shape-align-center' ,
value : Asc . c _oAscAlignShapeType . ALIGN _CENTER
} ) ,
new Common . UI . MenuItem ( {
caption : me . textShapeAlignRight ,
iconCls : 'menu__icon shape-align-right' ,
value : Asc . c _oAscAlignShapeType . ALIGN _RIGHT
} ) ,
new Common . UI . MenuItem ( {
caption : me . textShapeAlignTop ,
iconCls : 'menu__icon shape-align-top' ,
value : Asc . c _oAscAlignShapeType . ALIGN _TOP
} ) ,
new Common . UI . MenuItem ( {
caption : me . textShapeAlignMiddle ,
iconCls : 'menu__icon shape-align-middle' ,
value : Asc . c _oAscAlignShapeType . ALIGN _MIDDLE
} ) ,
new Common . UI . MenuItem ( {
caption : me . textShapeAlignBottom ,
iconCls : 'menu__icon shape-align-bottom' ,
value : Asc . c _oAscAlignShapeType . ALIGN _BOTTOM
} ) ,
{ caption : '--' } ,
new Common . UI . MenuItem ( {
caption : me . txtDistribHor ,
iconCls : 'menu__icon shape-distribute-hor' ,
value : 6
} ) ,
new Common . UI . MenuItem ( {
caption : me . txtDistribVert ,
iconCls : 'menu__icon shape-distribute-vert' ,
value : 7
} )
]
} )
} ) ;
me . mnuGroup = new Common . UI . MenuItem ( {
2022-04-27 19:24:39 +00:00
caption : this . txtGroup ,
iconCls : 'menu__icon shape-group'
} ) ;
2017-05-12 08:52:19 +00:00
2022-05-04 13:51:53 +00:00
me . mnuUnGroup = new Common . UI . MenuItem ( {
2022-04-27 19:24:39 +00:00
iconCls : 'menu__icon shape-ungroup' ,
caption : this . txtUngroup
} ) ;
2017-05-12 08:52:19 +00:00
2022-05-04 13:51:53 +00:00
me . menuImageArrange = new Common . UI . MenuItem ( {
2022-04-27 19:24:39 +00:00
caption : me . textArrange ,
2022-05-04 13:51:53 +00:00
menu : new Common . UI . Menu ( {
cls : 'ppm-toolbar shifted-right' ,
menuAlign : 'tl-tr' ,
items : [
new Common . UI . MenuItem ( {
caption : me . textArrangeFront ,
iconCls : 'menu__icon arrange-front' ,
valign : Asc . c _oAscChangeLevel . BringToFront
} ) ,
new Common . UI . MenuItem ( {
caption : me . textArrangeBack ,
iconCls : 'menu__icon arrange-back' ,
valign : Asc . c _oAscChangeLevel . SendToBack
} ) ,
new Common . UI . MenuItem ( {
caption : me . textArrangeForward ,
iconCls : 'menu__icon arrange-forward' ,
valign : Asc . c _oAscChangeLevel . BringForward
} ) ,
new Common . UI . MenuItem ( {
caption : me . textArrangeBackward ,
iconCls : 'menu__icon arrange-backward' ,
valign : Asc . c _oAscChangeLevel . BringBackward
} ) ,
{ caption : '--' } ,
me . mnuGroup ,
me . mnuUnGroup
]
} )
} ) ;
2016-03-11 00:48:53 +00:00
2022-05-04 13:51:53 +00:00
me . menuWrapPolygon = new Common . UI . MenuItem ( {
2022-04-27 19:24:39 +00:00
caption : me . textEditWrapBoundary ,
cls : 'no-icon-wrap-item'
} ) ;
2016-03-11 00:48:53 +00:00
2022-05-04 13:51:53 +00:00
me . menuImageWrap = new Common . UI . MenuItem ( {
2022-04-27 19:24:39 +00:00
iconCls : 'menu__icon wrap-inline' ,
caption : me . textWrap ,
2022-05-04 13:51:53 +00:00
menu : new Common . UI . Menu ( {
cls : 'ppm-toolbar shifted-right' ,
menuAlign : 'tl-tr' ,
items : [
new Common . UI . MenuItem ( {
caption : me . txtInline ,
iconCls : 'menu__icon wrap-inline' ,
toggleGroup : 'popuppicturewrapping' ,
wrapType : Asc . c _oAscWrapStyle2 . Inline ,
checkmark : false ,
checkable : true
} ) ,
{ caption : '--' } ,
new Common . UI . MenuItem ( {
caption : me . txtSquare ,
iconCls : 'menu__icon wrap-square' ,
toggleGroup : 'popuppicturewrapping' ,
wrapType : Asc . c _oAscWrapStyle2 . Square ,
checkmark : false ,
checkable : true
} ) ,
new Common . UI . MenuItem ( {
caption : me . txtTight ,
iconCls : 'menu__icon wrap-tight' ,
toggleGroup : 'popuppicturewrapping' ,
wrapType : Asc . c _oAscWrapStyle2 . Tight ,
checkmark : false ,
checkable : true
} ) ,
new Common . UI . MenuItem ( {
caption : me . txtThrough ,
iconCls : 'menu__icon wrap-through' ,
toggleGroup : 'popuppicturewrapping' ,
wrapType : Asc . c _oAscWrapStyle2 . Through ,
checkmark : false ,
checkable : true
} ) ,
new Common . UI . MenuItem ( {
caption : me . txtTopAndBottom ,
iconCls : 'menu__icon wrap-topandbottom' ,
toggleGroup : 'popuppicturewrapping' ,
wrapType : Asc . c _oAscWrapStyle2 . TopAndBottom ,
checkmark : false ,
checkable : true
} ) ,
{ caption : '--' } ,
new Common . UI . MenuItem ( {
caption : me . txtInFront ,
iconCls : 'menu__icon wrap-infront' ,
toggleGroup : 'popuppicturewrapping' ,
wrapType : Asc . c _oAscWrapStyle2 . InFront ,
checkmark : false ,
checkable : true
} ) ,
new Common . UI . MenuItem ( {
caption : me . txtBehind ,
iconCls : 'menu__icon wrap-behind' ,
toggleGroup : 'popuppicturewrapping' ,
wrapType : Asc . c _oAscWrapStyle2 . Behind ,
checkmark : false ,
checkable : true
} ) ,
{ caption : '--' } ,
me . menuWrapPolygon
]
} )
} ) ;
2016-03-11 00:48:53 +00:00
2022-05-04 13:51:53 +00:00
me . menuImageAdvanced = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-menu-image' ,
2016-03-11 00:48:53 +00:00
caption : me . advancedText
} ) ;
2022-04-27 19:24:39 +00:00
me . menuChartEdit = new Common . UI . MenuItem ( {
2016-03-11 00:48:53 +00:00
caption : me . editChartText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2021-09-21 10:34:31 +00:00
var menuChartEditSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-05-04 13:51:53 +00:00
me . menuOriginalSize = new Common . UI . MenuItem ( {
2016-03-11 00:48:53 +00:00
caption : me . originalSizeText
} ) ;
2022-05-04 13:51:53 +00:00
me . menuImgReplace = new Common . UI . MenuItem ( {
2018-04-11 13:46:44 +00:00
caption : me . textReplace ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2018-04-11 13:46:44 +00:00
menuAlign : 'tl-tr' ,
items : [
2022-05-04 13:51:53 +00:00
new Common . UI . MenuItem ( { caption : this . textFromFile , value : 0 } ) ,
new Common . UI . MenuItem ( { caption : this . textFromUrl , value : 1 } ) ,
new Common . UI . MenuItem ( { caption : this . textFromStorage , value : 2 } )
2018-04-11 13:46:44 +00:00
]
} )
} ) ;
2022-04-27 19:24:39 +00:00
me . menuImgCopy = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-copy' ,
2016-03-11 00:48:53 +00:00
caption : me . textCopy ,
value : 'copy'
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuImgPaste = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-paste' ,
2016-03-11 00:48:53 +00:00
caption : me . textPaste ,
value : 'paste'
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuImgCut = new Common . UI . MenuItem ( {
2020-08-25 12:34:03 +00:00
iconCls : 'menu__icon btn-cut' ,
2016-03-11 00:48:53 +00:00
caption : me . textCut ,
value : 'cut'
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuImgAccept = new Common . UI . MenuItem ( {
2022-01-20 21:11:12 +00:00
caption : me . textAccept ,
value : 'accept'
2022-04-27 19:24:39 +00:00
} ) ;
2022-01-20 21:11:12 +00:00
2022-04-27 19:24:39 +00:00
me . menuImgReject = new Common . UI . MenuItem ( {
2022-01-20 21:11:12 +00:00
caption : me . textReject ,
value : 'reject'
2022-04-27 19:24:39 +00:00
} ) ;
2022-01-20 21:11:12 +00:00
var menuImgReviewSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-04-27 19:24:39 +00:00
me . menuImgPrint = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-print' ,
2019-08-07 09:16:40 +00:00
caption : me . txtPrintSelection
2022-04-27 19:24:39 +00:00
} ) ;
2019-08-07 09:16:40 +00:00
2022-04-27 19:24:39 +00:00
me . menuSignatureEditSign = new Common . UI . MenuItem ( { caption : this . strSign , value : 0 } ) ;
me . menuSignatureEditSetup = new Common . UI . MenuItem ( { caption : this . strSetup , value : 2 } ) ;
2017-11-22 08:41:47 +00:00
var menuEditSignSeparator = new Common . UI . MenuItem ( { caption : '--' } ) ;
2022-04-27 19:24:39 +00:00
me . menuImgRotate = new Common . UI . MenuItem ( {
2019-02-26 15:59:16 +00:00
caption : me . textRotate ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2019-02-26 15:59:16 +00:00
menuAlign : 'tl-tr' ,
items : [
new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-rotate-90' ,
2019-02-26 15:59:16 +00:00
caption : this . textRotate90 ,
value : 1
2022-04-27 19:24:39 +00:00
} ) ,
2019-02-27 10:11:28 +00:00
new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-rotate-270' ,
2019-02-27 10:11:28 +00:00
caption : this . textRotate270 ,
value : 0
2022-04-27 19:24:39 +00:00
} ) ,
2019-02-27 11:51:52 +00:00
{ caption : '--' } ,
2019-02-26 15:59:16 +00:00
new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-flip-hor' ,
2019-02-26 15:59:16 +00:00
caption : this . textFlipH ,
value : 1
2022-04-27 19:24:39 +00:00
} ) ,
2019-02-26 15:59:16 +00:00
new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-flip-vert' ,
2019-02-26 15:59:16 +00:00
caption : this . textFlipV ,
value : 0
2022-04-27 19:24:39 +00:00
} )
2019-02-26 15:59:16 +00:00
]
} )
} ) ;
2019-04-09 10:41:08 +00:00
me . menuImgCrop = new Common . UI . MenuItem ( {
caption : me . textCrop ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2019-04-09 10:41:08 +00:00
menuAlign : 'tl-tr' ,
items : [
new Common . UI . MenuItem ( {
2019-04-09 11:29:51 +00:00
caption : me . textCrop ,
2019-04-09 10:41:08 +00:00
checkable : true ,
allowDepress : true ,
value : 0
2022-04-27 19:24:39 +00:00
} ) ,
2019-04-09 10:41:08 +00:00
new Common . UI . MenuItem ( {
2019-04-09 11:29:51 +00:00
caption : me . textCropFill ,
2019-04-09 10:41:08 +00:00
value : 1
2022-04-27 19:24:39 +00:00
} ) ,
2019-04-09 10:41:08 +00:00
new Common . UI . MenuItem ( {
2019-04-09 11:29:51 +00:00
caption : me . textCropFit ,
2019-04-09 10:41:08 +00:00
value : 2
2022-04-27 19:24:39 +00:00
} )
2019-04-09 10:41:08 +00:00
]
} )
} ) ;
2022-04-27 19:24:39 +00:00
me . menuImgRemoveControl = new Common . UI . MenuItem ( {
2020-12-23 14:29:31 +00:00
iconCls : 'menu__icon cc-remove' ,
caption : me . textRemoveControl ,
value : 'remove'
2022-04-27 19:24:39 +00:00
} ) ;
2020-12-23 14:29:31 +00:00
2022-04-27 19:24:39 +00:00
me . menuImgControlSettings = new Common . UI . MenuItem ( {
2020-12-23 14:29:31 +00:00
caption : me . textEditControls ,
value : 'settings'
2022-04-27 19:24:39 +00:00
} ) ;
2020-12-23 14:29:31 +00:00
var menuImgControlSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-05-04 13:51:53 +00:00
me . menuImgEditPoints = new Common . UI . MenuItem ( {
2021-09-21 10:34:31 +00:00
caption : me . textEditPoints
} ) ;
var menuImgEditPointsSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2016-03-11 00:48:53 +00:00
this . pictureMenu = new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2022-02-09 19:51:43 +00:00
restoreHeightAndTop : true ,
2016-03-11 00:48:53 +00:00
initMenu : function ( value ) {
if ( _ . isUndefined ( value . imgProps ) )
return ;
var notflow = ! value . imgProps . value . get _CanBeFlow ( ) ,
wrapping = value . imgProps . value . get _WrappingStyle ( ) ;
me . menuImageWrap . _originalProps = value . imgProps . value ;
2020-08-18 11:02:44 +00:00
var cls = 'menu__icon ' ;
2016-03-11 00:48:53 +00:00
if ( notflow ) {
2022-01-12 13:54:46 +00:00
for ( var i = 0 ; i < 8 ; i ++ ) {
2016-03-11 00:48:53 +00:00
me . menuImageWrap . menu . items [ i ] . setChecked ( false ) ;
}
2020-08-18 11:02:44 +00:00
cls += 'wrap-inline' ;
2016-03-11 00:48:53 +00:00
} else {
switch ( wrapping ) {
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . Inline :
2016-03-11 00:48:53 +00:00
me . menuImageWrap . menu . items [ 0 ] . setChecked ( true ) ;
2020-08-18 11:02:44 +00:00
cls += 'wrap-inline' ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . Square :
2022-01-12 13:54:46 +00:00
me . menuImageWrap . menu . items [ 2 ] . setChecked ( true ) ;
2020-08-18 11:02:44 +00:00
cls += 'wrap-square' ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . Tight :
2022-01-12 13:54:46 +00:00
me . menuImageWrap . menu . items [ 3 ] . setChecked ( true ) ;
2020-08-18 11:02:44 +00:00
cls += 'wrap-tight' ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . Through :
2022-01-12 13:54:46 +00:00
me . menuImageWrap . menu . items [ 4 ] . setChecked ( true ) ;
2020-08-18 11:02:44 +00:00
cls += 'wrap-through' ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . TopAndBottom :
2022-01-12 13:54:46 +00:00
me . menuImageWrap . menu . items [ 5 ] . setChecked ( true ) ;
2020-08-18 11:02:44 +00:00
cls += 'wrap-topandbottom' ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . Behind :
2022-01-12 13:54:46 +00:00
me . menuImageWrap . menu . items [ 8 ] . setChecked ( true ) ;
2020-08-18 11:02:44 +00:00
cls += 'wrap-behind' ;
2016-03-11 00:48:53 +00:00
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . InFront :
2022-01-12 13:54:46 +00:00
me . menuImageWrap . menu . items [ 7 ] . setChecked ( true ) ;
2020-08-18 11:02:44 +00:00
cls += 'wrap-infront' ;
2016-03-11 00:48:53 +00:00
break ;
default :
2022-01-12 13:54:46 +00:00
for ( var i = 0 ; i < 8 ; i ++ ) {
2016-03-11 00:48:53 +00:00
me . menuImageWrap . menu . items [ i ] . setChecked ( false ) ;
}
2020-08-18 11:02:44 +00:00
cls += 'wrap-infront' ;
2016-03-11 00:48:53 +00:00
break ;
}
}
2020-08-18 11:02:44 +00:00
me . menuImageWrap . setIconCls ( cls ) ;
2016-03-11 00:48:53 +00:00
_ . each ( me . menuImageWrap . menu . items , function ( item ) {
item . setDisabled ( notflow ) ;
} ) ;
var onlyCommonProps = ( value . imgProps . isImg && value . imgProps . isChart || value . imgProps . isImg && value . imgProps . isShape ||
2022-05-04 13:51:53 +00:00
value . imgProps . isShape && value . imgProps . isChart ) ;
2020-08-18 11:02:44 +00:00
if ( onlyCommonProps ) {
2022-05-04 13:51:53 +00:00
me . menuImageAdvanced . setCaption ( me . advancedText , true ) ;
me . menuImageAdvanced . setIconCls ( 'menu__icon btn-menu-image' ) ;
2020-08-18 11:02:44 +00:00
} else {
2022-05-04 13:51:53 +00:00
me . menuImageAdvanced . setCaption ( ( value . imgProps . isImg ) ? me . imageText : ( ( value . imgProps . isChart ) ? me . chartText : me . shapeText ) , true ) ;
me . menuImageAdvanced . setIconCls ( 'menu__icon ' + ( value . imgProps . isImg ? 'btn-menu-image' : ( value . imgProps . isChart ? 'btn-menu-chart' : 'btn-menu-shape' ) ) ) ;
2016-03-11 00:48:53 +00:00
}
2022-04-27 19:24:39 +00:00
me . menuChartEdit . setVisible ( ! _ . isNull ( value . imgProps . value . get _ChartProperties ( ) ) && ! onlyCommonProps ) ;
2018-04-11 13:46:44 +00:00
me . menuOriginalSize . setVisible ( value . imgProps . isOnlyImg || ! value . imgProps . isChart && ! value . imgProps . isShape ) ;
2020-12-23 14:29:31 +00:00
var in _control = me . api . asc _IsContentControl ( ) ,
control _props = in _control ? me . api . asc _GetContentControlProperties ( ) : null ,
2019-12-20 13:23:44 +00:00
lock _type = ( control _props ) ? control _props . get _Lock ( ) : Asc . c _oAscSdtLockType . Unlocked ,
2020-12-23 14:29:31 +00:00
content _locked = lock _type == Asc . c _oAscSdtLockType . SdtContentLocked || lock _type == Asc . c _oAscSdtLockType . ContentLocked ,
is _form = control _props && control _props . get _FormPr ( ) ;
2022-04-27 19:24:39 +00:00
me . menuImgRemoveControl . setVisible ( in _control ) ;
me . menuImgControlSettings . setVisible ( in _control && me . mode . canEditContentControl && ! is _form ) ;
2020-12-23 14:29:31 +00:00
menuImgControlSeparator . setVisible ( in _control ) ;
if ( in _control ) {
2022-04-27 19:24:39 +00:00
me . menuImgRemoveControl . setDisabled ( lock _type == Asc . c _oAscSdtLockType . SdtContentLocked || lock _type == Asc . c _oAscSdtLockType . SdtLocked ) ;
me . menuImgRemoveControl . setCaption ( is _form ? me . getControlLabel ( control _props ) : me . textRemoveControl ) ;
2020-12-23 14:29:31 +00:00
}
2019-12-20 13:23:44 +00:00
var islocked = value . imgProps . locked || ( value . headerProps !== undefined && value . headerProps . locked ) || content _locked ;
2018-04-11 13:46:44 +00:00
var pluginGuid = value . imgProps . value . asc _getPluginGuid ( ) ;
2022-05-04 13:51:53 +00:00
me . menuImgReplace . setVisible ( value . imgProps . isOnlyImg && ( pluginGuid === null || pluginGuid === undefined ) ) ;
if ( me . menuImgReplace . isVisible ( ) )
me . menuImgReplace . setDisabled ( islocked || pluginGuid === null ) ;
me . menuImgReplace . menu . items [ 2 ] . setVisible ( me . mode . canRequestInsertImage || me . mode . fileChoiceUrl && me . mode . fileChoiceUrl . indexOf ( "{documentType}" ) > - 1 ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuImgRotate . setVisible ( ! value . imgProps . isChart && ( pluginGuid === null || pluginGuid === undefined ) ) ;
if ( me . menuImgRotate . isVisible ( ) ) {
me . menuImgRotate . setDisabled ( islocked || value . imgProps . isSmartArt ) ;
me . menuImgRotate . menu . items [ 3 ] . setDisabled ( value . imgProps . isSmartArtInternal ) ;
me . menuImgRotate . menu . items [ 4 ] . setDisabled ( value . imgProps . isSmartArtInternal ) ;
2022-03-28 12:31:59 +00:00
}
2019-04-09 10:41:08 +00:00
me . menuImgCrop . setVisible ( me . api . asc _canEditCrop ( ) ) ;
if ( me . menuImgCrop . isVisible ( ) )
me . menuImgCrop . setDisabled ( islocked ) ;
2022-04-27 19:24:39 +00:00
if ( me . menuChartEdit . isVisible ( ) )
me . menuChartEdit . setDisabled ( islocked || value . imgProps . value . get _SeveralCharts ( ) ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
menuChartEditSeparator . setVisible ( me . menuChartEdit . isVisible ( ) ) ;
2018-04-11 13:46:44 +00:00
2016-03-11 00:48:53 +00:00
me . menuOriginalSize . setDisabled ( islocked || value . imgProps . value . get _ImageUrl ( ) === null || value . imgProps . value . get _ImageUrl ( ) === undefined ) ;
2022-05-04 13:51:53 +00:00
me . menuImageAdvanced . setDisabled ( islocked ) ;
me . menuImageAlign . setDisabled ( islocked || ( wrapping == Asc . c _oAscWrapStyle2 . Inline ) ) ;
2019-02-12 12:31:27 +00:00
if ( ! ( islocked || ( wrapping == Asc . c _oAscWrapStyle2 . Inline ) ) ) {
var objcount = me . api . asc _getSelectedDrawingObjectsCount ( ) ,
alignto = Common . Utils . InternalSettings . get ( "de-img-align-to" ) ; // 1 - page, 2 - margin, 3 - selected
2022-05-04 13:51:53 +00:00
me . menuImageAlign . menu . items [ 7 ] . setDisabled ( objcount == 2 && ( ! alignto || alignto == 3 ) ) ;
me . menuImageAlign . menu . items [ 8 ] . setDisabled ( objcount == 2 && ( ! alignto || alignto == 3 ) ) ;
2019-02-12 12:31:27 +00:00
}
2022-05-04 13:51:53 +00:00
me . menuImageArrange . setDisabled ( ( wrapping == Asc . c _oAscWrapStyle2 . Inline ) && ! value . imgProps . value . get _FromGroup ( ) || content _locked ||
( me . api && ! me . api . CanUnGroup ( ) && ! me . api . CanGroup ( ) && value . imgProps . isSmartArtInternal ) ) ;
me . menuImageArrange . menu . items [ 0 ] . setDisabled ( value . imgProps . isSmartArtInternal ) ;
me . menuImageArrange . menu . items [ 1 ] . setDisabled ( value . imgProps . isSmartArtInternal ) ;
me . menuImageArrange . menu . items [ 2 ] . setDisabled ( value . imgProps . isSmartArtInternal ) ;
me . menuImageArrange . menu . items [ 3 ] . setDisabled ( value . imgProps . isSmartArtInternal ) ;
2016-03-11 00:48:53 +00:00
if ( me . api ) {
2022-05-04 13:51:53 +00:00
me . mnuUnGroup . setDisabled ( islocked || ! me . api . CanUnGroup ( ) ) ;
me . mnuGroup . setDisabled ( islocked || ! me . api . CanGroup ( ) ) ;
me . menuWrapPolygon . setDisabled ( islocked || ! me . api . CanChangeWrapPolygon ( ) ) ;
2016-03-11 00:48:53 +00:00
}
2022-05-04 13:51:53 +00:00
me . menuImageWrap . setDisabled ( islocked || value . imgProps . value . get _FromGroup ( ) || ( notflow && me . menuWrapPolygon . isDisabled ( ) ) ||
2021-12-01 20:24:03 +00:00
( ! ! control _props && control _props . get _SpecificType ( ) == Asc . c _oAscContentControlSpecificType . Picture && ! control _props . get _FormPr ( ) ) ) ;
2016-03-11 00:48:53 +00:00
var cancopy = me . api && me . api . can _CopyCut ( ) ;
2022-04-27 19:24:39 +00:00
me . menuImgCopy . setDisabled ( ! cancopy ) ;
me . menuImgCut . setDisabled ( islocked || ! cancopy ) ;
me . menuImgPaste . setDisabled ( islocked ) ;
me . menuImgPrint . setVisible ( me . mode . canPrint ) ;
me . menuImgPrint . setDisabled ( ! cancopy ) ;
2017-11-22 08:41:47 +00:00
2022-01-20 21:11:12 +00:00
var lockreview = Common . Utils . InternalSettings . get ( "de-accept-reject-lock" ) ;
2022-04-27 19:24:39 +00:00
me . menuImgAccept . setVisible ( ! lockreview ) ;
me . menuImgReject . setVisible ( ! lockreview ) ;
2022-01-20 21:11:12 +00:00
menuImgReviewSeparator . setVisible ( ! lockreview ) ;
2018-08-01 16:08:24 +00:00
var signGuid = ( value . imgProps && value . imgProps . value && me . mode . isSignatureSupport ) ? value . imgProps . value . asc _getSignatureId ( ) : undefined ,
2017-11-24 11:47:48 +00:00
isInSign = ! ! signGuid ;
2022-04-27 19:24:39 +00:00
me . menuSignatureEditSign . setVisible ( isInSign ) ;
me . menuSignatureEditSetup . setVisible ( isInSign ) ;
2017-11-22 08:41:47 +00:00
menuEditSignSeparator . setVisible ( isInSign ) ;
if ( isInSign ) {
2022-04-27 19:24:39 +00:00
me . menuSignatureEditSign . cmpEl . attr ( 'data-value' , signGuid ) ; // sign
me . menuSignatureEditSetup . cmpEl . attr ( 'data-value' , signGuid ) ; // edit signature settings
2017-11-22 08:41:47 +00:00
}
2021-09-21 10:34:31 +00:00
var canEditPoints = me . api && me . api . asc _canEditGeometry ( ) ;
2022-05-04 13:51:53 +00:00
me . menuImgEditPoints . setVisible ( canEditPoints ) ;
2021-09-21 10:34:31 +00:00
menuImgEditPointsSeparator . setVisible ( canEditPoints ) ;
2022-05-04 13:51:53 +00:00
canEditPoints && me . menuImgEditPoints . setDisabled ( islocked ) ;
2016-03-11 00:48:53 +00:00
} ,
items : [
2022-04-27 19:24:39 +00:00
me . menuImgCut ,
me . menuImgCopy ,
me . menuImgPaste ,
me . menuImgPrint ,
2016-03-11 00:48:53 +00:00
{ caption : '--' } ,
2022-04-27 19:24:39 +00:00
me . menuImgAccept ,
me . menuImgReject ,
2022-01-20 21:11:12 +00:00
menuImgReviewSeparator ,
2022-04-27 19:24:39 +00:00
me . menuSignatureEditSign ,
me . menuSignatureEditSetup ,
2017-11-22 08:41:47 +00:00
menuEditSignSeparator ,
2022-04-27 19:24:39 +00:00
me . menuImgRemoveControl ,
me . menuImgControlSettings ,
2020-12-23 14:29:31 +00:00
menuImgControlSeparator ,
2022-05-04 13:51:53 +00:00
me . menuImgEditPoints ,
2021-09-21 10:34:31 +00:00
menuImgEditPointsSeparator ,
2022-05-04 13:51:53 +00:00
me . menuImageArrange ,
me . menuImageAlign ,
2016-03-11 00:48:53 +00:00
me . menuImageWrap ,
2022-04-27 19:24:39 +00:00
me . menuImgRotate ,
2016-03-11 00:48:53 +00:00
{ caption : '--' } ,
2022-04-27 19:24:39 +00:00
me . menuInsertCaption ,
2019-09-21 08:52:21 +00:00
menuInsertCaptionSeparator ,
2019-04-09 10:41:08 +00:00
me . menuImgCrop ,
2016-03-11 00:48:53 +00:00
me . menuOriginalSize ,
2022-05-04 13:51:53 +00:00
me . menuImgReplace ,
2022-04-27 19:24:39 +00:00
me . menuChartEdit ,
2021-09-21 10:34:31 +00:00
menuChartEditSeparator ,
2022-05-04 13:51:53 +00:00
me . menuImageAdvanced
2016-03-11 00:48:53 +00:00
]
2017-04-12 09:45:16 +00:00
} ) . on ( 'hide:after' , function ( menu , e , isFromInputControl ) {
if ( ! isFromInputControl ) me . fireEvent ( 'editcomplete' , me ) ;
2016-03-11 00:48:53 +00:00
me . currentMenu = null ;
} ) ;
/* table menu*/
2022-04-27 19:24:39 +00:00
me . menuTableInsertCaption = new Common . UI . MenuItem ( {
2019-09-21 08:52:21 +00:00
caption : me . txtInsertCaption
2022-04-27 19:24:39 +00:00
} ) ;
2019-09-21 08:52:21 +00:00
2022-05-04 19:18:04 +00:00
me . mnuTableMerge = new Common . UI . MenuItem ( {
2021-04-01 21:02:05 +00:00
iconCls : 'menu__icon btn-merge-cells' ,
2016-03-11 00:48:53 +00:00
caption : me . mergeCellsText
} ) ;
2022-05-04 19:18:04 +00:00
me . mnuTableSplit = new Common . UI . MenuItem ( {
2016-03-11 00:48:53 +00:00
caption : me . splitCellsText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuTableCellAlign = new Common . UI . MenuItem ( {
2020-08-20 18:03:07 +00:00
iconCls : 'menu__icon btn-align-top' ,
2016-03-11 00:48:53 +00:00
caption : me . cellAlignText ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
items : [
me . menuTableCellTop = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-align-top' ,
2017-06-06 08:29:30 +00:00
caption : me . textShapeAlignTop ,
2016-03-11 00:48:53 +00:00
toggleGroup : 'popuptablecellalign' ,
2020-08-18 11:02:44 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checkable : true ,
checked : false ,
2016-04-05 11:52:34 +00:00
valign : Asc . c _oAscVertAlignJc . Top
2022-04-27 19:24:39 +00:00
} ) ,
2016-03-11 00:48:53 +00:00
me . menuTableCellCenter = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-align-middle' ,
2017-06-06 08:29:30 +00:00
caption : me . textShapeAlignMiddle ,
2016-03-11 00:48:53 +00:00
toggleGroup : 'popuptablecellalign' ,
2020-08-18 11:02:44 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checkable : true ,
checked : false ,
2016-04-05 11:52:34 +00:00
valign : Asc . c _oAscVertAlignJc . Center
2022-04-27 19:24:39 +00:00
} ) ,
2016-03-11 00:48:53 +00:00
me . menuTableCellBottom = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-align-bottom' ,
2017-06-06 08:29:30 +00:00
caption : me . textShapeAlignBottom ,
2016-03-11 00:48:53 +00:00
toggleGroup : 'popuptablecellalign' ,
2020-08-18 11:02:44 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checkable : true ,
checked : false ,
2016-04-05 11:52:34 +00:00
valign : Asc . c _oAscVertAlignJc . Bottom
2022-04-27 19:24:39 +00:00
} )
2016-03-11 00:48:53 +00:00
]
} )
} ) ;
2022-04-27 19:24:39 +00:00
me . menuTableAdvanced = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-menu-table' ,
2016-03-11 00:48:53 +00:00
caption : me . advancedTableText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuParagraphAdvancedInTable = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-paragraph' ,
2016-03-11 00:48:53 +00:00
caption : me . advancedParagraphText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
var menuHyperlinkSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-04-27 19:24:39 +00:00
me . menuEditHyperlinkTable = new Common . UI . MenuItem ( {
2016-03-11 00:48:53 +00:00
caption : me . editHyperlinkText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-05-04 19:18:04 +00:00
me . menuRemoveHyperlinkTable = new Common . UI . MenuItem ( {
2016-03-11 00:48:53 +00:00
caption : me . removeHyperlinkText
} ) ;
var menuHyperlinkTable = new Common . UI . MenuItem ( {
2020-08-25 12:34:03 +00:00
iconCls : 'menu__icon btn-inserthyperlink' ,
2016-03-11 00:48:53 +00:00
caption : me . hyperlinkText ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
items : [
2022-04-27 19:24:39 +00:00
me . menuEditHyperlinkTable ,
2022-05-04 19:18:04 +00:00
me . menuRemoveHyperlinkTable
2016-03-11 00:48:53 +00:00
]
} )
} ) ;
2022-04-27 19:24:39 +00:00
me . menuTableRemoveForm = new Common . UI . MenuItem ( {
2020-10-07 16:13:24 +00:00
iconCls : 'menu__icon cc-remove' ,
2017-12-13 13:52:14 +00:00
caption : me . textRemove ,
value : 'remove'
2022-04-27 19:24:39 +00:00
} ) ;
2017-12-13 13:52:14 +00:00
2022-04-27 19:24:39 +00:00
me . menuTableRemoveControl = new Common . UI . MenuItem ( {
2022-02-07 12:50:32 +00:00
iconCls : 'menu__icon cc-remove' ,
caption : me . textRemoveControl ,
value : 'remove'
2022-04-27 19:24:39 +00:00
} ) ;
2022-02-07 12:50:32 +00:00
2022-04-27 19:24:39 +00:00
me . menuTableControlSettings = new Common . UI . MenuItem ( {
2020-10-07 16:13:24 +00:00
caption : me . textSettings ,
value : 'settings'
2022-04-27 19:24:39 +00:00
} ) ;
2017-12-13 13:52:14 +00:00
var menuTableControl = new Common . UI . MenuItem ( {
caption : me . textContentControls ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2017-12-13 13:52:14 +00:00
menuAlign : 'tl-tr' ,
items : [
2022-04-27 19:24:39 +00:00
me . menuTableRemoveControl ,
me . menuTableControlSettings
2017-12-13 13:52:14 +00:00
]
} )
} ) ;
2022-05-04 20:18:05 +00:00
me . menuTableTOC = new Common . UI . MenuItem ( {
2018-02-08 13:03:10 +00:00
caption : me . textTOC ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2018-02-08 13:03:10 +00:00
menuAlign : 'tl-tr' ,
items : [
{
caption : me . textSettings ,
value : 'settings'
} ,
{
caption : me . textUpdateAll ,
value : 'all'
} ,
{
caption : me . textUpdatePages ,
value : 'pages'
}
]
} )
} ) ;
2016-03-11 00:48:53 +00:00
/** coauthoring begin **/
2022-04-27 19:24:39 +00:00
me . menuAddCommentTable = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-menu-comments' ,
2016-03-11 00:48:53 +00:00
caption : me . addCommentText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
/** coauthoring end **/
2022-04-27 19:24:39 +00:00
me . menuAddHyperlinkTable = new Common . UI . MenuItem ( {
2020-08-25 12:34:03 +00:00
iconCls : 'menu__icon btn-inserthyperlink' ,
2016-03-11 00:48:53 +00:00
caption : me . hyperlinkText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuTableFollow = new Common . UI . MenuItem ( {
2019-04-15 14:37:15 +00:00
caption : me . textFollow
2022-04-27 19:24:39 +00:00
} ) ;
2019-04-15 14:37:15 +00:00
2016-03-11 00:48:53 +00:00
me . menuSpellTable = new Common . UI . MenuItem ( {
caption : me . loadSpellText ,
disabled : true
} ) ;
me . menuSpellMoreTable = new Common . UI . MenuItem ( {
caption : me . moreText ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
2019-06-21 07:46:00 +00:00
restoreHeight : true ,
2016-03-11 00:48:53 +00:00
items : [
]
} )
} ) ;
2019-08-10 13:38:51 +00:00
var langTemplate = _ . template ( [
2019-08-10 14:02:16 +00:00
'<a id="<%= id %>" tabindex="-1" type="menuitem" style="padding-left: 28px !important;" langval="<%= value %>" class="<% if (checked) { %> checked <% } %>">' ,
2019-12-10 13:49:35 +00:00
'<i class="icon <% if (spellcheck) { %> toolbar__icon btn-ic-docspell spellcheck-lang <% } %>"></i>' ,
2019-08-10 13:38:51 +00:00
'<%= caption %>' ,
'</a>'
] . join ( '' ) ) ;
2016-03-11 00:48:53 +00:00
me . langTableMenu = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-ic-doclang' ,
2016-03-11 00:48:53 +00:00
caption : me . langText ,
2019-08-10 13:38:51 +00:00
menu : new Common . UI . MenuSimple ( {
2019-01-28 13:51:07 +00:00
cls : 'lang-menu' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
2019-08-07 10:06:36 +00:00
restoreHeight : 285 ,
2019-07-11 11:35:24 +00:00
items : [ ] ,
2019-08-10 13:38:51 +00:00
itemTemplate : langTemplate ,
2019-07-11 11:35:24 +00:00
search : true
2016-03-11 00:48:53 +00:00
} )
} ) ;
2022-05-04 19:18:04 +00:00
me . menuIgnoreSpellTable = new Common . UI . MenuItem ( {
caption : me . ignoreSpellText ,
value : false
2016-03-11 00:48:53 +00:00
} ) ;
2022-05-04 19:18:04 +00:00
me . menuIgnoreAllSpellTable = new Common . UI . MenuItem ( {
caption : me . ignoreAllSpellText ,
value : true
2016-03-11 00:48:53 +00:00
} ) ;
2022-05-04 19:18:04 +00:00
me . menuToDictionaryTable = new Common . UI . MenuItem ( {
2019-08-05 08:59:52 +00:00
caption : me . toDictionaryText
} ) ;
2016-03-11 00:48:53 +00:00
var menuIgnoreSpellTableSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
var menuSpellcheckTableSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
me . menuSpellCheckTable = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-ic-docspell' ,
2016-03-11 00:48:53 +00:00
caption : me . spellcheckText ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
items : [
me . menuSpellTable ,
me . menuSpellMoreTable ,
menuIgnoreSpellTableSeparator ,
2022-05-04 19:18:04 +00:00
me . menuIgnoreSpellTable ,
me . menuIgnoreAllSpellTable ,
me . menuToDictionaryTable ,
2016-03-11 00:48:53 +00:00
{ caption : '--' } ,
me . langTableMenu
]
} )
} ) ;
2022-04-27 19:24:39 +00:00
me . menuTableCopy = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-copy' ,
2016-03-11 00:48:53 +00:00
caption : me . textCopy ,
value : 'copy'
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuTablePaste = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-paste' ,
2016-03-11 00:48:53 +00:00
caption : me . textPaste ,
value : 'paste'
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuTableCut = new Common . UI . MenuItem ( {
2020-08-25 12:34:03 +00:00
iconCls : 'menu__icon btn-cut' ,
2016-03-11 00:48:53 +00:00
caption : me . textCut ,
value : 'cut'
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuTableAccept = new Common . UI . MenuItem ( {
2022-01-20 21:11:12 +00:00
caption : me . textAccept ,
value : 'accept'
2022-04-27 19:24:39 +00:00
} ) ;
2022-01-20 21:11:12 +00:00
2022-04-27 19:24:39 +00:00
me . menuTableReject = new Common . UI . MenuItem ( {
2022-01-20 21:11:12 +00:00
caption : me . textReject ,
value : 'reject'
2022-04-27 19:24:39 +00:00
} ) ;
2022-01-20 21:11:12 +00:00
var menuTableReviewSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-04-27 19:24:39 +00:00
me . menuTablePrint = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-print' ,
2019-08-07 09:16:40 +00:00
caption : me . txtPrintSelection
2022-04-27 19:24:39 +00:00
} ) ;
2019-08-07 09:16:40 +00:00
2016-03-11 00:48:53 +00:00
var menuEquationSeparatorInTable = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-05-04 19:18:04 +00:00
me . menuTableDistRows = new Common . UI . MenuItem ( {
caption : me . textDistributeRows ,
value : false
} ) ;
me . menuTableDistCols = new Common . UI . MenuItem ( {
caption : me . textDistributeCols ,
value : true
} ) ;
2016-03-11 00:48:53 +00:00
2022-05-04 19:18:04 +00:00
me . menuTableDirection = new Common . UI . MenuItem ( {
2020-08-20 18:03:07 +00:00
iconCls : 'menu__icon text-orient-hor' ,
2016-03-11 00:48:53 +00:00
caption : me . directionText ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'ppm-toolbar shifted-right' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
items : [
me . menuTableDirectH = new Common . UI . MenuItem ( {
caption : me . directHText ,
2019-11-21 07:58:05 +00:00
iconCls : 'menu__icon text-orient-hor' ,
2016-03-11 00:48:53 +00:00
checkable : true ,
2019-11-21 07:58:05 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checked : false ,
toggleGroup : 'popuptabledirect' ,
2016-04-05 11:52:34 +00:00
direction : Asc . c _oAscCellTextDirection . LRTB
2022-05-04 19:18:04 +00:00
} ) ,
2016-03-11 00:48:53 +00:00
me . menuTableDirect90 = new Common . UI . MenuItem ( {
caption : me . direct90Text ,
2019-11-21 07:58:05 +00:00
iconCls : 'menu__icon text-orient-rdown' ,
2016-03-11 00:48:53 +00:00
checkable : true ,
2019-11-21 07:58:05 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checked : false ,
toggleGroup : 'popuptabledirect' ,
2016-04-05 11:52:34 +00:00
direction : Asc . c _oAscCellTextDirection . TBRL
2022-05-04 19:18:04 +00:00
} ) ,
2016-03-11 00:48:53 +00:00
me . menuTableDirect270 = new Common . UI . MenuItem ( {
caption : me . direct270Text ,
2019-11-21 07:58:05 +00:00
iconCls : 'menu__icon text-orient-rup' ,
2016-03-11 00:48:53 +00:00
checkable : true ,
2019-11-21 07:58:05 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checked : false ,
toggleGroup : 'popuptabledirect' ,
2016-04-05 11:52:34 +00:00
direction : Asc . c _oAscCellTextDirection . BTLR
2022-05-04 19:18:04 +00:00
} )
2016-03-11 00:48:53 +00:00
]
} )
} ) ;
2022-04-27 19:24:39 +00:00
me . menuTableStartNewList = new Common . UI . MenuItem ( {
2018-07-20 09:55:03 +00:00
caption : me . textStartNewList
2022-04-27 19:24:39 +00:00
} ) ;
2018-07-20 09:55:03 +00:00
2022-04-27 19:24:39 +00:00
me . menuTableStartNumberingFrom = new Common . UI . MenuItem ( {
2018-07-20 09:55:03 +00:00
caption : me . textStartNumberingFrom
2022-04-27 19:24:39 +00:00
} ) ;
2018-07-20 09:55:03 +00:00
2022-04-27 19:24:39 +00:00
me . menuTableContinueNumbering = new Common . UI . MenuItem ( {
2018-07-20 09:55:03 +00:00
caption : me . textContinueNumbering
2022-04-27 19:24:39 +00:00
} ) ;
2018-07-20 09:55:03 +00:00
var menuNumberingTable = new Common . UI . MenuItem ( {
caption : me . bulletsText ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2018-07-20 09:55:03 +00:00
menuAlign : 'tl-tr' ,
items : [
2022-04-27 19:24:39 +00:00
me . menuTableStartNewList ,
me . menuTableStartNumberingFrom ,
me . menuTableContinueNumbering
2018-07-20 09:55:03 +00:00
]
} )
} ) ;
2022-05-04 19:18:04 +00:00
me . menuTableRefreshField = new Common . UI . MenuItem ( {
2019-03-05 11:03:18 +00:00
caption : me . textRefreshField
} ) ;
var menuTableFieldSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-04-29 12:55:24 +00:00
me . menuTableSelectText = new Common . UI . MenuItem ( {
caption : me . selectText ,
menu : new Common . UI . Menu ( {
cls : 'shifted-right' ,
menuAlign : 'tl-tr' ,
style : 'width: 100px' ,
items : [
new Common . UI . MenuItem ( {
caption : me . rowText ,
value : 0
} ) ,
new Common . UI . MenuItem ( {
caption : me . columnText ,
value : 1
} ) ,
new Common . UI . MenuItem ( {
caption : me . cellText ,
value : 2
} ) ,
new Common . UI . MenuItem ( {
caption : me . tableText ,
value : 3
} )
]
} )
} ) ;
me . menuTableInsertText = new Common . UI . MenuItem ( {
iconCls : 'menu__icon btn-addcell' ,
caption : me . insertText ,
menu : new Common . UI . Menu ( {
cls : 'shifted-right' ,
menuAlign : 'tl-tr' ,
items : [
new Common . UI . MenuItem ( {
caption : me . insertColumnLeftText ,
value : 0
} ) ,
new Common . UI . MenuItem ( {
caption : me . insertColumnRightText ,
value : 1
} ) ,
new Common . UI . MenuItem ( {
caption : me . insertRowAboveText ,
value : 2
} ) ,
new Common . UI . MenuItem ( {
caption : me . insertRowBelowText ,
value : 3
} ) ,
new Common . UI . MenuItem ( {
caption : me . textSeveral ,
value : 4
} )
]
} )
} ) ;
me . menuTableDeleteText = new Common . UI . MenuItem ( {
iconCls : 'menu__icon btn-delcell' ,
caption : me . deleteText ,
menu : new Common . UI . Menu ( {
cls : 'shifted-right' ,
menuAlign : 'tl-tr' ,
style : 'width: 100px' ,
items : [
new Common . UI . MenuItem ( {
caption : me . rowText ,
value : 0
} ) ,
new Common . UI . MenuItem ( {
caption : me . columnText ,
value : 1
} ) ,
new Common . UI . MenuItem ( {
caption : me . tableText ,
value : 2
} ) ,
new Common . UI . MenuItem ( {
caption : me . textCells ,
value : 3
} )
]
} )
} ) ;
2016-03-11 00:48:53 +00:00
this . tableMenu = new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2022-02-09 19:51:43 +00:00
restoreHeightAndTop : true ,
2016-03-11 00:48:53 +00:00
initMenu : function ( value ) {
// table properties
if ( _ . isUndefined ( value . tableProps ) )
return ;
var isEquation = ( value . mathProps && value . mathProps . value ) ;
2022-01-20 21:39:02 +00:00
for ( var i = 11 ; i < 30 ; i ++ ) {
2016-03-11 00:48:53 +00:00
me . tableMenu . items [ i ] . setVisible ( ! isEquation ) ;
}
var align = value . tableProps . value . get _CellsVAlign ( ) ;
2020-08-20 18:03:07 +00:00
var cls = '' ;
switch ( align ) {
case Asc . c _oAscVertAlignJc . Top :
cls = 'menu__icon btn-align-top' ;
break ;
case Asc . c _oAscVertAlignJc . Center :
cls = 'menu__icon btn-align-middle' ;
break ;
case Asc . c _oAscVertAlignJc . Bottom :
cls = 'menu__icon btn-align-bottom' ;
break ;
}
2022-04-27 19:24:39 +00:00
me . menuTableCellAlign . setIconCls ( cls ) ;
2016-04-05 11:52:34 +00:00
me . menuTableCellTop . setChecked ( align == Asc . c _oAscVertAlignJc . Top ) ;
me . menuTableCellCenter . setChecked ( align == Asc . c _oAscVertAlignJc . Center ) ;
me . menuTableCellBottom . setChecked ( align == Asc . c _oAscVertAlignJc . Bottom ) ;
2016-03-11 00:48:53 +00:00
var dir = value . tableProps . value . get _CellsTextDirection ( ) ;
2020-08-20 18:03:07 +00:00
cls = '' ;
switch ( dir ) {
case Asc . c _oAscCellTextDirection . LRTB :
cls = 'menu__icon text-orient-hor' ;
break ;
case Asc . c _oAscCellTextDirection . TBRL :
cls = 'menu__icon text-orient-rdown' ;
break ;
case Asc . c _oAscCellTextDirection . BTLR :
2020-10-21 13:28:47 +00:00
cls = 'menu__icon text-orient-rup' ;
2020-08-20 18:03:07 +00:00
break ;
}
2022-05-04 19:18:04 +00:00
me . menuTableDirection . setIconCls ( cls ) ;
2016-04-05 11:52:34 +00:00
me . menuTableDirectH . setChecked ( dir == Asc . c _oAscCellTextDirection . LRTB ) ;
me . menuTableDirect90 . setChecked ( dir == Asc . c _oAscCellTextDirection . TBRL ) ;
me . menuTableDirect270 . setChecked ( dir == Asc . c _oAscCellTextDirection . BTLR ) ;
2016-03-11 00:48:53 +00:00
var disabled = value . tableProps . locked || ( value . headerProps !== undefined && value . headerProps . locked ) ;
2022-01-20 21:39:02 +00:00
me . tableMenu . items [ 14 ] . setDisabled ( disabled ) ;
me . tableMenu . items [ 15 ] . setDisabled ( disabled ) ;
2016-03-11 00:48:53 +00:00
if ( me . api ) {
2022-05-04 19:18:04 +00:00
me . mnuTableMerge . setDisabled ( disabled || ! me . api . CheckBeforeMergeCells ( ) ) ;
me . mnuTableSplit . setDisabled ( disabled || ! me . api . CheckBeforeSplitCells ( ) ) ;
2016-03-11 00:48:53 +00:00
}
2022-05-04 19:18:04 +00:00
me . menuTableDistRows . setDisabled ( disabled ) ;
me . menuTableDistCols . setDisabled ( disabled ) ;
2022-04-27 19:24:39 +00:00
me . menuTableCellAlign . setDisabled ( disabled ) ;
2022-05-04 19:18:04 +00:00
me . menuTableDirection . setDisabled ( disabled ) ;
2022-04-27 19:24:39 +00:00
me . menuTableAdvanced . setDisabled ( disabled ) ;
2016-03-11 00:48:53 +00:00
var cancopy = me . api && me . api . can _CopyCut ( ) ;
2022-04-27 19:24:39 +00:00
me . menuTableCopy . setDisabled ( ! cancopy ) ;
me . menuTableCut . setDisabled ( disabled || ! cancopy ) ;
me . menuTablePaste . setDisabled ( disabled ) ;
me . menuTablePrint . setVisible ( me . mode . canPrint ) ;
me . menuTablePrint . setDisabled ( ! cancopy ) ;
2016-03-11 00:48:53 +00:00
2022-01-20 21:39:02 +00:00
var lockreview = Common . Utils . InternalSettings . get ( "de-accept-reject-lock" ) ;
2022-04-27 19:24:39 +00:00
me . menuTableAccept . setVisible ( ! lockreview ) ;
me . menuTableReject . setVisible ( ! lockreview ) ;
2022-01-20 21:39:02 +00:00
menuTableReviewSeparator . setVisible ( ! lockreview ) ;
2018-07-20 09:55:03 +00:00
// bullets & numbering
var listId = me . api . asc _GetCurrentNumberingId ( ) ,
in _list = ( listId !== null ) ;
menuNumberingTable . setVisible ( in _list ) ;
if ( in _list ) {
2018-07-20 12:15:28 +00:00
var numLvl = me . api . asc _GetNumberingPr ( listId ) . get _Lvl ( me . api . asc _GetCurrentNumberingLvl ( ) ) ,
format = numLvl . get _Format ( ) ,
start = me . api . asc _GetCalculatedNumberingValue ( ) ;
2022-04-27 19:24:39 +00:00
me . menuTableStartNewList . setVisible ( numLvl . get _Start ( ) != start ) ;
me . menuTableStartNewList . value = { start : numLvl . get _Start ( ) } ;
me . menuTableStartNumberingFrom . setVisible ( format != Asc . c _oAscNumberingFormat . Bullet ) ;
me . menuTableStartNumberingFrom . value = { format : format , start : start } ;
me . menuTableStartNewList . setCaption ( ( format == Asc . c _oAscNumberingFormat . Bullet ) ? me . textSeparateList : me . textStartNewList ) ;
me . menuTableContinueNumbering . setCaption ( ( format == Asc . c _oAscNumberingFormat . Bullet ) ? me . textJoinList : me . textContinueNumbering ) ;
2018-07-20 09:55:03 +00:00
}
2016-03-11 00:48:53 +00:00
// hyperlink properties
var text = null ;
if ( me . api ) {
text = me . api . can _AddHyperlink ( ) ;
}
2022-04-27 19:24:39 +00:00
me . menuAddHyperlinkTable . setVisible ( value . hyperProps === undefined && text !== false ) ;
2016-03-11 00:48:53 +00:00
menuHyperlinkTable . setVisible ( value . hyperProps !== undefined ) ;
2022-04-27 19:24:39 +00:00
me . menuEditHyperlinkTable . hyperProps = value . hyperProps ;
2022-05-04 19:18:04 +00:00
me . menuRemoveHyperlinkTable . hyperProps = value . hyperProps ;
2016-03-11 00:48:53 +00:00
if ( text !== false ) {
2022-04-27 19:24:39 +00:00
me . menuAddHyperlinkTable . hyperProps = { } ;
me . menuAddHyperlinkTable . hyperProps . value = new Asc . CHyperlinkProperty ( ) ;
me . menuAddHyperlinkTable . hyperProps . value . put _Text ( text ) ;
2016-03-11 00:48:53 +00:00
}
2019-04-15 14:37:15 +00:00
// review move
var data = me . api . asc _GetRevisionsChangesStack ( ) ,
move = false ;
2022-04-27 19:24:39 +00:00
me . menuTableFollow . value = null ;
2019-04-15 14:37:15 +00:00
_ . each ( data , function ( item ) {
if ( ( item . get _Type ( ) == Asc . c _oAscRevisionsChangeType . TextAdd || item . get _Type ( ) == Asc . c _oAscRevisionsChangeType . TextRem ) &&
item . get _MoveType ( ) != Asc . c _oAscRevisionsMove . NoMove ) {
2022-04-27 19:24:39 +00:00
me . menuTableFollow . value = item ;
2019-04-15 14:37:15 +00:00
move = true ;
}
} ) ;
2022-04-27 19:24:39 +00:00
me . menuTableFollow . setVisible ( move ) ;
2019-04-15 14:37:15 +00:00
2022-05-04 19:18:04 +00:00
menuHyperlinkSeparator . setVisible ( me . menuAddHyperlinkTable . isVisible ( ) || menuHyperlinkTable . isVisible ( ) || menuNumberingTable . isVisible ( ) || me . menuTableFollow . isVisible ( ) ) ;
2019-04-15 14:37:15 +00:00
// paragraph properties
2022-04-27 19:24:39 +00:00
me . menuParagraphAdvancedInTable . setVisible ( value . paraProps !== undefined ) ;
2016-03-11 00:48:53 +00:00
me . _currentParaObjDisabled = disabled = value . paraProps . locked || ( value . headerProps !== undefined && value . headerProps . locked ) ;
2022-04-27 19:24:39 +00:00
me . menuAddHyperlinkTable . setDisabled ( disabled ) ;
2016-03-11 00:48:53 +00:00
menuHyperlinkTable . setDisabled ( disabled || value . hyperProps !== undefined && value . hyperProps . isSeveralLinks === true ) ;
2022-04-27 19:24:39 +00:00
me . menuParagraphAdvancedInTable . setDisabled ( disabled ) ;
2016-03-11 00:48:53 +00:00
me . menuSpellCheckTable . setVisible ( value . spellProps !== undefined && value . spellProps . value . get _Checked ( ) === false ) ;
2022-05-04 19:18:04 +00:00
me . menuToDictionaryTable . setVisible ( me . mode . isDesktopApp ) ;
2016-03-11 00:48:53 +00:00
menuSpellcheckTableSeparator . setVisible ( value . spellProps !== undefined && value . spellProps . value . get _Checked ( ) === false ) ;
me . langTableMenu . setDisabled ( disabled ) ;
if ( value . spellProps !== undefined && value . spellProps . value . get _Checked ( ) === false && value . spellProps . value . get _Variants ( ) !== null && value . spellProps . value . get _Variants ( ) !== undefined ) {
me . addWordVariants ( false ) ;
} else {
me . menuSpellTable . setCaption ( me . loadSpellText , true ) ;
me . clearWordVariants ( false ) ;
me . menuSpellMoreTable . setVisible ( false ) ;
}
if ( me . menuSpellCheckTable . isVisible ( ) && me . _currLang . id !== me . _currLang . tableid ) {
me . changeLanguageMenu ( me . langTableMenu . menu ) ;
me . _currLang . tableid = me . _currLang . id ;
}
//equation menu
var eqlen = 0 ;
if ( isEquation ) {
2022-01-20 21:39:02 +00:00
eqlen = me . addEquationMenu ( false , 10 ) ;
2016-03-11 00:48:53 +00:00
} else
2022-01-20 21:39:02 +00:00
me . clearEquationMenu ( false , 10 ) ;
2016-03-11 00:48:53 +00:00
menuEquationSeparatorInTable . setVisible ( isEquation && eqlen > 0 ) ;
2017-12-13 13:52:14 +00:00
2020-01-30 13:00:36 +00:00
var control _lock = ( value . paraProps ) ? ( ! value . paraProps . value . can _DeleteBlockContentControl ( ) || ! value . paraProps . value . can _EditBlockContentControl ( ) ||
! value . paraProps . value . can _DeleteInlineContentControl ( ) || ! value . paraProps . value . can _EditInlineContentControl ( ) ) : false ;
2018-02-08 13:03:10 +00:00
var in _toc = me . api . asc _GetTableOfContentsPr ( true ) ,
in _control = ! in _toc && me . api . asc _IsContentControl ( ) ;
2017-12-13 13:52:14 +00:00
if ( in _control ) {
var control _props = me . api . asc _GetContentControlProperties ( ) ,
2020-10-07 16:13:24 +00:00
lock _type = ( control _props ) ? control _props . get _Lock ( ) : Asc . c _oAscSdtLockType . Unlocked ,
is _form = control _props && control _props . get _FormPr ( ) ;
2022-04-27 19:24:39 +00:00
me . menuTableRemoveForm . setVisible ( is _form ) ;
2022-02-07 12:50:32 +00:00
menuTableControl . setVisible ( ! is _form ) ;
if ( is _form ) {
2022-04-27 19:24:39 +00:00
me . menuTableRemoveForm . setDisabled ( lock _type == Asc . c _oAscSdtLockType . SdtContentLocked || lock _type == Asc . c _oAscSdtLockType . SdtLocked ) ;
me . menuTableRemoveForm . setCaption ( me . getControlLabel ( control _props ) ) ;
2022-02-07 12:50:32 +00:00
} else {
2022-04-27 19:24:39 +00:00
me . menuTableRemoveControl . setDisabled ( lock _type == Asc . c _oAscSdtLockType . SdtContentLocked || lock _type == Asc . c _oAscSdtLockType . SdtLocked ) ;
me . menuTableControlSettings . setVisible ( me . mode . canEditContentControl ) ;
2022-02-07 12:50:32 +00:00
}
2020-01-30 13:00:36 +00:00
var spectype = control _props ? control _props . get _SpecificType ( ) : Asc . c _oAscContentControlSpecificType . None ;
control _lock = control _lock || spectype == Asc . c _oAscContentControlSpecificType . CheckBox || spectype == Asc . c _oAscContentControlSpecificType . Picture ||
spectype == Asc . c _oAscContentControlSpecificType . ComboBox || spectype == Asc . c _oAscContentControlSpecificType . DropDownList || spectype == Asc . c _oAscContentControlSpecificType . DateTime ;
2022-02-07 12:50:32 +00:00
} else {
menuTableControl . setVisible ( in _control ) ;
2022-04-27 19:24:39 +00:00
me . menuTableRemoveForm . setVisible ( in _control ) ;
2017-12-13 13:52:14 +00:00
}
2022-05-04 20:18:05 +00:00
me . menuTableTOC . setVisible ( in _toc ) ;
2019-03-05 11:03:18 +00:00
2020-01-30 13:00:36 +00:00
/** coauthoring begin **/
// comments
2022-04-27 19:24:39 +00:00
me . menuAddCommentTable . setVisible ( me . api . can _AddQuotedComment ( ) !== false && me . mode . canCoAuthoring && me . mode . canComments && ! control _lock ) ;
me . menuAddCommentTable . setDisabled ( value . paraProps !== undefined && value . paraProps . locked === true ) ;
2020-01-30 13:00:36 +00:00
/** coauthoring end **/
2019-03-05 11:03:18 +00:00
var in _field = me . api . asc _GetCurrentComplexField ( ) ;
2022-05-04 19:18:04 +00:00
me . menuTableRefreshField . setVisible ( ! ! in _field ) ;
me . menuTableRefreshField . setDisabled ( disabled ) ;
2019-03-05 11:03:18 +00:00
menuTableFieldSeparator . setVisible ( ! ! in _field ) ;
if ( in _field ) {
2022-05-04 19:18:04 +00:00
me . menuTableRefreshField . options . fieldProps = in _field ;
2019-03-05 11:03:18 +00:00
}
2016-03-11 00:48:53 +00:00
} ,
items : [
me . menuSpellCheckTable ,
menuSpellcheckTableSeparator ,
2022-04-27 19:24:39 +00:00
me . menuTableCut ,
me . menuTableCopy ,
me . menuTablePaste ,
me . menuTablePrint ,
2016-03-11 00:48:53 +00:00
{ caption : '--' } ,
2022-04-27 19:24:39 +00:00
me . menuTableAccept ,
me . menuTableReject ,
2022-01-20 21:39:02 +00:00
menuTableReviewSeparator ,
2016-03-11 00:48:53 +00:00
menuEquationSeparatorInTable ,
2022-05-04 19:18:04 +00:00
me . menuTableRefreshField ,
2019-03-05 11:03:18 +00:00
menuTableFieldSeparator ,
2022-04-29 12:55:24 +00:00
me . menuTableSelectText ,
me . menuTableInsertText ,
me . menuTableDeleteText ,
2016-03-11 00:48:53 +00:00
{ caption : '--' } ,
2022-05-04 19:18:04 +00:00
me . mnuTableMerge ,
me . mnuTableSplit ,
2016-03-11 00:48:53 +00:00
{ caption : '--' } ,
2022-05-04 19:18:04 +00:00
me . menuTableDistRows ,
me . menuTableDistCols ,
2018-01-18 14:44:03 +00:00
{ caption : '--' } ,
2022-04-27 19:24:39 +00:00
me . menuTableCellAlign ,
2022-05-04 19:18:04 +00:00
me . menuTableDirection ,
2016-03-11 00:48:53 +00:00
{ caption : '--' } ,
2022-04-27 19:24:39 +00:00
me . menuTableInsertCaption ,
2019-09-21 08:52:21 +00:00
{ caption : '--' } ,
2022-04-27 19:24:39 +00:00
me . menuTableAdvanced ,
2016-03-11 00:48:53 +00:00
{ caption : '--' } ,
/** coauthoring begin **/
2022-04-27 19:24:39 +00:00
me . menuAddCommentTable ,
2016-03-11 00:48:53 +00:00
/** coauthoring end **/
2018-07-20 09:55:03 +00:00
menuNumberingTable ,
2022-04-27 19:24:39 +00:00
me . menuAddHyperlinkTable ,
2016-03-11 00:48:53 +00:00
menuHyperlinkTable ,
2022-04-27 19:24:39 +00:00
me . menuTableFollow ,
2016-03-11 00:48:53 +00:00
menuHyperlinkSeparator ,
2022-04-27 19:24:39 +00:00
me . menuTableRemoveForm ,
2017-12-13 13:52:14 +00:00
menuTableControl ,
2022-05-04 20:18:05 +00:00
me . menuTableTOC ,
2022-04-27 19:24:39 +00:00
me . menuParagraphAdvancedInTable
2016-03-11 00:48:53 +00:00
]
2017-04-12 09:45:16 +00:00
} ) . on ( 'hide:after' , function ( menu , e , isFromInputControl ) {
2017-02-07 12:53:51 +00:00
if ( me . suppressEditComplete ) {
me . suppressEditComplete = false ;
return ;
}
2017-04-12 09:45:16 +00:00
if ( ! isFromInputControl ) me . fireEvent ( 'editcomplete' , me ) ;
2016-03-11 00:48:53 +00:00
me . currentMenu = null ;
} ) ;
/* text menu */
2022-05-04 19:18:04 +00:00
me . menuParagraphBreakBefore = new Common . UI . MenuItem ( {
2016-03-11 00:48:53 +00:00
caption : me . breakBeforeText ,
checkable : true
} ) ;
2022-05-04 19:18:04 +00:00
me . menuParagraphKeepLines = new Common . UI . MenuItem ( {
2016-03-11 00:48:53 +00:00
caption : me . keepLinesText ,
checkable : true
} ) ;
2022-05-04 19:18:04 +00:00
me . menuParagraphVAlign = new Common . UI . MenuItem ( {
2020-08-20 18:03:07 +00:00
iconCls : 'menu__icon btn-align-top' ,
2016-03-11 00:48:53 +00:00
caption : me . vertAlignText ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
items : [
me . menuParagraphTop = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-align-top' ,
2017-06-06 08:29:30 +00:00
caption : me . textShapeAlignTop ,
2020-08-18 11:02:44 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checkable : true ,
checked : false ,
toggleGroup : 'popupparagraphvalign' ,
2016-11-10 11:24:18 +00:00
valign : Asc . c _oAscVAlign . Top
2022-05-04 19:18:04 +00:00
} ) ,
2016-03-11 00:48:53 +00:00
me . menuParagraphCenter = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-align-middle' ,
2017-06-06 08:29:30 +00:00
caption : me . textShapeAlignMiddle ,
2020-08-18 11:02:44 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checkable : true ,
checked : false ,
toggleGroup : 'popupparagraphvalign' ,
2016-11-10 11:24:18 +00:00
valign : Asc . c _oAscVAlign . Center
2022-05-04 19:18:04 +00:00
} ) ,
2016-03-11 00:48:53 +00:00
me . menuParagraphBottom = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-align-bottom' ,
2017-06-06 08:29:30 +00:00
caption : me . textShapeAlignBottom ,
2020-08-18 11:02:44 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checkable : true ,
checked : false ,
toggleGroup : 'popupparagraphvalign' ,
2016-11-10 11:24:18 +00:00
valign : Asc . c _oAscVAlign . Bottom
2022-05-04 19:18:04 +00:00
} )
2016-03-11 00:48:53 +00:00
]
} )
} ) ;
2022-05-04 19:18:04 +00:00
me . menuParagraphDirection = new Common . UI . MenuItem ( {
2020-08-20 18:03:07 +00:00
iconCls : 'menu__icon text-orient-hor' ,
2016-03-11 00:48:53 +00:00
caption : me . directionText ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'ppm-toolbar shifted-right' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
items : [
me . menuParagraphDirectH = new Common . UI . MenuItem ( {
caption : me . directHText ,
2019-11-21 07:58:05 +00:00
iconCls : 'menu__icon text-orient-hor' ,
2016-03-11 00:48:53 +00:00
checkable : true ,
2019-11-21 07:58:05 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checked : false ,
toggleGroup : 'popupparagraphdirect' ,
2016-04-05 11:52:34 +00:00
direction : Asc . c _oAscVertDrawingText . normal
2022-05-04 19:18:04 +00:00
} ) ,
2016-03-11 00:48:53 +00:00
me . menuParagraphDirect90 = new Common . UI . MenuItem ( {
caption : me . direct90Text ,
2019-11-21 07:58:05 +00:00
iconCls : 'menu__icon text-orient-rdown' ,
2016-03-11 00:48:53 +00:00
checkable : true ,
2019-11-21 07:58:05 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checked : false ,
toggleGroup : 'popupparagraphdirect' ,
2016-04-05 11:52:34 +00:00
direction : Asc . c _oAscVertDrawingText . vert
2022-05-04 19:18:04 +00:00
} ) ,
2016-03-11 00:48:53 +00:00
me . menuParagraphDirect270 = new Common . UI . MenuItem ( {
caption : me . direct270Text ,
2019-11-21 07:58:05 +00:00
iconCls : 'menu__icon text-orient-rup' ,
2016-03-11 00:48:53 +00:00
checkable : true ,
2019-11-21 07:58:05 +00:00
checkmark : false ,
2016-03-11 00:48:53 +00:00
checked : false ,
toggleGroup : 'popupparagraphdirect' ,
2016-04-05 11:52:34 +00:00
direction : Asc . c _oAscVertDrawingText . vert270
2022-05-04 19:18:04 +00:00
} )
2016-03-11 00:48:53 +00:00
]
} )
} ) ;
2022-04-27 19:24:39 +00:00
me . menuParagraphAdvanced = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-paragraph' ,
2016-03-11 00:48:53 +00:00
caption : me . advancedParagraphText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuFrameAdvanced = new Common . UI . MenuItem ( {
2016-03-11 00:48:53 +00:00
caption : me . advancedFrameText
2022-04-27 19:24:39 +00:00
} ) ;
2020-09-21 21:01:04 +00:00
2022-04-27 19:24:39 +00:00
me . menuDropCapAdvanced = new Common . UI . MenuItem ( {
2020-09-21 21:01:04 +00:00
iconCls : 'menu__icon dropcap-intext' ,
caption : me . advancedDropCapText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
/** coauthoring begin **/
var menuCommentSeparatorPara = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-04-27 19:24:39 +00:00
me . menuAddCommentPara = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-menu-comments' ,
2016-03-11 00:48:53 +00:00
caption : me . addCommentText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
/** coauthoring end **/
var menuHyperlinkParaSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-04-27 19:24:39 +00:00
me . menuAddHyperlinkPara = new Common . UI . MenuItem ( {
2020-08-25 12:34:03 +00:00
iconCls : 'menu__icon btn-inserthyperlink' ,
2016-03-11 00:48:53 +00:00
caption : me . hyperlinkText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuEditHyperlinkPara = new Common . UI . MenuItem ( {
2016-03-11 00:48:53 +00:00
caption : me . editHyperlinkText
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-05-04 19:18:04 +00:00
me . menuRemoveHyperlinkPara = new Common . UI . MenuItem ( {
2016-03-11 00:48:53 +00:00
caption : me . removeHyperlinkText
} ) ;
var menuHyperlinkPara = new Common . UI . MenuItem ( {
2020-08-25 12:34:03 +00:00
iconCls : 'menu__icon btn-inserthyperlink' ,
2016-03-11 00:48:53 +00:00
caption : me . hyperlinkText ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
items : [
2022-04-27 19:24:39 +00:00
me . menuEditHyperlinkPara ,
2022-05-04 19:18:04 +00:00
me . menuRemoveHyperlinkPara
2016-03-11 00:48:53 +00:00
]
} )
} ) ;
var menuStyleSeparator = new Common . UI . MenuItemSeparator ( ) ;
var menuStyle = new Common . UI . MenuItem ( {
caption : me . styleText ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
items : [
me . menuStyleSave = new Common . UI . MenuItem ( {
caption : me . saveStyleText
2022-04-27 19:24:39 +00:00
} ) ,
2016-03-11 00:48:53 +00:00
me . menuStyleUpdate = new Common . UI . MenuItem ( {
caption : me . updateStyleText . replace ( '%1' , window . currentStyleName )
2022-04-27 19:24:39 +00:00
} )
2016-03-11 00:48:53 +00:00
]
} )
} ) ;
me . menuSpellPara = new Common . UI . MenuItem ( {
caption : me . loadSpellText ,
disabled : true
} ) ;
me . menuSpellMorePara = new Common . UI . MenuItem ( {
caption : me . moreText ,
menu : new Common . UI . Menu ( {
2020-08-18 11:50:10 +00:00
cls : 'shifted-right' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
2019-06-21 07:46:00 +00:00
restoreHeight : true ,
2019-06-20 11:32:10 +00:00
items : [ ]
2016-03-11 00:48:53 +00:00
} )
} ) ;
me . langParaMenu = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-ic-doclang' ,
2016-03-11 00:48:53 +00:00
caption : me . langText ,
2019-08-10 13:38:51 +00:00
menu : new Common . UI . MenuSimple ( {
2019-01-28 13:51:07 +00:00
cls : 'lang-menu' ,
2016-03-11 00:48:53 +00:00
menuAlign : 'tl-tr' ,
2019-08-07 10:06:36 +00:00
restoreHeight : 285 ,
2019-07-11 11:35:24 +00:00
items : [ ] ,
2019-08-10 13:38:51 +00:00
itemTemplate : langTemplate ,
2019-07-11 11:35:24 +00:00
search : true
2016-03-11 00:48:53 +00:00
} )
} ) ;
2022-05-04 19:18:04 +00:00
me . menuIgnoreSpellPara = new Common . UI . MenuItem ( {
caption : me . ignoreSpellText ,
value : false
2016-03-11 00:48:53 +00:00
} ) ;
2022-05-04 19:18:04 +00:00
me . menuIgnoreAllSpellPara = new Common . UI . MenuItem ( {
caption : me . ignoreAllSpellText ,
value : true
2016-03-11 00:48:53 +00:00
} ) ;
2022-05-04 19:18:04 +00:00
me . menuToDictionaryPara = new Common . UI . MenuItem ( {
2019-08-05 08:59:52 +00:00
caption : me . toDictionaryText
} ) ;
2016-03-11 00:48:53 +00:00
var menuIgnoreSpellParaSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
var menuSpellcheckParaSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-04-27 19:24:39 +00:00
me . menuParaCopy = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-copy' ,
2016-03-11 00:48:53 +00:00
caption : me . textCopy ,
value : 'copy'
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuParaPaste = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-paste' ,
2016-03-11 00:48:53 +00:00
caption : me . textPaste ,
value : 'paste'
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuParaCut = new Common . UI . MenuItem ( {
2020-08-25 12:34:03 +00:00
iconCls : 'menu__icon btn-cut' ,
2016-03-11 00:48:53 +00:00
caption : me . textCut ,
value : 'cut'
2022-04-27 19:24:39 +00:00
} ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . menuParaAccept = new Common . UI . MenuItem ( {
2022-01-20 21:11:12 +00:00
caption : me . textAccept ,
value : 'accept'
2022-04-27 19:24:39 +00:00
} ) ;
2022-01-20 21:11:12 +00:00
2022-04-27 19:24:39 +00:00
me . menuParaReject = new Common . UI . MenuItem ( {
2022-01-20 21:11:12 +00:00
caption : me . textReject ,
value : 'reject'
2022-04-27 19:24:39 +00:00
} ) ;
2022-01-20 21:11:12 +00:00
var menuParaReviewSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-04-27 19:24:39 +00:00
me . menuParaPrint = new Common . UI . MenuItem ( {
2020-08-18 11:02:44 +00:00
iconCls : 'menu__icon btn-print' ,
2019-08-07 09:16:40 +00:00
caption : me . txtPrintSelection
2022-04-27 19:24:39 +00:00
} ) ;
var menuEquationSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
me . menuParaRemoveControl = new Common . UI . MenuItem ( {
iconCls : 'menu__icon cc-remove' ,
caption : me . textRemoveControl ,
value : 'remove'
} ) ;
me . menuParaControlSettings = new Common . UI . MenuItem (
{
caption : me . textEditControls ,
value : 'settings'
} ) ;
var menuParaControlSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-05-04 20:18:05 +00:00
me . menuParaTOCSettings = new Common . UI . MenuItem ( {
2022-04-27 19:24:39 +00:00
caption : me . textTOCSettings ,
value : 'settings'
} ) ;
2022-05-04 20:18:05 +00:00
me . menuParaTOCRefresh = new Common . UI . MenuItem ( {
2022-04-27 19:24:39 +00:00
caption : me . textUpdateTOC ,
menu : new Common . UI . Menu ( {
cls : 'shifted-right' ,
menuAlign : 'tl-tr' ,
items : [
{
caption : me . textUpdateAll ,
value : 'all'
} ,
{
caption : me . textUpdatePages ,
value : 'pages'
}
]
} )
} ) ;
var menuParaTOCSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
2022-05-04 19:18:04 +00:00
me . menuParaRefreshField = new Common . UI . MenuItem ( {
2022-04-27 19:24:39 +00:00
caption : me . textRefreshField
} ) ;
var menuParaFieldSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
me . menuParaStartNewList = new Common . UI . MenuItem ( {
caption : me . textStartNewList
} ) ;
me . menuParaStartNumberingFrom = new Common . UI . MenuItem ( {
caption : me . textStartNumberingFrom
} ) ;
me . menuParaContinueNumbering = new Common . UI . MenuItem ( {
caption : me . textContinueNumbering
} ) ;
var menuParaNumberingSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
me . menuParaFollow = new Common . UI . MenuItem ( {
caption : me . textFollow
} ) ;
var menuParaFollowSeparator = new Common . UI . MenuItem ( {
caption : '--'
} ) ;
this . textMenu = new Common . UI . Menu ( {
cls : 'shifted-right' ,
restoreHeightAndTop : true ,
initMenu : function ( value ) {
var isInShape = ( value . imgProps && value . imgProps . value && ! _ . isNull ( value . imgProps . value . get _ShapeProperties ( ) ) ) ;
var isInChart = ( value . imgProps && value . imgProps . value && ! _ . isNull ( value . imgProps . value . get _ChartProperties ( ) ) ) ;
var isEquation = ( value . mathProps && value . mathProps . value ) ;
var in _toc = me . api . asc _GetTableOfContentsPr ( true ) ,
in _control = ! in _toc && me . api . asc _IsContentControl ( ) ,
control _props = in _control ? me . api . asc _GetContentControlProperties ( ) : null ,
is _form = control _props && control _props . get _FormPr ( ) ;
2022-05-04 19:18:04 +00:00
me . menuParagraphVAlign . setVisible ( isInShape && ! isInChart && ! isEquation && ! ( is _form && control _props . get _FormPr ( ) . get _Fixed ( ) ) ) ; // после того, как заголовок можно будет растягивать по вертикали, вернуть "|| isInChart" !!
me . menuParagraphDirection . setVisible ( isInShape && ! isInChart && ! isEquation && ! ( is _form && control _props . get _FormPr ( ) . get _Fixed ( ) ) ) ; // после того, как заголовок можно будет растягивать по вертикали, вернуть "|| isInChart" !!
2022-04-27 19:24:39 +00:00
if ( isInShape || isInChart ) {
var align = value . imgProps . value . get _VerticalTextAlign ( ) ;
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 ;
}
2022-05-04 19:18:04 +00:00
me . menuParagraphVAlign . setIconCls ( cls ) ;
2022-04-27 19:24:39 +00:00
me . menuParagraphTop . setChecked ( align == Asc . c _oAscVAlign . Top ) ;
me . menuParagraphCenter . setChecked ( align == Asc . c _oAscVAlign . Center ) ;
me . menuParagraphBottom . setChecked ( align == Asc . c _oAscVAlign . Bottom ) ;
var dir = value . imgProps . value . get _Vert ( ) ;
cls = '' ;
switch ( dir ) {
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 :
cls = 'menu__icon text-orient-rup' ;
break ;
}
2022-05-04 19:18:04 +00:00
me . menuParagraphDirection . setIconCls ( cls ) ;
2022-04-27 19:24:39 +00:00
me . menuParagraphDirectH . setChecked ( dir == Asc . c _oAscVertDrawingText . normal ) ;
me . menuParagraphDirect90 . setChecked ( dir == Asc . c _oAscVertDrawingText . vert ) ;
me . menuParagraphDirect270 . setChecked ( dir == Asc . c _oAscVertDrawingText . vert270 ) ;
}
me . menuParagraphAdvanced . isChart = ( value . imgProps && value . imgProps . isChart ) ;
me . menuParagraphAdvanced . isSmartArtInternal = ( value . imgProps && value . imgProps . isSmartArtInternal ) ;
2022-05-04 19:18:04 +00:00
me . menuParagraphBreakBefore . setVisible ( ! isInShape && ! isInChart && ! isEquation ) ;
me . menuParagraphKeepLines . setVisible ( ! isInShape && ! isInChart && ! isEquation ) ;
2022-04-27 19:24:39 +00:00
if ( value . paraProps ) {
2022-05-04 19:18:04 +00:00
me . menuParagraphBreakBefore . setChecked ( value . paraProps . value . get _PageBreakBefore ( ) ) ;
me . menuParagraphKeepLines . setChecked ( value . paraProps . value . get _KeepLines ( ) ) ;
2022-04-27 19:24:39 +00:00
}
var text = null ;
if ( me . api ) {
text = me . api . can _AddHyperlink ( ) ;
}
me . menuAddHyperlinkPara . setVisible ( value . hyperProps === undefined && text !== false ) ;
menuHyperlinkPara . setVisible ( value . hyperProps !== undefined ) ;
menuHyperlinkParaSeparator . setVisible ( me . menuAddHyperlinkPara . isVisible ( ) || menuHyperlinkPara . isVisible ( ) ) ;
me . menuEditHyperlinkPara . hyperProps = value . hyperProps ;
2022-05-04 19:18:04 +00:00
me . menuRemoveHyperlinkPara . hyperProps = value . hyperProps ;
2022-04-27 19:24:39 +00:00
if ( text !== false ) {
me . menuAddHyperlinkPara . hyperProps = { } ;
me . menuAddHyperlinkPara . hyperProps . value = new Asc . CHyperlinkProperty ( ) ;
me . menuAddHyperlinkPara . hyperProps . value . put _Text ( text ) ;
}
var disabled = value . paraProps . locked || ( value . headerProps !== undefined && value . headerProps . locked ) ;
me . _currentParaObjDisabled = disabled ;
me . menuAddHyperlinkPara . setDisabled ( disabled ) ;
menuHyperlinkPara . setDisabled ( disabled || value . hyperProps !== undefined && value . hyperProps . isSeveralLinks === true ) ;
// review move
var data = me . api . asc _GetRevisionsChangesStack ( ) ,
move = false ;
me . menuParaFollow . value = null ;
_ . each ( data , function ( item ) {
if ( ( item . get _Type ( ) == Asc . c _oAscRevisionsChangeType . TextAdd || item . get _Type ( ) == Asc . c _oAscRevisionsChangeType . TextRem ) &&
item . get _MoveType ( ) != Asc . c _oAscRevisionsMove . NoMove ) {
me . menuParaFollow . value = item ;
move = true ;
}
} ) ;
me . menuParaFollow . setVisible ( move ) ;
menuParaFollowSeparator . setVisible ( move ) ;
2022-05-04 19:18:04 +00:00
me . menuParagraphBreakBefore . setDisabled ( disabled || ! _ . isUndefined ( value . headerProps ) || ! _ . isUndefined ( value . imgProps ) ) ;
me . menuParagraphKeepLines . setDisabled ( disabled ) ;
2022-04-27 19:24:39 +00:00
me . menuParagraphAdvanced . setDisabled ( disabled ) ;
me . menuFrameAdvanced . setDisabled ( disabled ) ;
me . menuDropCapAdvanced . setDisabled ( disabled ) ;
2022-05-04 19:18:04 +00:00
me . menuParagraphVAlign . setDisabled ( disabled ) ;
me . menuParagraphDirection . setDisabled ( disabled ) ;
2022-04-27 19:24:39 +00:00
var cancopy = me . api && me . api . can _CopyCut ( ) ;
me . menuParaCopy . setDisabled ( ! cancopy ) ;
me . menuParaCut . setDisabled ( disabled || ! cancopy ) ;
me . menuParaPaste . setDisabled ( disabled ) ;
me . menuParaPrint . setVisible ( me . mode . canPrint ) ;
me . menuParaPrint . setDisabled ( ! cancopy ) ;
var lockreview = Common . Utils . InternalSettings . get ( "de-accept-reject-lock" ) ;
me . menuParaAccept . setVisible ( ! lockreview ) ;
me . menuParaReject . setVisible ( ! lockreview ) ;
menuParaReviewSeparator . setVisible ( ! lockreview ) ;
// spellCheck
var spell = ( value . spellProps !== undefined && value . spellProps . value . get _Checked ( ) === false ) ;
me . menuSpellPara . setVisible ( spell ) ;
menuSpellcheckParaSeparator . setVisible ( spell ) ;
2022-05-04 19:18:04 +00:00
me . menuIgnoreSpellPara . setVisible ( spell ) ;
me . menuIgnoreAllSpellPara . setVisible ( spell ) ;
me . menuToDictionaryPara . setVisible ( spell && me . mode . isDesktopApp ) ;
2022-04-27 19:24:39 +00:00
me . langParaMenu . setVisible ( spell ) ;
me . langParaMenu . setDisabled ( disabled ) ;
menuIgnoreSpellParaSeparator . setVisible ( spell ) ;
if ( spell && value . spellProps . value . get _Variants ( ) !== null && value . spellProps . value . get _Variants ( ) !== undefined ) {
me . addWordVariants ( true ) ;
} else {
me . menuSpellPara . setCaption ( me . loadSpellText , true ) ;
me . clearWordVariants ( true ) ;
me . menuSpellMorePara . setVisible ( false ) ;
}
if ( me . langParaMenu . isVisible ( ) && me . _currLang . id !== me . _currLang . paraid ) {
me . changeLanguageMenu ( me . langParaMenu . menu ) ;
me . _currLang . paraid = me . _currLang . id ;
}
//equation menu
var eqlen = 0 ;
if ( isEquation ) {
eqlen = me . addEquationMenu ( true , 18 ) ;
} else
me . clearEquationMenu ( true , 18 ) ;
menuEquationSeparator . setVisible ( isEquation && eqlen > 0 ) ;
me . menuEquationInsertCaption . setVisible ( isEquation ) ;
menuEquationInsertCaptionSeparator . setVisible ( isEquation ) ;
var frame _pr = value . paraProps . value . get _FramePr ( ) ;
me . menuFrameAdvanced . setVisible ( frame _pr !== undefined ) ;
me . menuDropCapAdvanced . setVisible ( frame _pr !== undefined ) ;
if ( frame _pr )
me . menuDropCapAdvanced . setIconCls ( frame _pr . get _DropCap ( ) === Asc . c _oAscDropCap . Drop ? 'menu__icon dropcap-intext' : 'menu__icon dropcap-inmargin' ) ;
var edit _style = me . mode . canEditStyles && ! isInChart && ! ( value . imgProps && value . imgProps . isSmartArtInternal ) ;
menuStyleSeparator . setVisible ( edit _style ) ;
menuStyle . setVisible ( edit _style ) ;
if ( edit _style ) {
me . menuStyleUpdate . setCaption ( me . updateStyleText . replace ( '%1' , DE . getController ( 'Main' ) . translationTable [ window . currentStyleName ] || window . currentStyleName ) ) ;
}
var control _lock = ( value . paraProps ) ? ( ! value . paraProps . value . can _DeleteBlockContentControl ( ) || ! value . paraProps . value . can _EditBlockContentControl ( ) ||
! value . paraProps . value . can _DeleteInlineContentControl ( ) || ! value . paraProps . value . can _EditInlineContentControl ( ) ) : false ;
me . menuParaRemoveControl . setVisible ( in _control ) ;
me . menuParaControlSettings . setVisible ( in _control && me . mode . canEditContentControl && ! is _form ) ;
menuParaControlSeparator . setVisible ( in _control ) ;
if ( in _control ) {
var lock _type = ( control _props ) ? control _props . get _Lock ( ) : Asc . c _oAscSdtLockType . Unlocked ;
me . menuParaRemoveControl . setDisabled ( lock _type == Asc . c _oAscSdtLockType . SdtContentLocked || lock _type == Asc . c _oAscSdtLockType . SdtLocked ) ;
me . menuParaRemoveControl . setCaption ( is _form ? me . getControlLabel ( control _props ) : me . textRemoveControl ) ;
2019-08-07 09:16:40 +00:00
2022-04-27 19:24:39 +00:00
var spectype = control _props ? control _props . get _SpecificType ( ) : Asc . c _oAscContentControlSpecificType . None ;
control _lock = control _lock || spectype == Asc . c _oAscContentControlSpecificType . CheckBox || spectype == Asc . c _oAscContentControlSpecificType . Picture ||
spectype == Asc . c _oAscContentControlSpecificType . ComboBox || spectype == Asc . c _oAscContentControlSpecificType . DropDownList || spectype == Asc . c _oAscContentControlSpecificType . DateTime ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
}
2022-05-04 20:18:05 +00:00
me . menuParaTOCSettings . setVisible ( in _toc ) ;
me . menuParaTOCRefresh . setVisible ( in _toc ) ;
2022-04-27 19:24:39 +00:00
menuParaTOCSeparator . setVisible ( in _toc ) ;
2017-12-13 13:52:14 +00:00
2022-04-27 19:24:39 +00:00
/** coauthoring begin **/
var isVisible = ! isInChart && me . api . can _AddQuotedComment ( ) !== false && me . mode . canCoAuthoring && me . mode . canComments && ! control _lock ;
if ( me . mode . compatibleFeatures )
isVisible = isVisible && ! isInShape ;
menuCommentSeparatorPara . setVisible ( isVisible ) ;
me . menuAddCommentPara . setVisible ( isVisible ) ;
me . menuAddCommentPara . setDisabled ( value . paraProps && value . paraProps . locked === true ) ;
/** coauthoring end **/
2017-12-13 13:52:14 +00:00
2022-04-27 19:24:39 +00:00
var in _field = me . api . asc _GetCurrentComplexField ( ) ;
2022-05-04 19:18:04 +00:00
me . menuParaRefreshField . setVisible ( ! ! in _field ) ;
me . menuParaRefreshField . setDisabled ( disabled ) ;
2022-04-27 19:24:39 +00:00
menuParaFieldSeparator . setVisible ( ! ! in _field ) ;
if ( in _field ) {
2022-05-04 19:18:04 +00:00
me . menuParaRefreshField . options . fieldProps = in _field ;
2022-04-27 19:24:39 +00:00
}
2017-12-13 13:52:14 +00:00
2022-04-27 19:24:39 +00:00
var listId = me . api . asc _GetCurrentNumberingId ( ) ,
in _list = ( listId !== null ) ;
menuParaNumberingSeparator . setVisible ( in _list ) ; // hide when first item is selected
me . menuParaStartNewList . setVisible ( in _list ) ;
me . menuParaStartNumberingFrom . setVisible ( in _list ) ;
me . menuParaContinueNumbering . setVisible ( in _list ) ;
if ( in _list ) {
var numLvl = me . api . asc _GetNumberingPr ( listId ) . get _Lvl ( me . api . asc _GetCurrentNumberingLvl ( ) ) ,
format = numLvl . get _Format ( ) ,
start = me . api . asc _GetCalculatedNumberingValue ( ) ;
me . menuParaStartNewList . setVisible ( numLvl . get _Start ( ) != start ) ;
me . menuParaStartNewList . value = { start : numLvl . get _Start ( ) } ;
me . menuParaStartNumberingFrom . setVisible ( format != Asc . c _oAscNumberingFormat . Bullet ) ;
me . menuParaStartNumberingFrom . value = { format : format , start : start } ;
me . menuParaStartNewList . setCaption ( ( format == Asc . c _oAscNumberingFormat . Bullet ) ? me . textSeparateList : me . textStartNewList ) ;
me . menuParaContinueNumbering . setCaption ( ( format == Asc . c _oAscNumberingFormat . Bullet ) ? me . textJoinList : me . textContinueNumbering ) ;
}
} ,
items : [
me . menuSpellPara ,
me . menuSpellMorePara ,
menuSpellcheckParaSeparator ,
2022-05-04 19:18:04 +00:00
me . menuIgnoreSpellPara ,
me . menuIgnoreAllSpellPara ,
me . menuToDictionaryPara ,
2022-04-27 19:24:39 +00:00
me . langParaMenu ,
menuIgnoreSpellParaSeparator ,
me . menuParaCut ,
me . menuParaCopy ,
me . menuParaPaste ,
me . menuParaPrint ,
menuParaReviewSeparator ,
me . menuParaAccept ,
me . menuParaReject ,
menuEquationInsertCaptionSeparator ,
me . menuEquationInsertCaption ,
{ caption : '--' } ,
menuEquationSeparator ,
me . menuParaRemoveControl ,
me . menuParaControlSettings ,
menuParaControlSeparator ,
2022-05-04 19:18:04 +00:00
me . menuParaRefreshField ,
2022-04-27 19:24:39 +00:00
menuParaFieldSeparator ,
2022-05-04 20:18:05 +00:00
me . menuParaTOCSettings ,
me . menuParaTOCRefresh ,
2022-04-27 19:24:39 +00:00
menuParaTOCSeparator ,
2022-05-04 19:18:04 +00:00
me . menuParagraphBreakBefore ,
me . menuParagraphKeepLines ,
me . menuParagraphVAlign ,
me . menuParagraphDirection ,
2022-04-27 19:24:39 +00:00
me . menuParagraphAdvanced ,
me . menuFrameAdvanced ,
me . menuDropCapAdvanced ,
/** coauthoring begin **/
menuCommentSeparatorPara ,
me . menuAddCommentPara ,
/** coauthoring end **/
menuHyperlinkParaSeparator ,
me . menuAddHyperlinkPara ,
menuHyperlinkPara ,
menuParaFollowSeparator ,
me . menuParaFollow ,
menuParaNumberingSeparator ,
me . menuParaStartNewList ,
me . menuParaStartNumberingFrom ,
me . menuParaContinueNumbering ,
menuStyleSeparator ,
menuStyle
]
} ) . on ( 'hide:after' , function ( menu , e , isFromInputControl ) {
if ( me . suppressEditComplete ) {
me . suppressEditComplete = false ;
return ;
}
2018-02-08 13:03:10 +00:00
2022-04-27 19:24:39 +00:00
if ( ! isFromInputControl ) me . fireEvent ( 'editcomplete' , me ) ;
me . currentMenu = null ;
2018-02-08 13:03:10 +00:00
} ) ;
2022-04-27 19:24:39 +00:00
/* header/footer menu */
var menuEditHeaderFooter = new Common . UI . MenuItem ( {
caption : me . editHeaderText
2018-02-08 13:03:10 +00:00
} ) ;
2022-04-27 19:24:39 +00:00
this . hdrMenu = new Common . UI . Menu ( {
cls : 'shifted-right' ,
initMenu : function ( value ) {
menuEditHeaderFooter . setCaption ( value . Header ? me . editHeaderText : me . editFooterText , true ) ;
menuEditHeaderFooter . off ( 'click' ) . on ( 'click' , function ( item ) {
if ( me . api ) {
if ( value . Header ) {
me . api . GoToHeader ( value . PageNum ) ;
}
else
me . api . GoToFooter ( value . PageNum ) ;
me . fireEvent ( 'editcomplete' , me ) ;
}
} ) ;
} ,
items : [
menuEditHeaderFooter
]
} ) . on ( 'hide:after' , function ( menu , e , isFromInputControl ) {
if ( ! isFromInputControl ) me . fireEvent ( 'editcomplete' , me ) ;
me . currentMenu = null ;
2018-02-26 09:03:16 +00:00
} ) ;
2022-04-27 19:24:39 +00:00
var nextpage = $ ( '#id_buttonNextPage' ) ;
nextpage . attr ( 'data-toggle' , 'tooltip' ) ;
nextpage . tooltip ( {
title : me . textNextPage + Common . Utils . String . platformKey ( 'Alt+PgDn' ) ,
placement : 'top-right'
2018-02-26 09:03:16 +00:00
} ) ;
2022-04-27 19:24:39 +00:00
var prevpage = $ ( '#id_buttonPrevPage' ) ;
prevpage . attr ( 'data-toggle' , 'tooltip' ) ;
prevpage . tooltip ( {
title : me . textPrevPage + Common . Utils . String . platformKey ( 'Alt+PgUp' ) ,
placement : 'top-right'
2018-07-20 09:00:30 +00:00
} ) ;
2022-04-27 19:24:39 +00:00
this . fireEvent ( 'createdelayedelements' , [ this , 'edit' ] ) ;
} ,
2019-04-15 14:37:15 +00:00
2022-04-27 19:24:39 +00:00
initEquationMenu : function ( ) {
var me = this ;
if ( ! me . _currentMathObj ) return ;
var type = me . _currentMathObj . get _Type ( ) ,
value = me . _currentMathObj ,
mnu , arr = [ ] ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
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 ( {
cls : 'shifted-right' ,
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 ) ;
2020-08-20 18:03:07 +00:00
}
2022-04-27 19:24:39 +00:00
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 ) ;
2020-08-20 18:03:07 +00:00
}
2016-03-11 00:48:53 +00:00
}
2022-04-27 19:24:39 +00:00
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 ) ;
2016-03-11 00:48:53 +00:00
}
2022-04-27 19:24:39 +00:00
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 ) ;
2016-03-11 00:48:53 +00:00
}
2022-04-27 19:24:39 +00:00
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 ) ;
2016-03-11 00:48:53 +00:00
}
2022-04-27 19:24:39 +00:00
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 }
2019-04-15 14:37:15 +00:00
} ) ;
2022-04-27 19:24:39 +00:00
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 ( {
cls : 'shifted-right' ,
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 ( {
cls : 'shifted-right' ,
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 ( {
cls : 'shifted-right' ,
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 ( {
cls : 'shifted-right' ,
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 ( {
cls : 'shifted-right' ,
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 ;
} ,
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
addEquationMenu : function ( isParagraph , insertIdx ) {
var me = this ;
if ( _ . isUndefined ( isParagraph ) ) {
isParagraph = me . textMenu . isVisible ( ) ;
}
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
me . clearEquationMenu ( isParagraph , insertIdx ) ;
2022-01-20 21:11:12 +00:00
2022-04-27 19:24:39 +00:00
var equationMenu = ( isParagraph ) ? me . textMenu : me . tableMenu ,
menuItems = me . initEquationMenu ( ) ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
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 ;
} ,
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
clearEquationMenu : function ( isParagraph , insertIdx ) {
var me = this ;
var equationMenu = ( isParagraph ) ? me . textMenu : me . tableMenu ;
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' ) ;
} ) ;
2016-03-11 00:48:53 +00:00
} else
2022-04-27 19:24:39 +00:00
equationMenu . items [ i ] . off ( 'click' ) ;
equationMenu . removeItem ( equationMenu . items [ i ] ) ;
i -- ;
} else
break ;
}
} ,
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
equationCallback : function ( eqProps ) {
this . fireEvent ( 'equation:callback' , [ eqProps ] ) ;
} ,
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
addWordVariants : function ( isParagraph ) {
var me = this ;
if ( ! me . textMenu || ! me . textMenu . isVisible ( ) && ! me . tableMenu . isVisible ( ) ) return ;
2017-12-13 13:52:14 +00:00
2022-04-27 19:24:39 +00:00
if ( _ . isUndefined ( isParagraph ) ) {
isParagraph = me . textMenu . isVisible ( ) ;
}
2020-01-30 13:00:36 +00:00
2022-04-27 19:24:39 +00:00
me . clearWordVariants ( isParagraph ) ;
2020-01-30 13:00:36 +00:00
2022-04-27 19:24:39 +00:00
var moreMenu = ( isParagraph ) ? me . menuSpellMorePara : me . menuSpellMoreTable ;
var spellMenu = ( isParagraph ) ? me . menuSpellPara : me . menuSpellTable ;
var arr = [ ] ,
arrMore = [ ] ;
var variants = me . _currentSpellObj . get _Variants ( ) ;
2021-09-02 18:32:19 +00:00
2022-04-27 19:24:39 +00:00
if ( variants . length > 0 ) {
moreMenu . setVisible ( variants . length > 3 ) ;
moreMenu . setDisabled ( me . _currentParaObjDisabled ) ;
2018-02-26 09:03:16 +00:00
2022-04-27 19:24:39 +00:00
_ . each ( variants , function ( variant , index ) {
var mnu = new Common . UI . MenuItem ( {
caption : variant ,
spellword : true ,
disabled : me . _currentParaObjDisabled
} ) . on ( 'click' , function ( item , e ) {
if ( me . api ) {
me . api . asc _replaceMisspelledWord ( item . caption , me . _currentSpellObj ) ;
me . fireEvent ( 'editcomplete' , me ) ;
}
} ) ;
2020-01-30 13:00:36 +00:00
2022-04-27 19:24:39 +00:00
( index < 3 ) ? arr . push ( mnu ) : arrMore . push ( mnu ) ;
} ) ;
2018-07-20 09:00:30 +00:00
2022-04-27 19:24:39 +00:00
if ( arr . length > 0 ) {
if ( isParagraph ) {
_ . each ( arr , function ( variant , index ) {
me . textMenu . insertItem ( index , variant ) ;
} )
} else {
_ . each ( arr , function ( variant , index ) {
me . menuSpellCheckTable . menu . insertItem ( index , variant ) ;
} )
2018-07-20 09:00:30 +00:00
}
2016-03-11 00:48:53 +00:00
}
2022-04-27 19:24:39 +00:00
if ( arrMore . length > 0 ) {
_ . each ( arrMore , function ( variant , index ) {
moreMenu . menu . addItem ( variant ) ;
} ) ;
}
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
spellMenu . setVisible ( false ) ;
} else {
moreMenu . setVisible ( false ) ;
spellMenu . setVisible ( true ) ;
spellMenu . setCaption ( me . noSpellVariantsText , true ) ;
}
} ,
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
clearWordVariants : function ( isParagraph ) {
var me = this ;
var spellMenu = ( isParagraph ) ? me . textMenu : me . menuSpellCheckTable . menu ;
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
for ( var i = 0 ; i < spellMenu . items . length ; i ++ ) {
if ( spellMenu . items [ i ] . options . spellword ) {
if ( spellMenu . checkeditem == spellMenu . items [ i ] ) {
spellMenu . checkeditem = undefined ;
spellMenu . activeItem = undefined ;
}
2016-03-11 00:48:53 +00:00
2022-04-27 19:24:39 +00:00
spellMenu . removeItem ( spellMenu . items [ i ] ) ;
i -- ;
}
}
( isParagraph ) ? me . menuSpellMorePara . menu . removeAll ( ) : me . menuSpellMoreTable . menu . removeAll ( ) ;
me . menuSpellMorePara . menu . checkeditem = undefined ;
me . menuSpellMorePara . menu . activeItem = undefined ;
me . menuSpellMoreTable . menu . checkeditem = undefined ;
me . menuSpellMoreTable . menu . activeItem = undefined ;
2016-03-11 00:48:53 +00:00
} ,
setLanguages : function ( langs ) {
var me = this ;
2017-04-19 08:28:40 +00:00
if ( langs && langs . length > 0 && me . langParaMenu && me . langTableMenu ) {
2019-08-10 13:38:51 +00:00
var arrPara = [ ] , arrTable = [ ] ;
_ . each ( langs , function ( lang ) {
var item = {
2019-01-28 13:51:07 +00:00
caption : lang . displayValue ,
2019-02-27 14:53:21 +00:00
value : lang . value ,
2016-03-11 00:48:53 +00:00
checkable : true ,
2019-01-28 13:51:07 +00:00
langid : lang . code ,
2019-08-10 13:38:51 +00:00
spellcheck : lang . spellcheck
} ;
arrPara . push ( item ) ;
arrTable . push ( _ . clone ( item ) ) ;
} ) ;
me . langParaMenu . menu . resetItems ( arrPara ) ;
me . langTableMenu . menu . resetItems ( arrTable ) ;
2016-03-11 00:48:53 +00:00
}
} ,
2022-04-27 19:24:39 +00:00
changeLanguageMenu : function ( menu ) {
if ( this . _currLang . id === null || this . _currLang . id === undefined ) {
menu . clearAll ( ) ;
2019-04-09 10:41:08 +00:00
} else {
2022-04-27 19:24:39 +00:00
var index = _ . findIndex ( menu . items , { langid : this . _currLang . id } ) ;
( index > - 1 ) && ! menu . items [ index ] . checked && menu . setChecked ( index , true ) ;
2019-12-05 10:48:48 +00:00
}
} ,
2020-10-07 16:13:24 +00:00
getControlLabel : function ( props ) {
var type = props ? props . get _SpecificType ( ) : Asc . c _oAscContentControlSpecificType . None ;
switch ( type ) {
case Asc . c _oAscContentControlSpecificType . CheckBox :
var specProps = props . get _CheckBoxPr ( ) ;
return ( typeof specProps . get _GroupKey ( ) !== 'string' ) ? this . textRemCheckBox : this . textRemRadioBox ;
case Asc . c _oAscContentControlSpecificType . ComboBox :
return this . textRemComboBox ;
case Asc . c _oAscContentControlSpecificType . DropDownList :
return this . textRemDropdown ;
case Asc . c _oAscContentControlSpecificType . Picture :
return this . textRemPicture ;
default :
return this . textRemField ;
}
} ,
2016-03-11 00:48:53 +00:00
focus : function ( ) {
var me = this ;
_ . defer ( function ( ) { me . cmpEl . focus ( ) ; } , 50 ) ;
} ,
2021-12-30 11:49:19 +00:00
SetDisabled : function ( state , canProtect , fillFormMode ) {
2017-08-23 15:06:55 +00:00
this . _isDisabled = state ;
2017-11-22 08:41:47 +00:00
this . _canProtect = canProtect ;
2021-12-30 11:49:19 +00:00
this . _fillFormMode = state ? fillFormMode : false ;
2017-08-23 15:06:55 +00:00
} ,
2016-03-11 00:48:53 +00:00
alignmentText : 'Alignment' ,
leftText : 'Left' ,
rightText : 'Right' ,
centerText : 'Center' ,
selectRowText : 'Select Row' ,
selectColumnText : 'Select Column' ,
selectCellText : 'Select Cell' ,
selectTableText : 'Select Table' ,
insertRowAboveText : 'Row Above' ,
insertRowBelowText : 'Row Below' ,
insertColumnLeftText : 'Column Left' ,
insertColumnRightText : 'Column Right' ,
deleteText : 'Delete' ,
deleteRowText : 'Delete Row' ,
deleteColumnText : 'Delete Column' ,
deleteTableText : 'Delete Table' ,
mergeCellsText : 'Merge Cells' ,
splitCellsText : 'Split Cell...' ,
splitCellTitleText : 'Split Cell' ,
2019-11-06 08:16:29 +00:00
originalSizeText : 'Actual Size' ,
2016-03-11 00:48:53 +00:00
advancedText : 'Advanced Settings' ,
breakBeforeText : 'Page break before' ,
keepLinesText : 'Keep lines together' ,
editHeaderText : 'Edit header' ,
editFooterText : 'Edit footer' ,
hyperlinkText : 'Hyperlink' ,
editHyperlinkText : 'Edit Hyperlink' ,
removeHyperlinkText : 'Remove Hyperlink' ,
styleText : 'Formatting as Style' ,
saveStyleText : 'Create new style' ,
updateStyleText : 'Update %1 style' ,
2022-06-26 10:43:51 +00:00
txtPressLink : 'Press {0} and click link' ,
2016-03-11 00:48:53 +00:00
selectText : 'Select' ,
insertRowText : 'Insert Row' ,
insertColumnText : 'Insert Column' ,
rowText : 'Row' ,
columnText : 'Column' ,
cellText : 'Cell' ,
tableText : 'Table' ,
aboveText : 'Above' ,
belowText : 'Below' ,
advancedTableText : 'Table Advanced Settings' ,
advancedParagraphText : 'Paragraph Advanced Settings' ,
paragraphText : 'Paragraph' ,
guestText : 'Guest' ,
editChartText : 'Edit Data' ,
/** coauthoring begin **/
addCommentText : 'Add Comment' ,
/** coauthoring end **/
cellAlignText : 'Cell Vertical Alignment' ,
txtInline : 'Inline' ,
txtSquare : 'Square' ,
txtTight : 'Tight' ,
txtThrough : 'Through' ,
txtTopAndBottom : 'Top and bottom' ,
txtBehind : 'Behind' ,
txtInFront : 'In front' ,
textWrap : 'Wrapping Style' ,
textAlign : 'Align' ,
textArrange : 'Arrange' ,
textShapeAlignLeft : 'Align Left' ,
textShapeAlignRight : 'Align Right' ,
textShapeAlignCenter : 'Align Center' ,
textShapeAlignTop : 'Align Top' ,
textShapeAlignBottom : 'Align Bottom' ,
textShapeAlignMiddle : 'Align Middle' ,
textArrangeFront : 'Bring To Front' ,
textArrangeBack : 'Send To Back' ,
textArrangeForward : 'Bring Forward' ,
textArrangeBackward : 'Send Backward' ,
txtGroup : 'Group' ,
txtUngroup : 'Ungroup' ,
textEditWrapBoundary : 'Edit Wrap Boundary' ,
vertAlignText : 'Vertical Alignment' ,
loadSpellText : 'Loading variants...' ,
ignoreAllSpellText : 'Ignore All' ,
ignoreSpellText : 'Ignore' ,
noSpellVariantsText : 'No variants' ,
moreText : 'More variants...' ,
spellcheckText : 'Spellcheck' ,
langText : 'Select Language' ,
advancedFrameText : 'Frame Advanced Settings' ,
tipIsLocked : 'This element is being edited by another user.' ,
textNextPage : 'Next Page' ,
textPrevPage : 'Previous Page' ,
imageText : 'Image Advanced Settings' ,
shapeText : 'Shape Advanced Settings' ,
chartText : 'Chart Advanced Settings' ,
insertText : 'Insert' ,
textCopy : 'Copy' ,
textPaste : 'Paste' ,
textCut : 'Cut' ,
directionText : 'Text Direction' ,
directHText : 'Horizontal' ,
2017-06-06 08:15:03 +00:00
direct90Text : 'Rotate Text Down' ,
direct270Text : 'Rotate Text Up°' ,
2016-03-11 00:48:53 +00:00
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' ,
2017-05-12 08:52:19 +00:00
txtDeleteCharsAndSeparators : 'Delete enclosing characters and separators' ,
2017-06-06 08:04:04 +00:00
txtKeepTextOnly : 'Keep text only' ,
2017-11-22 08:41:47 +00:00
textUndo : 'Undo' ,
strSign : 'Sign' ,
strDetails : 'Signature Details' ,
strSetup : 'Signature Setup' ,
2017-12-08 15:00:56 +00:00
strDelete : 'Remove Signature' ,
txtOverwriteCells : 'Overwrite cells' ,
2018-01-15 13:11:11 +00:00
textNest : 'Nest table' ,
2017-12-13 13:52:14 +00:00
textContentControls : 'Content control' ,
textRemove : 'Remove' ,
textSettings : 'Settings' ,
textRemoveControl : 'Remove content control' ,
2018-01-18 14:44:03 +00:00
textEditControls : 'Content control settings' ,
textDistributeRows : 'Distribute rows' ,
2018-02-08 13:03:10 +00:00
textDistributeCols : 'Distribute columns' ,
textUpdateTOC : 'Refresh table of contents' ,
textUpdateAll : 'Refresh entire table' ,
textUpdatePages : 'Refresh page numbers only' ,
textTOCSettings : 'Table of contents settings' ,
2018-02-26 09:03:16 +00:00
textTOC : 'Table of contents' ,
2018-03-23 14:11:51 +00:00
textRefreshField : 'Refresh field' ,
2018-04-11 13:46:44 +00:00
txtPasteSourceFormat : 'Keep source formatting' ,
textReplace : 'Replace image' ,
textFromUrl : 'From URL' ,
2018-07-20 09:00:30 +00:00
textFromFile : 'From File' ,
textStartNumberingFrom : 'Set numbering value' ,
textStartNewList : 'Start new list' ,
textContinueNumbering : 'Continue numbering' ,
textSeparateList : 'Separate list' ,
textJoinList : 'Join to previous list' ,
2018-07-20 09:55:03 +00:00
textNumberingValue : 'Numbering Value' ,
2019-02-12 12:31:27 +00:00
bulletsText : 'Bullets and Numbering' ,
txtDistribHor : 'Distribute Horizontally' ,
txtDistribVert : 'Distribute Vertically' ,
2019-02-27 10:11:28 +00:00
textRotate270 : 'Rotate 90° Counterclockwise' ,
textRotate90 : 'Rotate 90° Clockwise' ,
2019-02-26 15:59:16 +00:00
textFlipV : 'Flip Vertically' ,
textFlipH : 'Flip Horizontally' ,
2019-04-09 10:41:08 +00:00
textRotate : 'Rotate' ,
textCrop : 'Crop' ,
textCropFill : 'Fill' ,
2019-04-15 14:37:15 +00:00
textCropFit : 'Fit' ,
2019-08-05 08:59:52 +00:00
textFollow : 'Follow move' ,
2019-08-07 09:16:40 +00:00
toDictionaryText : 'Add to Dictionary' ,
2019-09-05 11:38:34 +00:00
txtPrintSelection : 'Print Selection' ,
2019-09-06 11:37:43 +00:00
textCells : 'Cells' ,
2019-09-21 08:52:21 +00:00
textSeveral : 'Several Rows/Columns' ,
2019-12-12 07:22:20 +00:00
txtInsertCaption : 'Insert Caption' ,
2020-05-13 14:43:45 +00:00
txtEmpty : '(Empty)' ,
2020-09-21 21:01:04 +00:00
textFromStorage : 'From Storage' ,
2020-10-15 12:50:39 +00:00
advancedDropCapText : 'Drop Cap Settings' ,
textTitleCellsRemove : 'Delete Cells' ,
textLeft : 'Shift cells left' ,
textRow : 'Delete entire row' ,
2020-10-31 16:11:19 +00:00
textCol : 'Delete entire column' ,
2020-10-07 16:13:24 +00:00
textRemCheckBox : 'Remove Checkbox' ,
textRemRadioBox : 'Remove Radio Button' ,
textRemComboBox : 'Remove Combo Box' ,
textRemDropdown : 'Remove Dropdown' ,
textRemPicture : 'Remove Image' ,
2021-08-19 12:50:54 +00:00
textRemField : 'Remove Text Field' ,
txtRemoveWarning : 'Do you want to remove this signature?<br>It can\'t be undone.' ,
2021-09-03 11:39:20 +00:00
notcriticalErrorTitle : 'Warning' ,
2021-09-21 10:34:31 +00:00
txtWarnUrl : 'Clicking this link can be harmful to your device and data.<br>Are you sure you want to continue?' ,
2022-01-20 21:11:12 +00:00
textEditPoints : 'Edit Points' ,
textAccept : 'Accept Change' ,
textReject : 'Reject Change'
2021-08-19 12:50:54 +00:00
2020-10-07 16:13:24 +00:00
} , DE . Views . DocumentHolder || { } ) ) ;
2016-03-11 00:48:53 +00:00
} ) ;