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
/ * *
* TableSettingsAdvanced . js
*
* Created by Julia Radzhabova on 2 / 27 / 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/TableSettingsAdvanced.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' ,
'common/main/lib/component/ThemeColorPalette' ,
'common/main/lib/component/ColorButton' ,
'common/main/lib/component/ListView' ,
'common/main/lib/component/TableStyler'
] , function ( contentTemplate ) {
'use strict' ;
DE . Views . TableSettingsAdvanced = Common . Views . AdvancedSettingsWindow . extend ( _ . extend ( {
options : {
contentWidth : 340 ,
height : 436 ,
2016-04-21 11:47:28 +00:00
toggleGroup : 'table-adv-settings-group' ,
storageName : 'de-table-settings-adv-category'
2016-03-11 00:48:53 +00:00
} ,
initialize : function ( options ) {
_ . extend ( this . options , {
title : this . textTitle ,
items : [
2016-05-02 12:16:16 +00:00
{ panelId : 'id-adv-table-width' , panelCaption : this . textTable } ,
{ panelId : 'id-adv-table-cell-props' , panelCaption : this . textCellProps } ,
2016-03-11 00:48:53 +00:00
{ panelId : 'id-adv-table-borders' , panelCaption : this . textBordersBackgroung } ,
2016-05-02 12:16:16 +00:00
{ panelId : 'id-adv-table-position' , panelCaption : this . textTablePosition } ,
2017-01-19 09:41:35 +00:00
{ panelId : 'id-adv-table-wrap' , panelCaption : this . textWrap } ,
{ panelId : 'id-adv-table-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 . _changedProps = null ;
this . _cellBackground = null ;
this . _state = {
2016-04-05 11:52:34 +00:00
HAlignType : Asc . c _oAscXAlign . Left ,
HAlignFrom : Asc . c _oAscHAnchor . Margin ,
HPositionFrom : Asc . c _oAscHAnchor . Margin ,
VAlignType : Asc . c _oAscYAlign . Top ,
VAlignFrom : Asc . c _oAscVAnchor . Margin ,
VPositionFrom : Asc . c _oAscVAnchor . Margin ,
2016-03-11 00:48:53 +00:00
spnXChanged : false ,
spnYChanged : false ,
fromWrapInline : false ,
verticalPropChanged : false ,
horizontalPropChanged : false ,
alignChanged : false
} ;
this . _allTable = false ;
this . TableMargins = {
Left : 0.19 ,
Right : 0.19 ,
Top : 0 ,
Bottom : 0
} ;
this . CellMargins = {
Left : 0.19 ,
Right : 0.19 ,
Top : null ,
Bottom : null ,
Flag : 0 // 0(checked) - как в таблице, 1(indeterminate) - разные значения, не определено, 2 (unchecked) - собственные
} ;
this . TableBorders = { } ;
this . CellBorders = { } ;
this . ChangedTableBorders = undefined ; // undefined - не менялись, null - применялись пресеты, отправлять TableBorders, object - менялись отдельные границы, отправлять ChangedTableBorders
this . ChangedCellBorders = undefined ; // undefined - не менялись, null - применялись пресеты, отправлять CellBorders, object - менялись отдельные границы, отправлять ChangedCellBorders
this . BorderSize = { ptValue : 0 , pxValue : 0 } ;
this . TableColor = { Value : 1 , Color : 'transparent' } ; // value=1 - цвет определен - прозрачный или другой
this . CellColor = { Value : 1 , Color : 'transparent' } ; // value=1 - цвет определен - прозрачный или другой, value=0 - цвет не определен, рисуем прозрачным
this . IndeterminateColor = '#C8C8C8' ;
this . IndeterminateSize = 4.5 ;
this . tableStylerRows = this . options . tableStylerRows ;
this . tableStylerColumns = this . options . tableStylerColumns ;
this . borderProps = this . options . borderProps ;
2016-05-26 09:12:32 +00:00
this . pageWidth = 210 ;
2016-04-05 12:57:51 +00:00
this . _originalProps = new Asc . CTableProp ( this . options . tableProps ) ;
2016-03-11 00:48:53 +00:00
} ,
render : function ( ) {
Common . Views . AdvancedSettingsWindow . prototype . render . call ( this ) ;
var me = this ;
this . _marginsChange = function ( field , newValue , oldValue , eOpts , source , property ) {
if ( source == 'table' )
this . TableMargins [ property ] = field . getNumberValue ( ) ;
else
this . CellMargins [ property ] = field . getNumberValue ( ) ;
} ;
this . chWidth = new Common . UI . CheckBox ( {
el : $ ( '#tableadv-checkbox-width' ) ,
value : true ,
2016-05-02 12:16:16 +00:00
labelText : ''
2016-03-11 00:48:53 +00:00
} ) ;
this . chWidth . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
var value = ( newValue == 'checked' ) ;
this . nfWidth . setDisabled ( ! value ) ;
2016-03-17 09:44:42 +00:00
this . cmbUnit . setDisabled ( ! value ) ;
2016-03-11 00:48:53 +00:00
if ( this . _changedProps ) {
if ( value && this . nfWidth . getNumberValue ( ) > 0 )
2021-06-01 19:28:38 +00:00
this . _changedProps . put _Width ( this . cmbUnit . getValue ( ) ? - this . nfWidth . getNumberValue ( ) : Common . Utils . Metric . fnRecalcToMM ( this . nfWidth . getNumberValue ( ) ) ) ;
2016-03-11 00:48:53 +00:00
else
this . _changedProps . put _Width ( null ) ;
}
} , this ) ) ;
this . nfWidth = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-width' ) ,
step : . 1 ,
2016-05-02 12:16:16 +00:00
width : 115 ,
2016-03-11 00:48:53 +00:00
defaultUnit : "cm" ,
value : '10 cm' ,
maxValue : 55.88 ,
minValue : 0
} ) ;
this . nfWidth . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps )
2016-03-17 09:44:42 +00:00
this . _changedProps . put _Width ( this . cmbUnit . getValue ( ) ? - field . getNumberValue ( ) : Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
} , this ) ) ;
2016-04-06 15:17:40 +00:00
var currmetric = Common . Utils . Metric . getCurrentMetric ( ) ;
2016-03-17 09:44:42 +00:00
this . cmbUnit = new Common . UI . ComboBox ( {
el : $ ( '#tableadv-cmb-unit' ) ,
2016-05-02 12:16:16 +00:00
style : 'width: 115px;' ,
menuStyle : 'min-width: 115px;' ,
2016-03-17 09:44:42 +00:00
editable : false ,
cls : 'input-group-nr' ,
data : [
2016-04-06 15:17:40 +00:00
{ value : 0 , displayValue : ( currmetric == Common . Utils . Metric . c _MetricUnits . pt ) ? this . txtPt : ( ( currmetric == Common . Utils . Metric . c _MetricUnits . inch ) ? this . txtInch : this . txtCm ) } ,
2016-03-17 09:44:42 +00:00
{ value : 1 , displayValue : this . txtPercent }
2020-10-13 16:15:30 +00:00
] ,
takeFocusOnClose : true
2016-03-17 09:44:42 +00:00
} ) ;
this . cmbUnit . on ( 'selected' , _ . bind ( function ( combo , record ) {
if ( this . _changedProps ) {
var maxwidth = Common . Utils . Metric . fnRecalcFromMM ( 558 ) ;
2016-04-06 13:38:54 +00:00
this . nfWidth . setDefaultUnit ( record . value ? '%' : Common . Utils . Metric . getCurrentMetricName ( ) ) ;
2016-03-17 13:27:44 +00:00
this . nfWidth . setMaxValue ( record . value ? parseFloat ( ( 100 * maxwidth / this . pageWidth ) . toFixed ( 2 ) ) : maxwidth ) ;
2016-03-17 09:44:42 +00:00
this . nfWidth . setStep ( ( record . value || Common . Utils . Metric . getCurrentMetric ( ) == Common . Utils . Metric . c _MetricUnits . pt ) ? 1 : 0.1 ) ;
this . nfWidth . setValue ( ( record . value ) ? 100 * this . nfWidth . getNumberValue ( ) / this . pageWidth : this . pageWidth * this . nfWidth . getNumberValue ( ) / 100 ) ;
this . _changedProps . put _Width ( record . value ? - this . nfWidth . getNumberValue ( ) : Common . Utils . Metric . fnRecalcToMM ( this . nfWidth . getNumberValue ( ) ) ) ;
}
2016-03-11 00:48:53 +00:00
} , this ) ) ;
this . chAllowSpacing = new Common . UI . CheckBox ( {
el : $ ( '#tableadv-checkbox-spacing' ) ,
value : true ,
2016-05-02 12:16:16 +00:00
labelText : ''
2016-03-11 00:48:53 +00:00
} ) ;
this . chAllowSpacing . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
var value = ( newValue == 'checked' ) ;
if ( this . _changedProps ) {
this . nfSpacing . setDisabled ( ! value ) ;
this . ShowHideSpacing ( value ) ;
if ( this . _changedProps ) {
if ( value && this . nfSpacing . getNumberValue ( ) > 0 )
this . _changedProps . put _Spacing ( Common . Utils . Metric . fnRecalcToMM ( this . nfSpacing . getNumberValue ( ) ) ) ;
else
this . _changedProps . put _Spacing ( null ) ;
}
}
} , this ) ) ;
this . nfSpacing = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-spacing' ) ,
step : . 1 ,
2016-05-02 12:16:16 +00:00
width : 115 ,
2016-03-11 00:48:53 +00:00
defaultUnit : "cm" ,
value : '0.5 cm' ,
maxValue : 2.14 ,
minValue : 0
} ) ;
this . nfSpacing . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps )
this . _changedProps . put _Spacing ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
} , this ) ) ;
this . spinners . push ( this . nfSpacing ) ;
this . chAutofit = new Common . UI . CheckBox ( {
el : $ ( '#tableadv-checkbox-autofit' ) ,
value : true ,
labelText : this . textAutofit
} ) ;
this . chAutofit . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
2016-04-05 11:52:34 +00:00
this . _changedProps . put _TableLayout ( ( field . getValue ( ) == 'checked' ) ? Asc . c _oAscTableLayout . AutoFit : Asc . c _oAscTableLayout . Fixed ) ;
2016-03-11 00:48:53 +00:00
}
} , this ) ) ;
// Margins
this . spnTableMarginTop = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-margin-table-top' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnTableMarginTop . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
this . _marginsChange ( field , newValue , oldValue , eOpts , 'table' , 'Top' ) ;
if ( this . _changedProps ) {
if ( this . _changedProps . get _DefaultMargins ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _DefaultMargins ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _DefaultMargins ( ) . put _Top ( ( this . TableMargins . Top !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . TableMargins . Top ) : null ) ;
this . TableMargins . isChanged = true ;
}
} , this ) ) ;
this . spinners . push ( this . spnTableMarginTop ) ;
this . spnTableMarginBottom = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-margin-table-bottom' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnTableMarginBottom . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
this . _marginsChange ( field , newValue , oldValue , eOpts , 'table' , 'Bottom' ) ;
if ( this . _changedProps ) {
if ( this . _changedProps . get _DefaultMargins ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _DefaultMargins ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _DefaultMargins ( ) . put _Bottom ( ( this . TableMargins . Bottom !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . TableMargins . Bottom ) : null ) ;
this . TableMargins . isChanged = true ;
}
} , this ) ) ;
this . spinners . push ( this . spnTableMarginBottom ) ;
this . spnTableMarginLeft = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-margin-table-left' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0.19 cm' ,
maxValue : 9.34 ,
minValue : 0
} ) ;
this . spnTableMarginLeft . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
this . _marginsChange ( field , newValue , oldValue , eOpts , 'table' , 'Left' ) ;
if ( this . _changedProps ) {
if ( this . _changedProps . get _DefaultMargins ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _DefaultMargins ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _DefaultMargins ( ) . put _Left ( ( this . TableMargins . Left !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . TableMargins . Left ) : null ) ;
this . TableMargins . isChanged = true ;
}
} , this ) ) ;
this . spinners . push ( this . spnTableMarginLeft ) ;
this . spnTableMarginRight = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-margin-table-right' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0.19 cm' ,
maxValue : 9.34 ,
minValue : 0
} ) ;
this . spnTableMarginRight . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
this . _marginsChange ( field , newValue , oldValue , eOpts , 'table' , 'Right' ) ;
if ( this . _changedProps ) {
if ( this . _changedProps . get _DefaultMargins ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _DefaultMargins ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _DefaultMargins ( ) . put _Right ( ( this . TableMargins . Right !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . TableMargins . Right ) : null ) ;
this . TableMargins . isChanged = true ;
}
} , this ) ) ;
this . spinners . push ( this . spnTableMarginRight ) ;
// Cell Margins
var setCellFlag = function ( ) {
if ( me . CellMargins . Flag == 'indeterminate' )
me . _changedProps . get _CellMargins ( ) . put _Flag ( 1 ) ;
else if ( me . CellMargins . Flag == 'checked' )
me . _changedProps . get _CellMargins ( ) . put _Flag ( 0 ) ;
else
me . _changedProps . get _CellMargins ( ) . put _Flag ( 2 ) ;
} ;
this . chCellMargins = new Common . UI . CheckBox ( {
el : $ ( '#tableadv-checkbox-margins' ) ,
value : true ,
labelText : this . textCheckMargins
} ) ;
this . chCellMargins . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( oldValue == 'checked' && this . _originalProps && this . _originalProps . get _CellMargins ( ) . get _Flag ( ) == 1 ) { // позволяем выставлять значение indeterminate только если исходные значения не совпадали
field . setValue ( 'indeterminate' , true ) ;
}
this . fillMargins . call ( this , field . getValue ( ) ) ;
this . CellMargins . Flag = field . getValue ( ) ;
if ( this . _changedProps ) {
if ( this . _changedProps . get _CellMargins ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _CellMargins ( new Asc . CMargins ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _CellMargins ( ) . put _Left ( ( this . CellMargins . Left !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . CellMargins . Left ) : null ) ;
this . _changedProps . get _CellMargins ( ) . put _Top ( ( this . CellMargins . Top !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . CellMargins . Top ) : null ) ;
this . _changedProps . get _CellMargins ( ) . put _Bottom ( ( this . CellMargins . Bottom !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . CellMargins . Bottom ) : null ) ;
this . _changedProps . get _CellMargins ( ) . put _Right ( ( this . CellMargins . Right !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . CellMargins . Right ) : null ) ;
setCellFlag ( ) ;
}
} , this ) ) ;
this . spnMarginTop = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-margin-top' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnMarginTop . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
this . _marginsChange ( field , newValue , oldValue , eOpts , 'cell' , 'Top' ) ;
if ( this . _changedProps ) {
if ( this . _changedProps . get _CellMargins ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _CellMargins ( new Asc . CMargins ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _CellMargins ( ) . put _Top ( ( this . CellMargins . Top !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . CellMargins . Top ) : null ) ;
setCellFlag ( ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnMarginTop ) ;
this . spnMarginBottom = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-margin-bottom' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnMarginBottom . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
this . _marginsChange ( field , newValue , oldValue , eOpts , 'cell' , 'Bottom' ) ;
if ( this . _changedProps ) {
if ( this . _changedProps . get _CellMargins ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _CellMargins ( new Asc . CMargins ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _CellMargins ( ) . put _Bottom ( ( this . CellMargins . Bottom !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . CellMargins . Bottom ) : null ) ;
setCellFlag ( ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnMarginBottom ) ;
this . spnMarginLeft = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-margin-left' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0.19 cm' ,
maxValue : 9.34 ,
minValue : 0
} ) ;
this . spnMarginLeft . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
this . _marginsChange ( field , newValue , oldValue , eOpts , 'cell' , 'Left' ) ;
if ( this . _changedProps ) {
if ( this . _changedProps . get _CellMargins ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _CellMargins ( new Asc . CMargins ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _CellMargins ( ) . put _Left ( ( this . CellMargins . Left !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . CellMargins . Left ) : null ) ;
setCellFlag ( ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnMarginLeft ) ;
this . spnMarginRight = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-margin-right' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0.19 cm' ,
maxValue : 9.34 ,
minValue : 0
} ) ;
this . spnMarginRight . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
this . _marginsChange ( field , newValue , oldValue , eOpts , 'cell' , 'Right' ) ;
if ( this . _changedProps ) {
if ( this . _changedProps . get _CellMargins ( ) === undefined )
2016-04-05 12:57:51 +00:00
this . _changedProps . put _CellMargins ( new Asc . CMargins ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _CellMargins ( ) . put _Right ( ( this . CellMargins . Right !== null ) ? Common . Utils . Metric . fnRecalcToMM ( this . CellMargins . Right ) : null ) ;
setCellFlag ( ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnMarginRight ) ;
2016-04-04 14:05:54 +00:00
// Cell Size
this . chPrefWidth = new Common . UI . CheckBox ( {
el : $ ( '#tableadv-checkbox-prefwidth' ) ,
value : false ,
labelText : ''
} ) ;
this . chPrefWidth . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
var value = ( newValue == 'checked' ) ;
this . nfPrefWidth . setDisabled ( ! value ) ;
this . cmbPrefWidthUnit . setDisabled ( ! value ) ;
if ( this . _changedProps ) {
if ( value && this . nfPrefWidth . getNumberValue ( ) > 0 )
2021-06-04 11:25:15 +00:00
this . _changedProps . put _CellsWidth ( this . cmbPrefWidthUnit . getValue ( ) ? - this . nfPrefWidth . getNumberValue ( ) : Common . Utils . Metric . fnRecalcToMM ( this . nfPrefWidth . getNumberValue ( ) ) ) ;
2016-04-04 14:05:54 +00:00
else
this . _changedProps . put _CellsWidth ( null ) ;
}
} , this ) ) ;
this . nfPrefWidth = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-prefwidth' ) ,
step : . 1 ,
width : 115 ,
defaultUnit : "cm" ,
value : '10 cm' ,
maxValue : 55.88 ,
minValue : 0
} ) ;
this . nfPrefWidth . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps )
this . _changedProps . put _CellsWidth ( this . cmbPrefWidthUnit . getValue ( ) ? - field . getNumberValue ( ) : Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
} , this ) ) ;
this . cmbPrefWidthUnit = new Common . UI . ComboBox ( {
el : $ ( '#tableadv-combo-prefwidth-unit' ) ,
style : 'width: 115px;' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
cls : 'input-group-nr' ,
data : [
2016-04-06 15:17:40 +00:00
{ value : 0 , displayValue : ( currmetric == Common . Utils . Metric . c _MetricUnits . pt ) ? this . txtPt : ( ( currmetric == Common . Utils . Metric . c _MetricUnits . inch ) ? this . txtInch : this . txtCm ) } ,
2016-04-04 14:05:54 +00:00
{ value : 1 , displayValue : this . txtPercent }
2020-10-13 16:15:30 +00:00
] ,
takeFocusOnClose : true
2016-04-04 14:05:54 +00:00
} ) ;
this . cmbPrefWidthUnit . on ( 'selected' , _ . bind ( function ( combo , record ) {
if ( this . _changedProps ) {
2016-05-30 07:57:51 +00:00
var defUnit = ( record . value ) ? '%' : Common . Utils . Metric . getCurrentMetricName ( ) ;
if ( this . nfPrefWidth . getUnitValue ( ) !== defUnit ) {
var maxwidth = Common . Utils . Metric . fnRecalcFromMM ( 558 ) ;
this . nfPrefWidth . setDefaultUnit ( defUnit ) ;
this . nfPrefWidth . setMaxValue ( record . value ? parseFloat ( ( 100 * maxwidth / this . pageWidth ) . toFixed ( 2 ) ) : maxwidth ) ;
this . nfPrefWidth . setStep ( ( record . value || Common . Utils . Metric . getCurrentMetric ( ) == Common . Utils . Metric . c _MetricUnits . pt ) ? 1 : 0.1 ) ;
this . nfPrefWidth . setValue ( ( record . value ) ? 100 * this . nfPrefWidth . getNumberValue ( ) / this . pageWidth : this . pageWidth * this . nfPrefWidth . getNumberValue ( ) / 100 ) ;
this . _changedProps . put _CellsWidth ( record . value ? - this . nfPrefWidth . getNumberValue ( ) : Common . Utils . Metric . fnRecalcToMM ( this . nfPrefWidth . getNumberValue ( ) ) ) ;
}
2016-04-04 14:05:54 +00:00
}
} , this ) ) ;
this . chWrapText = new Common . UI . CheckBox ( {
el : $ ( '#tableadv-checkbox-wrap' ) ,
value : false ,
labelText : this . textWrapText
} ) ;
this . chWrapText . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
this . _changedProps . put _CellsNoWrap ( ( field . getValue ( ) != 'checked' ) ) ;
}
} , this ) ) ;
2016-03-11 00:48:53 +00:00
// Wrapping
this . btnWrapNone = new Common . UI . Button ( {
2020-04-29 07:36:53 +00:00
parentEl : $ ( '#tableadv-button-wrap-none' ) ,
2021-03-05 21:52:06 +00:00
cls : 'btn-options huge-1' ,
iconCls : 'options__icon options__icon-huge table-align-center' ,
2016-03-11 00:48:53 +00:00
posId : c _tableWrap . TABLE _WRAP _NONE ,
hint : this . textWrapNoneTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'advtablewrapGroup'
} ) ;
this . btnWrapNone . on ( 'click' , _ . bind ( this . onBtnInlineWrapClick , this ) ) ;
this . btnWrapParallel = new Common . UI . Button ( {
2020-04-29 07:36:53 +00:00
parentEl : $ ( '#tableadv-button-wrap-parallel' ) ,
2021-03-05 21:52:06 +00:00
cls : 'btn-options huge-1' ,
iconCls : 'options__icon options__icon-huge table-flow' ,
2016-03-11 00:48:53 +00:00
posId : c _tableWrap . TABLE _WRAP _PARALLEL ,
hint : this . textWrapParallelTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'advtablewrapGroup'
} ) ;
this . btnWrapParallel . on ( 'click' , _ . bind ( this . onBtnFlowWrapClick , this ) ) ;
this . btnAlignLeft = new Common . UI . Button ( {
2020-04-29 07:36:53 +00:00
parentEl : $ ( '#tableadv-button-align-left' ) ,
2021-03-05 21:52:06 +00:00
cls : 'btn-options huge-1' ,
iconCls : 'options__icon options__icon-huge table-align-left' ,
2016-03-11 00:48:53 +00:00
posId : c _tableAlign . TABLE _ALIGN _LEFT ,
hint : this . textLeftTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'advtablealignGroup'
} ) ;
this . btnAlignLeft . on ( 'click' , _ . bind ( function ( btn ) {
if ( this . _changedProps && btn . pressed ) {
this . _changedProps . put _TableAlignment ( btn . options . posId ) ;
this . _changedProps . put _TableIndent ( Common . Utils . Metric . fnRecalcToMM ( this . spnIndentLeft . getNumberValue ( ) ) ) ;
this . spnIndentLeft . setDisabled ( ! btn . pressed ) ;
this . _state . alignChanged = true ;
}
} , this ) ) ;
this . btnAlignCenter = new Common . UI . Button ( {
2020-04-29 07:36:53 +00:00
parentEl : $ ( '#tableadv-button-align-center' ) ,
2021-03-05 21:52:06 +00:00
cls : 'btn-options huge-1' ,
iconCls : 'options__icon options__icon-huge table-align-center' ,
2016-03-11 00:48:53 +00:00
posId : c _tableAlign . TABLE _ALIGN _CENTER ,
hint : this . textCenterTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'advtablealignGroup'
} ) ;
this . btnAlignCenter . on ( 'click' , _ . bind ( function ( btn ) {
if ( this . _changedProps && btn . pressed ) {
this . _changedProps . put _TableAlignment ( btn . options . posId ) ;
this . _changedProps . put _TableIndent ( 0 ) ;
this . spnIndentLeft . setDisabled ( btn . pressed ) ;
this . _state . alignChanged = true ;
}
} , this ) ) ;
this . btnAlignRight = new Common . UI . Button ( {
2020-04-29 07:36:53 +00:00
parentEl : $ ( '#tableadv-button-align-right' ) ,
2021-03-05 21:52:06 +00:00
cls : 'btn-options huge-1' ,
iconCls : 'options__icon options__icon-huge table-align-right' ,
2016-03-11 00:48:53 +00:00
posId : c _tableAlign . TABLE _ALIGN _RIGHT ,
hint : this . textRightTooltip ,
enableToggle : true ,
allowDepress : false ,
toggleGroup : 'advtablealignGroup'
} ) ;
this . btnAlignRight . on ( 'click' , _ . bind ( function ( btn ) {
if ( this . _changedProps && btn . pressed ) {
this . _changedProps . put _TableAlignment ( btn . options . posId ) ;
this . _changedProps . put _TableIndent ( 0 ) ;
this . spnIndentLeft . setDisabled ( btn . pressed ) ;
this . _state . alignChanged = true ;
}
} , this ) ) ;
this . spnIndentLeft = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-indent' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
defaultValue : 0 ,
value : '0 cm' ,
maxValue : 38.09 ,
minValue : - 38.09
} ) ;
this . spnIndentLeft . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
this . _changedProps . put _TableIndent ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnIndentLeft ) ;
this . spnDistanceTop = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-distance-top' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '1 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnDistanceTop . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _TablePaddings ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _TablePaddings ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _TablePaddings ( ) . put _Top ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnDistanceTop ) ;
this . spnDistanceBottom = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-distance-bottom' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '1 cm' ,
maxValue : 55.87 ,
minValue : 0
} ) ;
this . spnDistanceBottom . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _TablePaddings ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _TablePaddings ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _TablePaddings ( ) . put _Bottom ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnDistanceBottom ) ;
this . spnDistanceLeft = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-distance-left' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '1 cm' ,
maxValue : 9.34 ,
minValue : 0
} ) ;
this . spnDistanceLeft . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _TablePaddings ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _TablePaddings ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _TablePaddings ( ) . put _Left ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnDistanceLeft ) ;
this . spnDistanceRight = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-number-distance-right' ) ,
step : . 1 ,
width : 85 ,
defaultUnit : "cm" ,
value : '0.19 cm' ,
maxValue : 9.34 ,
minValue : 0
} ) ;
this . spnDistanceRight . on ( 'change' , _ . bind ( function ( field , newValue , oldValue , eOpts ) {
if ( this . _changedProps ) {
if ( this . _changedProps . get _TablePaddings ( ) === undefined )
2016-04-18 12:21:15 +00:00
this . _changedProps . put _TablePaddings ( new Asc . asc _CPaddings ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _TablePaddings ( ) . put _Right ( Common . Utils . Metric . fnRecalcToMM ( field . getNumberValue ( ) ) ) ;
}
} , this ) ) ;
this . spinners . push ( this . spnDistanceRight ) ;
// Position
this . spnX = new Common . UI . MetricSpinner ( {
el : $ ( '#tableadv-spin-x' ) ,
step : . 1 ,
width : 115 ,
disabled : true ,
defaultUnit : "cm" ,
defaultValue : 0 ,
value : '1 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 . CTablePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _UseAlign ( false ) ;
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 : $ ( '#tableadv-spin-y' ) ,
step : . 1 ,
width : 115 ,
disabled : true ,
defaultUnit : "cm" ,
defaultValue : 0 ,
value : '1 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 . CTablePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionV ( ) . put _UseAlign ( false ) ;
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 _oAscXAlign . Left } ,
{ displayValue : this . textCenter , value : Asc . c _oAscXAlign . Center } ,
{ displayValue : this . textRight , value : Asc . c _oAscXAlign . Right }
2016-03-11 00:48:53 +00:00
] ;
this . cmbHAlign = new Common . UI . ComboBox ( {
el : $ ( '#tableadv-combo-halign' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
2020-10-13 16:15:30 +00:00
data : this . _arrHAlign ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
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 . textMargin , value : Asc . c _oAscHAnchor . Margin } ,
{ displayValue : this . textPage , value : Asc . c _oAscHAnchor . Page } ,
{ displayValue : this . textAnchorText , value : Asc . c _oAscHAnchor . Text }
2016-03-11 00:48:53 +00:00
] ;
this . cmbHRelative = new Common . UI . ComboBox ( {
el : $ ( '#tableadv-combo-hrelative' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
2020-10-13 16:15:30 +00:00
data : this . _arrHRelative ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
this . cmbHRelative . setValue ( this . _state . HAlignFrom ) ;
this . cmbHRelative . on ( 'selected' , _ . bind ( this . onHRelativeSelect , this ) ) ;
this . cmbHPosition = new Common . UI . ComboBox ( {
el : $ ( '#tableadv-combo-hposition' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
2020-10-13 16:15:30 +00:00
data : this . _arrHRelative ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
this . cmbHPosition . setDisabled ( true ) ;
this . cmbHPosition . setValue ( this . _state . HPositionFrom ) ;
this . cmbHPosition . on ( 'selected' , _ . bind ( this . onHPositionSelect , this ) ) ;
// Vertical
this . _arrVAlign = [
2016-04-05 11:52:34 +00:00
{ displayValue : this . textTop , value : Asc . c _oAscYAlign . Top } ,
{ displayValue : this . textCenter , value : Asc . c _oAscYAlign . Center } ,
{ displayValue : this . textBottom , value : Asc . c _oAscYAlign . Bottom }
2016-03-11 00:48:53 +00:00
] ;
this . cmbVAlign = new Common . UI . ComboBox ( {
el : $ ( '#tableadv-combo-valign' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
2020-10-13 16:15:30 +00:00
data : this . _arrVAlign ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
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 . textMargin , value : Asc . c _oAscVAnchor . Margin } ,
{ displayValue : this . textPage , value : Asc . c _oAscVAnchor . Page } ,
{ displayValue : this . textAnchorText , value : Asc . c _oAscVAnchor . Text }
2016-03-11 00:48:53 +00:00
] ;
this . cmbVRelative = new Common . UI . ComboBox ( {
el : $ ( '#tableadv-combo-vrelative' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
2020-10-13 16:15:30 +00:00
data : this . _arrVRelative ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
this . cmbVRelative . setValue ( this . _state . VAlignFrom ) ;
this . cmbVRelative . on ( 'selected' , _ . bind ( this . onVRelativeSelect , this ) ) ;
this . cmbVPosition = new Common . UI . ComboBox ( {
el : $ ( '#tableadv-combo-vposition' ) ,
cls : 'input-group-nr' ,
menuStyle : 'min-width: 115px;' ,
editable : false ,
2020-10-13 16:15:30 +00:00
data : this . _arrVRelative ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
this . cmbVPosition . setDisabled ( true ) ;
this . cmbVPosition . setValue ( this . _state . VPositionFrom ) ;
this . cmbVPosition . on ( 'selected' , _ . bind ( this . onVPositionSelect , this ) ) ;
this . radioHAlign = new Common . UI . RadioBox ( {
el : $ ( '#tableadv-radio-halign' ) ,
name : 'asc-radio-horizontal' ,
checked : true
} ) ;
this . radioHAlign . on ( 'change' , _ . bind ( this . onRadioHAlignChange , this ) ) ;
this . radioHPosition = new Common . UI . RadioBox ( {
el : $ ( '#tableadv-radio-hposition' ) ,
name : 'asc-radio-horizontal'
} ) ;
this . radioHPosition . on ( 'change' , _ . bind ( this . onRadioHPositionChange , this ) ) ;
this . radioVAlign = new Common . UI . RadioBox ( {
el : $ ( '#tableadv-radio-valign' ) ,
name : 'asc-radio-vertical' ,
checked : true
} ) ;
this . radioVAlign . on ( 'change' , _ . bind ( this . onRadioVAlignChange , this ) ) ;
this . radioVPosition = new Common . UI . RadioBox ( {
el : $ ( '#tableadv-radio-vposition' ) ,
name : 'asc-radio-vertical'
} ) ;
this . radioVPosition . on ( 'change' , _ . bind ( this . onRadioVPositionChange , this ) ) ;
this . chMove = new Common . UI . CheckBox ( {
el : $ ( '#tableadv-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' ) ? 2 : 1 ] . 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 : $ ( '#tableadv-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 ) ) ;
// Borders
this . cmbBorderSize = new Common . UI . ComboBorderSize ( {
el : $ ( '#tableadv-combo-border-size' ) ,
2021-07-11 13:12:05 +00:00
style : "width: 93px;" ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
2016-05-26 14:42:19 +00:00
var rec = this . cmbBorderSize . store . at ( 1 ) ;
2016-03-11 00:48:53 +00:00
this . BorderSize = { ptValue : rec . get ( 'value' ) , pxValue : rec . get ( 'pxValue' ) } ;
this . cmbBorderSize . setValue ( this . BorderSize . ptValue ) ;
this . cmbBorderSize . on ( 'selected' , _ . bind ( this . onBorderSizeSelect , this ) ) ;
this . btnBorderColor = new Common . UI . ColorButton ( {
2020-04-29 14:37:59 +00:00
parentEl : $ ( '#tableadv-border-color-btn' ) ,
2020-04-30 12:11:03 +00:00
additionalAlign : this . menuAddAlign ,
2021-01-20 13:42:48 +00:00
color : 'auto' ,
2021-07-11 13:12:05 +00:00
auto : true ,
cls : 'move-focus' ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
2020-04-29 14:37:59 +00:00
this . btnBorderColor . on ( 'color:select' , _ . bind ( me . onColorsBorderSelect , me ) ) ;
2021-01-20 13:42:48 +00:00
this . btnBorderColor . on ( 'auto:select' , _ . bind ( me . onColorsBorderSelect , me ) ) ;
2020-04-29 14:37:59 +00:00
this . colorsBorder = this . btnBorderColor . getPicker ( ) ;
2016-03-11 00:48:53 +00:00
this . btnBackColor = new Common . UI . ColorButton ( {
2020-04-29 14:37:59 +00:00
parentEl : $ ( '#tableadv-button-back-color' ) ,
additionalAlign : this . menuAddAlign ,
2021-07-11 13:12:05 +00:00
transparent : true ,
cls : 'move-focus' ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
2020-04-29 14:37:59 +00:00
this . btnBackColor . on ( 'color:select' , _ . bind ( this . onColorsBackSelect , this ) ) ;
this . colorsBack = this . btnBackColor . getPicker ( ) ;
2016-03-11 00:48:53 +00:00
this . btnTableBackColor = new Common . UI . ColorButton ( {
2020-04-29 14:37:59 +00:00
parentEl : $ ( '#tableadv-button-table-back-color' ) ,
additionalAlign : this . menuAddAlign ,
2021-07-11 13:12:05 +00:00
transparent : true ,
cls : 'move-focus' ,
takeFocusOnClose : true
2016-03-11 00:48:53 +00:00
} ) ;
2020-04-29 14:37:59 +00:00
this . btnTableBackColor . on ( 'color:select' , _ . bind ( this . onColorsTableBackSelect , this ) ) ;
this . colorsTableBack = this . btnTableBackColor . getPicker ( ) ;
2016-03-11 00:48:53 +00:00
this . tableBordersImageSpacing = new Common . UI . TableStyler ( {
el : $ ( '#id-detablestyler-spacing' ) ,
width : 200 ,
height : 200 ,
rows : this . tableStylerRows ,
columns : this . tableStylerColumns ,
spacingMode : true
} ) ;
this . tableBordersImage = new Common . UI . TableStyler ( {
el : $ ( '#id-detablestyler' ) ,
width : 200 ,
height : 200 ,
rows : this . tableStylerRows ,
columns : this . tableStylerColumns ,
spacingMode : false
} ) ;
var _arrBorderPresets = [
2021-01-26 20:52:43 +00:00
[ 'cm' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-inner-only' , 'tableadv-button-border-inner' , this . tipInner ] ,
[ 'lrtb' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-outer-only' , 'tableadv-button-border-outer' , this . tipOuter ] ,
[ 'lrtbcm' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-all' , 'tableadv-button-border-all' , this . tipAll ] ,
[ '' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-none' , 'tableadv-button-border-none' , this . tipNone ]
2016-03-11 00:48:53 +00:00
] ;
this . _btnsBorderPosition = [ ] ;
_ . each ( _arrBorderPresets , function ( item , index , list ) {
var _btn = new Common . UI . Button ( {
2020-04-29 07:36:53 +00:00
parentEl : $ ( '#' + item [ 2 ] ) ,
2016-03-11 00:48:53 +00:00
style : 'margin-left: 5px; margin-bottom: 4px;' ,
2021-09-28 16:29:36 +00:00
cls : 'btn-options large border-off' ,
2016-03-11 00:48:53 +00:00
iconCls : item [ 1 ] ,
strId : item [ 0 ] ,
hint : item [ 3 ]
} ) ;
_btn . on ( 'click' , _ . bind ( this . _ApplyBorderPreset , this ) ) ;
this . _btnsBorderPosition . push ( _btn ) ;
} , this ) ;
var _arrTableBorderPresets = [
2021-01-26 20:52:43 +00:00
[ 'cm' , '' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-twin-none-inner' , 'tableadv-button-border-inner-none' , this . tipCellInner ] ,
[ 'lrtb' , '' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-twin-none-outer' , 'tableadv-button-border-outer-none' , this . tipCellOuter ] ,
[ 'lrtbcm' , '' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-twin-none-all' , 'tableadv-button-border-all-none' , this . tipCellAll ] ,
[ '' , '' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-twin-none' , 'tableadv-button-border-none-none' , this . tipNone ] ,
[ 'lrtbcm' , 'lrtb' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-twin-all' , 'tableadv-button-border-all-table' , this . tipTableOuterCellAll ] ,
[ '' , 'lrtb' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-twin-outer-none' , 'tableadv-button-border-none-table' , this . tipOuter ] ,
[ 'cm' , 'lrtb' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-twin-outer-inner' , 'tableadv-button-border-inner-table' , this . tipTableOuterCellInner ] ,
[ 'lrtb' , 'lrtb' , 'btn-borders-large toolbar__icon toolbar__icon-big borders-twin-outer-outer' , 'tableadv-button-border-outer-table' , this . tipTableOuterCellOuter ]
2016-03-11 00:48:53 +00:00
] ;
this . _btnsTableBorderPosition = [ ] ;
_ . each ( _arrTableBorderPresets , function ( item , index , list ) {
var _btn = new Common . UI . Button ( {
2020-04-29 07:36:53 +00:00
parentEl : $ ( '#' + item [ 3 ] ) ,
2016-03-11 00:48:53 +00:00
style : 'margin-left: 5px; margin-bottom: 4px;' ,
2021-09-28 16:29:36 +00:00
cls : 'btn-options large border-off' ,
2016-03-11 00:48:53 +00:00
iconCls : item [ 2 ] ,
strCellId : item [ 0 ] ,
strTableId : item [ 1 ] ,
hint : item [ 4 ]
} ) ;
_btn . on ( 'click' , _ . bind ( this . _ApplyBorderPreset , this ) ) ;
this . _btnsTableBorderPosition . push ( _btn ) ;
} , this ) ;
2017-01-19 09:41:35 +00:00
// Alt Text
2016-03-11 00:48:53 +00:00
2017-01-19 09:41:35 +00:00
this . inputAltTitle = new Common . UI . InputField ( {
el : $ ( '#table-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 . AlignContainer = $ ( '#tableadv-panel-align' ) ;
this . DistanceContainer = $ ( '#tableadv-panel-distance' ) ;
this . BordersContainer = $ ( '#tableadv-panel-borders' ) ;
this . BordersSpacingContainer = $ ( '#tableadv-panel-borders-spacing' ) ;
this . CellBackContainer = $ ( '#tableadv-panel-cell-back' ) ;
this . TableBackContainer = $ ( '#tableadv-panel-table-back' ) ;
this . afterRender ( ) ;
} ,
2020-10-13 16:15:30 +00:00
getFocusedComponents : function ( ) {
return [
2021-04-13 13:51:24 +00:00
this . chWidth , this . nfWidth , this . cmbUnit , this . chAutofit , this . spnTableMarginTop , this . spnTableMarginLeft , this . spnTableMarginBottom , this . spnTableMarginRight , this . chAllowSpacing , this . nfSpacing , // 0 tab
this . chPrefWidth , this . nfPrefWidth , this . cmbPrefWidthUnit , this . chCellMargins , this . spnMarginTop , this . spnMarginLeft , this . spnMarginBottom , this . spnMarginRight , this . chWrapText , // 1 tab
2021-07-11 13:12:05 +00:00
this . cmbBorderSize , this . btnBorderColor ] . concat ( this . _btnsBorderPosition ) . concat ( this . _btnsTableBorderPosition ) . concat ( [ this . btnBackColor , this . btnTableBackColor ,
2021-04-14 08:01:41 +00:00
this . radioHAlign , this . cmbHAlign , this . radioHPosition , this . cmbHRelative , this . spnX , this . cmbHPosition ,
this . radioVAlign , this . cmbVAlign , this . radioVPosition , this . cmbVRelative , this . spnY , this . cmbVPosition , this . chMove , this . chOverlap , // 3 tab
2020-10-13 16:15:30 +00:00
this . spnIndentLeft , this . spnDistanceTop , this . spnDistanceLeft , this . spnDistanceBottom , this . spnDistanceRight , // 4 tab
this . inputAltTitle , this . textareaAltDescription // 5 tab
2021-07-11 13:12:05 +00:00
] ) ;
2020-10-13 16:15:30 +00:00
} ,
2020-10-01 19:25:59 +00:00
onCategoryClick : function ( btn , index ) {
Common . Views . AdvancedSettingsWindow . prototype . onCategoryClick . call ( this , btn , index ) ;
2020-10-13 16:15:30 +00:00
var me = this ;
setTimeout ( function ( ) {
switch ( index ) {
case 0 :
if ( ! me . nfWidth . isDisabled ( ) )
me . nfWidth . focus ( ) ;
else
me . spnTableMarginTop . focus ( ) ;
break ;
case 1 :
me . onCellCategoryClick ( btn ) ;
if ( ! me . nfPrefWidth . isDisabled ( ) )
me . nfPrefWidth . focus ( ) ;
2021-04-13 13:51:24 +00:00
else
me . chPrefWidth . focus ( ) ;
2020-10-13 16:15:30 +00:00
break ;
2021-07-11 13:12:05 +00:00
case 2 :
me . cmbBorderSize . focus ( ) ;
break ;
2020-10-13 16:15:30 +00:00
case 3 :
if ( ! me . cmbHAlign . isDisabled ( ) )
me . cmbHAlign . focus ( ) ;
else
me . spnX . focus ( ) ;
break ;
case 4 :
if ( me . spnIndentLeft . isVisible ( ) )
me . spnIndentLeft . focus ( ) ;
else
me . spnDistanceTop . focus ( ) ;
break ;
case 5 :
me . inputAltTitle . focus ( ) ;
break ;
}
} , 10 ) ;
2020-10-01 19:25:59 +00:00
} ,
2016-03-11 00:48:53 +00:00
afterRender : function ( ) {
this . updateMetricUnit ( ) ;
this . updateThemeColors ( ) ;
this . _setDefaults ( this . _originalProps ) ;
if ( this . borderProps !== undefined ) {
this . btnBorderColor . setColor ( this . borderProps . borderColor ) ;
2021-01-20 13:42:48 +00:00
this . btnBorderColor . setAutoColor ( this . borderProps . borderColor == 'auto' ) ;
var colorstr = ( typeof ( this . btnBorderColor . color ) == 'object' ) ? this . btnBorderColor . color . color : this . btnBorderColor . color ;
2016-03-11 00:48:53 +00:00
this . tableBordersImageSpacing . setVirtualBorderColor ( colorstr ) ;
this . tableBordersImage . setVirtualBorderColor ( colorstr ) ;
2021-01-20 13:42:48 +00:00
if ( this . borderProps . borderColor == 'auto' )
this . colorsBorder . clearSelection ( ) ;
else
this . colorsBorder . select ( this . borderProps . borderColor , true ) ;
2016-03-11 00:48:53 +00:00
this . cmbBorderSize . setValue ( this . borderProps . borderSize . ptValue ) ;
var rec = this . cmbBorderSize . getSelectedRecord ( ) ;
if ( rec )
this . onBorderSizeSelect ( this . cmbBorderSize , rec ) ;
}
for ( var i = 0 ; i < this . tableBordersImageSpacing . rows ; i ++ ) {
for ( var j = 0 ; j < this . tableBordersImageSpacing . columns ; j ++ ) {
this . tableBordersImageSpacing . getCell ( j , i ) . on ( 'borderclick' , function ( ct , border , size , color ) {
if ( this . ChangedCellBorders === undefined ) {
2016-04-05 12:57:51 +00:00
this . ChangedCellBorders = new Asc . CBorders ( ) ;
2016-03-11 00:48:53 +00:00
}
this . _UpdateCellBordersStyle ( ct , border , size , color , this . CellBorders , this . ChangedCellBorders ) ;
} , this ) ;
}
}
this . tableBordersImageSpacing . on ( 'borderclick' , function ( ct , border , size , color ) {
if ( this . ChangedTableBorders === undefined ) {
2016-04-05 12:57:51 +00:00
this . ChangedTableBorders = new Asc . CBorders ( ) ;
2016-03-11 00:48:53 +00:00
}
this . _UpdateTableBordersStyle ( ct , border , size , color , this . TableBorders , this . ChangedTableBorders ) ;
} , this ) ;
for ( i = 0 ; i < this . tableBordersImage . rows ; i ++ ) {
for ( j = 0 ; j < this . tableBordersImage . columns ; j ++ ) {
this . tableBordersImage . getCell ( j , i ) . on ( 'borderclick' , function ( ct , border , size , color ) {
if ( this . _allTable ) {
if ( this . ChangedTableBorders === undefined ) {
2016-04-05 12:57:51 +00:00
this . ChangedTableBorders = new Asc . CBorders ( ) ;
2016-03-11 00:48:53 +00:00
}
} else {
if ( this . ChangedCellBorders === undefined ) {
2016-04-05 12:57:51 +00:00
this . ChangedCellBorders = new Asc . CBorders ( ) ;
2016-03-11 00:48:53 +00:00
}
}
this . _UpdateCellBordersStyle ( ct , border , size , color , ( this . _allTable ) ? this . TableBorders : this . CellBorders , ( this . _allTable ) ? this . ChangedTableBorders : this . ChangedCellBorders ) ;
} , this ) ;
}
}
this . tableBordersImage . on ( 'borderclick' , function ( ct , border , size , color ) {
if ( this . _allTable ) {
if ( this . ChangedTableBorders === undefined ) {
2016-04-05 12:57:51 +00:00
this . ChangedTableBorders = new Asc . CBorders ( ) ;
2016-03-11 00:48:53 +00:00
}
} else {
if ( this . ChangedCellBorders === undefined ) {
2016-04-05 12:57:51 +00:00
this . ChangedCellBorders = new Asc . CBorders ( ) ;
2016-03-11 00:48:53 +00:00
}
}
this . _UpdateTableBordersStyle ( ct , border , size , color , ( this . _allTable ) ? this . TableBorders : this . CellBorders , ( this . _allTable ) ? this . ChangedTableBorders : this . ChangedCellBorders ) ;
} , this ) ;
2016-04-21 11:47:28 +00:00
2016-09-30 13:08:11 +00:00
var cellcolorstr = ( typeof ( this . CellColor . Color ) == 'object' ) ? this . CellColor . Color . color : this . CellColor . Color ,
tablecolorstr = ( typeof ( this . TableColor . Color ) == 'object' ) ? this . TableColor . Color . color : this . TableColor . Color ;
this . tableBordersImageSpacing . setTableColor ( tablecolorstr ) ;
this . tableBordersImage . setTableColor ( tablecolorstr ) ;
this . tableBordersImageSpacing . setCellsColor ( cellcolorstr ) ;
this . tableBordersImage . setCellsColor ( ( this . _allTable ) ? tablecolorstr : cellcolorstr ) ;
2016-04-21 11:47:28 +00:00
if ( this . storageName ) {
var value = Common . localStorage . getItem ( this . storageName ) ;
this . setActiveCategory ( ( value !== null ) ? parseInt ( value ) : 0 ) ;
}
2016-03-11 00:48:53 +00:00
} ,
getSettings : function ( ) {
if ( this . _cellBackground ) {
if ( this . _allTable ) {
if ( this . _changedProps . get _Spacing ( ) === null || ( this . _changedProps . get _Spacing ( ) === undefined && this . _originalProps . get _Spacing ( ) === null ) )
this . _changedProps . put _CellsBackground ( null ) ;
else
this . _changedProps . put _CellsBackground ( this . _cellBackground ) ;
} else
this . _changedProps . put _CellsBackground ( this . _cellBackground ) ;
}
if ( this . ChangedTableBorders === null ) {
this . _changedProps . put _TableBorders ( this . TableBorders ) ;
} else if ( this . ChangedTableBorders !== undefined ) {
this . _changedProps . put _TableBorders ( this . ChangedTableBorders ) ;
}
if ( this . ChangedCellBorders === null ) {
this . _changedProps . put _CellBorders ( this . CellBorders ) ;
} else if ( this . ChangedCellBorders !== undefined ) {
this . _changedProps . put _CellBorders ( this . ChangedCellBorders ) ;
}
2017-01-19 09:41:35 +00:00
if ( this . isAltTitleChanged )
2017-01-22 10:40:41 +00:00
this . _changedProps . put _TableCaption ( this . inputAltTitle . getValue ( ) ) ;
2017-01-19 09:41:35 +00:00
if ( this . isAltDescChanged )
2017-01-22 10:40:41 +00:00
this . _changedProps . put _TableDescription ( this . textareaAltDescription . val ( ) ) ;
2017-01-19 09:41:35 +00:00
2021-01-20 13:42:48 +00:00
return { tableProps : this . _changedProps , borderProps : { borderSize : this . BorderSize , borderColor : this . btnBorderColor . isAutoColor ( ) ? 'auto' : this . btnBorderColor . color } } ;
2016-03-11 00:48:53 +00:00
} ,
_setDefaults : function ( props ) {
if ( props ) {
this . _allTable = ! props . get _CellSelect ( ) ;
2016-05-26 09:12:32 +00:00
this . pageWidth = Common . Utils . Metric . fnRecalcFromMM ( props . get _PercentFullWidth ( ) ) ;
2016-03-11 00:48:53 +00:00
2016-04-06 15:17:40 +00:00
var value ,
TableWidth = props . get _Width ( ) ,
currmetric = Common . Utils . Metric . getCurrentMetric ( ) ;
2016-03-17 09:44:42 +00:00
2016-04-06 15:17:40 +00:00
// main props
this . cmbUnit . store . at ( 0 ) . set ( 'displayValue' , ( currmetric == Common . Utils . Metric . c _MetricUnits . pt ) ? this . txtPt : ( ( currmetric == Common . Utils . Metric . c _MetricUnits . inch ) ? this . txtInch : this . txtCm ) ) ;
2016-03-17 09:44:42 +00:00
this . cmbUnit . setValue ( TableWidth < 0 ? 1 : 0 ) ;
2016-04-06 13:38:54 +00:00
this . nfWidth . setDefaultUnit ( TableWidth < 0 ? '%' : Common . Utils . Metric . getCurrentMetricName ( ) ) ;
2016-03-17 09:44:42 +00:00
if ( TableWidth < 0 ) //%
2016-03-17 13:27:44 +00:00
this . nfWidth . setMaxValue ( parseFloat ( ( 100 * Common . Utils . Metric . fnRecalcFromMM ( 558 ) / this . pageWidth ) . toFixed ( 2 ) ) ) ;
2016-03-17 09:44:42 +00:00
this . nfWidth . setStep ( ( TableWidth < 0 || Common . Utils . Metric . getCurrentMetric ( ) == Common . Utils . Metric . c _MetricUnits . pt ) ? 1 : 0.1 ) ;
if ( TableWidth !== null )
this . nfWidth . setValue ( TableWidth > 0 ? Common . Utils . Metric . fnRecalcFromMM ( TableWidth ) : - TableWidth , true ) ;
2016-03-11 00:48:53 +00:00
this . chWidth . setValue ( TableWidth !== null , true ) ;
2016-03-17 09:44:42 +00:00
value = ( this . chWidth . getValue ( ) !== 'checked' ) ;
this . nfWidth . setDisabled ( value ) ;
this . cmbUnit . setDisabled ( value ) ;
2016-03-11 00:48:53 +00:00
var TableSpacing = props . get _Spacing ( ) ;
if ( TableSpacing !== null ) {
this . nfSpacing . setValue ( Common . Utils . Metric . fnRecalcFromMM ( TableSpacing ) , true ) ;
}
this . chAllowSpacing . setValue ( TableSpacing !== null , true ) ;
this . nfSpacing . setDisabled ( this . chAllowSpacing . getValue ( ) !== 'checked' ) ;
var autoFit = props . get _TableLayout ( ) ;
this . chAutofit . setDisabled ( autoFit === undefined ) ;
2016-04-05 11:52:34 +00:00
this . chAutofit . setValue ( autoFit === Asc . c _oAscTableLayout . AutoFit , true ) ;
2016-03-11 00:48:53 +00:00
// margins
var margins = props . get _DefaultMargins ( ) ;
if ( margins ) {
this . TableMargins = {
Left : ( margins . get _Left ( ) !== null ) ? Common . Utils . Metric . fnRecalcFromMM ( margins . get _Left ( ) ) : null ,
Right : ( margins . get _Right ( ) !== null ) ? Common . Utils . Metric . fnRecalcFromMM ( margins . get _Right ( ) ) : null ,
Top : ( margins . get _Top ( ) !== null ) ? Common . Utils . Metric . fnRecalcFromMM ( margins . get _Top ( ) ) : null ,
Bottom : ( margins . get _Bottom ( ) !== null ) ? Common . Utils . Metric . fnRecalcFromMM ( margins . get _Bottom ( ) ) : null
} ;
}
margins = props . get _CellMargins ( ) ;
var flag = undefined ;
if ( margins ) {
this . CellMargins = {
Left : ( margins . get _Left ( ) !== null ) ? Common . Utils . Metric . fnRecalcFromMM ( margins . get _Left ( ) ) : null ,
Right : ( margins . get _Right ( ) !== null ) ? Common . Utils . Metric . fnRecalcFromMM ( margins . get _Right ( ) ) : null ,
Top : ( margins . get _Top ( ) !== null ) ? Common . Utils . Metric . fnRecalcFromMM ( margins . get _Top ( ) ) : null ,
Bottom : ( margins . get _Bottom ( ) !== null ) ? Common . Utils . Metric . fnRecalcFromMM ( margins . get _Bottom ( ) ) : null
} ;
flag = margins . get _Flag ( ) ;
this . CellMargins . Flag = ( flag == 1 ) ? 'indeterminate' : ( ( flag == 0 ) ? 'checked' : 'unchecked' ) ;
this . chCellMargins . setValue ( this . CellMargins . Flag , true ) ;
}
if ( flag === 0 ) {
// Если для всех выделенных ячеек пришло одинаковое значение Flag=0 (Use Default Margins), выставим в поля для Cell Margins значения DefaultMargins
if ( this . CellMargins . Left === null ) this . CellMargins . Left = this . TableMargins . Left ;
if ( this . CellMargins . Top === null ) this . CellMargins . Top = this . TableMargins . Top ;
if ( this . CellMargins . Right === null ) this . CellMargins . Right = this . TableMargins . Right ;
if ( this . CellMargins . Bottom === null ) this . CellMargins . Bottom = this . TableMargins . Bottom ;
}
this . fillMargins ( this . CellMargins . Flag ) ;
2016-04-04 14:05:54 +00:00
// Cell Size
var cellWidth = props . get _CellsWidth ( ) ;
2016-04-06 15:17:40 +00:00
this . cmbPrefWidthUnit . store . at ( 0 ) . set ( 'displayValue' , ( currmetric == Common . Utils . Metric . c _MetricUnits . pt ) ? this . txtPt : ( ( currmetric == Common . Utils . Metric . c _MetricUnits . inch ) ? this . txtInch : this . txtCm ) ) ;
2016-04-04 14:05:54 +00:00
this . cmbPrefWidthUnit . setValue ( cellWidth < 0 ? 1 : 0 ) ;
2016-04-06 13:38:54 +00:00
this . nfPrefWidth . setDefaultUnit ( cellWidth < 0 ? '%' : Common . Utils . Metric . getCurrentMetricName ( ) ) ;
2016-04-04 14:05:54 +00:00
if ( cellWidth < 0 ) //%
this . nfPrefWidth . setMaxValue ( parseFloat ( ( 100 * Common . Utils . Metric . fnRecalcFromMM ( 558 ) / this . pageWidth ) . toFixed ( 2 ) ) ) ;
this . nfPrefWidth . setStep ( ( cellWidth < 0 || Common . Utils . Metric . getCurrentMetric ( ) == Common . Utils . Metric . c _MetricUnits . pt ) ? 1 : 0.1 ) ;
if ( cellWidth !== null )
this . nfPrefWidth . setValue ( cellWidth > 0 ? Common . Utils . Metric . fnRecalcFromMM ( cellWidth ) : - cellWidth , true ) ;
2016-08-03 09:54:51 +00:00
this . chPrefWidth . setValue ( ( props . get _CellsWidthNotEqual ( ) ) ? 'indeterminate' : ( cellWidth !== null ) , true ) ;
2016-04-04 14:05:54 +00:00
value = ( this . chPrefWidth . getValue ( ) !== 'checked' ) ;
this . nfPrefWidth . setDisabled ( value ) ;
this . cmbPrefWidthUnit . setDisabled ( value ) ;
var wrapText = ! props . get _CellsNoWrap ( ) ;
this . chWrapText . setValue ( wrapText , true ) ;
2016-03-11 00:48:53 +00:00
// wrapping props
this . _TblWrapStyleChanged ( props . get _TableWrap ( ) ) ;
this . ShowHideWrap ( props . get _TableWrap ( ) === c _tableWrap . TABLE _WRAP _NONE ) ;
this . btnWrapParallel . setDisabled ( ! props . get _CanBeFlow ( ) ) ;
// align props
var tableAlign = props . get _TableAlignment ( ) ;
if ( tableAlign !== null ) {
this . _TblAlignChanged ( tableAlign ) ;
this . spnIndentLeft . setValue ( tableAlign !== c _tableAlign . TABLE _ALIGN _LEFT ? 0 : Common . Utils . Metric . fnRecalcFromMM ( props . get _TableIndent ( ) ) , true ) ;
this . spnIndentLeft . setDisabled ( tableAlign !== c _tableAlign . TABLE _ALIGN _LEFT ) ;
}
this . _state . alignChanged = false ;
// distances & position
var paddings = props . get _TablePaddings ( ) ;
if ( paddings ) {
this . spnDistanceTop . setValue ( Common . Utils . Metric . fnRecalcFromMM ( paddings . get _Top ( ) ) , true ) ;
this . spnDistanceLeft . setValue ( Common . Utils . Metric . fnRecalcFromMM ( paddings . get _Left ( ) ) , true ) ;
this . spnDistanceBottom . setValue ( Common . Utils . Metric . fnRecalcFromMM ( paddings . get _Bottom ( ) ) , true ) ;
this . spnDistanceRight . setValue ( Common . Utils . Metric . fnRecalcFromMM ( paddings . get _Right ( ) ) , true ) ;
}
var Position = props . get _PositionH ( ) ;
if ( Position ) {
value = Position . get _RelativeFrom ( ) ;
for ( var i = 0 ; i < this . _arrHRelative . length ; i ++ ) {
if ( value == this . _arrHRelative [ i ] . value ) {
this . cmbHRelative . setValue ( value ) ;
this . cmbHPosition . setValue ( value ) ;
this . _state . HPositionFrom = value ;
this . _state . HAlignFrom = value ;
break ;
}
}
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 = this . _originalProps . get _Value _X ( this . _state . HPositionFrom ) ;
this . spnX . setValue ( Common . Utils . Metric . fnRecalcFromMM ( value ) ) ;
} else {
this . radioHPosition . setValue ( true ) ;
value = Position . get _Value ( ) ;
this . spnX . setValue ( Common . Utils . Metric . fnRecalcFromMM ( value ) ) ;
}
} else {
value = this . _originalProps . get _Value _X ( this . _state . HPositionFrom ) ;
this . spnX . setValue ( Common . Utils . Metric . fnRecalcFromMM ( value ) ) ;
}
Position = props . get _PositionV ( ) ;
if ( Position ) {
value = Position . get _RelativeFrom ( ) ;
for ( i = 0 ; i < this . _arrVRelative . length ; i ++ ) {
if ( value == this . _arrVRelative [ i ] . value ) {
this . cmbVRelative . setValue ( value ) ;
this . cmbVPosition . setValue ( value ) ;
this . _state . VAlignFrom = value ;
this . _state . VPositionFrom = value ;
break ;
}
}
2016-04-05 11:52:34 +00:00
if ( value == Asc . c _oAscVAnchor . Text )
2016-03-11 00:48:53 +00:00
this . chMove . setValue ( true , true ) ;
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 ;
}
}
value = props . get _Value _Y ( this . _state . VPositionFrom ) ;
this . spnY . setValue ( Common . Utils . Metric . fnRecalcFromMM ( value ) ) ;
} else {
this . radioVPosition . setValue ( true ) ;
value = Position . get _Value ( ) ;
this . spnY . setValue ( Common . Utils . Metric . fnRecalcFromMM ( value ) ) ;
}
} else {
value = props . get _Value _Y ( this . _state . VPositionFrom ) ;
this . spnY . setValue ( Common . Utils . Metric . fnRecalcFromMM ( value ) ) ;
}
this . chOverlap . setValue ( ( props . get _AllowOverlap ( ) !== null ) ? props . get _AllowOverlap ( ) : 'indeterminate' , true ) ;
this . _state . verticalPropChanged = false ;
this . _state . horizontalPropChanged = false ;
// borders
2016-04-05 12:57:51 +00:00
this . TableBorders = new Asc . CBorders ( props . get _TableBorders ( ) ) ;
2016-03-11 00:48:53 +00:00
2016-04-05 12:57:51 +00:00
this . CellBorders = new Asc . CBorders ( props . get _CellBorders ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _UpdateBordersNoSpacing _ ( ) ;
this . _UpdateBordersSpacing _ ( ) ;
var disable _inner = ( this . CellBorders . get _InsideV ( ) === null && this . CellBorders . get _InsideH ( ) === null ) ;
this . _btnsBorderPosition [ 0 ] . setDisabled ( disable _inner && ! this . _allTable ) ;
this . _btnsTableBorderPosition [ 0 ] . setDisabled ( disable _inner && ! this . _allTable ) ;
this . _btnsTableBorderPosition [ 6 ] . setDisabled ( disable _inner && ! this . _allTable ) ;
// background colors
var background = props . get _TableBackground ( ) ;
if ( background && background . get _Value ( ) == 0 ) {
var color = background . get _Color ( ) ;
if ( color ) {
2016-04-05 11:52:34 +00:00
if ( color . get _type ( ) == Asc . c _oAscColor . COLOR _TYPE _SCHEME ) {
2016-03-11 00:48:53 +00:00
this . TableColor = { Value : 1 , Color : { color : Common . Utils . ThemeColor . getHexColor ( color . get _r ( ) , color . get _g ( ) , color . get _b ( ) ) , effectValue : color . get _value ( ) } } ;
} else {
this . TableColor = { Value : 1 , Color : Common . Utils . ThemeColor . getHexColor ( color . get _r ( ) , color . get _g ( ) , color . get _b ( ) ) } ;
}
} else
this . TableColor = { Value : 1 , Color : 'transparent' } ;
} else
this . TableColor = { Value : 0 , Color : 'transparent' } ;
background = props . get _CellsBackground ( ) ;
if ( background ) {
if ( background . get _Value ( ) == 0 ) {
var color = background . get _Color ( ) ;
if ( color ) {
2016-04-05 11:52:34 +00:00
if ( color . get _type ( ) == Asc . c _oAscColor . COLOR _TYPE _SCHEME ) {
2016-03-11 00:48:53 +00:00
this . CellColor = { Value : 1 , Color : { color : Common . Utils . ThemeColor . getHexColor ( color . get _r ( ) , color . get _g ( ) , color . get _b ( ) ) , effectValue : color . get _value ( ) } } ;
} else {
this . CellColor = { Value : 1 , Color : Common . Utils . ThemeColor . getHexColor ( color . get _r ( ) , color . get _g ( ) , color . get _b ( ) ) } ;
}
} else
this . CellColor = { Value : 1 , Color : 'transparent' } ;
} else
this . CellColor = { Value : 1 , Color : 'transparent' } ;
} else
this . CellColor = { Value : 0 , Color : 'transparent' } ;
this . btnBackColor . setColor ( this . CellColor . Color ) ;
if ( typeof ( this . CellColor . Color ) == 'object' ) {
var isselected = false ;
for ( var i = 0 ; i < 10 ; i ++ ) {
if ( Common . Utils . ThemeColor . ThemeValues [ i ] == this . CellColor . Color . effectValue ) {
this . colorsBack . select ( this . CellColor . Color , true ) ;
isselected = true ;
break ;
}
}
if ( ! isselected ) this . colorsBack . clearSelection ( ) ;
} else
this . colorsBack . select ( this . CellColor . Color , true ) ;
this . btnTableBackColor . setColor ( this . TableColor . Color ) ;
if ( typeof ( this . TableColor . Color ) == 'object' ) {
var isselected = false ;
for ( var i = 0 ; i < 10 ; i ++ ) {
if ( Common . Utils . ThemeColor . ThemeValues [ i ] == this . TableColor . Color . effectValue ) {
this . colorsTableBack . select ( this . TableColor . Color , true ) ;
isselected = true ;
break ;
}
}
if ( ! isselected ) this . colorsTableBack . clearSelection ( ) ;
} else
this . colorsTableBack . select ( this . TableColor . Color , true ) ;
this . ShowHideSpacing ( this . chAllowSpacing . getValue ( ) === 'checked' ) ;
2017-01-22 10:40:41 +00:00
value = props . get _TableCaption ( ) ;
this . inputAltTitle . setValue ( value ? value : '' ) ;
value = props . get _TableDescription ( ) ;
this . textareaAltDescription . val ( value ? value : '' ) ;
2016-03-11 00:48:53 +00:00
}
2016-04-05 12:57:51 +00:00
this . _changedProps = new Asc . CTableProp ( ) ;
2016-09-30 13:10:46 +00:00
this . _changedProps . put _CellSelect ( ! this . _allTable ) ;
2016-03-11 00:48:53 +00:00
this . _cellBackground = null ;
this . ChangedTableBorders = undefined ;
this . ChangedCellBorders = undefined ;
} ,
fillMargins : function ( checkMarginsState ) {
this . spnMarginLeft . setValue ( ( this . CellMargins . Left !== null ) ? this . CellMargins . Left : '' , true ) ;
this . spnMarginTop . setValue ( ( this . CellMargins . Top !== null ) ? this . CellMargins . Top : '' , true ) ;
this . spnMarginRight . setValue ( ( this . CellMargins . Right !== null ) ? this . CellMargins . Right : '' , true ) ;
this . spnMarginBottom . setValue ( ( this . CellMargins . Bottom !== null ) ? this . CellMargins . Bottom : '' , true ) ;
var disabled = ( checkMarginsState == 'checked' ) ;
this . spnMarginTop . setDisabled ( disabled ) ;
this . spnMarginBottom . setDisabled ( disabled ) ;
this . spnMarginLeft . setDisabled ( disabled ) ;
this . spnMarginRight . setDisabled ( disabled ) ;
this . spnTableMarginLeft . setValue ( ( this . TableMargins . Left !== null ) ? this . TableMargins . Left : '' , true ) ;
this . spnTableMarginTop . setValue ( ( this . TableMargins . Top !== null ) ? this . TableMargins . Top : '' , true ) ;
this . spnTableMarginRight . setValue ( ( this . TableMargins . Right !== null ) ? this . TableMargins . Right : '' , true ) ;
this . spnTableMarginBottom . setValue ( ( this . TableMargins . Bottom !== null ) ? this . TableMargins . Bottom : '' , true ) ;
} ,
_TblWrapStyleChanged : function ( style ) {
if ( style == c _tableWrap . TABLE _WRAP _NONE )
this . btnWrapNone . toggle ( true ) ;
else
this . btnWrapParallel . toggle ( true ) ;
this . _state . fromWrapInline = ( style == c _tableWrap . TABLE _WRAP _NONE ) ;
} ,
_TblAlignChanged : function ( style ) {
if ( style == c _tableAlign . TABLE _ALIGN _LEFT )
this . btnAlignLeft . toggle ( true , true ) ;
else if ( style == c _tableAlign . TABLE _ALIGN _CENTER )
this . btnAlignCenter . toggle ( true , true ) ;
else
this . btnAlignRight . toggle ( true , true ) ;
} ,
onBtnInlineWrapClick : function ( btn , e ) {
this . ShowHideWrap ( true ) ;
if ( this . _changedProps && btn . pressed ) {
if ( this . _state . alignChanged ) {
2016-04-05 11:52:34 +00:00
if ( this . _state . HAlignType === Asc . c _oAscXAlign . Left )
2016-05-05 09:15:52 +00:00
this . btnAlignLeft . toggle ( true ) ;
2016-04-05 11:52:34 +00:00
else if ( this . _state . HAlignType == Asc . c _oAscXAlign . Center )
2016-05-05 09:15:52 +00:00
this . btnAlignCenter . toggle ( true ) ;
2016-04-05 11:52:34 +00:00
else if ( this . _state . HAlignType == Asc . c _oAscXAlign . Right )
2016-05-05 09:15:52 +00:00
this . btnAlignRight . toggle ( true ) ;
2016-03-11 00:48:53 +00:00
this . _state . alignChanged = false ;
}
this . _changedProps . put _TableWrap ( btn . options . posId ) ;
if ( this . btnAlignLeft . pressed ) this . _changedProps . put _TableAlignment ( c _tableAlign . TABLE _ALIGN _LEFT ) ;
else if ( this . btnAlignCenter . pressed ) this . _changedProps . put _TableAlignment ( c _tableAlign . TABLE _ALIGN _CENTER ) ;
else this . _changedProps . put _TableAlignment ( c _tableAlign . TABLE _ALIGN _RIGHT ) ;
this . spnIndentLeft . setDisabled ( ! this . btnAlignLeft . pressed ) ;
this . _changedProps . put _TableIndent ( Common . Utils . Metric . fnRecalcToMM ( this . spnIndentLeft . getNumberValue ( ) ) ) ;
}
2020-10-13 16:15:30 +00:00
! this . spnIndentLeft . isDisabled ( ) && this . spnIndentLeft . focus ( ) ;
2016-03-11 00:48:53 +00:00
} ,
onBtnFlowWrapClick : function ( btn , e ) {
this . ShowHideWrap ( false ) ;
if ( this . _changedProps && btn . pressed ) {
this . _changedProps . put _TableWrap ( btn . options . posId ) ;
this . _changedProps . put _TableAlignment ( null ) ;
this . _changedProps . put _TableIndent ( null ) ;
if ( this . _state . fromWrapInline && ! this . _state . verticalPropChanged ) {
this . radioVPosition . setValue ( true ) ;
}
if ( this . _state . alignChanged ) {
2016-04-05 11:52:34 +00:00
if ( this . btnAlignLeft . pressed ) this . _state . HAlignType = Asc . c _oAscXAlign . Left ;
else if ( this . btnAlignCenter . pressed ) this . _state . HAlignType = Asc . c _oAscXAlign . Center ;
else this . _state . HAlignType = Asc . c _oAscXAlign . Right ;
2016-03-11 00:48:53 +00:00
this . cmbHAlign . setValue ( this . _state . HAlignType ) ;
this . radioHAlign . setValue ( true ) ;
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 . CTablePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _UseAlign ( true ) ;
this . _changedProps . get _PositionH ( ) . put _Align ( this . _state . HAlignType ) ;
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HAlignFrom ) ;
this . _state . alignChanged = false ;
this . _state . horizontalPropChanged = true ;
} else if ( this . _state . fromWrapInline && ! this . _state . horizontalPropChanged ) {
this . radioHPosition . setValue ( true ) ;
}
}
2020-10-13 16:15:30 +00:00
this . spnDistanceTop . focus ( ) ;
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 . CTablePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . HAlignType = record . value ;
this . _changedProps . get _PositionH ( ) . put _UseAlign ( true ) ;
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HAlignFrom ) ;
this . _changedProps . get _PositionH ( ) . put _Align ( this . _state . HAlignType ) ;
this . _state . alignChanged = true ;
}
} ,
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 . CTablePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . HAlignFrom = record . value ;
this . _changedProps . get _PositionH ( ) . put _UseAlign ( true ) ;
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 . CTablePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . HPositionFrom = record . value ;
this . _changedProps . get _PositionH ( ) . put _UseAlign ( false ) ;
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 ( ) ) ) ;
}
} ,
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 . CTablePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . VAlignType = record . value ;
this . _changedProps . get _PositionV ( ) . put _UseAlign ( true ) ;
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 . CTablePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . VAlignFrom = record . value ;
this . _changedProps . get _PositionV ( ) . put _UseAlign ( true ) ;
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 _oAscVAnchor . Text , 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 . CTablePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _state . VPositionFrom = record . value ;
this . _changedProps . get _PositionV ( ) . put _UseAlign ( false ) ;
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 _oAscVAnchor . Text , true ) ;
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 . CTablePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _UseAlign ( newValue ) ;
if ( newValue ) {
this . _changedProps . get _PositionH ( ) . put _Align ( this . _state . HAlignType ) ;
this . _changedProps . get _PositionH ( ) . put _RelativeFrom ( this . _state . HAlignFrom ) ;
}
}
if ( newValue ) {
this . cmbHAlign . setDisabled ( false ) ;
2020-10-13 16:15:30 +00:00
this . cmbHAlign . focus ( ) ;
2016-03-11 00:48:53 +00:00
this . cmbHRelative . setDisabled ( false ) ;
this . spnX . setDisabled ( true ) ;
this . cmbHPosition . setDisabled ( true ) ;
this . _state . horizontalPropChanged = true ;
this . _state . alignChanged = true ;
}
} ,
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 . CTablePositionH ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionH ( ) . put _UseAlign ( ! newValue ) ;
if ( newValue ) {
if ( ! this . _state . spnXChanged ) {
var val = this . _originalProps . get _Value _X ( this . _state . HPositionFrom ) ;
this . spnX . setValue ( Common . Utils . Metric . fnRecalcFromMM ( val ) ) ;
}
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 ) ;
2020-10-13 16:15:30 +00:00
this . spnX . focus ( ) ;
2016-03-11 00:48:53 +00:00
this . cmbHPosition . setDisabled ( false ) ;
this . _state . alignChanged = false ;
}
} ,
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 . CTablePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionV ( ) . put _UseAlign ( newValue ) ;
if ( newValue ) {
this . _changedProps . get _PositionV ( ) . put _Align ( this . _state . VAlignType ) ;
this . _changedProps . get _PositionV ( ) . put _RelativeFrom ( this . _state . VAlignFrom ) ;
this . _state . verticalPropChanged = true ;
}
}
if ( newValue ) {
this . cmbVAlign . setDisabled ( false ) ;
2020-10-13 16:15:30 +00:00
this . cmbVAlign . focus ( ) ;
2016-03-11 00:48:53 +00:00
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 _oAscVAnchor . Text , 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 . CTablePositionV ( ) ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . get _PositionV ( ) . put _UseAlign ( ! newValue ) ;
if ( newValue ) {
if ( ! this . _state . spnYChanged ) {
var val = this . _originalProps . get _Value _Y ( this . _state . VPositionFrom ) ;
this . spnY . setValue ( Common . Utils . Metric . fnRecalcFromMM ( val ) ) ;
}
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 ) ;
2020-10-13 16:15:30 +00:00
this . spnY . focus ( ) ;
2016-03-11 00:48:53 +00:00
this . cmbVPosition . setDisabled ( false ) ;
2016-04-05 11:52:34 +00:00
this . chMove . setValue ( this . _state . VPositionFrom == Asc . c _oAscVAnchor . Text , true ) ;
2016-03-11 00:48:53 +00:00
}
} ,
onBorderSizeSelect : function ( combo , record ) {
this . BorderSize = { ptValue : record . value , pxValue : record . pxValue } ;
this . tableBordersImage . setVirtualBorderSize ( this . BorderSize . pxValue ) ;
this . tableBordersImageSpacing . setVirtualBorderSize ( this . BorderSize . pxValue ) ;
} ,
2020-04-29 14:37:59 +00:00
onColorsBorderSelect : function ( btn , color ) {
2016-03-11 00:48:53 +00:00
var colorstr = ( typeof ( color ) == 'object' ) ? color . color : color ;
this . tableBordersImage . setVirtualBorderColor ( colorstr ) ;
this . tableBordersImageSpacing . setVirtualBorderColor ( colorstr ) ;
} ,
2020-04-29 14:37:59 +00:00
onColorsBackSelect : function ( btn , color ) {
2016-03-11 00:48:53 +00:00
this . CellColor = { Value : 1 , Color : color } ;
if ( this . _cellBackground === null )
2016-04-05 12:57:51 +00:00
this . _cellBackground = new Asc . CBackground ( ) ;
2016-03-11 00:48:53 +00:00
if ( this . CellColor . Color == 'transparent' ) {
this . _cellBackground . put _Value ( 1 ) ;
2016-04-18 12:21:15 +00:00
this . _cellBackground . put _Color ( new Asc . asc _CColor ( 0 , 0 , 0 ) ) ;
2016-03-11 00:48:53 +00:00
} else {
this . _cellBackground . put _Value ( 0 ) ;
this . _cellBackground . put _Color ( Common . Utils . ThemeColor . getRgbColor ( this . CellColor . Color ) ) ;
}
2016-09-30 13:08:11 +00:00
var colorstr = ( typeof ( color ) == 'object' ) ? color . color : color ;
this . tableBordersImageSpacing . setCellsColor ( colorstr ) ;
if ( ! this . _allTable )
this . tableBordersImage . setCellsColor ( colorstr ) ;
2016-03-11 00:48:53 +00:00
} ,
2020-04-29 14:37:59 +00:00
onColorsTableBackSelect : function ( btn , color ) {
2016-03-11 00:48:53 +00:00
this . TableColor . Color = color ;
if ( this . _changedProps ) {
var background = this . _changedProps . get _TableBackground ( ) ;
if ( background === undefined ) {
2016-04-05 12:57:51 +00:00
background = new Asc . CBackground ( ) ;
2016-03-11 00:48:53 +00:00
this . _changedProps . put _TableBackground ( background ) ;
}
if ( this . TableColor . Color == 'transparent' ) {
background . put _Value ( 1 ) ;
2016-04-18 12:21:15 +00:00
background . put _Color ( new Asc . asc _CColor ( 0 , 0 , 0 ) ) ;
2016-03-11 00:48:53 +00:00
} else {
background . put _Value ( 0 ) ;
background . put _Color ( Common . Utils . ThemeColor . getRgbColor ( this . TableColor . Color ) ) ;
}
}
2016-09-30 13:08:11 +00:00
var colorstr = ( typeof ( color ) == 'object' ) ? color . color : color ;
this . tableBordersImageSpacing . setTableColor ( colorstr ) ;
this . tableBordersImage . setTableColor ( colorstr ) ;
if ( this . _allTable )
this . tableBordersImage . setCellsColor ( colorstr ) ;
2016-03-11 00:48:53 +00:00
} ,
_UpdateBordersSpacing _ : function ( ) {
var source = this . TableBorders ;
var oldSize = this . BorderSize ;
var oldColor = this . btnBorderColor . color ;
this . _UpdateTableBorderSpacing _ ( source . get _Left ( ) , 'l' ) ;
this . _UpdateTableBorderSpacing _ ( source . get _Top ( ) , 't' ) ;
this . _UpdateTableBorderSpacing _ ( source . get _Right ( ) , 'r' ) ;
this . _UpdateTableBorderSpacing _ ( source . get _Bottom ( ) , 'b' ) ;
source = this . CellBorders ;
for ( var i = 0 ; i < this . tableBordersImageSpacing . rows ; i ++ ) {
this . _UpdateCellBorderSpacing _ ( source . get _Left ( ) , 'l' , this . tableBordersImageSpacing . getCell ( 0 , i ) ) ;
}
for ( i = 0 ; i < this . tableBordersImageSpacing . rows ; i ++ ) {
this . _UpdateCellBorderSpacing _ ( source . get _Right ( ) , 'r' , this . tableBordersImageSpacing . getCell ( this . tableBordersImageSpacing . columns - 1 , i ) ) ;
}
for ( i = 0 ; i < this . tableBordersImageSpacing . columns ; i ++ ) {
this . _UpdateCellBorderSpacing _ ( source . get _Top ( ) , 't' , this . tableBordersImageSpacing . getCell ( i , 0 ) ) ;
}
for ( i = 0 ; i < this . tableBordersImageSpacing . columns ; i ++ ) {
this . _UpdateCellBorderSpacing _ ( source . get _Bottom ( ) , 'b' , this . tableBordersImageSpacing . getCell ( i , this . tableBordersImageSpacing . rows - 1 ) ) ;
}
if ( this . _allTable && source . get _InsideV ( ) === null ) {
2016-04-18 12:21:15 +00:00
source . put _InsideV ( new Asc . asc _CTextBorder ( ) ) ;
2016-03-11 00:48:53 +00:00
}
if ( source . get _InsideV ( ) !== null ) {
for ( i = 0 ; i < this . tableBordersImageSpacing . rows ; i ++ ) {
this . _UpdateCellBorderSpacing _ ( source . get _InsideV ( ) , 'r' , this . tableBordersImageSpacing . getCell ( 0 , i ) ) ;
this . _UpdateCellBorderSpacing _ ( source . get _InsideV ( ) , 'l' , this . tableBordersImageSpacing . getCell ( 1 , i ) ) ;
}
}
if ( this . _allTable && source . get _InsideH ( ) === null ) {
2016-04-18 12:21:15 +00:00
source . put _InsideH ( new Asc . asc _CTextBorder ( ) ) ;
2016-03-11 00:48:53 +00:00
}
if ( source . get _InsideH ( ) !== null ) {
for ( i = 0 ; i < this . tableBordersImageSpacing . columns ; i ++ ) {
this . _UpdateCellBorderSpacing _ ( source . get _InsideH ( ) , 'b' , this . tableBordersImageSpacing . getCell ( i , 0 ) ) ;
this . _UpdateCellBorderSpacing _ ( source . get _InsideH ( ) , 't' , this . tableBordersImageSpacing . getCell ( i , 1 ) ) ;
}
}
this . tableBordersImageSpacing . setVirtualBorderSize ( oldSize . pxValue ) ;
this . tableBordersImageSpacing . setVirtualBorderColor ( ( typeof ( oldColor ) == 'object' ) ? oldColor . color : oldColor ) ;
} ,
_UpdateCellBorderSpacing _ : function ( BorderParam , borderName , cell ) {
if ( null !== BorderParam && undefined !== BorderParam ) {
if ( null !== BorderParam . get _Value ( ) && null !== BorderParam . get _Size ( ) && null !== BorderParam . get _Color ( ) ) {
if ( 1 == BorderParam . get _Value ( ) ) {
cell . setBordersSize ( borderName , this . _BorderPt2Px ( BorderParam . get _Size ( ) * 72 / 25.4 ) ) ;
cell . setBordersColor ( borderName , 'rgb(' + BorderParam . get _Color ( ) . get _r ( ) + ',' + BorderParam . get _Color ( ) . get _g ( ) + ',' + BorderParam . get _Color ( ) . get _b ( ) + ')' ) ;
} else
cell . setBordersSize ( borderName , 0 ) ;
} else {
cell . setBordersSize ( borderName , this . IndeterminateSize ) ;
cell . setBordersColor ( borderName , this . IndeterminateColor ) ;
}
}
else {
cell . setBordersSize ( borderName , this . IndeterminateSize ) ;
cell . setBordersColor ( borderName , this . IndeterminateColor ) ;
}
} ,
_UpdateTableBorderSpacing _ : function ( BorderParam , borderName ) {
if ( null !== BorderParam && undefined !== BorderParam ) {
if ( null !== BorderParam . get _Value ( ) && null !== BorderParam . get _Size ( ) && null !== BorderParam . get _Color ( ) ) {
if ( 1 == BorderParam . get _Value ( ) ) {
this . tableBordersImageSpacing . setBordersSize ( borderName , this . _BorderPt2Px ( BorderParam . get _Size ( ) * 72 / 25.4 ) ) ;
this . tableBordersImageSpacing . setBordersColor ( borderName , 'rgb(' + BorderParam . get _Color ( ) . get _r ( ) + ',' + BorderParam . get _Color ( ) . get _g ( ) + ',' + BorderParam . get _Color ( ) . get _b ( ) + ')' ) ;
} else
this . tableBordersImageSpacing . setBordersSize ( borderName , 0 ) ;
} else {
this . tableBordersImageSpacing . setBordersSize ( borderName , this . IndeterminateSize ) ;
this . tableBordersImageSpacing . setBordersColor ( borderName , this . IndeterminateColor ) ;
}
}
else {
this . tableBordersImageSpacing . setBordersSize ( borderName , this . IndeterminateSize ) ;
this . tableBordersImageSpacing . setBordersColor ( borderName , this . IndeterminateColor ) ;
}
} ,
_UpdateBordersNoSpacing _ : function ( ) {
var source = ( this . _allTable ) ? this . TableBorders : this . CellBorders ;
var oldSize = this . BorderSize ;
var oldColor = this . btnBorderColor . color ;
this . _UpdateTableBorderNoSpacing _ ( source . get _Left ( ) , 'l' ) ;
this . _UpdateTableBorderNoSpacing _ ( source . get _Top ( ) , 't' ) ;
this . _UpdateTableBorderNoSpacing _ ( source . get _Right ( ) , 'r' ) ;
this . _UpdateTableBorderNoSpacing _ ( source . get _Bottom ( ) , 'b' ) ;
if ( this . _allTable && source . get _InsideV ( ) == null ) {
2016-04-18 12:21:15 +00:00
source . put _InsideV ( new Asc . asc _CTextBorder ( ) ) ;
2016-03-11 00:48:53 +00:00
}
if ( source . get _InsideV ( ) !== null ) {
for ( var i = 0 ; i < this . tableBordersImage . rows ; i ++ ) {
this . _UpdateCellBorderNoSpacing _ ( source . get _InsideV ( ) , 'r' , this . tableBordersImage . getCell ( 0 , i ) ) ;
this . _UpdateCellBorderNoSpacing _ ( source . get _InsideV ( ) , 'l' , this . tableBordersImage . getCell ( 1 , i ) ) ;
}
}
if ( this . _allTable && source . get _InsideH ( ) == null ) {
2016-04-18 12:21:15 +00:00
source . put _InsideH ( new Asc . asc _CTextBorder ( ) ) ;
2016-03-11 00:48:53 +00:00
}
if ( source . get _InsideH ( ) !== null ) {
for ( i = 0 ; i < this . tableBordersImage . columns ; i ++ ) {
this . _UpdateCellBorderNoSpacing _ ( source . get _InsideH ( ) , 'b' , this . tableBordersImage . getCell ( i , 0 ) ) ;
this . _UpdateCellBorderNoSpacing _ ( source . get _InsideH ( ) , 't' , this . tableBordersImage . getCell ( i , 1 ) ) ;
}
}
this . tableBordersImage . setVirtualBorderSize ( oldSize . pxValue ) ;
this . tableBordersImage . setVirtualBorderColor ( ( typeof ( oldColor ) == 'object' ) ? oldColor . color : oldColor ) ;
} ,
_UpdateCellBorderNoSpacing _ : function ( BorderParam , borderName , cell ) {
if ( null !== BorderParam && undefined !== BorderParam ) {
if ( null !== BorderParam . get _Value ( ) && null !== BorderParam . get _Size ( ) && null !== BorderParam . get _Color ( ) ) {
if ( 1 == BorderParam . get _Value ( ) ) {
cell . setBordersSize ( borderName , this . _BorderPt2Px ( BorderParam . get _Size ( ) * 72 / 25.4 ) ) ;
cell . setBordersColor ( borderName , 'rgb(' + BorderParam . get _Color ( ) . get _r ( ) + ',' + BorderParam . get _Color ( ) . get _g ( ) + ',' + BorderParam . get _Color ( ) . get _b ( ) + ')' ) ;
} else
cell . setBordersSize ( borderName , 0 ) ;
} else {
cell . setBordersSize ( borderName , this . IndeterminateSize ) ;
cell . setBordersColor ( borderName , this . IndeterminateColor ) ;
}
}
else {
cell . setBordersSize ( borderName , this . IndeterminateSize ) ;
cell . setBordersColor ( borderName , this . IndeterminateColor ) ;
}
} ,
_UpdateTableBorderNoSpacing _ : function ( BorderParam , borderName ) {
if ( null !== BorderParam && undefined !== BorderParam ) {
if ( null !== BorderParam . get _Value ( ) && null !== BorderParam . get _Size ( ) && null !== BorderParam . get _Color ( ) ) {
if ( 1 == BorderParam . get _Value ( ) ) {
this . tableBordersImage . setBordersSize ( borderName , this . _BorderPt2Px ( BorderParam . get _Size ( ) * 72 / 25.4 ) ) ;
this . tableBordersImage . setBordersColor ( borderName , 'rgb(' + BorderParam . get _Color ( ) . get _r ( ) + ',' + BorderParam . get _Color ( ) . get _g ( ) + ',' + BorderParam . get _Color ( ) . get _b ( ) + ')' ) ;
} else
this . tableBordersImage . setBordersSize ( borderName , 0 ) ;
} else {
this . tableBordersImage . setBordersSize ( borderName , this . IndeterminateSize ) ;
this . tableBordersImage . setBordersColor ( borderName , this . IndeterminateColor ) ;
}
}
else {
this . tableBordersImage . setBordersSize ( borderName , this . IndeterminateSize ) ;
this . tableBordersImage . setBordersColor ( borderName , this . IndeterminateColor ) ;
}
} ,
_BorderPt2Px : function ( value ) {
if ( value == 0 ) return 0 ;
if ( value < 0.6 ) return 0.5 ;
if ( value <= 1 ) return 1 ;
if ( value <= 1.5 ) return 2 ;
if ( value <= 2.25 ) return 3 ;
if ( value <= 3 ) return 4 ;
if ( value <= 4.5 ) return 5 ;
return 6 ;
} ,
_ApplyBorderPreset : function ( btn ) {
var cellborder = ( btn . options . strId !== undefined ) ? btn . options . strId : btn . options . strCellId ;
var tableborder = btn . options . strTableId ;
var updateBorders ;
if ( this . _allTable && tableborder === undefined ) {
updateBorders = this . TableBorders ;
this . ChangedTableBorders = null ;
} else {
updateBorders = this . CellBorders ;
this . ChangedCellBorders = null ;
}
this . _UpdateBorderStyle ( updateBorders . get _Left ( ) , ( cellborder . indexOf ( 'l' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _Top ( ) , ( cellborder . indexOf ( 't' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _Right ( ) , ( cellborder . indexOf ( 'r' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _Bottom ( ) , ( cellborder . indexOf ( 'b' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _InsideV ( ) , ( cellborder . indexOf ( 'c' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _InsideH ( ) , ( cellborder . indexOf ( 'm' ) > - 1 ) ) ;
if ( tableborder === undefined ) {
this . _UpdateBordersNoSpacing _ ( ) ;
if ( this . _allTable ) {
updateBorders = this . CellBorders ;
this . ChangedCellBorders = null ;
this . _UpdateBorderStyle ( updateBorders . get _Left ( ) , ( cellborder . indexOf ( 'l' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _Top ( ) , ( cellborder . indexOf ( 't' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _Right ( ) , ( cellborder . indexOf ( 'r' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _Bottom ( ) , ( cellborder . indexOf ( 'b' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _InsideV ( ) , ( cellborder . indexOf ( 'c' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _InsideH ( ) , ( cellborder . indexOf ( 'm' ) > - 1 ) ) ;
}
return ;
}
updateBorders = this . TableBorders ;
this . ChangedTableBorders = null ;
this . _UpdateBorderStyle ( updateBorders . get _Left ( ) , ( tableborder . indexOf ( 'l' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _Top ( ) , ( tableborder . indexOf ( 't' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _Right ( ) , ( tableborder . indexOf ( 'r' ) > - 1 ) ) ;
this . _UpdateBorderStyle ( updateBorders . get _Bottom ( ) , ( tableborder . indexOf ( 'b' ) > - 1 ) ) ;
this . _UpdateBordersSpacing _ ( ) ;
} ,
_UpdateCellBordersStyle : function ( ct , border , size , color , destination , changed _destination ) {
var updateBorders = destination ;
if ( ct . col == 0 && border . indexOf ( 'l' ) > - 1 ) {
this . _UpdateBorderStyle ( updateBorders . get _Left ( ) , ( size > 0 ) ) ;
if ( changed _destination ) {
2016-04-18 12:21:15 +00:00
changed _destination . put _Left ( new Asc . asc _CTextBorder ( updateBorders . get _Left ( ) ) ) ;
2016-03-11 00:48:53 +00:00
}
}
if ( ct . col == this . tableStylerColumns - 1 && border . indexOf ( 'r' ) > - 1 ) {
this . _UpdateBorderStyle ( updateBorders . get _Right ( ) , ( size > 0 ) ) ;
if ( changed _destination ) {
2016-04-18 12:21:15 +00:00
changed _destination . put _Right ( new Asc . asc _CTextBorder ( updateBorders . get _Right ( ) ) ) ;
2016-03-11 00:48:53 +00:00
}
}
if ( ct . row == 0 && border . indexOf ( 't' ) > - 1 ) {
this . _UpdateBorderStyle ( updateBorders . get _Top ( ) , ( size > 0 ) ) ;
if ( changed _destination ) {
2016-04-18 12:21:15 +00:00
changed _destination . put _Top ( new Asc . asc _CTextBorder ( updateBorders . get _Top ( ) ) ) ;
2016-03-11 00:48:53 +00:00
}
}
if ( ct . row == this . tableStylerRows - 1 && border . indexOf ( 'b' ) > - 1 ) {
this . _UpdateBorderStyle ( updateBorders . get _Bottom ( ) , ( size > 0 ) ) ;
if ( changed _destination ) {
2016-04-18 12:21:15 +00:00
changed _destination . put _Bottom ( new Asc . asc _CTextBorder ( updateBorders . get _Bottom ( ) ) ) ;
2016-03-11 00:48:53 +00:00
}
}
if ( ct . col == 0 && border . indexOf ( 'r' ) > - 1 || ct . col == this . tableStylerColumns - 1 && border . indexOf ( 'l' ) > - 1 ) {
this . _UpdateBorderStyle ( updateBorders . get _InsideV ( ) , ( size > 0 ) ) ;
if ( changed _destination ) {
2016-04-18 12:21:15 +00:00
changed _destination . put _InsideV ( new Asc . asc _CTextBorder ( updateBorders . get _InsideV ( ) ) ) ;
2016-03-11 00:48:53 +00:00
}
}
if ( ct . row == 0 && border . indexOf ( 'b' ) > - 1 || ct . row == this . tableStylerRows - 1 && border . indexOf ( 't' ) > - 1 ) {
this . _UpdateBorderStyle ( updateBorders . get _InsideH ( ) , ( size > 0 ) ) ;
if ( changed _destination ) {
2016-04-18 12:21:15 +00:00
changed _destination . put _InsideH ( new Asc . asc _CTextBorder ( updateBorders . get _InsideH ( ) ) ) ;
2016-03-11 00:48:53 +00:00
}
}
} ,
_UpdateTableBordersStyle : function ( ct , border , size , color , destination , changed _destination ) {
var updateBorders = destination ;
if ( border . indexOf ( 'l' ) > - 1 ) {
this . _UpdateBorderStyle ( updateBorders . get _Left ( ) , ( size > 0 ) ) ;
if ( changed _destination ) {
2016-04-18 12:21:15 +00:00
changed _destination . put _Left ( new Asc . asc _CTextBorder ( updateBorders . get _Left ( ) ) ) ;
2016-03-11 00:48:53 +00:00
}
}
if ( border . indexOf ( 't' ) > - 1 ) {
this . _UpdateBorderStyle ( updateBorders . get _Top ( ) , ( size > 0 ) ) ;
if ( changed _destination ) {
2016-04-18 12:21:15 +00:00
changed _destination . put _Top ( new Asc . asc _CTextBorder ( updateBorders . get _Top ( ) ) ) ;
2016-03-11 00:48:53 +00:00
}
}
if ( border . indexOf ( 'r' ) > - 1 ) {
this . _UpdateBorderStyle ( updateBorders . get _Right ( ) , ( size > 0 ) ) ;
if ( changed _destination ) {
2016-04-18 12:21:15 +00:00
changed _destination . put _Right ( new Asc . asc _CTextBorder ( updateBorders . get _Right ( ) ) ) ;
2016-03-11 00:48:53 +00:00
}
}
if ( border . indexOf ( 'b' ) > - 1 ) {
this . _UpdateBorderStyle ( updateBorders . get _Bottom ( ) , ( size > 0 ) ) ;
if ( changed _destination ) {
2016-04-18 12:21:15 +00:00
changed _destination . put _Bottom ( new Asc . asc _CTextBorder ( updateBorders . get _Bottom ( ) ) ) ;
2016-03-11 00:48:53 +00:00
}
}
} ,
_UpdateBorderStyle : function ( border , visible ) {
if ( null == border )
return 0 ;
if ( visible && this . BorderSize . ptValue > 0 ) {
var size = parseFloat ( this . BorderSize . ptValue ) ;
border . put _Value ( 1 ) ;
border . put _Size ( size * 25.4 / 72.0 ) ;
2021-01-20 13:42:48 +00:00
var color ;
if ( this . btnBorderColor . isAutoColor ( ) ) {
color = new Asc . asc _CColor ( ) ;
color . put _auto ( true ) ;
} else {
color = Common . Utils . ThemeColor . getRgbColor ( this . btnBorderColor . color ) ;
}
2016-03-11 00:48:53 +00:00
border . put _Color ( color ) ;
}
else {
2016-04-18 12:21:15 +00:00
border . put _Color ( new Asc . asc _CColor ( ) ) ;
2016-03-11 00:48:53 +00:00
border . put _Value ( 0 ) ;
}
return border . get _Value ( ) ;
} ,
onCellCategoryClick : function ( btn ) {
if ( this . CellMargins . Flag == 'checked' && this . TableMargins . isChanged ) {
this . CellMargins . Left = this . TableMargins . Left ;
this . CellMargins . Top = this . TableMargins . Top ;
this . CellMargins . Right = this . TableMargins . Right ;
this . CellMargins . Bottom = this . TableMargins . Bottom ;
this . spnMarginRight . setValue ( this . CellMargins . Right , true ) ;
this . spnMarginLeft . setValue ( this . CellMargins . Left , true ) ;
this . spnMarginBottom . setValue ( this . CellMargins . Bottom , true ) ;
this . spnMarginTop . setValue ( this . CellMargins . Top , true ) ;
}
this . TableMargins . isChanged = false ;
} ,
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.1 ) ;
2016-03-11 00:48:53 +00:00
}
}
} ,
updateThemeColors : function ( ) {
this . colorsBorder . updateColors ( Common . Utils . ThemeColor . getEffectColors ( ) , Common . Utils . ThemeColor . getStandartColors ( ) ) ;
this . colorsBack . updateColors ( Common . Utils . ThemeColor . getEffectColors ( ) , Common . Utils . ThemeColor . getStandartColors ( ) ) ;
this . colorsTableBack . updateColors ( Common . Utils . ThemeColor . getEffectColors ( ) , Common . Utils . ThemeColor . getStandartColors ( ) ) ;
} ,
ShowHideWrap : function ( inline ) {
this . AlignContainer . toggleClass ( 'settings-hidden' , ! inline ) ;
this . DistanceContainer . toggleClass ( 'settings-hidden' , inline ) ;
this . btnsCategory [ 3 ] . setDisabled ( inline ) ;
} ,
ShowHideSpacing : function ( spacing ) {
this . BordersContainer . toggleClass ( 'settings-hidden' , spacing ) ;
this . BordersSpacingContainer . toggleClass ( 'settings-hidden' , ! spacing ) ;
this . TableBackContainer . css ( 'display' , ( ! spacing && ! this . _allTable ) ? 'none' : 'inline-block' ) ;
this . CellBackContainer . css ( 'display' , ( ! spacing && this . _allTable ) ? 'none' : 'inline-block' ) ;
this . TableBackContainer . css ( 'float' , ( ! spacing && this . _allTable ) ? 'none' : 'right' ) ;
( spacing ) ? this . _UpdateBordersSpacing _ ( ) : this . _UpdateBordersNoSpacing _ ( ) ;
} ,
textWidth : 'Width' ,
2016-05-02 12:16:16 +00:00
textAllowSpacing : 'Spacing between cells' ,
2016-03-11 00:48:53 +00:00
textAlign : 'Alignment' ,
textIndLeft : 'Indent from Left' ,
textWidthSpaces : 'Width & Spaces' ,
textWrap : 'Text Wrapping' ,
textMargins : 'Cell Margins' ,
textTop : 'Top' ,
textLeft : 'Left' ,
textBottom : 'Bottom' ,
textRight : 'Right' ,
textDistance : 'Distance From Text' ,
textPosition : 'Position' ,
textWrapParallelTooltip : 'Flow table' ,
textWrapNoneTooltip : 'Inline table' ,
textLeftTooltip : 'Left' ,
textRightTooltip : 'Right' ,
textCenterTooltip : 'Center' ,
textTitle : 'Table - Advanced Settings' ,
2016-05-02 12:16:16 +00:00
textDefaultMargins : 'Default Cell Margins' ,
2016-03-11 00:48:53 +00:00
textCheckMargins : 'Use default margins' ,
textBordersBackgroung : 'Borders & Background' ,
textOnlyCells : 'For selected cells only' ,
textBorderWidth : 'Border Size' ,
textBorderColor : 'Border Color' ,
textBackColor : 'Cell Background' ,
textPreview : 'Preview' ,
textBorderDesc : 'Click on diagramm or use buttons to select borders' ,
textTableBackColor : 'Table Background' ,
txtNoBorders : 'No borders' ,
textCenter : 'Center' ,
textMargin : 'Margin' ,
textPage : 'Page' ,
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' ,
textAnchorText : 'Text' ,
textAutofit : 'Automatically resize to fit contents' ,
2016-05-02 12:16:16 +00:00
textCellProps : 'Cell' ,
2016-03-11 00:48:53 +00:00
tipAll : 'Set Outer Border and All Inner Lines' ,
tipNone : 'Set No Borders' ,
tipInner : 'Set Inner Lines Only' ,
tipOuter : 'Set Outer Border Only' ,
tipCellAll : 'Set Borders for Inner Cells Only' ,
tipTableOuterCellAll : 'Set Outer Border and Borders for All Inner Cells' ,
tipCellInner : 'Set Vertical and Horizontal Lines for Inner Cells Only' ,
tipTableOuterCellInner : 'Set Outer Border and Vertical and Horizontal Lines for Inner Cells' ,
tipCellOuter : 'Set Outer Borders for Inner Cells Only' ,
2016-03-17 09:44:42 +00:00
tipTableOuterCellOuter : 'Set Table Outer Border and Outer Borders for Inner Cells' ,
txtPercent : 'Percent' ,
txtCm : 'Centimeter' ,
2016-04-04 14:05:54 +00:00
txtPt : 'Point' ,
2016-04-06 15:17:40 +00:00
txtInch : 'Inch' ,
2016-04-04 14:05:54 +00:00
textCellSize : 'Cell Size' ,
textPrefWidth : 'Preferred width' ,
textMeasure : 'Measure in' ,
textCellOptions : 'Cell Options' ,
2016-05-02 12:16:16 +00:00
textWrapText : 'Wrap text' ,
textTable : 'Table' ,
textTableSize : 'Table Size' ,
2016-05-05 09:15:52 +00:00
textTablePosition : 'Table Position' ,
2017-01-19 09:41:35 +00:00
textWrappingStyle : 'Wrapping Style' ,
textAlt : 'Alternative Text' ,
textAltTitle : 'Title' ,
textAltDescription : 'Description' ,
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.'
2016-03-11 00:48:53 +00:00
} , DE . Views . TableSettingsAdvanced || { } ) ) ;
} ) ;