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
/ * *
* ImageSettingsAdvanced . js
*
* Created by Julia Radzhabova on 3 / 03 / 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 ( [ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.template' ,
'common/main/lib/view/AdvancedSettingsWindow' ,
'common/main/lib/component/ComboBox' ,
'common/main/lib/component/MetricSpinner' ,
'common/main/lib/component/CheckBox' ,
'common/main/lib/component/RadioBox'
] , function ( contentTemplate ) {
'use strict' ;
DE . Views . ImageSettingsAdvanced = Common . Views . AdvancedSettingsWindow . extend ( _ . extend ( {
options : {
contentWidth : 340 ,
2016-03-17 13:31:57 +00:00
height : 485 ,
2016-03-11 00:48:53 +00:00
toggleGroup : 'image-adv-settings-group' ,
sizeOriginal : { width : 0 , height : 0 } ,
sizeMax : { width : 55.88 , height : 55.88 } ,
2016-04-21 11:47:28 +00:00
properties : null ,
storageName : 'de-img-settings-adv-category'
2016-03-11 00:48:53 +00:00
} ,
initialize : function ( options ) {
_ . extend ( this . options , {
title : this . textTitle ,
items : [
{ panelId : 'id-adv-image-width' , panelCaption : this . textSize } ,
2016-04-21 11:47:28 +00:00
{ panelId : 'id-adv-shape-size' , panelCaption : this . textSize } ,
2018-08-03 11:00:54 +00:00
{ panelId : 'id-adv-image-rotate' , panelCaption : this . textRotation } ,
2016-03-11 00:48:53 +00:00
{ panelId : 'id-adv-image-wrap' , panelCaption : this . textBtnWrap } ,
{ panelId : 'id-adv-image-position' , panelCaption : this . textPosition } ,
2017-08-04 11:24:30 +00:00
{ panelId : 'id-adv-image-shape' , panelCaption : this . textWeightArrows } ,
2020-02-25 13:47:53 +00:00
{ panelId : 'id-adv-image-margins' , panelCaption : this . textTextBox } ,
2017-01-18 13:14:03 +00:00
{ panelId : 'id-adv-image-alttext' , panelCaption : this . textAlt }
2016-03-11 00:48:53 +00:00
] ,
contentTemplate : _ . template ( contentTemplate ) ( {
scope : this
} )
} , options ) ;
Common . Views . AdvancedSettingsWindow . prototype . initialize . call ( this , this . options ) ;
this . spinners = [ ] ;
this . _state = {
2016-04-05 11:52:34 +00:00
HAlignType : Asc . c _oAscAlignH . Left ,
HAlignFrom : Asc . c _oAscRelativeFromH . Character ,
HPositionFrom : Asc . c _oAscRelativeFromH . Character ,
HPositionPcFrom : Asc . c _oAscRelativeFromH . Page ,
2016-04-12 07:55:42 +00:00
ShapeWidthPcFrom : Asc . c _oAscRelativeFromH . Margin ,
2016-04-05 11:52:34 +00:00
VAlignType : Asc . c _oAscAlignV . Top ,
2016-04-20 10:31:42 +00:00
VAlignFrom : Asc . c _oAscRelativeFromV . Paragraph ,
VPositionFrom : Asc . c _oAscRelativeFromV . Paragraph ,
2016-04-05 11:52:34 +00:00
VPositionPcFrom : Asc . c _oAscRelativeFromV . Page ,
2016-04-12 07:55:42 +00:00
ShapeHeightPcFrom : Asc . c _oAscRelativeFromV . Margin ,
2016-03-11 00:48:53 +00:00
spnXChanged : false ,
2016-03-17 13:31:57 +00:00
spnYChanged : false ,
spnXPcChanged : false ,
spnYPcChanged : false
2016-03-11 00:48:53 +00:00
} ;
2016-04-05 11:52:34 +00:00
this . _objectType = Asc . c _oAscTypeSelectElement . Image ;
2016-03-11 00:48:53 +00:00
this . Margins = undefined ;
this . _nRatio = 1 ;
this . _originalProps = this . options . imageProps ;
2016-05-19 14:35:21 +00:00
this . sectionProps = this . options . sectionProps ;
2016-03-17 13:31:57 +00:00
this . pageWidth = this . options . sectionProps ? this . options . sectionProps . get _W ( ) : 210 ;
this . pageHeight = this . options . sectionProps ? this . options . sectionProps . get _H ( ) : 297 ;
2020-02-19 14:07:50 +00:00
this . api = this . options . api ;
2016-03-11 00:48:53 +00:00
this . _changedProps = null ;
this . _changedShapeProps = null ;
} ,
render : function ( ) {
Common . Views . AdvancedSettingsWindow . prototype . render . call ( this ) ;
var me = this ;
2016-04-12 07:55:42 +00:00
// Image & Chart Size
2016-03-11 00:48:53 +00:00
this . spnWidth = new Common . UI . MetricSpinner ( {
el : $ ( '#image-advanced-spin-width' ) ,
step : . 1 ,
width : 80 ,
defaultUnit : "cm" ,
value : '3 cm' ,
maxValue : 55.88 ,
minValue : 0
} ) ;
this . spnWidth . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . btnRatio . pressed ) {
var w = field . getNumberValue ( ) ;
var h = w / this . _nRatio ;
if ( h > this . sizeMax . height ) {
h = this . sizeMax . height ;
w = h * this . _nRatio ;
this . spnWidth . setValue ( w , true ) ;
}
this . spnHeight . setValue ( h , true ) ;
}
if ( this . _changedProps ) {
this . _changedProps . put _Width ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
this . _changedProps . put _Height ( Common . Utils . Metric . fnRecalcToMM ( this . spnHeight . getNumberValue ( ) ) ) ;
2019-04-22 14:29:30 +00:00
this . _changedProps . put _ResetCrop ( false ) ;
2016-03-11 00:48:53 +00:00
}
} , this ) ) ;
this . spinners . push ( this . spnWidth ) ;
this . spnHeight = new Common . UI . MetricSpinner ( {
el : $ ( '#image-advanced-spin-height' ) ,
step : . 1 ,
width : 80 ,
defaultUnit : "cm" ,
value : '3 cm' ,
maxValue : 55.88 ,
minValue : 0
} ) ;
this . spnHeight . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
var h = field . getNumberValue ( ) , w = null ;
if ( this . btnRatio . pressed ) {
w = h * this . _nRatio ;
if ( w > this . sizeMax . width ) {
w = this . sizeMax . width ;
h = w / this . _nRatio ;
this . spnHeight . setValue ( h , true ) ;
}
this . spnWidth . setValue ( w , true ) ;
}
if ( this . _changedProps ) {
this . _changedProps . put _Height ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
this . _changedProps . put _Width ( Common . Utils . Metric . fnRecalcToMM ( this . spnWidth . getNumberValue ( ) ) ) ;
2019-04-22 14:29:30 +00:00
this . _changedProps . put _ResetCrop ( false ) ;
2016-03-11 00:48:53 +00:00
}
} , this ) ) ;
this . spinners . push ( this . spnHeight ) ;
this . btnOriginalSize = new Common . UI . Button ( {
el : $ ( '#image-advanced-button-original-size' )
} ) ;
this . btnOriginalSize . on ( 'click' , _ . bind ( function ( btn , e ) {
this . spnWidth . setValue ( this . sizeOriginal . width , true ) ;
this . spnHeight . setValue ( this . sizeOriginal . height , true ) ;
this . _nRatio = this . sizeOriginal . width / this . sizeOriginal . height ;
if ( this . _changedProps ) {
this . _changedProps . put _Height ( Common . Utils . Metric . fnRecalcToMM ( this . spnHeight . getNumberValue ( ) ) ) ;
this . _changedProps . put _Width ( Common . Utils . Metric . fnRecalcToMM ( this . spnWidth . getNumberValue ( ) ) ) ;
2019-04-22 14:29:30 +00:00
this . _changedProps . put _ResetCrop ( true ) ;
2016-03-11 00:48:53 +00:00
}
} , this ) ) ;
this . btnRatio = new Common . UI . Button ( {
cls : 'btn-toolbar' ,
2019-12-02 11:48:50 +00:00
iconCls : 'toolbar__icon advanced-btn-ratio' ,
2016-03-11 00:48:53 +00:00
style : 'margin-bottom: 1px;' ,
enableToggle : true ,
hint : this . textKeepRatio
} ) ;
this . btnRatio . render ( $ ( '#image-advanced-button-ratio' ) ) ;
this . btnRatio . on ( 'click' , _ . bind ( function ( btn , e ) {
if ( btn . pressed && this . spnHeight . getNumberValue ( ) > 0 ) {
this . _nRatio = this . spnWidth . getNumberValue ( ) / this . spnHeight . getNumberValue ( ) ;
}
2016-05-24 08:35:01 +00:00
if ( this . _changedProps ) {
this . _changedProps . asc _putLockAspect ( btn . pressed ) ;
}
2016-03-11 00:48:53 +00:00
} , this ) ) ;
2016-04-12 07:55:42 +00:00
// Shape Size
this . radioHSize = new Common . UI . RadioBox ( {
el : $ ( '#shape-radio-hsize' ) ,
name : 'asc-radio-width' ,
checked : true
} ) ;
this . radioHSize . on ( 'change' , _ . bind ( this . onRadioHSizeChange , this ) ) ;
this . radioHSizePc = new Common . UI . RadioBox ( {
el : $ ( '#shape-radio-hsizepc' ) ,
name : 'asc-radio-width'
} ) ;
this . radioHSizePc . on ( 'change' , _ . bind ( this . onRadioHSizePcChange , this ) ) ;
this . radioVSize = new Common . UI . RadioBox ( {
el : $ ( '#shape-radio-vsize' ) ,
name : 'asc-radio-height' ,
checked : true
} ) ;
this . radioVSize . on ( 'change' , _ . bind ( this . onRadioVSizeChange , this ) ) ;
this . radioVSizePc = new Common . UI . RadioBox ( {
el : $ ( '#shape-radio-vsizepc' ) ,
name : 'asc-radio-height'
} ) ;
this . radioVSizePc . on ( 'change' , _ . bind ( this . onRadioVSizePcChange , this ) ) ;
this . chRatio = new Common . UI . CheckBox ( {
el : $ ( '#shape-checkbox-ratio' ) ,
labelText : this . textAspectRatio
} ) ;
this . chRatio . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( ( field . getValue ( ) == 'checked' ) && this . spnShapeHeight . getNumberValue ( ) > 0 ) {
this . _nRatio = this . spnShapeWidth . getNumberValue ( ) / this . spnShapeHeight . getNumberValue ( ) ;
}
2016-05-24 08:35:01 +00:00
if ( this . _changedProps ) {
this . _changedProps . asc _putLockAspect ( field . getValue ( ) == 'checked' ) ;
}
2016-04-12 07:55:42 +00:00
} , this ) ) ;
this . spnShapeWidth = new Common . UI . MetricSpinner ( {
el : $ ( '#shape-advanced-spin-width' ) ,
step : . 1 ,
width : 80 ,
defaultUnit : "cm" ,
value : '3 cm' ,
maxValue : 55.88 ,
minValue : 0
} ) ;
this . spnShapeWidth . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . chRatio . getValue ( ) == 'checked' && ! this . chRatio . isDisabled ( ) ) {
var w = field . getNumberValue ( ) ;
var h = w / this . _nRatio ;
if ( h > this . sizeMax . height ) {
h = this . sizeMax . height ;
w = h * this . _nRatio ;
this . spnShapeWidth . setValue ( w , true ) ;
}
this . spnShapeHeight . setValue ( h , true ) ;
}
if ( this . _changedProps ) {
this . _changedProps . put _Width ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
2016-04-12 10:21:31 +00:00
this . fillShapeHeight ( ) ;
2016-04-12 07:55:42 +00:00
}
} , this ) ) ;
this . spinners . push ( this . spnShapeWidth ) ;
this . spnShapeHeight = new Common . UI . MetricSpinner ( {
el : $ ( '#shape-advanced-spin-height' ) ,
step : . 1 ,
width : 80 ,
defaultUnit : "cm" ,
value : '3 cm' ,
maxValue : 55.88 ,
minValue : 0
} ) ;
this . spnShapeHeight . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
var h = field . getNumberValue ( ) , w = null ;
if ( this . chRatio . getValue ( ) == 'checked' && ! this . chRatio . isDisabled ( ) ) {
w = h * this . _nRatio ;
if ( w > this . sizeMax . width ) {
w = this . sizeMax . width ;
h = w / this . _nRatio ;
this . spnShapeHeight . setValue ( h , true ) ;
}
this . spnShapeWidth . setValue ( w , true ) ;
}
if ( this . _changedProps ) {
this . _changedProps . put _Height ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
2016-04-12 10:21:31 +00:00
this . fillShapeWidth ( ) ;
2016-04-12 07:55:42 +00:00
}
} , this ) ) ;
this . spinners . push ( this . spnShapeHeight ) ;
this . spnShapeWidthPc = new Common . UI . MetricSpinner ( {
el : $ ( '#shape-advanced-spin-width-rel' ) ,
disabled : true ,
step : 1 ,
width : 80 ,
defaultUnit : "%" ,
value : '1 %' ,
maxValue : 1000 ,
minValue : 1
} ) ;
this . spnShapeWidthPc . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _SizeRelH ( ) === null || this . _changedProps . get _SizeRelH ( ) === undefined )
this . _changedProps . put _SizeRelH ( new Asc . CImagePositionH ( ) ) ;
this . _changedProps . get _SizeRelH ( ) . put _Value ( field . getNumberValue ( ) ) ;
this . _changedProps . get _SizeRelH ( ) . put _RelativeFrom ( this . _state . ShapeWidthPcFrom ) ;
2016-04-12 10:21:31 +00:00
this . fillShapeHeight ( ) ;
2016-04-12 07:55:42 +00:00
}
} , this ) ) ;
this . spnShapeHeightPc = new Common . UI . MetricSpinner ( {
el : $ ( '#shape-advanced-spin-height-rel' ) ,
disabled : true ,
step : 1 ,
width : 80 ,
defaultUnit : "%" ,
value : '1 %' ,
maxValue : 1000 ,
minValue : 1
} ) ;
this . spnShapeHeightPc . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _SizeRelV ( ) === null || this . _changedProps . get _SizeRelV ( ) === undefined )
this . _changedProps . put _SizeRelV ( new Asc . CImagePositionV ( ) ) ;
this . _changedProps . get _SizeRelV ( ) . put _Value ( field . getNumberValue ( ) ) ;
this . _changedProps . get _SizeRelV ( ) . put _RelativeFrom ( this . _state . ShapeHeightPcFrom ) ;
2016-04-12 10:21:31 +00:00
this . fillShapeWidth ( ) ;
2016-04-12 07:55:42 +00:00
}
} , this ) ) ;
this . _arrHRelativePc = [
2016-05-19 14:35:21 +00:00
{ displayValue : this . textLeftMargin , value : Asc . c _oAscRelativeFromH . LeftMargin , size : this . sectionProps . get _LeftMargin ( ) } ,
{ displayValue : this . textMargin , value : Asc . c _oAscRelativeFromH . Margin , size : this . sectionProps . get _W ( ) - this . sectionProps . get _LeftMargin ( ) - this . sectionProps . get _RightMargin ( ) } ,
{ displayValue : this . textPage , value : Asc . c _oAscRelativeFromH . Page , size : this . sectionProps . get _W ( ) } ,
{ displayValue : this . textRightMargin , value : Asc . c _oAscRelativeFromH . RightMargin , size : this . sectionProps . get _RightMargin ( ) }
2016-04-12 07:55:42 +00:00
] ;
this . cmbWidthPc = new Common . UI . ComboBox ( {
el : $ ( '#shape-combo-width-rel' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
data : this . _arrHRelativePc
} ) ;
this . cmbWidthPc . setDisabled ( true ) ;
this . cmbWidthPc . setValue ( this . _state . ShapeWidthPcFrom ) ;
this . cmbWidthPc . on ( 'selected' , _ . bind ( this . onCmbWidthPcSelect , this ) ) ;
this . _arrVRelativePc = [
2016-05-19 14:35:21 +00:00
{ displayValue : this . textMargin , value : Asc . c _oAscRelativeFromV . Margin , size : this . sectionProps . get _H ( ) - this . sectionProps . get _TopMargin ( ) - this . sectionProps . get _BottomMargin ( ) } ,
{ displayValue : this . textBottomMargin , value : Asc . c _oAscRelativeFromV . BottomMargin , size : this . sectionProps . get _BottomMargin ( ) } ,
{ displayValue : this . textPage , value : Asc . c _oAscRelativeFromV . Page , size : this . sectionProps . get _H ( ) } ,
{ displayValue : this . textTopMargin , value : Asc . c _oAscRelativeFromV . TopMargin , size : this . sectionProps . get _TopMargin ( ) }
2016-04-12 07:55:42 +00:00
] ;
this . cmbHeightPc = new Common . UI . ComboBox ( {
el : $ ( '#shape-combo-height-rel' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
data : this . _arrVRelativePc
} ) ;
this . cmbHeightPc . setDisabled ( true ) ;
this . cmbHeightPc . setValue ( this . _state . ShapeHeightPcFrom ) ;
this . cmbHeightPc . on ( 'selected' , _ . bind ( this . onCmbHeightPcSelect , this ) ) ;
2018-08-03 11:00:54 +00:00
// Rotation
this . spnAngle = new Common . UI . MetricSpinner ( {
el : $ ( '#image-advanced-spin-angle' ) ,
step : 1 ,
width : 80 ,
defaultUnit : "°" ,
value : '0 °' ,
maxValue : 3600 ,
minValue : - 3600
} ) ;
this . chFlipHor = new Common . UI . CheckBox ( {
el : $ ( '#image-advanced-checkbox-hor' ) ,
labelText : this . textHorizontally
} ) ;
this . chFlipVert = new Common . UI . CheckBox ( {
el : $ ( '#image-advanced-checkbox-vert' ) ,
labelText : this . textVertically
} ) ;
2016-03-11 00:48:53 +00:00
// Wrapping
this . btnWrapInline = new Common . UI . Button ( {
2019-12-17 12:15:19 +00:00
cls : 'btn-options huge-1' ,
2016-03-11 00:48:53 +00:00
iconCls : 'icon-advanced-wrap btn-wrap-inline' ,
2016-04-05 11:52:34 +00:00
posId : Asc . c _oAscWrapStyle2 . Inline ,
2016-03-11 00:48:53 +00:00
hint : this . textWrapInlineTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'imgAdvWrapGroup'
} ) ;
this . btnWrapInline . render ( $ ( '#image-advanced-button-wrap-inline' ) ) ;
this . btnWrapInline . on ( 'click' , _ . bind ( this . onBtnWrapClick , this ) ) ;
this . btnWrapSquare = new Common . UI . Button ( {
2019-12-17 12:15:19 +00:00
cls : 'btn-options huge-1' ,
2016-03-11 00:48:53 +00:00
iconCls : 'icon-advanced-wrap btn-wrap-square' ,
2016-04-05 11:52:34 +00:00
posId : Asc . c _oAscWrapStyle2 . Square ,
2016-03-11 00:48:53 +00:00
hint : this . textWrapSquareTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'imgAdvWrapGroup'
} ) ;
this . btnWrapSquare . render ( $ ( '#image-advanced-button-wrap-square' ) ) ;
this . btnWrapSquare . on ( 'click' , _ . bind ( this . onBtnWrapClick , this ) ) ;
this . btnWrapTight = new Common . UI . Button ( {
2019-12-17 12:15:19 +00:00
cls : 'btn-options huge-1' ,
2016-03-11 00:48:53 +00:00
iconCls : 'icon-advanced-wrap btn-wrap-tight' ,
2016-04-05 11:52:34 +00:00
posId : Asc . c _oAscWrapStyle2 . Tight ,
2016-03-11 00:48:53 +00:00
hint : this . textWrapTightTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'imgAdvWrapGroup'
} ) ;
this . btnWrapTight . render ( $ ( '#image-advanced-button-wrap-tight' ) ) ;
this . btnWrapTight . on ( 'click' , _ . bind ( this . onBtnWrapClick , this ) ) ;
this . btnWrapThrough = new Common . UI . Button ( {
2019-12-17 12:15:19 +00:00
cls : 'btn-options huge-1' ,
2016-03-11 00:48:53 +00:00
iconCls : 'icon-advanced-wrap btn-wrap-through' ,
2016-04-05 11:52:34 +00:00
posId : Asc . c _oAscWrapStyle2 . Through ,
2016-03-11 00:48:53 +00:00
hint : this . textWrapThroughTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'imgAdvWrapGroup'
} ) ;
this . btnWrapThrough . render ( $ ( '#image-advanced-button-wrap-through' ) ) ;
this . btnWrapThrough . on ( 'click' , _ . bind ( this . onBtnWrapClick , this ) ) ;
this . btnWrapTopBottom = new Common . UI . Button ( {
2019-12-17 12:15:19 +00:00
cls : 'btn-options huge-1' ,
2016-03-11 00:48:53 +00:00
iconCls : 'icon-advanced-wrap btn-wrap-topbottom' ,
2016-04-05 11:52:34 +00:00
posId : Asc . c _oAscWrapStyle2 . TopAndBottom ,
2016-03-11 00:48:53 +00:00
hint : this . textWrapTopbottomTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'imgAdvWrapGroup'
} ) ;
this . btnWrapTopBottom . render ( $ ( '#image-advanced-button-wrap-topbottom' ) ) ;
this . btnWrapTopBottom . on ( 'click' , _ . bind ( this . onBtnWrapClick , this ) ) ;
this . btnWrapBehind = new Common . UI . Button ( {
2019-12-17 12:15:19 +00:00
cls : 'btn-options huge-1' ,
2016-03-11 00:48:53 +00:00
iconCls : 'icon-advanced-wrap btn-wrap-behind' ,
2016-04-05 11:52:34 +00:00
posId : Asc . c _oAscWrapStyle2 . Behind ,
2016-03-11 00:48:53 +00:00
hint : this . textWrapBehindTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'imgAdvWrapGroup'
} ) ;
this . btnWrapBehind . render ( $ ( '#image-advanced-button-wrap-behind' ) ) ;
this . btnWrapBehind . on ( 'click' , _ . bind ( this . onBtnWrapClick , this ) ) ;
this . btnWrapInFront = new Common . UI . Button ( {
2019-12-17 12:15:19 +00:00
cls : 'btn-options huge-1' ,
2016-03-11 00:48:53 +00:00
iconCls : 'icon-advanced-wrap btn-wrap-infront' ,
2016-04-05 11:52:34 +00:00
posId : Asc . c _oAscWrapStyle2 . InFront ,
2016-03-11 00:48:53 +00:00
hint : this . textWrapInFrontTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'imgAdvWrapGroup'
} ) ;
this . btnWrapInFront . render ( $ ( '#image-advanced-button-wrap-infront' ) ) ;
this . btnWrapInFront . on ( 'click' , _ . bind ( this . onBtnWrapClick , this ) ) ;
this . spnTop = new Common . UI . MetricSpinner ( {
el : $ ( '#image-advanced-distance-top' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnTop . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _Paddings ( ) === null || this . _changedProps . get _Paddings ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _Paddings ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _Paddings ( ) . put _Top ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnTop ) ;
this . spnBottom = new Common . UI . MetricSpinner ( {
el : $ ( '#image-advanced-distance-bottom' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnBottom . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _Paddings ( ) === null || this . _changedProps . get _Paddings ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _Paddings ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _Paddings ( ) . put _Bottom ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnBottom ) ;
this . spnLeft = new Common . UI . MetricSpinner ( {
el : $ ( '#image-advanced-distance-left' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0.32 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnLeft . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _Paddings ( ) === null || this . _changedProps . get _Paddings ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _Paddings ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _Paddings ( ) . put _Left ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnLeft ) ;
this . spnRight = new Common . UI . MetricSpinner ( {
el : $ ( '#image-advanced-distance-right' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0.32 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnRight . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _Paddings ( ) === null || this . _changedProps . get _Paddings ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _Paddings ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _Paddings ( ) . put _Right ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnRight ) ;
// Position
this . spnX = new Common . UI . MetricSpinner ( {
el : $ ( '#image-spin-x' ) ,
step : . 1 ,
width : 115 ,
disabled : true ,
defaultUnit : "cm" ,
defaultValue : 0 ,
value : '0 cm' ,
maxValue : 55.87 ,
minValue : - 55.87
} ) ;
this . spnX . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionH ( ) === null || this . _changedProps . get _PositionH ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionH ( new Asc . CImagePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _UseAlign ( false ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionH ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HPositionFrom ) ;
this . _changedProps . get _PositionH ( ) . put _Value ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
this . _state . spnXChanged = true ;
}
} , this ) ) ;
this . spinners . push ( this . spnX ) ;
this . spnY = new Common . UI . MetricSpinner ( {
el : $ ( '#image-spin-y' ) ,
step : . 1 ,
width : 115 ,
disabled : true ,
defaultUnit : "cm" ,
defaultValue : 0 ,
value : '0 cm' ,
maxValue : 55.87 ,
minValue : - 55.87
} ) ;
this . spnY . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionV ( ) === null || this . _changedProps . get _PositionV ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionV ( new Asc . CImagePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionV ( ) . put _UseAlign ( false ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionV ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionV ( ) . put _RelativeFrom ( this . _state . VPositionFrom ) ;
this . _changedProps . get _PositionV ( ) . put _Value ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
this . _state . spnYChanged = true ;
}
} , this ) ) ;
this . spinners . push ( this . spnY ) ;
// Horizontal
this . _arrHAlign = [
2016-04-05 11:52:34 +00:00
{ displayValue : this . textLeft , value : Asc . c _oAscAlignH . Left } ,
{ displayValue : this . textCenter , value : Asc . c _oAscAlignH . Center } ,
{ displayValue : this . textRight , value : Asc . c _oAscAlignH . Right }
2016-03-11 00:48:53 +00:00
] ;
this . cmbHAlign = new Common . UI . ComboBox ( {
el : $ ( '#image-combo-halign' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
data : this . _arrHAlign
} ) ;
this . cmbHAlign . setValue ( this . _state . HAlignType ) ;
this . cmbHAlign . on ( 'selected' , _ . bind ( this . onHAlignSelect , this ) ) ;
this . _arrHRelative = [
2016-04-05 11:52:34 +00:00
{ displayValue : this . textCharacter , value : Asc . c _oAscRelativeFromH . Character } ,
{ displayValue : this . textColumn , value : Asc . c _oAscRelativeFromH . Column } ,
{ displayValue : this . textLeftMargin , value : Asc . c _oAscRelativeFromH . LeftMargin } ,
{ displayValue : this . textMargin , value : Asc . c _oAscRelativeFromH . Margin } ,
{ displayValue : this . textPage , value : Asc . c _oAscRelativeFromH . Page } ,
{ displayValue : this . textRightMargin , value : Asc . c _oAscRelativeFromH . RightMargin }
2016-03-11 00:48:53 +00:00
] ;
this . cmbHRelative = new Common . UI . ComboBox ( {
el : $ ( '#image-combo-hrelative' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
data : this . _arrHRelative
} ) ;
this . cmbHRelative . setValue ( this . _state . HAlignFrom ) ;
this . cmbHRelative . on ( 'selected' , _ . bind ( this . onHRelativeSelect , this ) ) ;
this . cmbHPosition = new Common . UI . ComboBox ( {
el : $ ( '#image-combo-hposition' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
data : this . _arrHRelative
} ) ;
this . cmbHPosition . setDisabled ( true ) ;
this . cmbHPosition . setValue ( this . _state . HPositionFrom ) ;
this . cmbHPosition . on ( 'selected' , _ . bind ( this . onHPositionSelect , this ) ) ;
2016-03-17 13:31:57 +00:00
this . spnXPc = new Common . UI . MetricSpinner ( {
el : $ ( '#image-spin-xpc' ) ,
step : 1 ,
width : 115 ,
disabled : true ,
defaultUnit : "%" ,
defaultValue : 0 ,
value : '0 %' ,
maxValue : 1000 ,
minValue : - 1000
} ) ;
this . spnXPc . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionH ( ) === null || this . _changedProps . get _PositionH ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionH ( new Asc . CImagePositionH ( ) ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionH ( ) . put _UseAlign ( false ) ;
this . _changedProps . get _PositionH ( ) . put _Percent ( true ) ;
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HPositionPcFrom ) ;
this . _changedProps . get _PositionH ( ) . put _Value ( field . getNumberValue ( ) ) ;
this . _state . spnXPcChanged = true ;
}
} , this ) ) ;
this . cmbHPositionPc = new Common . UI . ComboBox ( {
el : $ ( '#image-combo-hpositionpc' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
data : this . _arrHRelativePc
} ) ;
this . cmbHPositionPc . setDisabled ( true ) ;
this . cmbHPositionPc . setValue ( this . _state . HPositionPcFrom ) ;
this . cmbHPositionPc . on ( 'selected' , _ . bind ( this . onHPositionPcSelect , this ) ) ;
2016-03-11 00:48:53 +00:00
// Vertical
this . _arrVAlign = [
2016-04-05 11:52:34 +00:00
{ displayValue : this . textTop , value : Asc . c _oAscAlignV . Top } ,
{ displayValue : this . textCenter , value : Asc . c _oAscAlignV . Center } ,
{ displayValue : this . textBottom , value : Asc . c _oAscAlignV . Bottom }
2016-03-11 00:48:53 +00:00
] ;
this . cmbVAlign = new Common . UI . ComboBox ( {
el : $ ( '#image-combo-valign' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
data : this . _arrVAlign
} ) ;
this . cmbVAlign . setValue ( this . _state . VAlignType ) ;
this . cmbVAlign . on ( 'selected' , _ . bind ( this . onVAlignSelect , this ) ) ;
this . _arrVRelative = [
2016-04-05 11:52:34 +00:00
{ displayValue : this . textLine , value : Asc . c _oAscRelativeFromV . Line } ,
{ displayValue : this . textMargin , value : Asc . c _oAscRelativeFromV . Margin } ,
{ displayValue : this . textBottomMargin , value : Asc . c _oAscRelativeFromV . BottomMargin } ,
{ displayValue : this . textParagraph , value : Asc . c _oAscRelativeFromV . Paragraph } ,
{ displayValue : this . textPage , value : Asc . c _oAscRelativeFromV . Page } ,
{ displayValue : this . textTopMargin , value : Asc . c _oAscRelativeFromV . TopMargin }
2016-03-11 00:48:53 +00:00
] ;
this . cmbVRelative = new Common . UI . ComboBox ( {
el : $ ( '#image-combo-vrelative' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
data : this . _arrVRelative
} ) ;
this . cmbVRelative . setValue ( this . _state . VAlignFrom ) ;
this . cmbVRelative . on ( 'selected' , _ . bind ( this . onVRelativeSelect , this ) ) ;
this . cmbVPosition = new Common . UI . ComboBox ( {
el : $ ( '#image-combo-vposition' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
data : this . _arrVRelative
} ) ;
this . cmbVPosition . setDisabled ( true ) ;
this . cmbVPosition . setValue ( this . _state . VPositionFrom ) ;
this . cmbVPosition . on ( 'selected' , _ . bind ( this . onVPositionSelect , this ) ) ;
2016-03-17 13:31:57 +00:00
this . spnYPc = new Common . UI . MetricSpinner ( {
el : $ ( '#image-spin-ypc' ) ,
step : 1 ,
width : 115 ,
disabled : true ,
defaultUnit : "%" ,
defaultValue : 0 ,
value : '0 %' ,
maxValue : 1000 ,
minValue : - 1000
} ) ;
this . spnYPc . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionV ( ) === null || this . _changedProps . get _PositionV ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionV ( new Asc . CImagePositionV ( ) ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionV ( ) . put _UseAlign ( false ) ;
this . _changedProps . get _PositionV ( ) . put _Percent ( true ) ;
this . _changedProps . get _PositionV ( ) . put _RelativeFrom ( this . _state . VPositionPcFrom ) ;
this . _changedProps . get _PositionV ( ) . put _Value ( field . getNumberValue ( ) ) ;
this . _state . spnYPcChanged = true ;
}
} , this ) ) ;
this . cmbVPositionPc = new Common . UI . ComboBox ( {
el : $ ( '#image-combo-vpositionpc' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
data : this . _arrVRelativePc
} ) ;
this . cmbVPositionPc . setDisabled ( true ) ;
this . cmbVPositionPc . setValue ( this . _state . VPositionPcFrom ) ;
this . cmbVPositionPc . on ( 'selected' , _ . bind ( this . onVPositionPcSelect , this ) ) ;
2016-03-11 00:48:53 +00:00
this . radioHAlign = new Common . UI . RadioBox ( {
el : $ ( '#image-radio-halign' ) ,
name : 'asc-radio-horizontal' ,
checked : true
} ) ;
this . radioHAlign . on ( 'change' , _ . bind ( this . onRadioHAlignChange , this ) ) ;
this . radioHPosition = new Common . UI . RadioBox ( {
el : $ ( '#image-radio-hposition' ) ,
name : 'asc-radio-horizontal'
} ) ;
this . radioHPosition . on ( 'change' , _ . bind ( this . onRadioHPositionChange , this ) ) ;
2016-03-17 13:31:57 +00:00
this . radioHPositionPc = new Common . UI . RadioBox ( {
el : $ ( '#image-radio-hpositionpc' ) ,
name : 'asc-radio-horizontal'
} ) ;
this . radioHPositionPc . on ( 'change' , _ . bind ( this . onRadioHPositionPcChange , this ) ) ;
2016-03-11 00:48:53 +00:00
this . radioVAlign = new Common . UI . RadioBox ( {
el : $ ( '#image-radio-valign' ) ,
name : 'asc-radio-vertical' ,
checked : true
} ) ;
this . radioVAlign . on ( 'change' , _ . bind ( this . onRadioVAlignChange , this ) ) ;
this . radioVPosition = new Common . UI . RadioBox ( {
el : $ ( '#image-radio-vposition' ) ,
name : 'asc-radio-vertical'
} ) ;
this . radioVPosition . on ( 'change' , _ . bind ( this . onRadioVPositionChange , this ) ) ;
2016-03-17 13:31:57 +00:00
this . radioVPositionPc = new Common . UI . RadioBox ( {
el : $ ( '#image-radio-vpositionpc' ) ,
name : 'asc-radio-vertical'
} ) ;
this . radioVPositionPc . on ( 'change' , _ . bind ( this . onRadioVPositionPcChange , this ) ) ;
2016-03-11 00:48:53 +00:00
this . chMove = new Common . UI . CheckBox ( {
el : $ ( '#image-checkbox-move' ) ,
labelText : this . textMove
} ) ;
this . chMove . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
var value = this . _arrVRelative [ ( field . getValue ( ) == 'checked' ) ? 3 : 4 ] . value ;
if ( this . cmbVRelative . isDisabled ( ) ) {
this . cmbVPosition . setValue ( value ) ;
var rec = this . cmbVPosition . getSelectedRecord ( ) ;
if ( rec ) this . onVPositionSelect ( this . cmbVPosition , rec ) ;
} else {
this . cmbVRelative . setValue ( value ) ;
var rec = this . cmbVRelative . getSelectedRecord ( ) ;
if ( rec ) this . onVRelativeSelect ( this . cmbVRelative , rec ) ;
}
}
} , this ) ) ;
this . chOverlap = new Common . UI . CheckBox ( {
el : $ ( '#image-checkbox-overlap' ) ,
labelText : this . textOverlap
} ) ;
this . chOverlap . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
this . _changedProps . put _AllowOverlap ( field . getValue ( ) == 'checked' ) ;
}
} , this ) ) ;
// Margins
this . spnMarginTop = new Common . UI . MetricSpinner ( {
el : $ ( '#image-margin-top' ) ,
step : . 1 ,
width : 100 ,
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnMarginTop . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . Margins === undefined )
2016-04-18 12:21:15 +00:00
this . Margins = new Asc . asc _CPaddings ( ) ;
2016-03-11 00:48:53 +00:00
this . Margins . put _Top ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnMarginTop ) ;
this . spnMarginBottom = new Common . UI . MetricSpinner ( {
el : $ ( '#image-margin-bottom' ) ,
step : . 1 ,
width : 100 ,
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnMarginBottom . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . Margins === undefined )
2016-04-18 12:21:15 +00:00
this . Margins = new Asc . asc _CPaddings ( ) ;
2016-03-11 00:48:53 +00:00
this . Margins . put _Bottom ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnMarginBottom ) ;
this . spnMarginLeft = new Common . UI . MetricSpinner ( {
el : $ ( '#image-margin-left' ) ,
step : . 1 ,
width : 100 ,
defaultUnit : "cm" ,
value : '0.19 cm' ,
maxValue : 9.34 ,
minValue : 0
} ) ;
this . spnMarginLeft . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . Margins === undefined )
2016-04-18 12:21:15 +00:00
this . Margins = new Asc . asc _CPaddings ( ) ;
2016-03-11 00:48:53 +00:00
this . Margins . put _Left ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnMarginLeft ) ;
this . spnMarginRight = new Common . UI . MetricSpinner ( {
el : $ ( '#image-margin-right' ) ,
step : . 1 ,
width : 100 ,
defaultUnit : "cm" ,
value : '0.19 cm' ,
maxValue : 9.34 ,
minValue : 0
} ) ;
this . spnMarginRight . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . Margins === undefined )
2016-04-18 12:21:15 +00:00
this . Margins = new Asc . asc _CPaddings ( ) ;
2016-03-11 00:48:53 +00:00
this . Margins . put _Right ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnMarginRight ) ;
2020-02-25 13:47:53 +00:00
this . chAutofit = new Common . UI . CheckBox ( {
el : $ ( '#shape-checkbox-autofit' ) ,
labelText : this . textResizeFit
} ) ;
this . chAutofit . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedShapeProps ) {
this . _changedShapeProps . asc _putTextFitType ( field . getValue ( ) == 'checked' ? AscFormat . text _fit _Auto : AscFormat . text _fit _No ) ;
}
} , this ) ) ;
2016-03-11 00:48:53 +00:00
// Shape
this . _arrCapType = [
2016-04-05 11:52:34 +00:00
{ displayValue : this . textFlat , value : Asc . c _oAscLineCapType . Flat } ,
{ displayValue : this . textRound , value : Asc . c _oAscLineCapType . Round } ,
{ displayValue : this . textSquare , value : Asc . c _oAscLineCapType . Square }
2016-03-11 00:48:53 +00:00
] ;
this . cmbCapType = new Common . UI . ComboBox ( {
el : $ ( '#shape-advanced-cap-type' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 100px;' ,
editable : false ,
data : this . _arrCapType
} ) ;
2016-04-05 11:52:34 +00:00
this . cmbCapType . setValue ( Asc . c _oAscLineCapType . Flat ) ;
2016-03-11 00:48:53 +00:00
this . cmbCapType . on ( 'selected' , _ . bind ( function ( combo , record ) {
if ( this . _changedShapeProps ) {
if ( this . _changedShapeProps . get _stroke ( ) === null )
2016-04-18 12:21:15 +00:00
this . _changedShapeProps . put _stroke ( new Asc . asc _CStroke ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedShapeProps . get _stroke ( ) . put _linecap ( record . value ) ;
}
} , this ) ) ;
this . _arrJoinType = [
2016-04-05 11:52:34 +00:00
{ displayValue : this . textRound , value : Asc . c _oAscLineJoinType . Round } ,
{ displayValue : this . textBevel , value : Asc . c _oAscLineJoinType . Bevel } ,
{ displayValue : this . textMiter , value : Asc . c _oAscLineJoinType . Miter }
2016-03-11 00:48:53 +00:00
] ;
this . cmbJoinType = new Common . UI . ComboBox ( {
el : $ ( '#shape-advanced-join-type' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 100px;' ,
editable : false ,
data : this . _arrJoinType
} ) ;
2016-04-05 11:52:34 +00:00
this . cmbJoinType . setValue ( Asc . c _oAscLineJoinType . Round ) ;
2016-03-11 00:48:53 +00:00
this . cmbJoinType . on ( 'selected' , _ . bind ( function ( combo , record ) {
if ( this . _changedShapeProps ) {
if ( this . _changedShapeProps . get _stroke ( ) === null )
2016-04-18 12:21:15 +00:00
this . _changedShapeProps . put _stroke ( new Asc . asc _CStroke ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedShapeProps . get _stroke ( ) . put _linejoin ( record . value ) ;
}
} , this ) ) ;
var _arrStyles = [ ] , _arrSize = [ ] ;
for ( var i = 0 ; i < 6 ; i ++ )
_arrStyles . push ( { value : i , offsetx : 80 * i + 10 , offsety : 0 } ) ;
2016-04-05 11:52:34 +00:00
_arrStyles [ 0 ] . type = Asc . c _oAscLineBeginType . None ;
_arrStyles [ 1 ] . type = Asc . c _oAscLineBeginType . Triangle ;
_arrStyles [ 2 ] . type = Asc . c _oAscLineBeginType . Arrow ;
_arrStyles [ 3 ] . type = Asc . c _oAscLineBeginType . Stealth ;
_arrStyles [ 4 ] . type = Asc . c _oAscLineBeginType . Diamond ;
_arrStyles [ 5 ] . type = Asc . c _oAscLineBeginType . Oval ;
2016-03-11 00:48:53 +00:00
for ( i = 0 ; i < 9 ; i ++ )
_arrSize . push ( { value : i , offsetx : 80 + 10 , offsety : 20 * ( i + 1 ) } ) ;
2016-04-05 11:52:34 +00:00
_arrSize [ 0 ] . type = Asc . c _oAscLineBeginSize . small _small ;
_arrSize [ 1 ] . type = Asc . c _oAscLineBeginSize . small _mid ;
_arrSize [ 2 ] . type = Asc . c _oAscLineBeginSize . small _large ;
_arrSize [ 3 ] . type = Asc . c _oAscLineBeginSize . mid _small ;
_arrSize [ 4 ] . type = Asc . c _oAscLineBeginSize . mid _mid ;
_arrSize [ 5 ] . type = Asc . c _oAscLineBeginSize . mid _large ;
_arrSize [ 6 ] . type = Asc . c _oAscLineBeginSize . large _small ;
_arrSize [ 7 ] . type = Asc . c _oAscLineBeginSize . large _mid ;
_arrSize [ 8 ] . type = Asc . c _oAscLineBeginSize . large _large ;
2016-03-11 00:48:53 +00:00
this . btnBeginStyle = new Common . UI . ComboBox ( {
el : $ ( '#shape-advanced-begin-style' ) ,
template : _ . template ( [
'<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">' ,
'<div class="img-arrows form-control image" style="width: 100px;"></div>' ,
'<div style="display: table-cell;"></div>' ,
'<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>' ,
'</div>'
] . join ( '' ) )
} ) ;
this . btnBeginStyleMenu = ( new Common . UI . Menu ( {
style : 'min-width: 105px;' ,
2019-02-28 10:05:23 +00:00
additionalAlign : this . menuAddAlign ,
2016-03-11 00:48:53 +00:00
items : [
{ template : _ . template ( '<div id="shape-advanced-menu-begin-style" style="width: 105px; margin: 0 5px;"></div>' ) }
]
} ) ) . render ( $ ( '#shape-advanced-begin-style' ) ) ;
this . mnuBeginStylePicker = new Common . UI . DataView ( {
el : $ ( '#shape-advanced-menu-begin-style' ) ,
parentMenu : this . btnBeginStyleMenu ,
store : new Common . UI . DataViewStore ( _arrStyles ) ,
itemTemplate : _ . template ( '<div id="<%= id %>" class="item-arrow img-arrows" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>' )
} ) ;
this . mnuBeginStylePicker . on ( 'item:click' , _ . bind ( this . onSelectBeginStyle , this ) ) ;
this . _selectStyleItem ( this . btnBeginStyle , null ) ;
this . btnBeginSize = new Common . UI . ComboBox ( {
el : $ ( '#shape-advanced-begin-size' ) ,
template : _ . template ( [
'<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">' ,
'<div class="img-arrows form-control image" style="width: 100px;"></div>' ,
'<div style="display: table-cell;"></div>' ,
'<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>' ,
'</div>'
] . join ( '' ) )
} ) ;
this . btnBeginSizeMenu = ( new Common . UI . Menu ( {
style : 'min-width: 160px;' ,
2019-02-28 10:05:23 +00:00
additionalAlign : this . menuAddAlign ,
2016-03-11 00:48:53 +00:00
items : [
{ template : _ . template ( '<div id="shape-advanced-menu-begin-size" style="width: 160px; margin: 0 5px;"></div>' ) }
]
} ) ) . render ( $ ( '#shape-advanced-begin-size' ) ) ;
this . mnuBeginSizePicker = new Common . UI . DataView ( {
el : $ ( '#shape-advanced-menu-begin-size' ) ,
parentMenu : this . btnBeginSizeMenu ,
store : new Common . UI . DataViewStore ( _arrSize ) ,
itemTemplate : _ . template ( '<div id="<%= id %>" class="item-arrow img-arrows" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>' )
} ) ;
this . mnuBeginSizePicker . on ( 'item:click' , _ . bind ( this . onSelectBeginSize , this ) ) ;
this . _selectStyleItem ( this . btnBeginSize , null ) ;
for ( i = 0 ; i < _arrStyles . length ; i ++ )
_arrStyles [ i ] . offsety += 200 ;
for ( i = 0 ; i < _arrSize . length ; i ++ )
_arrSize [ i ] . offsety += 200 ;
this . btnEndStyle = new Common . UI . ComboBox ( {
el : $ ( '#shape-advanced-end-style' ) ,
template : _ . template ( [
'<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">' ,
'<div class="img-arrows form-control image" style="width: 100px;"></div>' ,
'<div style="display: table-cell;"></div>' ,
'<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>' ,
'</div>'
] . join ( '' ) )
} ) ;
this . btnEndStyleMenu = ( new Common . UI . Menu ( {
style : 'min-width: 105px;' ,
2019-02-28 10:05:23 +00:00
additionalAlign : this . menuAddAlign ,
2016-03-11 00:48:53 +00:00
items : [
{ template : _ . template ( '<div id="shape-advanced-menu-end-style" style="width: 105px; margin: 0 5px;"></div>' ) }
]
} ) ) . render ( $ ( '#shape-advanced-end-style' ) ) ;
this . mnuEndStylePicker = new Common . UI . DataView ( {
el : $ ( '#shape-advanced-menu-end-style' ) ,
parentMenu : this . btnEndStyleMenu ,
store : new Common . UI . DataViewStore ( _arrStyles ) ,
itemTemplate : _ . template ( '<div id="<%= id %>" class="item-arrow img-arrows" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>' )
} ) ;
this . mnuEndStylePicker . on ( 'item:click' , _ . bind ( this . onSelectEndStyle , this ) ) ;
this . _selectStyleItem ( this . btnEndStyle , null ) ;
this . btnEndSize = new Common . UI . ComboBox ( {
el : $ ( '#shape-advanced-end-size' ) ,
template : _ . template ( [
'<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">' ,
'<div class="img-arrows form-control image" style="width: 100px;"></div>' ,
'<div style="display: table-cell;"></div>' ,
'<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>' ,
'</div>'
] . join ( '' ) )
} ) ;
this . btnEndSizeMenu = ( new Common . UI . Menu ( {
style : 'min-width: 160px;' ,
2019-02-28 10:05:23 +00:00
additionalAlign : this . menuAddAlign ,
2016-03-11 00:48:53 +00:00
items : [
{ template : _ . template ( '<div id="shape-advanced-menu-end-size" style="width: 160px; margin: 0 5px;"></div>' ) }
]
} ) ) . render ( $ ( '#shape-advanced-end-size' ) ) ;
this . mnuEndSizePicker = new Common . UI . DataView ( {
el : $ ( '#shape-advanced-menu-end-size' ) ,
parentMenu : this . btnEndSizeMenu ,
store : new Common . UI . DataViewStore ( _arrSize ) ,
itemTemplate : _ . template ( '<div id="<%= id %>" class="item-arrow img-arrows" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>' )
} ) ;
this . mnuEndSizePicker . on ( 'item:click' , _ . bind ( this . onSelectEndSize , this ) ) ;
this . _selectStyleItem ( this . btnEndSize , null ) ;
2017-01-18 13:14:03 +00:00
// Alt Text
this . inputAltTitle = new Common . UI . InputField ( {
el : $ ( '#image-advanced-alt-title' ) ,
allowBlank : true ,
validateOnBlur : false ,
style : 'width: 100%;'
} ) . on ( 'changed:after' , function ( ) {
me . isAltTitleChanged = true ;
} ) ;
this . textareaAltDescription = this . $window . find ( 'textarea' ) ;
this . textareaAltDescription . keydown ( function ( event ) {
if ( event . keyCode == Common . UI . Keys . RETURN ) {
event . stopPropagation ( ) ;
}
me . isAltDescChanged = true ;
} ) ;
2016-03-11 00:48:53 +00:00
this . afterRender ( ) ;
} ,
afterRender : function ( ) {
this . updateMetricUnit ( ) ;
this . _setDefaults ( this . _originalProps ) ;
2016-04-21 11:47:28 +00:00
this . btnsCategory [ ( this . _objectType == Asc . c _oAscTypeSelectElement . Shape ) ? 0 : 1 ] . setVisible ( false ) ;
if ( this . storageName ) {
var value = Common . localStorage . getItem ( this . storageName ) ;
this . setActiveCategory ( ( value !== null ) ? parseInt ( value ) : 0 ) ;
2016-04-12 07:55:42 +00:00
}
2016-03-11 00:48:53 +00:00
} ,
_setDefaults : function ( props ) {
if ( props ) {
2016-04-05 11:52:34 +00:00
this . _objectType = Asc . c _oAscTypeSelectElement . Image ;
2016-03-11 00:48:53 +00:00
var value = props . get _WrappingStyle ( ) ;
if ( props . get _CanBeFlow ( ) ) {
switch ( value ) {
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . Inline :
2016-03-11 00:48:53 +00:00
this . btnWrapInline . toggle ( true ) ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . Square :
2016-03-11 00:48:53 +00:00
this . btnWrapSquare . toggle ( true ) ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . Tight :
2016-03-11 00:48:53 +00:00
this . btnWrapTight . toggle ( true ) ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . Through :
2016-03-11 00:48:53 +00:00
this . btnWrapThrough . toggle ( true ) ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . TopAndBottom :
2016-03-11 00:48:53 +00:00
this . btnWrapTopBottom . toggle ( true ) ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . Behind :
2016-03-11 00:48:53 +00:00
this . btnWrapBehind . toggle ( true ) ;
break ;
2016-04-05 11:52:34 +00:00
case Asc . c _oAscWrapStyle2 . InFront :
2016-03-11 00:48:53 +00:00
this . btnWrapInFront . toggle ( true ) ;
break ;
default :
this . btnWrapInline . toggle ( false ) ;
this . btnWrapSquare . toggle ( false ) ;
this . btnWrapTight . toggle ( false ) ;
this . btnWrapThrough . toggle ( false ) ;
this . btnWrapTopBottom . toggle ( false ) ;
this . btnWrapBehind . toggle ( false ) ;
this . btnWrapInFront . toggle ( false ) ;
break ;
}
this . _DisableElem ( value ) ;
} else {
this . btnWrapInline . toggle ( true ) ;
this . btnWrapSquare . setDisabled ( true ) ;
this . btnWrapTight . setDisabled ( true ) ;
this . btnWrapThrough . setDisabled ( true ) ;
this . btnWrapTopBottom . setDisabled ( true ) ;
this . btnWrapBehind . setDisabled ( true ) ;
this . btnWrapInFront . setDisabled ( true ) ;
2016-04-05 11:52:34 +00:00
this . _DisableElem ( Asc . c _oAscWrapStyle2 . Inline ) ;
2016-03-11 00:48:53 +00:00
}
if ( props . get _Paddings ( ) ) {
var Paddings = {
Top : props . get _Paddings ( ) . get _Top ( ) ,
Right : props . get _Paddings ( ) . get _Right ( ) ,
Bottom : props . get _Paddings ( ) . get _Bottom ( ) ,
Left : props . get _Paddings ( ) . get _Left ( )
} ;
if ( Paddings . Top !== null && Paddings . Top !== undefined ) this . spnTop . setValue ( Common . Utils . Metric . fnRecalcFromMM ( Paddings . Top ) , true ) ;
if ( Paddings . Left !== null && Paddings . Left !== undefined ) this . spnLeft . setValue ( Common . Utils . Metric . fnRecalcFromMM ( Paddings . Left ) , true ) ;
if ( Paddings . Bottom !== null && Paddings . Bottom !== undefined ) this . spnBottom . setValue ( Common . Utils . Metric . fnRecalcFromMM ( Paddings . Bottom ) , true ) ;
if ( Paddings . Right !== null && Paddings . Right !== undefined ) this . spnRight . setValue ( Common . Utils . Metric . fnRecalcFromMM ( Paddings . Right ) , true ) ;
}
var Position = props . get _PositionH ( ) ;
if ( Position ) {
if ( Position . get _UseAlign ( ) ) {
value = Position . get _Align ( ) ;
for ( var i = 0 ; i < this . _arrHAlign . length ; i ++ ) {
if ( value == this . _arrHAlign [ i ] . value ) {
this . cmbHAlign . setValue ( value ) ;
this . _state . HAlignType = value ;
break ;
}
}
value = Position . get _RelativeFrom ( ) ;
for ( var i = 0 ; i < this . _arrHRelative . length ; i ++ ) {
if ( value == this . _arrHRelative [ i ] . value ) {
this . cmbHRelative . setValue ( value ) ;
this . _state . HAlignFrom = value ;
break ;
}
}
2016-03-17 13:31:57 +00:00
} else if ( Position . get _Percent ( ) ) {
this . radioHPositionPc . setValue ( true ) ;
this . spnXPc . setValue ( Position . get _Value ( ) ) ;
value = Position . get _RelativeFrom ( ) ;
for ( i = 0 ; i < this . _arrHRelativePc . length ; i ++ ) {
if ( value == this . _arrHRelativePc [ i ] . value ) {
this . cmbHPositionPc . setValue ( value ) ;
this . _state . HPositionPcFrom = value ;
break ;
}
}
2016-03-11 00:48:53 +00:00
} else {
this . radioHPosition . setValue ( true ) ;
value = Position . get _Value ( ) ;
this . spnX . setValue ( Common . Utils . Metric . fnRecalcFromMM ( value ) ) ;
value = Position . get _RelativeFrom ( ) ;
for ( i = 0 ; i < this . _arrHRelative . length ; i ++ ) {
if ( value == this . _arrHRelative [ i ] . value ) {
this . cmbHPosition . setValue ( value ) ;
this . _state . HPositionFrom = value ;
break ;
}
}
}
}
Position = props . get _PositionV ( ) ;
if ( Position ) {
if ( Position . get _UseAlign ( ) ) {
value = Position . get _Align ( ) ;
for ( i = 0 ; i < this . _arrVAlign . length ; i ++ ) {
if ( value == this . _arrVAlign [ i ] . value ) {
this . cmbVAlign . setValue ( value ) ;
this . _state . VAlignType = value ;
break ;
}
}
2016-03-17 13:31:57 +00:00
value = Position . get _RelativeFrom ( ) ;
for ( i = 0 ; i < this . _arrVRelative . length ; i ++ ) {
if ( value == this . _arrVRelative [ i ] . value ) {
this . cmbVRelative . setValue ( value ) ;
this . _state . VAlignFrom = value ;
break ;
}
}
} else if ( Position . get _Percent ( ) ) {
this . radioVPositionPc . setValue ( true ) ;
this . spnYPc . setValue ( Position . get _Value ( ) ) ;
value = Position . get _RelativeFrom ( ) ;
for ( i = 0 ; i < this . _arrVRelativePc . length ; i ++ ) {
if ( value == this . _arrVRelativePc [ i ] . value ) {
this . cmbVPositionPc . setValue ( value ) ;
this . _state . VPositionPcFrom = value ;
break ;
}
}
2016-03-11 00:48:53 +00:00
} else {
this . radioVPosition . setValue ( true ) ;
value = Position . get _Value ( ) ;
this . spnY . setValue ( Common . Utils . Metric . fnRecalcFromMM ( value ) ) ;
2016-03-17 13:31:57 +00:00
value = Position . get _RelativeFrom ( ) ;
for ( i = 0 ; i < this . _arrVRelative . length ; i ++ ) {
if ( value == this . _arrVRelative [ i ] . value ) {
this . cmbVPosition . setValue ( value ) ;
this . _state . VPositionFrom = value ;
break ;
}
2016-03-11 00:48:53 +00:00
}
}
2016-04-05 11:52:34 +00:00
this . chMove . setValue ( ( value == Asc . c _oAscRelativeFromV . Line || value == Asc . c _oAscRelativeFromV . Paragraph ) , true ) ;
2016-03-17 13:31:57 +00:00
this . chMove . setDisabled ( ! Position . get _UseAlign ( ) && Position . get _Percent ( ) ) ;
2016-03-11 00:48:53 +00:00
}
this . chOverlap . setValue ( ( props . get _AllowOverlap ( ) !== null && props . get _AllowOverlap ( ) !== undefined ) ? props . get _AllowOverlap ( ) : 'indeterminate' , true ) ;
if ( props . get _Height ( ) > 0 )
this . _nRatio = props . get _Width ( ) / props . get _Height ( ) ;
var shapeprops = props . get _ShapeProperties ( ) ;
var chartprops = props . get _ChartProperties ( ) ;
2019-06-14 07:53:20 +00:00
var pluginGuid = props . asc _getPluginGuid ( ) ;
2016-03-11 00:48:53 +00:00
this . btnOriginalSize . setVisible ( ! ( shapeprops || chartprops ) ) ;
this . btnOriginalSize . setDisabled ( props . get _ImageUrl ( ) === null || props . get _ImageUrl ( ) === undefined ) ;
2018-08-03 11:00:54 +00:00
this . btnsCategory [ 5 ] . setVisible ( shapeprops !== null && ! shapeprops . get _FromChart ( ) ) ; // Shapes
this . btnsCategory [ 6 ] . setVisible ( shapeprops !== null && ! shapeprops . get _FromChart ( ) ) ; // Margins
2019-06-14 07:53:20 +00:00
this . btnsCategory [ 2 ] . setVisible ( ! chartprops && ( pluginGuid === null || pluginGuid === undefined ) ) ; // Rotation
2016-03-11 00:48:53 +00:00
2020-02-19 14:07:50 +00:00
var control _props = this . api && this . api . asc _IsContentControl ( ) ? this . api . asc _GetContentControlProperties ( ) : null ;
this . btnsCategory [ 3 ] . setDisabled ( props . get _FromGroup ( ) || ! ! control _props && ( control _props . get _SpecificType ( ) == Asc . c _oAscContentControlSpecificType . Picture ) ) ; // Wrapping
2016-03-11 00:48:53 +00:00
if ( shapeprops ) {
2016-04-05 11:52:34 +00:00
this . _objectType = Asc . c _oAscTypeSelectElement . Shape ;
2016-03-11 00:48:53 +00:00
this . _setShapeDefaults ( shapeprops ) ;
this . setTitle ( this . textTitleShape ) ;
2016-05-24 08:35:01 +00:00
value = props . asc _getLockAspect ( ) ;
this . chRatio . setValue ( value ) ;
2016-04-12 07:55:42 +00:00
this . spnShapeWidth . setMaxValue ( this . sizeMax . width ) ;
this . spnShapeHeight . setMaxValue ( this . sizeMax . height ) ;
var sizeRelH = props . get _SizeRelH ( ) ;
if ( sizeRelH ) {
this . radioHSizePc . setValue ( true ) ;
this . spnShapeWidthPc . setValue ( sizeRelH . get _Value ( ) ) ;
value = sizeRelH . get _RelativeFrom ( ) ;
for ( i = 0 ; i < this . _arrHRelativePc . length ; i ++ ) {
if ( value == this . _arrHRelativePc [ i ] . value ) {
this . cmbWidthPc . setValue ( value ) ;
2016-05-19 14:35:21 +00:00
this . spnShapeWidth . setValue ( Common . Utils . Metric . fnRecalcFromMM ( this . _arrHRelativePc [ i ] . size * sizeRelH . get _Value ( ) / 100 ) . toFixed ( 2 ) , true ) ;
2016-04-12 07:55:42 +00:00
this . _state . ShapeWidthPcFrom = value ;
break ;
}
}
} else {
this . radioHSize . setValue ( true ) ;
value = props . get _Width ( ) ;
this . spnShapeWidth . setValue ( ( value !== undefined ) ? Common . Utils . Metric . fnRecalcFromMM ( value ) . toFixed ( 2 ) : '' , true ) ;
}
var sizeRelV = props . get _SizeRelV ( ) ;
if ( sizeRelV ) {
this . radioVSizePc . setValue ( true ) ;
this . spnShapeHeightPc . setValue ( sizeRelV . get _Value ( ) ) ;
value = sizeRelV . get _RelativeFrom ( ) ;
for ( i = 0 ; i < this . _arrVRelativePc . length ; i ++ ) {
if ( value == this . _arrVRelativePc [ i ] . value ) {
this . cmbHeightPc . setValue ( value ) ;
2016-05-19 14:35:21 +00:00
this . spnShapeHeight . setValue ( Common . Utils . Metric . fnRecalcFromMM ( this . _arrVRelativePc [ i ] . size * sizeRelV . get _Value ( ) / 100 ) . toFixed ( 2 ) , true ) ;
2016-04-12 07:55:42 +00:00
this . _state . ShapeHeightPcFrom = value ;
break ;
}
}
} else {
this . radioVSize . setValue ( true ) ;
value = props . get _Height ( ) ;
this . spnShapeHeight . setValue ( ( value !== undefined ) ? Common . Utils . Metric . fnRecalcFromMM ( value ) . toFixed ( 2 ) : '' , true ) ;
}
this . chRatio . setDisabled ( this . radioVSizePc . getValue ( ) || this . radioHSizePc . getValue ( ) ) ;
2016-03-11 00:48:53 +00:00
var margins = shapeprops . get _paddings ( ) ;
if ( margins ) {
var val = margins . get _Left ( ) ;
this . spnMarginLeft . setValue ( ( null !== val && undefined !== val ) ? Common . Utils . Metric . fnRecalcFromMM ( val ) : '' , true ) ;
val = margins . get _Top ( ) ;
this . spnMarginTop . setValue ( ( null !== val && undefined !== val ) ? Common . Utils . Metric . fnRecalcFromMM ( val ) : '' , true ) ;
val = margins . get _Right ( ) ;
this . spnMarginRight . setValue ( ( null !== val && undefined !== val ) ? Common . Utils . Metric . fnRecalcFromMM ( val ) : '' , true ) ;
val = margins . get _Bottom ( ) ;
this . spnMarginBottom . setValue ( ( null !== val && undefined !== val ) ? Common . Utils . Metric . fnRecalcFromMM ( val ) : '' , true ) ;
}
2020-02-25 13:47:53 +00:00
this . chAutofit . setValue ( shapeprops . asc _getTextFitType ( ) == AscFormat . text _fit _Auto ) ;
2018-08-03 11:00:54 +00:00
this . btnsCategory [ 6 ] . setDisabled ( null === margins ) ; // Margins
this . btnsCategory [ 5 ] . setDisabled ( shapeprops . get _stroke ( ) . get _type ( ) == Asc . c _oAscStrokeType . STROKE _NONE ) ; // Weights & Arrows
2016-03-11 00:48:53 +00:00
2016-04-12 07:55:42 +00:00
} else {
2016-05-24 08:35:01 +00:00
value = props . asc _getLockAspect ( ) ;
2016-04-12 07:55:42 +00:00
if ( chartprops ) {
this . _objectType = Asc . c _oAscTypeSelectElement . Chart ;
this . setTitle ( this . textTitleChart ) ;
}
else {
this . setTitle ( this . textTitle ) ;
}
2016-05-24 08:35:01 +00:00
this . btnRatio . toggle ( value ) ;
2016-04-12 07:55:42 +00:00
this . spnWidth . setMaxValue ( this . sizeMax . width ) ;
this . spnHeight . setMaxValue ( this . sizeMax . height ) ;
value = props . get _Width ( ) ;
this . spnWidth . setValue ( ( value !== undefined ) ? Common . Utils . Metric . fnRecalcFromMM ( value ) . toFixed ( 2 ) : '' , true ) ;
value = props . get _Height ( ) ;
this . spnHeight . setValue ( ( value !== undefined ) ? Common . Utils . Metric . fnRecalcFromMM ( value ) . toFixed ( 2 ) : '' , true ) ;
2016-03-11 00:48:53 +00:00
}
2018-08-03 11:00:54 +00:00
if ( ! chartprops ) {
value = props . asc _getRot ( ) ;
this . spnAngle . setValue ( ( value == undefined || value === null ) ? '' : Math . floor ( value * 180 / 3.14159265358979 + 0.5 ) , true ) ;
this . chFlipHor . setValue ( props . asc _getFlipH ( ) ) ;
this . chFlipVert . setValue ( props . asc _getFlipV ( ) ) ;
}
2017-01-18 13:14:03 +00:00
value = props . asc _getTitle ( ) ;
this . inputAltTitle . setValue ( value ? value : '' ) ;
value = props . asc _getDescription ( ) ;
this . textareaAltDescription . val ( value ? value : '' ) ;
2016-04-18 12:21:15 +00:00
this . _changedProps = new Asc . asc _CImgProperty ( ) ;
2016-03-11 00:48:53 +00:00
}
} ,
getSettings : function ( ) {
var properties = this . _changedProps ;
2016-04-05 11:52:34 +00:00
if ( this . _objectType == Asc . c _oAscTypeSelectElement . Shape ) {
2016-03-11 00:48:53 +00:00
properties . put _ShapeProperties ( this . _changedShapeProps ) ;
if ( this . Margins ) {
if ( properties . get _ShapeProperties ( ) === null || properties . get _ShapeProperties ( ) === undefined )
2016-04-18 12:21:15 +00:00
properties . put _ShapeProperties ( new Asc . asc _CShapeProperty ( ) ) ;
2016-03-11 00:48:53 +00:00
properties . get _ShapeProperties ( ) . put _paddings ( this . Margins ) ;
}
}
2016-04-05 11:52:34 +00:00
if ( this . _originalProps . get _WrappingStyle ( ) === Asc . c _oAscWrapStyle2 . Inline && properties . get _WrappingStyle ( ) !== undefined && properties . get _WrappingStyle ( ) !== Asc . c _oAscWrapStyle2 . Inline ) {
2016-03-11 00:48:53 +00:00
if ( properties . get _PositionH ( ) === null || properties . get _PositionH ( ) === undefined ) {
2016-04-05 12:57:51 +00:00
properties . put _PositionH ( new Asc . CImagePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
properties . get _PositionH ( ) . put _UseAlign ( false ) ;
2016-03-17 13:31:57 +00:00
properties . get _PositionH ( ) . put _Percent ( false ) ;
2016-04-05 11:52:34 +00:00
properties . get _PositionH ( ) . put _RelativeFrom ( Asc . c _oAscRelativeFromH . Column ) ;
var val = this . _originalProps . get _Value _X ( Asc . c _oAscRelativeFromH . Column ) ;
2016-03-11 00:48:53 +00:00
properties . get _PositionH ( ) . put _Value ( val ) ;
}
if ( properties . get _PositionV ( ) === null || properties . get _PositionV ( ) === undefined ) {
2016-04-05 12:57:51 +00:00
properties . put _PositionV ( new Asc . CImagePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
properties . get _PositionV ( ) . put _UseAlign ( false ) ;
2016-03-17 13:31:57 +00:00
properties . get _PositionV ( ) . put _Percent ( false ) ;
2016-04-05 11:52:34 +00:00
properties . get _PositionV ( ) . put _RelativeFrom ( Asc . c _oAscRelativeFromV . Paragraph ) ;
val = this . _originalProps . get _Value _Y ( Asc . c _oAscRelativeFromV . Paragraph ) ;
2016-03-11 00:48:53 +00:00
properties . get _PositionV ( ) . put _Value ( val ) ;
}
}
2018-08-03 11:00:54 +00:00
if ( this . _objectType != Asc . c _oAscTypeSelectElement . Chart ) {
properties . asc _putRot ( this . spnAngle . getNumberValue ( ) * 3.14159265358979 / 180 ) ;
properties . asc _putFlipH ( this . chFlipHor . getValue ( ) == 'checked' ) ;
properties . asc _putFlipV ( this . chFlipVert . getValue ( ) == 'checked' ) ;
}
2017-01-18 13:14:03 +00:00
if ( this . isAltTitleChanged )
properties . asc _putTitle ( this . inputAltTitle . getValue ( ) ) ;
if ( this . isAltDescChanged )
properties . asc _putDescription ( this . textareaAltDescription . val ( ) ) ;
2016-03-11 00:48:53 +00:00
return { imageProps : properties } ;
} ,
_setShapeDefaults : function ( props ) {
if ( props ) {
var stroke = props . get _stroke ( ) ;
if ( stroke ) {
var value = stroke . get _linejoin ( ) ;
for ( var i = 0 ; i < this . _arrJoinType . length ; i ++ ) {
if ( value == this . _arrJoinType [ i ] . value ) {
this . cmbJoinType . setValue ( value ) ;
break ;
}
}
value = stroke . get _linecap ( ) ;
for ( i = 0 ; i < this . _arrCapType . length ; i ++ ) {
if ( value == this . _arrCapType [ i ] . value ) {
this . cmbCapType . setValue ( value ) ;
break ;
}
}
var canchange = stroke . get _canChangeArrows ( ) ;
this . btnBeginStyle . setDisabled ( ! canchange ) ;
this . btnEndStyle . setDisabled ( ! canchange ) ;
this . btnBeginSize . setDisabled ( ! canchange ) ;
this . btnEndSize . setDisabled ( ! canchange ) ;
if ( canchange ) {
value = stroke . get _linebeginsize ( ) ;
var rec = this . mnuBeginSizePicker . store . findWhere ( { type : value } ) ;
if ( rec ) {
this . _beginSizeIdx = rec . get ( 'value' ) ;
} else {
this . _beginSizeIdx = null ;
this . _selectStyleItem ( this . btnBeginSize , null ) ;
}
value = stroke . get _linebeginstyle ( ) ;
rec = this . mnuBeginStylePicker . store . findWhere ( { type : value } ) ;
if ( rec ) {
this . mnuBeginStylePicker . selectRecord ( rec , true ) ;
this . _updateSizeArr ( this . btnBeginSize , this . mnuBeginSizePicker , rec , this . _beginSizeIdx ) ;
this . _selectStyleItem ( this . btnBeginStyle , rec ) ;
} else
this . _selectStyleItem ( this . btnBeginStyle , null ) ;
value = stroke . get _lineendsize ( ) ;
rec = this . mnuEndSizePicker . store . findWhere ( { type : value } ) ;
if ( rec ) {
this . _endSizeIdx = rec . get ( 'value' ) ;
} else {
this . _endSizeIdx = null ;
this . _selectStyleItem ( this . btnEndSize , null ) ;
}
value = stroke . get _lineendstyle ( ) ;
rec = this . mnuEndStylePicker . store . findWhere ( { type : value } ) ;
if ( rec ) {
this . mnuEndStylePicker . selectRecord ( rec , true ) ;
this . _updateSizeArr ( this . btnEndSize , this . mnuEndSizePicker , rec , this . _endSizeIdx ) ;
this . _selectStyleItem ( this . btnEndStyle , rec ) ;
} else
this . _selectStyleItem ( this . btnEndStyle , null ) ;
} else {
this . _selectStyleItem ( this . btnBeginStyle ) ;
this . _selectStyleItem ( this . btnEndStyle ) ;
this . _selectStyleItem ( this . btnBeginSize ) ;
this . _selectStyleItem ( this . btnEndSize ) ;
}
}
}
2016-04-18 12:21:15 +00:00
this . _changedShapeProps = new Asc . asc _CShapeProperty ( ) ;
2016-03-11 00:48:53 +00:00
} ,
updateMetricUnit : function ( ) {
if ( this . spinners ) {
for ( var i = 0 ; i < this . spinners . length ; i ++ ) {
var spinner = this . spinners [ i ] ;
2016-04-06 13:38:54 +00:00
spinner . setDefaultUnit ( Common . Utils . Metric . getCurrentMetricName ( ) ) ;
2016-04-06 15:17:40 +00:00
spinner . setStep ( Common . Utils . Metric . getCurrentMetric ( ) == Common . Utils . Metric . c _MetricUnits . pt ? 1 : 0.01 ) ;
2016-03-11 00:48:53 +00:00
}
}
this . sizeMax = {
width : Common . Utils . Metric . fnRecalcFromMM ( this . options . sizeMax . width * 10 ) ,
height : Common . Utils . Metric . fnRecalcFromMM ( this . options . sizeMax . height * 10 )
} ;
if ( this . options . sizeOriginal )
this . sizeOriginal = {
width : Common . Utils . Metric . fnRecalcFromMM ( this . options . sizeOriginal . width ) ,
height : Common . Utils . Metric . fnRecalcFromMM ( this . options . sizeOriginal . height )
} ;
} ,
onBtnWrapClick : function ( btn , e ) {
this . _DisableElem ( btn . options . posId ) ;
if ( this . _changedProps )
this . _changedProps . put _WrappingStyle ( btn . options . posId ) ;
} ,
_DisableElem : function ( btnId ) {
2016-04-05 11:52:34 +00:00
var disabledLR = ( btnId == Asc . c _oAscWrapStyle2 . Inline || btnId == Asc . c _oAscWrapStyle2 . Behind || btnId == Asc . c _oAscWrapStyle2 . InFront || btnId == Asc . c _oAscWrapStyle2 . TopAndBottom ) ;
var disabledTB = ( btnId == Asc . c _oAscWrapStyle2 . Inline || btnId == Asc . c _oAscWrapStyle2 . Behind || btnId == Asc . c _oAscWrapStyle2 . InFront
|| btnId == Asc . c _oAscWrapStyle2 . Tight || btnId == Asc . c _oAscWrapStyle2 . Through ) ;
2016-03-11 00:48:53 +00:00
this . spnLeft . setDisabled ( disabledLR ) ;
this . spnRight . setDisabled ( disabledLR ) ;
this . spnTop . setDisabled ( disabledTB ) ;
this . spnBottom . setDisabled ( disabledTB ) ;
2018-08-03 11:00:54 +00:00
this . btnsCategory [ 4 ] . setDisabled ( btnId == Asc . c _oAscWrapStyle2 . Inline ) ;
2016-03-11 00:48:53 +00:00
} ,
onHAlignSelect : function ( combo , record ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionH ( ) === null || this . _changedProps . get _PositionH ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionH ( new Asc . CImagePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . HAlignType = record . value ;
this . _changedProps . get _PositionH ( ) . put _UseAlign ( true ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionH ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HAlignFrom ) ;
this . _changedProps . get _PositionH ( ) . put _Align ( this . _state . HAlignType ) ;
}
} ,
onHRelativeSelect : function ( combo , record ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionH ( ) === null || this . _changedProps . get _PositionH ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionH ( new Asc . CImagePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . HAlignFrom = record . value ;
this . _changedProps . get _PositionH ( ) . put _UseAlign ( true ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionH ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HAlignFrom ) ;
this . _changedProps . get _PositionH ( ) . put _Align ( this . _state . HAlignType ) ;
}
} ,
onHPositionSelect : function ( combo , record ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionH ( ) === null || this . _changedProps . get _PositionH ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionH ( new Asc . CImagePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . HPositionFrom = record . value ;
this . _changedProps . get _PositionH ( ) . put _UseAlign ( false ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionH ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HPositionFrom ) ;
if ( ! this . _state . spnXChanged ) {
var val = this . _originalProps . get _Value _X ( this . _state . HPositionFrom ) ;
this . spnX . setValue ( Common . Utils . Metric . fnRecalcFromMM ( val ) , true ) ;
}
this . _changedProps . get _PositionH ( ) . put _Value ( Common . Utils . Metric . fnRecalcToMM ( this . spnX . getNumberValue ( ) ) ) ;
}
} ,
2016-03-17 13:31:57 +00:00
onHPositionPcSelect : function ( combo , record ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionH ( ) === null || this . _changedProps . get _PositionH ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionH ( new Asc . CImagePositionH ( ) ) ;
2016-03-17 13:31:57 +00:00
this . _state . HPositionPcFrom = record . value ;
this . _changedProps . get _PositionH ( ) . put _UseAlign ( false ) ;
this . _changedProps . get _PositionH ( ) . put _Percent ( true ) ;
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HPositionPcFrom ) ;
if ( ! this . _state . spnXPcChanged ) {
var val = this . _originalProps . get _Value _X ( this . _state . HPositionPcFrom ) ;
this . spnXPc . setValue ( parseFloat ( ( 100 * val / this . pageWidth ) . toFixed ( 2 ) ) , true ) ;
}
this . _changedProps . get _PositionH ( ) . put _Value ( this . spnXPc . getNumberValue ( ) ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onVAlignSelect : function ( combo , record ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionV ( ) === null || this . _changedProps . get _PositionV ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionV ( new Asc . CImagePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . VAlignType = record . value ;
this . _changedProps . get _PositionV ( ) . put _UseAlign ( true ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionV ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionV ( ) . put _RelativeFrom ( this . _state . VAlignFrom ) ;
this . _changedProps . get _PositionV ( ) . put _Align ( this . _state . VAlignType ) ;
}
} ,
onVRelativeSelect : function ( combo , record ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionV ( ) === null || this . _changedProps . get _PositionV ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionV ( new Asc . CImagePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . VAlignFrom = record . value ;
this . _changedProps . get _PositionV ( ) . put _UseAlign ( true ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionV ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionV ( ) . put _RelativeFrom ( this . _state . VAlignFrom ) ;
this . _changedProps . get _PositionV ( ) . put _Align ( this . _state . VAlignType ) ;
2016-04-05 11:52:34 +00:00
this . chMove . setValue ( this . _state . VAlignFrom == Asc . c _oAscRelativeFromV . Line || this . _state . VAlignFrom == Asc . c _oAscRelativeFromV . Paragraph , true ) ;
2016-03-11 00:48:53 +00:00
}
} ,
onVPositionSelect : function ( combo , record ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionV ( ) === null || this . _changedProps . get _PositionV ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionV ( new Asc . CImagePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . VPositionFrom = record . value ;
this . _changedProps . get _PositionV ( ) . put _UseAlign ( false ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionV ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionV ( ) . put _RelativeFrom ( this . _state . VPositionFrom ) ;
if ( ! this . _state . spnYChanged ) {
var val = this . _originalProps . get _Value _Y ( this . _state . VPositionFrom ) ;
this . spnY . setValue ( Common . Utils . Metric . fnRecalcFromMM ( val ) , true ) ;
}
this . _changedProps . get _PositionV ( ) . put _Value ( Common . Utils . Metric . fnRecalcToMM ( this . spnY . getNumberValue ( ) ) ) ;
2016-04-05 11:52:34 +00:00
this . chMove . setValue ( this . _state . VPositionFrom == Asc . c _oAscRelativeFromV . Line || this . _state . VPositionFrom == Asc . c _oAscRelativeFromV . Paragraph , true ) ;
2016-03-11 00:48:53 +00:00
}
} ,
2016-03-17 13:31:57 +00:00
onVPositionPcSelect : function ( combo , record ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionV ( ) === null || this . _changedProps . get _PositionV ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionV ( new Asc . CImagePositionV ( ) ) ;
2016-03-17 13:31:57 +00:00
this . _state . VPositionPcFrom = record . value ;
this . _changedProps . get _PositionV ( ) . put _UseAlign ( false ) ;
this . _changedProps . get _PositionV ( ) . put _Percent ( true ) ;
this . _changedProps . get _PositionV ( ) . put _RelativeFrom ( this . _state . VPositionPcFrom ) ;
if ( ! this . _state . spnYPcChanged ) {
var val = this . _originalProps . get _Value _Y ( this . _state . VPositionPcFrom ) ;
this . spnYPc . setValue ( parseFloat ( ( 100 * val / this . pageHeight ) . toFixed ( 2 ) ) , true ) ;
}
this . _changedProps . get _PositionV ( ) . put _Value ( this . spnYPc . getNumberValue ( ) ) ;
}
} ,
2016-03-11 00:48:53 +00:00
onRadioHAlignChange : function ( field , newValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionH ( ) === null || this . _changedProps . get _PositionH ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionH ( new Asc . CImagePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _UseAlign ( newValue ) ;
if ( newValue ) {
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionH ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _Align ( this . _state . HAlignType ) ;
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HAlignFrom ) ;
}
}
if ( newValue ) {
this . cmbHAlign . setDisabled ( false ) ;
this . cmbHRelative . setDisabled ( false ) ;
this . spnX . setDisabled ( true ) ;
this . cmbHPosition . setDisabled ( true ) ;
2016-03-17 13:31:57 +00:00
this . spnXPc . setDisabled ( true ) ;
this . cmbHPositionPc . setDisabled ( true ) ;
2016-03-11 00:48:53 +00:00
}
} ,
onRadioHPositionChange : function ( field , newValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionH ( ) === null || this . _changedProps . get _PositionH ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionH ( new Asc . CImagePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
if ( newValue ) {
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionH ( ) . put _UseAlign ( false ) ;
this . _changedProps . get _PositionH ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _Value ( Common . Utils . Metric . fnRecalcToMM ( this . spnX . getNumberValue ( ) ) ) ;
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HPositionFrom ) ;
}
}
if ( newValue ) {
this . cmbHAlign . setDisabled ( true ) ;
this . cmbHRelative . setDisabled ( true ) ;
this . spnX . setDisabled ( false ) ;
this . cmbHPosition . setDisabled ( false ) ;
2016-03-17 13:31:57 +00:00
this . spnXPc . setDisabled ( true ) ;
this . cmbHPositionPc . setDisabled ( true ) ;
}
} ,
onRadioHPositionPcChange : function ( field , newValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionH ( ) === null || this . _changedProps . get _PositionH ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionH ( new Asc . CImagePositionH ( ) ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionH ( ) . put _Percent ( newValue ) ;
if ( newValue ) {
this . _changedProps . get _PositionH ( ) . put _UseAlign ( false ) ;
this . _changedProps . get _PositionH ( ) . put _Value ( this . spnXPc . getNumberValue ( ) ) ;
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HPositionPcFrom ) ;
}
}
if ( newValue ) {
this . cmbHAlign . setDisabled ( true ) ;
this . cmbHRelative . setDisabled ( true ) ;
this . spnX . setDisabled ( true ) ;
this . cmbHPosition . setDisabled ( true ) ;
this . spnXPc . setDisabled ( false ) ;
this . cmbHPositionPc . setDisabled ( false ) ;
2016-03-11 00:48:53 +00:00
}
} ,
onRadioVAlignChange : function ( field , newValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionV ( ) === null || this . _changedProps . get _PositionV ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionV ( new Asc . CImagePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionV ( ) . put _UseAlign ( newValue ) ;
if ( newValue ) {
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionV ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionV ( ) . put _Align ( this . _state . VAlignType ) ;
this . _changedProps . get _PositionV ( ) . put _RelativeFrom ( this . _state . VAlignFrom ) ;
}
}
if ( newValue ) {
this . cmbVAlign . setDisabled ( false ) ;
this . cmbVRelative . setDisabled ( false ) ;
this . spnY . setDisabled ( true ) ;
this . cmbVPosition . setDisabled ( true ) ;
2016-04-05 11:52:34 +00:00
this . chMove . setValue ( this . _state . VAlignFrom == Asc . c _oAscRelativeFromV . Line || this . _state . VAlignFrom == Asc . c _oAscRelativeFromV . Paragraph , true ) ;
2016-03-17 13:31:57 +00:00
this . chMove . setDisabled ( false ) ;
this . spnYPc . setDisabled ( true ) ;
this . cmbVPositionPc . setDisabled ( true ) ;
2016-03-11 00:48:53 +00:00
}
} ,
onRadioVPositionChange : function ( field , newValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionV ( ) === null || this . _changedProps . get _PositionV ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionV ( new Asc . CImagePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
if ( newValue ) {
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionV ( ) . put _UseAlign ( false ) ;
this . _changedProps . get _PositionV ( ) . put _Percent ( false ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionV ( ) . put _Value ( Common . Utils . Metric . fnRecalcToMM ( this . spnY . getNumberValue ( ) ) ) ;
this . _changedProps . get _PositionV ( ) . put _RelativeFrom ( this . _state . VPositionFrom ) ;
}
}
if ( newValue ) {
this . cmbVAlign . setDisabled ( true ) ;
this . cmbVRelative . setDisabled ( true ) ;
this . spnY . setDisabled ( false ) ;
this . cmbVPosition . setDisabled ( false ) ;
2016-04-05 11:52:34 +00:00
this . chMove . setValue ( this . _state . VPositionFrom == Asc . c _oAscRelativeFromV . Line || this . _state . VPositionFrom == Asc . c _oAscRelativeFromV . Paragraph , true ) ;
2016-03-17 13:31:57 +00:00
this . chMove . setDisabled ( false ) ;
this . spnYPc . setDisabled ( true ) ;
2017-01-18 13:14:03 +00:00
this . cmbVPositionPc . setDisabled ( true ) ;
2016-03-17 13:31:57 +00:00
}
} ,
onRadioVPositionPcChange : function ( field , newValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _PositionV ( ) === null || this . _changedProps . get _PositionV ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _PositionV ( new Asc . CImagePositionV ( ) ) ;
2016-03-17 13:31:57 +00:00
this . _changedProps . get _PositionV ( ) . put _Percent ( newValue ) ;
if ( newValue ) {
this . _changedProps . get _PositionV ( ) . put _UseAlign ( false ) ;
this . _changedProps . get _PositionV ( ) . put _Value ( this . spnYPc . getNumberValue ( ) ) ;
this . _changedProps . get _PositionV ( ) . put _RelativeFrom ( this . _state . VPositionPcFrom ) ;
}
}
if ( newValue ) {
this . cmbVAlign . setDisabled ( true ) ;
this . cmbVRelative . setDisabled ( true ) ;
this . spnY . setDisabled ( true ) ;
this . cmbVPosition . setDisabled ( true ) ;
this . chMove . setValue ( false , true ) ;
this . chMove . setDisabled ( true ) ;
this . spnYPc . setDisabled ( false ) ;
2017-01-18 13:14:03 +00:00
this . cmbVPositionPc . setDisabled ( false ) ;
2016-03-11 00:48:53 +00:00
}
} ,
2016-04-12 07:55:42 +00:00
onRadioHSizeChange : function ( field , newValue , eOpts ) {
if ( newValue ) {
if ( this . _changedProps ) {
this . _changedProps . put _Width ( Common . Utils . Metric . fnRecalcToMM ( this . spnShapeWidth . getNumberValue ( ) ) ) ;
this . _changedProps . put _SizeRelH ( undefined ) ;
2016-04-12 10:21:31 +00:00
this . fillShapeHeight ( ) ;
2016-04-12 07:55:42 +00:00
}
this . chRatio . setDisabled ( this . radioVSizePc . getValue ( ) ) ;
this . cmbWidthPc . setDisabled ( true ) ;
this . spnShapeWidthPc . setDisabled ( true ) ;
this . spnShapeWidth . setDisabled ( false ) ;
}
} ,
onRadioHSizePcChange : function ( field , newValue , eOpts ) {
if ( newValue ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _SizeRelH ( ) === null || this . _changedProps . get _SizeRelH ( ) === undefined )
this . _changedProps . put _SizeRelH ( new Asc . CImagePositionH ( ) ) ;
this . _changedProps . get _SizeRelH ( ) . put _Value ( this . spnShapeWidthPc . getNumberValue ( ) ) ;
this . _changedProps . get _SizeRelH ( ) . put _RelativeFrom ( this . _state . ShapeWidthPcFrom ) ;
2016-04-12 10:21:31 +00:00
this . fillShapeHeight ( ) ;
2016-04-12 07:55:42 +00:00
}
this . chRatio . setDisabled ( true ) ;
this . cmbWidthPc . setDisabled ( false ) ;
this . spnShapeWidthPc . setDisabled ( false ) ;
this . spnShapeWidth . setDisabled ( true ) ;
}
} ,
onRadioVSizeChange : function ( field , newValue , eOpts ) {
if ( newValue ) {
if ( this . _changedProps ) {
this . _changedProps . put _Height ( Common . Utils . Metric . fnRecalcToMM ( this . spnShapeHeight . getNumberValue ( ) ) ) ;
this . _changedProps . put _SizeRelV ( undefined ) ;
2016-04-12 10:21:31 +00:00
this . fillShapeWidth ( ) ;
2016-04-12 07:55:42 +00:00
}
this . chRatio . setDisabled ( this . radioHSizePc . getValue ( ) ) ;
this . cmbHeightPc . setDisabled ( true ) ;
this . spnShapeHeightPc . setDisabled ( true ) ;
this . spnShapeHeight . setDisabled ( false ) ;
}
} ,
onRadioVSizePcChange : function ( field , newValue , eOpts ) {
if ( newValue ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _SizeRelV ( ) === null || this . _changedProps . get _SizeRelV ( ) === undefined )
this . _changedProps . put _SizeRelV ( new Asc . CImagePositionV ( ) ) ;
this . _changedProps . get _SizeRelV ( ) . put _Value ( this . spnShapeHeightPc . getNumberValue ( ) ) ;
this . _changedProps . get _SizeRelV ( ) . put _RelativeFrom ( this . _state . ShapeHeightPcFrom ) ;
2016-04-12 10:21:31 +00:00
this . fillShapeWidth ( ) ;
2016-04-12 07:55:42 +00:00
}
this . chRatio . setDisabled ( true ) ;
this . cmbHeightPc . setDisabled ( false ) ;
this . spnShapeHeightPc . setDisabled ( false ) ;
this . spnShapeHeight . setDisabled ( true ) ;
}
} ,
onCmbWidthPcSelect : function ( combo , record ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _SizeRelH ( ) === null || this . _changedProps . get _SizeRelH ( ) === undefined )
this . _changedProps . put _SizeRelH ( new Asc . CImagePositionH ( ) ) ;
this . _state . ShapeWidthPcFrom = record . value ;
this . _changedProps . get _SizeRelH ( ) . put _Value ( this . spnShapeWidthPc . getNumberValue ( ) ) ;
this . _changedProps . get _SizeRelH ( ) . put _RelativeFrom ( this . _state . ShapeWidthPcFrom ) ;
2016-04-12 10:21:31 +00:00
this . fillShapeHeight ( ) ;
2016-04-12 07:55:42 +00:00
}
} ,
onCmbHeightPcSelect : function ( combo , record ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _SizeRelV ( ) === null || this . _changedProps . get _SizeRelV ( ) === undefined )
this . _changedProps . put _SizeRelV ( new Asc . CImagePositionV ( ) ) ;
this . _state . ShapeHeightPcFrom = record . value ;
this . _changedProps . get _SizeRelV ( ) . put _Value ( this . spnShapeHeightPc . getNumberValue ( ) ) ;
this . _changedProps . get _SizeRelV ( ) . put _RelativeFrom ( this . _state . ShapeHeightPcFrom ) ;
2016-04-12 10:21:31 +00:00
this . fillShapeWidth ( ) ;
}
} ,
fillShapeWidth : function ( combo , record ) {
if ( this . radioHSize . getValue ( ) )
this . _changedProps . put _Width ( Common . Utils . Metric . fnRecalcToMM ( this . spnShapeWidth . getNumberValue ( ) ) ) ;
else {
if ( this . _changedProps . get _SizeRelH ( ) === null || this . _changedProps . get _SizeRelH ( ) === undefined )
this . _changedProps . put _SizeRelH ( new Asc . CImagePositionH ( ) ) ;
this . _changedProps . get _SizeRelH ( ) . put _Value ( this . spnShapeWidthPc . getNumberValue ( ) ) ;
this . _changedProps . get _SizeRelH ( ) . put _RelativeFrom ( this . _state . ShapeWidthPcFrom ) ;
}
} ,
fillShapeHeight : function ( combo , record ) {
if ( this . radioVSize . getValue ( ) )
this . _changedProps . put _Height ( Common . Utils . Metric . fnRecalcToMM ( this . spnShapeHeight . getNumberValue ( ) ) ) ;
else {
if ( this . _changedProps . get _SizeRelV ( ) === null || this . _changedProps . get _SizeRelV ( ) === undefined )
this . _changedProps . put _SizeRelV ( new Asc . CImagePositionV ( ) ) ;
this . _changedProps . get _SizeRelV ( ) . put _Value ( this . spnShapeHeightPc . getNumberValue ( ) ) ;
this . _changedProps . get _SizeRelV ( ) . put _RelativeFrom ( this . _state . ShapeHeightPcFrom ) ;
2016-04-12 07:55:42 +00:00
}
} ,
2016-03-11 00:48:53 +00:00
_updateSizeArr : function ( combo , picker , record , sizeidx ) {
if ( record . get ( 'value' ) > 0 ) {
picker . store . each ( function ( rec ) {
rec . set ( { offsetx : record . get ( 'value' ) * 80 + 10 } ) ;
} , this ) ;
combo . setDisabled ( false ) ;
if ( sizeidx !== null ) {
picker . selectByIndex ( sizeidx , true ) ;
this . _selectStyleItem ( combo , picker . store . at ( sizeidx ) ) ;
} else
this . _selectStyleItem ( combo , null ) ;
} else {
this . _selectStyleItem ( combo , null ) ;
combo . setDisabled ( true ) ;
}
} ,
_selectStyleItem : function ( combo , record ) {
var formcontrol = $ ( combo . el ) . find ( '.form-control' ) ;
formcontrol . css ( 'background-position' , ( ( record ) ? ( - record . get ( 'offsetx' ) + 20 ) + 'px' : '0' ) + ' ' + ( ( record ) ? '-' + record . get ( 'offsety' ) + 'px' : '-30px' ) ) ;
} ,
onSelectBeginStyle : function ( picker , view , record , e ) {
if ( this . _changedShapeProps ) {
if ( this . _changedShapeProps . get _stroke ( ) === null )
2016-04-18 12:21:15 +00:00
this . _changedShapeProps . put _stroke ( new Asc . asc _CStroke ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedShapeProps . get _stroke ( ) . put _linebeginstyle ( record . get ( 'type' ) ) ;
}
if ( this . _beginSizeIdx === null || this . _beginSizeIdx === undefined )
this . _beginSizeIdx = 4 ;
this . _updateSizeArr ( this . btnBeginSize , this . mnuBeginSizePicker , record , this . _beginSizeIdx ) ;
this . _selectStyleItem ( this . btnBeginStyle , record ) ;
} ,
onSelectBeginSize : function ( picker , view , record , e ) {
if ( this . _changedShapeProps ) {
if ( this . _changedShapeProps . get _stroke ( ) === null )
2016-04-18 12:21:15 +00:00
this . _changedShapeProps . put _stroke ( new Asc . asc _CStroke ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedShapeProps . get _stroke ( ) . put _linebeginsize ( record . get ( 'type' ) ) ;
}
this . _beginSizeIdx = record . get ( 'value' ) ;
this . _selectStyleItem ( this . btnBeginSize , record ) ;
} ,
onSelectEndStyle : function ( picker , view , record , e ) {
if ( this . _changedShapeProps ) {
if ( this . _changedShapeProps . get _stroke ( ) === null )
2016-04-18 12:21:15 +00:00
this . _changedShapeProps . put _stroke ( new Asc . asc _CStroke ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedShapeProps . get _stroke ( ) . put _lineendstyle ( record . get ( 'type' ) ) ;
}
if ( this . _endSizeIdx === null || this . _endSizeIdx === undefined )
this . _endSizeIdx = 4 ;
this . _updateSizeArr ( this . btnEndSize , this . mnuEndSizePicker , record , this . _endSizeIdx ) ;
this . _selectStyleItem ( this . btnEndStyle , record ) ;
} ,
onSelectEndSize : function ( picker , view , record , e ) {
if ( this . _changedShapeProps ) {
if ( this . _changedShapeProps . get _stroke ( ) === null )
2016-04-18 12:21:15 +00:00
this . _changedShapeProps . put _stroke ( new Asc . asc _CStroke ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedShapeProps . get _stroke ( ) . put _lineendsize ( record . get ( 'type' ) ) ;
}
this . _endSizeIdx = record . get ( 'value' ) ;
this . _selectStyleItem ( this . btnEndSize , record ) ;
} ,
textTop : 'Top' ,
textLeft : 'Left' ,
textBottom : 'Bottom' ,
textRight : 'Right' ,
2019-11-06 08:11:30 +00:00
textOriginalSize : 'Actual Size' ,
2016-03-11 00:48:53 +00:00
textPosition : 'Position' ,
textDistance : 'Distance From Text' ,
textSize : 'Size' ,
textWrap : 'Wrapping Style' ,
textWidth : 'Width' ,
textHeight : 'Height' ,
textWrapInlineTooltip : 'Inline' ,
textWrapSquareTooltip : 'Square' ,
textWrapTightTooltip : 'Tight' ,
textWrapThroughTooltip : 'Through' ,
textWrapTopbottomTooltip : 'Top and Bottom' ,
textWrapBehindTooltip : 'Behind' ,
textWrapInFrontTooltip : 'In Front' ,
textTitle : 'Image - Advanced Settings' ,
textKeepRatio : 'Constant Proportions' ,
textBtnWrap : 'Text Wrapping' ,
textCenter : 'Center' ,
textCharacter : 'Character' ,
textColumn : 'Column' ,
textLeftMargin : 'Left Margin' ,
textMargin : 'Margin' ,
textPage : 'Page' ,
textRightMargin : 'Right Margin' ,
textLine : 'Line' ,
textBottomMargin : 'Bottom Margin' ,
textParagraph : 'Paragraph' ,
textTopMargin : 'Top Margin' ,
textHorizontal : 'Horizontal' ,
textVertical : 'Vertical' ,
textAlignment : 'Alignment' ,
textRelative : 'relative to' ,
textRightOf : 'to the right Of' ,
textBelow : 'below' ,
textOverlap : 'Allow overlap' ,
textMove : 'Move object with text' ,
textOptions : 'Options' ,
textShape : 'Shape Settings' ,
textTitleShape : 'Shape - Advanced Settings' ,
textTitleChart : 'Chart - Advanced Settings' ,
strMargins : 'Text Padding' ,
textRound : 'Round' ,
textMiter : 'Miter' ,
textSquare : 'Square' ,
textFlat : 'Flat' ,
textBevel : 'Bevel' ,
textArrows : 'Arrows' ,
textLineStyle : 'Line Style' ,
textCapType : 'Cap Type' ,
textJoinType : 'Join Type' ,
textBeginStyle : 'Begin Style' ,
textBeginSize : 'Begin Size' ,
textEndStyle : 'End Style' ,
2016-03-17 13:31:57 +00:00
textEndSize : 'End Size' ,
2016-04-12 07:55:42 +00:00
textPositionPc : 'Relative position' ,
textAspectRatio : 'Lock aspect ratio' ,
textAbsoluteWH : 'Absolute' ,
2017-01-18 13:14:03 +00:00
textRelativeWH : 'Relative' ,
textAlt : 'Alternative Text' ,
textAltTitle : 'Title' ,
textAltDescription : 'Description' ,
2017-08-04 11:24:30 +00:00
textAltTip : 'The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table.' ,
2018-08-03 11:00:54 +00:00
textWeightArrows : 'Weights & Arrows' ,
textRotation : 'Rotation' ,
textAngle : 'Angle' ,
textFlipped : 'Flipped' ,
textHorizontally : 'Horizontally' ,
2020-02-25 13:47:53 +00:00
textVertically : 'Vertically' ,
textTextBox : 'Text Box' ,
textAutofit : 'AutoFit' ,
textResizeFit : 'Resize shape to fit text'
2016-03-11 00:48:53 +00:00
} , DE . Views . ImageSettingsAdvanced || { } ) ) ;
} ) ;