/* * * (c) Copyright Ascensio System Limited 2010-2016 * * This program is a free software product. You can redistribute it and/or * modify it under the terms of the GNU Affero General Public License (AGPL) * version 3 as published by the Free Software Foundation. In accordance with * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect * that Ascensio System SIA expressly excludes the warranty of non-infringement * of any third-party rights. * * This program is distributed WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html * * You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, * EU, LV-1021. * * The interactive user interfaces in modified source and object code versions * of the Program must display Appropriate Legal Notices, as required under * Section 5 of the GNU AGPL version 3. * * Pursuant to Section 7(b) of the License you must retain the original Product * logo when distributing the program. Pursuant to Section 7(e) we decline to * grant you any rights under trademark law for use of our trademarks. * * All the Product's GUI elements, including illustrations and icon sets, as * well as technical writing content are licensed under the terms of the * Creative Commons Attribution-ShareAlike 4.0 International. See the License * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ /** * DropcapSettingsAdvanced.js * * Created by Alexander Yuzhin on 2/24/14 * Copyright (c) 2014 Ascensio System SIA. All rights reserved. * */ var c_oAscFrameWrap = { None : -1, Inline : false, Flow : true }; define([ 'text!documenteditor/main/app/template/DropcapSettingsAdvanced.template', 'core', 'common/main/lib/component/Button', 'common/main/lib/component/CheckBox', 'common/main/lib/component/ComboBoxFonts', 'common/main/lib/component/MetricSpinner', 'common/main/lib/component/TableStyler', 'common/main/lib/component/ThemeColorPalette', 'common/main/lib/view/AdvancedSettingsWindow' ], function (contentTemplate) { 'use strict'; DE.Views.DropcapSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({ options: { contentWidth: 320, height : 380, toggleGroup : 'dropcap-adv-settings-group', storageName: 'de-dropcap-settings-adv-category' }, initialize : function(options) { _.extend(this.options, { title: this.textTitle, contentTemplate: _.template(contentTemplate)({ scope: this }), items: [ {panelId: 'id-adv-dropcap-frame', panelCaption: this.textFrame}, {panelId: 'id-adv-dropcap-dropcap', panelCaption: this.strDropcap}, {panelId: 'id-adv-dropcap-borders', panelCaption: this.strBorders}, {panelId: 'id-adv-dropcap-margins', panelCaption: this.strMargins} ] }, options); this.tableStylerRows = this.options.tableStylerRows; this.tableStylerColumns = this.options.tableStylerColumns; this.fontStore = this.options.fontStore; this.borderProps = this.options.borderProps; this.isFrame = this.options.isFrame; this.api = this.options.api; this.Borders = {}; this.BorderSize = {ptValue: 0, pxValue: 0}; this.paragraphShade = 'transparent'; this._changedProps = null; this.ChangedBorders = undefined; // undefined - не менялись, null - применялись пресеты, отправлять Borders, object - менялись отдельные границы, отправлять ChangedBorders this._noApply = true; this.Margins = undefined; this._originalProps = new Asc.asc_CParagraphProperty(this.options.paragraphProps); Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); }, render: function() { var me = this; Common.Views.AdvancedSettingsWindow.prototype.render.call(this); this.tableStyler = new Common.UI.TableStyler({ el: $('#drop-advanced-borderstyler'), width: 200, height: 170, rows: this.tableStylerRows, columns: this.tableStylerColumns, spacingMode: false }); _.each([ [c_tableBorder.BORDER_HORIZONTAL_TOP, 't', 'btn-borders-large btn-adv-paragraph-top', '00'], [c_tableBorder.BORDER_HORIZONTAL_CENTER, 'm', 'btn-borders-large btn-adv-paragraph-inner-hor', '01'], [c_tableBorder.BORDER_HORIZONTAL_BOTTOM, 'b', 'btn-borders-large btn-adv-paragraph-bottom', '10'], [c_tableBorder.BORDER_OUTER, 'lrtb', 'btn-borders-large btn-adv-paragraph-outer', '11'], [c_tableBorder.BORDER_VERTICAL_LEFT, 'l', 'btn-borders-large btn-adv-paragraph-left', '20'], [c_tableBorder.BORDER_ALL, 'lrtbm', 'btn-borders-large btn-adv-paragraph-all', '21'], [c_tableBorder.BORDER_VERTICAL_RIGHT, 'r', 'btn-borders-large btn-adv-paragraph-right', '30'], [c_tableBorder.BORDER_NONE, '', 'btn-borders-large btn-adv-paragraph-none', '31'] ], function(item, index) { var _btn = new Common.UI.Button({ posId : item[0], strId : item[1], iconCls : item[2], style : 'margin-left: 5px; margin-bottom: 4px;', cls : 'btn-options large' }); _btn.render($('#drop-advanced-button-borderline-' + item[3])) .on('click', function(btn) { me._ApplyBorderPreset(btn.options.strId); }); }, this); var txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt); this.cmbBorderSize = new Common.UI.ComboBorderSize({ el : $('#drop-advanced-input-bordersize'), style : 'width: 90px;', store : new Backbone.Collection(), data: [ {id: Common.UI.getId(), displayValue: this.txtNoBorders, value: 0, borderstyle: ''}, {id: Common.UI.getId(), displayValue: '0.5 ' + txtPt, value: 0.5, pxValue: 0.5, offsety: 0}, {id: Common.UI.getId(), displayValue: '1 ' + txtPt, value: 1, pxValue: 1, offsety: 20}, {id: Common.UI.getId(), displayValue: '1.5 ' + txtPt, value: 1.5, pxValue: 2, offsety: 40}, {id: Common.UI.getId(), displayValue: '2.25 ' + txtPt, value: 2.25, pxValue: 3, offsety: 60}, {id: Common.UI.getId(), displayValue: '3 ' + txtPt, value: 3, pxValue: 4, offsety: 80}, {id: Common.UI.getId(), displayValue: '4.5 ' + txtPt, value: 4.5, pxValue: 5, offsety: 100}, {id: Common.UI.getId(), displayValue: '6 ' + txtPt, value: 6, pxValue: 6, offsety: 120} ] }).on('selected', _.bind(function(combo, record) { this.BorderSize = {ptValue: record.value, pxValue: record.pxValue}; this.tableStyler.setVirtualBorderSize(this.BorderSize.pxValue); }, this)); var rec = this.cmbBorderSize.store.at(2); this.cmbBorderSize.setValue(rec.get('value')); this.BorderSize = {ptValue: rec.get('value'), pxValue: rec.get('pxValue')}; this.btnBorderColor = new Common.UI.ColorButton({ style: "width:45px;", menu : new Common.UI.Menu({ items: [ { template: _.template('
') }, { template: _.template('' + me.textNewColor + '') } ] }) }); this.btnBorderColor.on('render:after', function(btn) { me.colorsBorder = new Common.UI.ThemeColorPalette({ el: $('#drop-advanced-border-color-menu'), dynamiccolors: 10, colors: [ me.textThemeColors, '-', {color: '3366FF', effectId: 1}, {color: '0000FF', effectId: 2}, {color: '000090', effectId: 3}, {color: '660066', effectId: 4}, {color: '800000', effectId: 5}, {color: 'FF0000', effectId: 1}, {color: 'FF6600', effectId: 1}, {color: 'FFFF00', effectId: 2}, {color: 'CCFFCC', effectId: 3}, {color: '008000', effectId: 4}, '-', {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2}, {color: '000000', effectId: 3}, {color: 'FFFFFF', effectId: 4}, {color: '000000', effectId: 5}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, '-', '--', '-', me.textStandartColors, '-', '3D55FE', '5301B3', '980ABD', 'B2275F', 'F83D26', 'F86A1D', 'F7AC16', 'F7CA12', 'FAFF44', 'D6EF39', '-', '--' ] }) .on('select', _.bind(function(picker, color) { me.btnBorderColor.setColor(color); me.tableStyler.setVirtualBorderColor((typeof(color) == 'object') ? color.color : color); }, me)); }); this.btnBorderColor.render( $('#drop-advanced-button-bordercolor')); this.btnBorderColor.setColor('000000'); this.btnBorderColor.menu.cmpEl.on('click', '#drop-advanced-border-color-new', _.bind(function() { me.colorsBorder.addNewColor((typeof(me.btnBorderColor.color) == 'object') ? me.btnBorderColor.color.color : me.btnBorderColor.color); }, me)); this.btnBackColor = new Common.UI.ColorButton({ style: "width:45px;", menu : new Common.UI.Menu({ items: [ { template: _.template('') }, { template: _.template('' + me.textNewColor + '') } ] }) }); this.btnBackColor.on('render:after', function(btn) { me.colorsBack = new Common.UI.ThemeColorPalette({ el: $('#drop-advanced-back-color-menu'), dynamiccolors: 10, colors: [ me.textThemeColors, '-', {color: '3366FF', effectId: 1}, {color: '0000FF', effectId: 2}, {color: '000090', effectId: 3}, {color: '660066', effectId: 4}, {color: '800000', effectId: 5}, {color: 'FF0000', effectId: 1}, {color: 'FF6600', effectId: 1}, {color: 'FFFF00', effectId: 2}, {color: 'CCFFCC', effectId: 3}, {color: '008000', effectId: 4}, '-', {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2}, {color: '000000', effectId: 3}, {color: 'FFFFFF', effectId: 4}, {color: '000000', effectId: 5}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, {color: 'FFFFFF', effectId: 2},{color: '000000', effectId: 1}, '-', '--', '-', me.textStandartColors, '-', 'transparent', '5301B3', '980ABD', 'B2275F', 'F83D26', 'F86A1D', 'F7AC16', 'F7CA12', 'FAFF44', 'D6EF39', '-', '--' ] }) .on('select', _.bind(function(picker, color) { var clr, border; me.btnBackColor.setColor(color); me.paragraphShade = color; if (me._changedProps) { if (me._changedProps.get_Shade()===undefined || me._changedProps.get_Shade()===null) { me._changedProps.put_Shade(new Asc.asc_CParagraphShd()); } if (color=='transparent') { me._changedProps.get_Shade().put_Value(Asc.c_oAscShdNil); } else { me._changedProps.get_Shade().put_Value(Asc.c_oAscShdClear); me._changedProps.get_Shade().put_Color(Common.Utils.ThemeColor.getRgbColor(color)); } } }, me)); }); this.btnBackColor.render( $('#drop-advanced-button-color')); this.btnBackColor.menu.cmpEl.on('click', '#drop-advanced-back-color-new', _.bind(function() { me.colorsBack.addNewColor(); }, me)); this.spnMarginTop = new Common.UI.MetricSpinner({ el : $('#drop-advanced-input-top'), step : 0.1, width : 100, value : '0 cm', defaultUnit : 'cm', maxValue : 55.87, minValue : 0 }) .on('change', _.bind(function(field, newValue, oldValue) { if (!this._noApply) { if (_.isUndefined(this.Margins)) this.Margins = {}; this.Margins.Top = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()); } }, me)); this.spnMarginLeft = new Common.UI.MetricSpinner({ el : $('#drop-advanced-input-left'), step : 0.1, width : 100, value : '0 cm', defaultUnit : 'cm', maxValue : 55.87, minValue : 0 }) .on('change', _.bind(function(field, newValue, oldValue) { if (!this._noApply) { if (_.isUndefined(this.Margins)) this.Margins = {}; this.Margins.Left = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()); } }, me)); this.spnMarginBottom = new Common.UI.MetricSpinner({ el : $('#drop-advanced-input-bottom'), step : 0.1, width : 100, value : '0 cm', defaultUnit : 'cm', maxValue : 55.87, minValue : 0 }) .on('change', _.bind(function(field, newValue, oldValue) { if (!this._noApply) { if (_.isUndefined(this.Margins)) this.Margins = {}; this.Margins.Bottom = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()); } }, me)); this.spnMarginRight = new Common.UI.MetricSpinner({ el : $('#drop-advanced-input-right'), step : 0.1, width : 100, value : '0 cm', defaultUnit : 'cm', maxValue : 55.87, minValue : 0 }) .on('change', _.bind(function(field, newValue, oldValue) { if (!this._noApply) { if (_.isUndefined(this.Margins)) this.Margins = {}; this.Margins.Right = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()); } }, me)); this.btnNone = new Common.UI.Button({ cls : 'btn x-huge btn-options', iconCls : 'icon-advanced-wrap btn-drop-none', enableToggle: true, toggleGroup : 'dropAdvGroup', allowDepress: false, hint: this.textNone }) .on('toggle', _.bind(function(btn, pressed) { if (me._changedProps && pressed) { me._DisableElem(Asc.c_oAscDropCap.None); me._changedProps.put_DropCap(Asc.c_oAscDropCap.None); } }, me)); this.btnInText = new Common.UI.Button({ cls : 'btn x-huge btn-options', iconCls : 'icon-advanced-wrap btn-drop-text', enableToggle: true, toggleGroup : 'dropAdvGroup', allowDepress: false, hint: this.textInText }) .on('toggle', _.bind(function(btn, pressed) { if (me._changedProps && pressed) { me._DisableElem(Asc.c_oAscDropCap.Drop); me._changedProps.put_DropCap(Asc.c_oAscDropCap.Drop); } }, me)); this.btnInMargin = new Common.UI.Button({ cls : 'btn x-huge btn-options', iconCls : 'icon-advanced-wrap btn-drop-margin', enableToggle: true, toggleGroup : 'dropAdvGroup', allowDepress: false, hint: this.textInMargin }) .on('toggle', _.bind(function(btn, pressed) { if (me._changedProps && pressed) { me._DisableElem(Asc.c_oAscDropCap.Margin); me._changedProps.put_DropCap(Asc.c_oAscDropCap.Margin); } }, me)); this.spnRowHeight = new Common.UI.MetricSpinner({ el : $('#drop-advanced-input-rowheight'), step : 1, width : 120, value : 3, defaultUnit : '', maxValue : 10, minValue : 1, allowDecimal: false }) .on('change', _.bind(function(field, newValue, oldValue) { if (me._changedProps) { me._changedProps.put_Lines(field.getNumberValue()); } }, me)); this.numDistance = new Common.UI.MetricSpinner({ el : $('#drop-advanced-input-distance'), step : 0.1, width : 120, value : '0 cm', defaultUnit : 'cm', maxValue : 55.87, minValue : 0 }) .on('change', _.bind(function(field, newValue, oldValue) { if (me._changedProps) { me._changedProps.put_HSpace(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); } }, me)); this.cmbFonts = new Common.UI.ComboBoxFonts({ el : $('#drop-advanced-input-fonts'), cls : 'input-group-nr', style : 'width: 290px;', menuCls : 'scrollable-menu', menuStyle : 'min-width: 55px;', store : new Common.Collections.Fonts(), recent : 0, hint: this.tipFontName }) .on('selected', _.bind(function(combo, record) { if (me._changedProps) { me._changedProps.put_FontFamily(record.name); } }, me)); this.btnFrameNone = new Common.UI.Button({ cls : 'btn huge btn-options', iconCls : 'icon-right-panel btn-frame-none', enableToggle: true, toggleGroup : 'frameAdvGroup', allowDepress: false, hint: this.textNone }) .on('toggle', _.bind(function(btn, pressed) { if (me._changedProps && pressed) { me._DisableElem(c_oAscFrameWrap.None); me._changedProps.put_Wrap(c_oAscFrameWrap.None); } }, me)); this.btnFrameInline = new Common.UI.Button({ cls : 'btn huge btn-options', iconCls : 'icon-right-panel btn-frame-inline', enableToggle: true, toggleGroup : 'frameAdvGroup', allowDepress: false, hint: this.textInline }) .on('toggle', _.bind(function(btn, pressed) { if (me._changedProps && pressed) { me._DisableElem(c_oAscFrameWrap.Inline); me._changedProps.put_Wrap(c_oAscFrameWrap.Inline); } }, me)); this.btnFrameFlow = new Common.UI.Button({ cls : 'btn huge btn-options', iconCls : 'icon-right-panel btn-frame-flow', enableToggle: true, toggleGroup : 'frameAdvGroup', allowDepress: false, hint: this.textFlow }) .on('toggle', _.bind(function(btn, pressed) { if (me._changedProps && pressed) { me._DisableElem(c_oAscFrameWrap.Flow); me._changedProps.put_Wrap(c_oAscFrameWrap.Flow); } }, me)); this._arrWidth = [ {displayValue: this.textAuto, value: 0}, {displayValue: this.textExact, value: 1} ]; this.cmbWidth = new Common.UI.ComboBox({ el : $('#frame-advanced-input-widthtype'), cls : 'input-group-nr', menuStyle : 'min-width: 130px;', editable : false, data : this._arrWidth }) .on('selected', _.bind(function(combo, record) { if (me._changedProps) { me.spnWidth.suspendEvents(); me.spnWidth.setValue((record.value==0) ? '' : 1); me.spnWidth.resumeEvents(); me._changedProps.put_W((record.value==0) ? undefined : Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())); } }, me)); this.cmbWidth.setValue(this._arrWidth[0].value); this.spnWidth = new Common.UI.MetricSpinner({ el : $('#frame-advanced-input-width'), maxValue : 55.88, minValue : 0.02, step : 0.1, defaultUnit : "cm", value : '' }) .on('change', _.bind(function(field, newValue, oldValue) { if (me._changedProps) { me.cmbWidth.suspendEvents(); me.cmbWidth.setValue(this._arrWidth[1].value); me.cmbWidth.resumeEvents(); me._changedProps.put_W(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); } }, me)); this._arrHeight = [ {displayValue: this.textAuto, value: 0}, {displayValue: this.textExact, value: 1}, {displayValue: this.textAtLeast, value: 2} ]; this.cmbHeight = new Common.UI.ComboBox({ el : $('#frame-advanced-input-heighttype'), cls : 'input-group-nr', menuStyle : 'min-width: 130px;', editable : false, data : this._arrHeight }) .on('selected', _.bind(function(combo, record) { if (me._changedProps) { me.spnHeight.suspendEvents(); me.spnHeight.setValue((record.value==0) ? '' : 1); me.spnHeight.resumeEvents(); me._changedProps.put_HRule((record.value==0) ? Asc.linerule_Auto : ((record.value==1) ? Asc.linerule_Exact : Asc.linerule_AtLeast)); if (record.value > 0) this._changedProps.put_H(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())); } }, me)); this.cmbHeight.setValue(this._arrHeight[0].value); this.spnHeight = new Common.UI.MetricSpinner({ el : $('#frame-advanced-input-height'), maxValue : 55.88, minValue : 0.02, step : 0.1, defaultUnit : "cm", value : '' }) .on('change', _.bind(function(field, newValue, oldValue) { if (me._changedProps) { var type = Asc.linerule_Auto; if (me.cmbHeight.getValue()==me._arrHeight[1].value) type = Asc.linerule_Exact; else if (me.cmbHeight.getValue()==me._arrHeight[2].value) type = Asc.linerule_AtLeast; if (type==Asc.linerule_Auto) { me.cmbHeight.suspendEvents(); me.cmbHeight.setValue(me._arrHeight[2].value); type = Asc.linerule_AtLeast; me.cmbHeight.resumeEvents(); } me._changedProps.put_HRule(type); me._changedProps.put_H(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); } }, me)); this.spnX = new Common.UI.MetricSpinner({ el : $('#frame-advanced-input-hdist'), maxValue : 55.87, minValue : 0, step : 0.1, defaultUnit : "cm", value : '0 cm', width : 'auto' }) .on('change', _.bind(function(field, newValue, oldValue) { if (me._changedProps) { me._changedProps.put_HSpace(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); } }, me)); this.spnY = new Common.UI.MetricSpinner({ el : $('#frame-advanced-input-vdist'), maxValue : 55.87, minValue : 0, step : 0.1, defaultUnit : "cm", value : '0 cm', width : 'auto' }) .on('change', _.bind(function(field, newValue, oldValue) { if (me._changedProps) { me._changedProps.put_VSpace(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); } }, me)); this._arrHAlign = [ {displayValue: this.textLeft, value: Asc.c_oAscXAlign.Left}, {displayValue: this.textCenter, value: Asc.c_oAscXAlign.Center}, {displayValue: this.textRight, value: Asc.c_oAscXAlign.Right} ]; this.cmbHAlign = new Common.UI.ComboBox({ el : $('#frame-advanced-input-hposition'), cls : 'input-group-nr', menuStyle : 'min-width: 130px;', data : this._arrHAlign }) .on('changed:after', _.bind(function(combo, record) { if (me._changedProps) { me._changedProps.put_XAlign(undefined); me._changedProps.put_X(Common.Utils.Metric.fnRecalcToMM(parseFloat(record.value))); } }, me)) .on('selected', _.bind(function(combo, record) { if (me._changedProps) { me._changedProps.put_XAlign(record.value); } }, me)); this.cmbHAlign.setValue(this._arrHAlign[0].value); this._arrHRelative = [ {displayValue: this.textMargin, value: Asc.c_oAscHAnchor.Margin}, {displayValue: this.textPage, value: Asc.c_oAscHAnchor.Page}, {displayValue: this.textColumn, value: Asc.c_oAscHAnchor.Text} ]; this.cmbHRelative = new Common.UI.ComboBox({ el : $('#frame-advanced-input-hrelative'), cls : 'input-group-nr', menuStyle : 'min-width: 95px;', data : this._arrHRelative, editable : false }) .on('selected', _.bind(function(combo, record) { if (me._changedProps) { me._changedProps.put_HAnchor(record.value); } }, me)); this.cmbHRelative.setValue(this._arrHRelative[1].value); this._arrVAlign = [ {displayValue: this.textTop, value: Asc.c_oAscYAlign.Top}, {displayValue: this.textCenter, value: Asc.c_oAscYAlign.Center}, {displayValue: this.textBottom, value: Asc.c_oAscYAlign.Bottom} ]; this.cmbVAlign = new Common.UI.ComboBox({ el : $('#frame-advanced-input-vposition'), cls : 'input-group-nr', menuStyle : 'min-width: 130px;', data : this._arrVAlign }) .on('changed:after', _.bind(function(combo, record) { if (me._changedProps) { me._changedProps.put_YAlign(undefined); me._changedProps.put_Y(Common.Utils.Metric.fnRecalcToMM(parseFloat(record.value))); } }, me)) .on('selected', _.bind(function(combo, record) { if (me._changedProps) { me._changedProps.put_YAlign(record.value); } }, me)); this.cmbVAlign.setValue(this._arrVAlign[0].value); this._arrVRelative = [ {displayValue: this.textMargin, value: Asc.c_oAscVAnchor.Margin}, {displayValue: this.textPage, value: Asc.c_oAscVAnchor.Page}, {displayValue: this.textParagraph, value: Asc.c_oAscVAnchor.Text} ]; this.cmbVRelative = new Common.UI.ComboBox({ el : $('#frame-advanced-input-vrelative'), cls : 'input-group-nr', menuStyle : 'min-width: 95px;', data : this._arrVRelative, editable : false }) .on('selected', _.bind(function(combo, record) { if (me._changedProps) { me._changedProps.put_VAnchor(record.value); this.chMove.setValue(record.value == Asc.c_oAscVAnchor.Text, true); } }, me)); this.cmbVRelative.setValue(this._arrVRelative[2].value); this.chMove = new Common.UI.CheckBox({ el: $('#frame-advanced-checkbox-move'), labelText: this.textMove }) .on('change', _.bind(function(checkbox, state) { if (me._changedProps) { var rec = this.cmbVRelative.store.at(state == 'checked' ? 2 : 1); me.cmbVRelative.setValue(rec.get('value')); me._changedProps.put_VAnchor(rec.get('value')); } }, me)); this.btnNone.render($('#drop-advanced-button-none')); this.btnInText.render($('#drop-advanced-button-intext')); this.btnInMargin.render($('#drop-advanced-button-inmargin')); this.btnFrameNone.render($('#frame-advanced-button-none')); this.btnFrameInline.render($('#frame-advanced-button-inline')); this.btnFrameFlow.render($('#frame-advanced-button-flow')); this.on('show', _.bind(this.onShowDialog, this)); this.afterRender(); }, afterRender: function() { this.updateMetricUnit(); this.updateThemeColors(); if (!this.isFrame) { this.cmbFonts.fillFonts(this.fontStore); } this._setDefaults(this._originalProps); if (this.borderProps !== undefined) { this.btnBorderColor.setColor(this.borderProps.borderColor); this.tableStyler.setVirtualBorderColor((typeof(this.borderProps.borderColor) == 'object') ? this.borderProps.borderColor.color : this.borderProps.borderColor); this.cmbBorderSize.setValue(this.borderProps.borderSize.ptValue); this.BorderSize = {ptValue: this.borderProps.borderSize.ptValue, pxValue: this.borderProps.borderSize.pxValue}; this.tableStyler.setVirtualBorderSize(this.BorderSize.pxValue); this.colorsBorder.select(this.borderProps.borderColor); } this.setTitle((this.isFrame) ? this.textTitleFrame : this.textTitle); for (var i=0; i