diff --git a/apps/common/main/lib/component/ComboBorderSize.js b/apps/common/main/lib/component/ComboBorderSize.js index 455abc63f6..86a7f6f2a9 100644 --- a/apps/common/main/lib/component/ComboBorderSize.js +++ b/apps/common/main/lib/component/ComboBorderSize.js @@ -94,18 +94,20 @@ define([ ].join('')), initialize : function(options) { + var txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt); + Common.UI.ComboBox.prototype.initialize.call(this, _.extend({ editable: false, store: new Common.UI.BordersStore(), data: [ {displayValue: this.txtNoBorders, value: 0, pxValue: 0 }, - {displayValue: '0.5 pt', value: 0.5, pxValue: 0.5, offsety: 0}, - {displayValue: '1 pt', value: 1, pxValue: 1, offsety: 20}, - {displayValue: '1.5 pt', value: 1.5, pxValue: 2, offsety: 40}, - {displayValue: '2.25 pt', value: 2.25,pxValue: 3, offsety: 60}, - {displayValue: '3 pt', value: 3, pxValue: 4, offsety: 80}, - {displayValue: '4.5 pt', value: 4.5, pxValue: 5, offsety: 100}, - {displayValue: '6 pt', value: 6, pxValue: 6, offsety: 120} + {displayValue: '0.5 ' + txtPt, value: 0.5, pxValue: 0.5, offsety: 0}, + {displayValue: '1 ' + txtPt, value: 1, pxValue: 1, offsety: 20}, + {displayValue: '1.5 ' + txtPt, value: 1.5, pxValue: 2, offsety: 40}, + {displayValue: '2.25 ' + txtPt, value: 2.25,pxValue: 3, offsety: 60}, + {displayValue: '3 ' + txtPt, value: 3, pxValue: 4, offsety: 80}, + {displayValue: '4.5 ' + txtPt, value: 4.5, pxValue: 5, offsety: 100}, + {displayValue: '6 ' + txtPt, value: 6, pxValue: 6, offsety: 120} ], menuStyle: 'min-width: 150px;' }, options)); @@ -187,19 +189,20 @@ define([ initialize : function(options) { this.txtNoBorders = options.txtNoBorders || this.txtNoBorders; + var txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt); Common.UI.ComboBox.prototype.initialize.call(this, _.extend({ editable: true, store: new Common.UI.BordersStore(), data: [ {displayValue: this.txtNoBorders, value: 0, pxValue: 0 }, - {displayValue: '0.5 pt', value: 0.5, pxValue: 0.5, offsety: 0}, - {displayValue: '1 pt', value: 1, pxValue: 1, offsety: 20}, - {displayValue: '1.5 pt', value: 1.5, pxValue: 2, offsety: 40}, - {displayValue: '2.25 pt', value: 2.25,pxValue: 3, offsety: 60}, - {displayValue: '3 pt', value: 3, pxValue: 4, offsety: 80}, - {displayValue: '4.5 pt', value: 4.5, pxValue: 5, offsety: 100}, - {displayValue: '6 pt', value: 6, pxValue: 6, offsety: 120} + {displayValue: '0.5 ' + txtPt, value: 0.5, pxValue: 0.5, offsety: 0}, + {displayValue: '1 ' + txtPt, value: 1, pxValue: 1, offsety: 20}, + {displayValue: '1.5 ' + txtPt, value: 1.5, pxValue: 2, offsety: 40}, + {displayValue: '2.25 ' + txtPt, value: 2.25,pxValue: 3, offsety: 60}, + {displayValue: '3 ' + txtPt, value: 3, pxValue: 4, offsety: 80}, + {displayValue: '4.5 ' + txtPt, value: 4.5, pxValue: 5, offsety: 100}, + {displayValue: '6 ' + txtPt, value: 6, pxValue: 6, offsety: 120} ], menuStyle: 'min-width: 150px;' }, options)); diff --git a/apps/common/main/lib/component/MetricSpinner.js b/apps/common/main/lib/component/MetricSpinner.js index 1a2d0856e4..8611da192b 100644 --- a/apps/common/main/lib/component/MetricSpinner.js +++ b/apps/common/main/lib/component/MetricSpinner.js @@ -58,7 +58,7 @@ * * * @property {String} defaultUnit - * Name of the unit of measurement. Can be px|em|%|en|ex|pt|"|cm|mm|pc|s|ms. + * Name of the unit of measurement. Can be px|em|%|en|ex|pt|"|cm|mm|pc|s|ms|см|мм|пт|сек|мс. * * defaultUnit: 'px', * @@ -262,7 +262,7 @@ define([ var units = this.options.defaultUnit; if ( typeof value.match !== 'undefined'){ - var searchUnits = value.match(/(px|em|%|en|ex|pt|"|cm|mm|pc|s|ms)$/i); + var searchUnits = value.match(/(px|em|%|en|ex|pt|"|cm|mm|pc|s|ms|см|мм|пт|сек|мс)$/i); if (null !== searchUnits && searchUnits[0]!=='undefined') { units = searchUnits[0].toLowerCase(); } @@ -482,25 +482,25 @@ define([ }, _recalcUnits: function(value, fromUnit){ - if ( fromUnit.match(/(s|ms)$/i) && this.options.defaultUnit.match(/(s|ms)$/i) ) { + if ( fromUnit.match(/(s|ms|сек|мс)$/i) && this.options.defaultUnit.match(/(s|ms|сек|мс)$/i) ) { var v_out = value; // to sec - if (fromUnit=='ms') + if (fromUnit=='ms' || fromUnit=='мс') v_out = v_out/1000.; // from sec - if (this.options.defaultUnit=='ms') + if (this.options.defaultUnit=='ms' || this.options.defaultUnit=='мс') v_out = v_out*1000; return v_out; } - if ( fromUnit.match(/(pt|"|cm|mm|pc)$/i)===null || this.options.defaultUnit.match(/(pt|"|cm|mm|pc)$/i)===null) + if ( fromUnit.match(/(pt|"|cm|mm|pc|см|мм|пт)$/i)===null || this.options.defaultUnit.match(/(pt|"|cm|mm|pc|см|мм|пт)$/i)===null) return value; var v_out = value; // to mm - if (fromUnit=='cm') + if (fromUnit=='cm' || fromUnit=='см') v_out = v_out*10; - else if (fromUnit=='pt') + else if (fromUnit=='pt' || fromUnit=='пт') v_out = v_out * 25.4 / 72.0; else if (fromUnit=='\"') v_out = v_out * 25.4; @@ -508,9 +508,9 @@ define([ v_out = v_out * 25.4 / 6.0; // from mm - if (this.options.defaultUnit=='cm') + if (this.options.defaultUnit=='cm' || this.options.defaultUnit=='см') v_out = v_out/10.; - else if (this.options.defaultUnit=='pt') + else if (this.options.defaultUnit=='pt' || this.options.defaultUnit=='пт') v_out = parseFloat((v_out * 72.0 / 25.4).toFixed(3)); else if (this.options.defaultUnit=='\"') v_out = parseFloat((v_out / 25.4).toFixed(3)); diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index b442e01d97..2efcf0de62 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -285,9 +285,9 @@ define([ if (value.Get_FontSize() !== undefined) proptext += (value.Get_FontSize() + ', '); if (value.Get_Spacing() !== undefined) - proptext += (me.textSpacing + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Spacing()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', '); + proptext += (me.textSpacing + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Spacing()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', '); if (value.Get_Position() !== undefined) - proptext += (me.textPosition + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Position()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', '); + proptext += (me.textPosition + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_Position()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', '); if (value.Get_Lang() !== undefined) proptext += (Common.util.LanguageInfo.getLocalLanguageName(value.Get_Lang())[1] + ', '); @@ -303,11 +303,11 @@ define([ if (value.Get_ContextualSpacing()) proptext += ((value.Get_ContextualSpacing() ? me.textContextual : me.textNoContextual) + ', '); if (value.Get_IndLeft() !== undefined) - proptext += (me.textIndentLeft + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndLeft()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', '); + proptext += (me.textIndentLeft + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndLeft()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', '); if (value.Get_IndRight() !== undefined) - proptext += (me.textIndentRight + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndRight()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', '); + proptext += (me.textIndentRight + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndRight()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', '); if (value.Get_IndFirstLine() !== undefined) - proptext += (me.textFirstLine + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndFirstLine()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', '); + proptext += (me.textFirstLine + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_IndFirstLine()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', '); if (value.Get_Jc() !== undefined) { switch (value.Get_Jc()) { case 0: @@ -334,16 +334,16 @@ define([ if (value.Get_SpacingLineRule() !== undefined && value.Get_SpacingLine() !== undefined) { proptext += me.textLineSpacing; proptext += (((value.Get_SpacingLineRule() == c_paragraphLinerule.LINERULE_LEAST) ? me.textAtLeast : ((value.Get_SpacingLineRule() == c_paragraphLinerule.LINERULE_AUTO) ? me.textMultiple : me.textExact)) + ' '); - proptext += (((value.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO) ? value.Get_SpacingLine() : Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingLine()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]) + ', '); + proptext += (((value.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO) ? value.Get_SpacingLine() : Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingLine()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName()) + ', '); } if (value.Get_SpacingBeforeAutoSpacing()) proptext += (me.textSpacingBefore + ' ' + me.textAuto +', '); else if (value.Get_SpacingBefore() !== undefined) - proptext += (me.textSpacingBefore + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingBefore()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', '); + proptext += (me.textSpacingBefore + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingBefore()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', '); if (value.Get_SpacingAfterAutoSpacing()) proptext += (me.textSpacingAfter + ' ' + me.textAuto +', '); else if (value.Get_SpacingAfter() !== undefined) - proptext += (me.textSpacingAfter + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingAfter()).toFixed(2) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] + ', '); + proptext += (me.textSpacingAfter + ' ' + Common.Utils.Metric.fnRecalcFromMM(value.Get_SpacingAfter()).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName() + ', '); if (value.Get_WidowControl()) proptext += ((value.Get_WidowControl() ? me.textWidow : me.textNoWidow) + ', '); if (value.Get_Tabs() !== undefined) diff --git a/apps/common/main/lib/util/utils.js b/apps/common/main/lib/util/utils.js index 1bfee8ae59..c7f6f0a6b2 100644 --- a/apps/common/main/lib/util/utils.js +++ b/apps/common/main/lib/util/utils.js @@ -38,7 +38,7 @@ if (Common.Utils === undefined) { Common.Utils = {}; } -Common.Utils = new(function() { +Common.Utils = _.extend(new(function() { var userAgent = navigator.userAgent.toLowerCase(), check = function(regex){ return regex.test(userAgent); @@ -164,7 +164,7 @@ Common.Utils = new(function() { hostnameStrongRe: hostnameStrongRe, documentSettingsType: documentSettingsType } -})(); +})(), Common.Utils || {}); Common.Utils.ThemeColor = new(function() { return { @@ -249,7 +249,7 @@ Common.Utils.ThemeColor = new(function() { } })(); -Common.Utils.Metric = new(function() { +Common.Utils.Metric = _.extend( new(function() { var me = this; me.c_MetricUnits = { @@ -257,13 +257,16 @@ Common.Utils.Metric = new(function() { pt: 1, inch: 2 }; + me.currentMetric = me.c_MetricUnits.pt; - me.metricName = ['cm', 'pt', '\"']; + me.metricName = ['Cm', 'Pt', 'Inch']; me.defaultMetric = me.c_MetricUnits.cm; return { c_MetricUnits: me.c_MetricUnits, - metricName : me.metricName, + txtCm : 'cm', + txtPt : 'pt', + txtInch : '\"', setCurrentMetric: function(value) { me.currentMetric = value; @@ -273,6 +276,14 @@ Common.Utils.Metric = new(function() { return me.currentMetric; }, + getCurrentMetricName: function() { + return this['txt' + me.metricName[me.currentMetric]]; + }, + + getMetricName: function(unit) { + return this['txt' + me.metricName[(unit !== undefined) ? unit : 0]]; + }, + setDefaultMetric: function(value) { me.defaultMetric = value; }, @@ -309,7 +320,7 @@ Common.Utils.Metric = new(function() { return value; } } -})(); +})(), Common.Utils.Metric || {}); Common.Utils.RGBColor = function(colorString) { var r, g, b; diff --git a/apps/common/main/lib/view/AdvancedSettingsWindow.js b/apps/common/main/lib/view/AdvancedSettingsWindow.js index 7863b9bc8f..2ad8a0524b 100644 --- a/apps/common/main/lib/view/AdvancedSettingsWindow.js +++ b/apps/common/main/lib/view/AdvancedSettingsWindow.js @@ -76,6 +76,7 @@ define([ this.handler = _options.handler; this.toggleGroup = _options.toggleGroup; this.contentWidth = _options.contentWidth; + this.storageName = _options.storageName; Common.UI.Window.prototype.initialize.call(this, _options); }, @@ -143,6 +144,37 @@ define([ return false; }, + setActiveCategory: function(index) { + if (this.btnsCategory.length<1) return; + + var btnActive = this.btnsCategory[(index>=0 && index +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+ + + + +
+
+
+
+
diff --git a/apps/documenteditor/main/app/view/ChartSettings.js b/apps/documenteditor/main/app/view/ChartSettings.js index a396fdf0b6..c202e3d34e 100644 --- a/apps/documenteditor/main/app/view/ChartSettings.js +++ b/apps/documenteditor/main/app/view/ChartSettings.js @@ -311,13 +311,13 @@ define([ value = props.get_Width(); if ( Math.abs(this._state.Width-value)>0.001 ) { - this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Width = value; } value = props.get_Height(); if ( Math.abs(this._state.Height-value)>0.001 ) { - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Height = value; } } @@ -325,10 +325,10 @@ define([ updateMetricUnit: function() { var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width); - this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; + this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; + this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); }, createDelayedElements: function() { diff --git a/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js b/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js index a6eea5c858..00dd5ddb5d 100644 --- a/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/DropcapSettingsAdvanced.js @@ -61,7 +61,8 @@ define([ options: { contentWidth: 320, height : 380, - toggleGroup : 'dropcap-adv-settings-group' + toggleGroup : 'dropcap-adv-settings-group', + storageName: 'de-dropcap-settings-adv-category' }, initialize : function(options) { @@ -135,20 +136,20 @@ define([ }); }, 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 pt', value: 0.5, pxValue: 0.5, offsety: 0}, - {id: Common.UI.getId(), displayValue: '1 pt', value: 1, pxValue: 1, offsety: 20}, - {id: Common.UI.getId(), displayValue: '1.5 pt', value: 1.5, pxValue: 2, offsety: 40}, - {id: Common.UI.getId(), displayValue: '2.25 pt', value: 2.25, pxValue: 3, offsety: 60}, - {id: Common.UI.getId(), displayValue: '3 pt', value: 3, pxValue: 4, offsety: 80}, - {id: Common.UI.getId(), displayValue: '4.5 pt', value: 4.5, pxValue: 5, offsety: 100}, - {id: Common.UI.getId(), displayValue: '6 pt', value: 6, pxValue: 6, offsety: 120} + {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}; @@ -742,26 +743,13 @@ define([ this._UpdateTableBordersStyle(ct, border, size, color, this.Borders); }, this); - var btnCategoryFrame, btnCategoryDropcap; - - _.each(this.btnsCategory, function(btn) { - if (btn.options.contentTarget == 'id-adv-dropcap-frame') - btnCategoryFrame = btn; - else if(btn.options.contentTarget == 'id-adv-dropcap-dropcap') - btnCategoryDropcap = btn; - }); - - this.content_panels.filter('.active').removeClass('active'); - - if (!this.isFrame) { - btnCategoryFrame.hide(); - btnCategoryDropcap.toggle(true, true); - $("#" + btnCategoryDropcap.options.contentTarget).addClass('active'); - } else { - btnCategoryDropcap.hide(); - btnCategoryFrame.toggle(true, true); - $("#" + btnCategoryFrame.options.contentTarget).addClass('active'); + if (this.isFrame) this.setHeight(500); + + this.btnsCategory[(this.isFrame) ? 1 : 0].setVisible(false); + if (this.storageName) { + var value = Common.localStorage.getItem(this.storageName); + this.setActiveCategory((value!==null) ? parseInt(value) : 0); } }, @@ -851,7 +839,7 @@ define([ me.spnX, me.spnY ], function(spinner) { - spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]); + spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()); spinner.setStep(Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1); }); }, @@ -902,7 +890,7 @@ define([ } } else { value = frame_props.get_X(); - this.cmbHAlign.setValue(Common.Utils.Metric.fnRecalcFromMM((value!==undefined) ? value : 0) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]); + this.cmbHAlign.setValue(Common.Utils.Metric.fnRecalcFromMM((value!==undefined) ? value : 0) + ' ' + Common.Utils.Metric.getCurrentMetricName()); } value = frame_props.get_VAnchor(); @@ -924,7 +912,7 @@ define([ } } else { value = frame_props.get_Y(); - this.cmbVAlign.setValue(Common.Utils.Metric.fnRecalcFromMM((value!==undefined) ? value : 0) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]); + this.cmbVAlign.setValue(Common.Utils.Metric.fnRecalcFromMM((value!==undefined) ? value : 0) + ' ' + Common.Utils.Metric.getCurrentMetricName()); } value = frame_props.get_Wrap(); diff --git a/apps/documenteditor/main/app/view/HeaderFooterSettings.js b/apps/documenteditor/main/app/view/HeaderFooterSettings.js index 58d042c25c..9162235171 100644 --- a/apps/documenteditor/main/app/view/HeaderFooterSettings.js +++ b/apps/documenteditor/main/app/view/HeaderFooterSettings.js @@ -234,7 +234,7 @@ define([ if (this.spinners) { for (var i=0; i0.001 ) { - this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Width = value; } value = props.get_Height(); if ( Math.abs(this._state.Height-value)>0.001 ) { - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Height = value; } @@ -278,8 +278,8 @@ define([ var w = imgsize.get_ImageWidth(); var h = imgsize.get_ImageHeight(); - this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); var properties = new Asc.asc_CImgProperty(); properties.put_Width(w); diff --git a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js index dfb06c8b7d..ec0a330dbe 100644 --- a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js @@ -54,7 +54,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat toggleGroup: 'image-adv-settings-group', sizeOriginal: {width: 0, height: 0}, sizeMax: {width: 55.88, height: 55.88}, - properties: null + properties: null, + storageName: 'de-img-settings-adv-category' }, initialize : function(options) { @@ -62,6 +63,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat title: this.textTitle, items: [ {panelId: 'id-adv-image-width', panelCaption: this.textSize}, + {panelId: 'id-adv-shape-size', panelCaption: this.textSize}, {panelId: 'id-adv-image-wrap', panelCaption: this.textBtnWrap}, {panelId: 'id-adv-image-position', panelCaption: this.textPosition}, {panelId: 'id-adv-image-shape', panelCaption: this.textShape}, @@ -80,10 +82,12 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat HAlignFrom: Asc.c_oAscRelativeFromH.Character, HPositionFrom: Asc.c_oAscRelativeFromH.Character, HPositionPcFrom: Asc.c_oAscRelativeFromH.Page, + ShapeWidthPcFrom: Asc.c_oAscRelativeFromH.Margin, VAlignType: Asc.c_oAscAlignV.Top, - VAlignFrom: Asc.c_oAscRelativeFromV.Line, - VPositionFrom: Asc.c_oAscRelativeFromV.Line, + VAlignFrom: Asc.c_oAscRelativeFromV.Paragraph, + VPositionFrom: Asc.c_oAscRelativeFromV.Paragraph, VPositionPcFrom: Asc.c_oAscRelativeFromV.Page, + ShapeHeightPcFrom: Asc.c_oAscRelativeFromV.Margin, spnXChanged: false, spnYChanged: false, spnXPcChanged: false, @@ -105,6 +109,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat var me = this; + // Image & Chart Size this.spnWidth = new Common.UI.MetricSpinner({ el: $('#image-advanced-spin-width'), step: .1, @@ -186,6 +191,177 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat } }, this)); + // Shape Size + this.radioHSize = new Common.UI.RadioBox({ + el: $('#shape-radio-hsize'), + name: 'asc-radio-width', + checked: true + }); + this.radioHSize.on('change', _.bind(this.onRadioHSizeChange, this)); + + this.radioHSizePc = new Common.UI.RadioBox({ + el: $('#shape-radio-hsizepc'), + name: 'asc-radio-width' + }); + this.radioHSizePc.on('change', _.bind(this.onRadioHSizePcChange, this)); + + this.radioVSize = new Common.UI.RadioBox({ + el: $('#shape-radio-vsize'), + name: 'asc-radio-height', + checked: true + }); + this.radioVSize.on('change', _.bind(this.onRadioVSizeChange, this)); + + this.radioVSizePc = new Common.UI.RadioBox({ + el: $('#shape-radio-vsizepc'), + name: 'asc-radio-height' + }); + this.radioVSizePc.on('change', _.bind(this.onRadioVSizePcChange, this)); + + this.chRatio = new Common.UI.CheckBox({ + el: $('#shape-checkbox-ratio'), + labelText: this.textAspectRatio + }); + this.chRatio.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if ((field.getValue()=='checked') && this.spnShapeHeight.getNumberValue()>0) { + this._nRatio = this.spnShapeWidth.getNumberValue()/this.spnShapeHeight.getNumberValue(); + } + }, this)); + + this.spnShapeWidth = new Common.UI.MetricSpinner({ + el: $('#shape-advanced-spin-width'), + step: .1, + width: 80, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spnShapeWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this.chRatio.getValue()=='checked' && !this.chRatio.isDisabled()) { + var w = field.getNumberValue(); + var h = w/this._nRatio; + if (h>this.sizeMax.height) { + h = this.sizeMax.height; + w = h * this._nRatio; + this.spnShapeWidth.setValue(w, true); + } + this.spnShapeHeight.setValue(h, true); + } + if (this._changedProps) { + this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this.fillShapeHeight(); + } + }, this)); + this.spinners.push(this.spnShapeWidth); + + this.spnShapeHeight = new Common.UI.MetricSpinner({ + el: $('#shape-advanced-spin-height'), + step: .1, + width: 80, + defaultUnit : "cm", + value: '3 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spnShapeHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var h = field.getNumberValue(), w = null; + if (this.chRatio.getValue()=='checked' && !this.chRatio.isDisabled()) { + w = h * this._nRatio; + if (w>this.sizeMax.width) { + w = this.sizeMax.width; + h = w/this._nRatio; + this.spnShapeHeight.setValue(h, true); + } + this.spnShapeWidth.setValue(w, true); + } + if (this._changedProps) { + this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this.fillShapeWidth(); + } + }, this)); + this.spinners.push(this.spnShapeHeight); + + this.spnShapeWidthPc = new Common.UI.MetricSpinner({ + el: $('#shape-advanced-spin-width-rel'), + disabled: true, + step: 1, + width: 80, + defaultUnit : "%", + value: '1 %', + maxValue: 1000, + minValue: 1 + }); + this.spnShapeWidthPc.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + if (this._changedProps.get_SizeRelH()===null || this._changedProps.get_SizeRelH()===undefined) + this._changedProps.put_SizeRelH(new Asc.CImagePositionH()); + + this._changedProps.get_SizeRelH().put_Value(field.getNumberValue()); + this._changedProps.get_SizeRelH().put_RelativeFrom(this._state.ShapeWidthPcFrom); + + this.fillShapeHeight(); + } + }, this)); + + this.spnShapeHeightPc = new Common.UI.MetricSpinner({ + el: $('#shape-advanced-spin-height-rel'), + disabled: true, + step: 1, + width: 80, + defaultUnit : "%", + value: '1 %', + maxValue: 1000, + minValue: 1 + }); + this.spnShapeHeightPc.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + if (this._changedProps) { + if (this._changedProps.get_SizeRelV()===null || this._changedProps.get_SizeRelV()===undefined) + this._changedProps.put_SizeRelV(new Asc.CImagePositionV()); + + this._changedProps.get_SizeRelV().put_Value(field.getNumberValue()); + this._changedProps.get_SizeRelV().put_RelativeFrom(this._state.ShapeHeightPcFrom); + + this.fillShapeWidth(); + } + }, this)); + + this._arrHRelativePc = [ + {displayValue: this.textLeftMargin, value: Asc.c_oAscRelativeFromH.LeftMargin}, + {displayValue: this.textMargin, value: Asc.c_oAscRelativeFromH.Margin}, + {displayValue: this.textPage, value: Asc.c_oAscRelativeFromH.Page}, + {displayValue: this.textRightMargin, value: Asc.c_oAscRelativeFromH.RightMargin} + ]; + + this.cmbWidthPc = new Common.UI.ComboBox({ + el: $('#shape-combo-width-rel'), + cls: 'input-group-nr', + menuStyle: 'min-width: 115px;', + editable: false, + data: this._arrHRelativePc + }); + this.cmbWidthPc.setDisabled(true); + this.cmbWidthPc.setValue(this._state.ShapeWidthPcFrom); + this.cmbWidthPc.on('selected', _.bind(this.onCmbWidthPcSelect, this)); + + this._arrVRelativePc = [ + {displayValue: this.textMargin, value: Asc.c_oAscRelativeFromV.Margin}, + {displayValue: this.textBottomMargin, value: Asc.c_oAscRelativeFromV.BottomMargin}, + {displayValue: this.textPage, value: Asc.c_oAscRelativeFromV.Page}, + {displayValue: this.textTopMargin, value: Asc.c_oAscRelativeFromV.TopMargin} + ]; + + this.cmbHeightPc = new Common.UI.ComboBox({ + el: $('#shape-combo-height-rel'), + cls: 'input-group-nr', + menuStyle: 'min-width: 115px;', + editable: false, + data: this._arrVRelativePc + }); + this.cmbHeightPc.setDisabled(true); + this.cmbHeightPc.setValue(this._state.ShapeHeightPcFrom); + this.cmbHeightPc.on('selected', _.bind(this.onCmbHeightPcSelect, this)); + // Wrapping this.btnWrapInline = new Common.UI.Button({ @@ -471,13 +647,6 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat } }, this)); - this._arrHRelativePc = [ - {displayValue: this.textLeftMargin, value: Asc.c_oAscRelativeFromH.LeftMargin}, - {displayValue: this.textMargin, value: Asc.c_oAscRelativeFromH.Margin}, - {displayValue: this.textPage, value: Asc.c_oAscRelativeFromH.Page}, - {displayValue: this.textRightMargin, value: Asc.c_oAscRelativeFromH.RightMargin} - ]; - this.cmbHPositionPc = new Common.UI.ComboBox({ el: $('#image-combo-hpositionpc'), cls: 'input-group-nr', @@ -560,13 +729,6 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat } }, this)); - this._arrVRelativePc = [ - {displayValue: this.textMargin, value: Asc.c_oAscRelativeFromV.Margin}, - {displayValue: this.textBottomMargin, value: Asc.c_oAscRelativeFromV.BottomMargin}, - {displayValue: this.textPage, value: Asc.c_oAscRelativeFromV.Page}, - {displayValue: this.textTopMargin, value: Asc.c_oAscRelativeFromV.TopMargin} - ]; - this.cmbVPositionPc = new Common.UI.ComboBox({ el: $('#image-combo-vpositionpc'), cls: 'input-group-nr', @@ -906,6 +1068,11 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat afterRender: function() { this.updateMetricUnit(); this._setDefaults(this._originalProps); + this.btnsCategory[(this._objectType == Asc.c_oAscTypeSelectElement.Shape) ? 0 : 1].setVisible(false); + if (this.storageName) { + var value = Common.localStorage.getItem(this.storageName); + this.setActiveCategory((value!==null) ? parseInt(value) : 0); + } }, _setDefaults: function(props) { @@ -958,13 +1125,6 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this._DisableElem(Asc.c_oAscWrapStyle2.Inline); } - this.spnWidth.setMaxValue(this.sizeMax.width); - this.spnHeight.setMaxValue(this.sizeMax.height); - value = props.get_Width(); - this.spnWidth.setValue((value!==undefined) ? Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) : '', true); - value = props.get_Height(); - this.spnHeight.setValue((value!==undefined) ? Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) : '', true); - if (props.get_Paddings()) { var Paddings = { Top: props.get_Paddings().get_Top(), @@ -1081,15 +1241,58 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this.btnOriginalSize.setVisible(!(shapeprops || chartprops)); this.btnOriginalSize.setDisabled(props.get_ImageUrl()===null || props.get_ImageUrl()===undefined); - this.btnsCategory[3].setVisible(shapeprops!==null && !shapeprops.get_FromChart()); // Shapes - this.btnsCategory[4].setVisible(shapeprops!==null && !shapeprops.get_FromChart()); // Margins - this.btnsCategory[1].setDisabled(props.get_FromGroup()); // Wrapping + this.btnsCategory[4].setVisible(shapeprops!==null && !shapeprops.get_FromChart()); // Shapes + this.btnsCategory[5].setVisible(shapeprops!==null && !shapeprops.get_FromChart()); // Margins + this.btnsCategory[2].setDisabled(props.get_FromGroup()); // Wrapping if (shapeprops) { this._objectType = Asc.c_oAscTypeSelectElement.Shape; this._setShapeDefaults(shapeprops); this.setTitle(this.textTitleShape); value = Common.localStorage.getItem("de-settings-shaperatio"); + if (value!==null && parseInt(value) == 1) { + this.chRatio.setValue(true); + } + + this.spnShapeWidth.setMaxValue(this.sizeMax.width); + this.spnShapeHeight.setMaxValue(this.sizeMax.height); + + var sizeRelH = props.get_SizeRelH(); + if (sizeRelH) { + this.radioHSizePc.setValue(true); + this.spnShapeWidthPc.setValue(sizeRelH.get_Value()); + value = sizeRelH.get_RelativeFrom(); + for (i=0; i0) { picker.store.each( function(rec){ @@ -1674,7 +2003,10 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat textBeginSize: 'Begin Size', textEndStyle: 'End Style', textEndSize: 'End Size', - textPositionPc: 'Relative position' + textPositionPc: 'Relative position', + textAspectRatio: 'Lock aspect ratio', + textAbsoluteWH: 'Absolute', + textRelativeWH: 'Relative' }, DE.Views.ImageSettingsAdvanced || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/PageMarginsDialog.js b/apps/documenteditor/main/app/view/PageMarginsDialog.js index 7ef8bf8571..f05259d113 100644 --- a/apps/documenteditor/main/app/view/PageMarginsDialog.js +++ b/apps/documenteditor/main/app/view/PageMarginsDialog.js @@ -213,7 +213,7 @@ define([ if (this.spinners) { for (var i=0; i1584) { + var value = parseFloat(record.value), + expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(' + me.txtPt + ')?\\s*$'); + if (!(expr.exec(record.value)) || value<0 || value>1584) { this._state.StrokeType = this._state.StrokeWidth = -1; Common.UI.error({ msg: this.textBorderSizeErr, @@ -1483,7 +1486,7 @@ define([ if (this._state.StrokeType !== strokeType || strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) { if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) { var w = stroke.get_width(); - var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !(/pt\s*$/.test(this.cmbBorderSize.getRawValue())); + var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue())); if ( Math.abs(this._state.StrokeWidth-w)>0.001 || check_value || (this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) { this._state.StrokeWidth = w; @@ -1497,7 +1500,7 @@ define([ if (_selectedItem) this.cmbBorderSize.selectRecord(_selectedItem); else { - this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' pt' : ''); + this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : ''); } this.BorderSize = w; } diff --git a/apps/documenteditor/main/app/view/TableSettings.js b/apps/documenteditor/main/app/view/TableSettings.js index b2d796002d..fc5ec0b170 100644 --- a/apps/documenteditor/main/app/view/TableSettings.js +++ b/apps/documenteditor/main/app/view/TableSettings.js @@ -91,7 +91,6 @@ define([ this._locked = false; this._originalLook = new Asc.CTablePropLook(); - var fullwidth = 218; this._originalProps = null; this.CellBorders = {}; this.CellColor = {Value: 1, Color: 'transparent'}; // value=1 - цвет определен - прозрачный или другой, value=0 - цвет не определен, рисуем прозрачным diff --git a/apps/documenteditor/main/app/view/TableSettingsAdvanced.js b/apps/documenteditor/main/app/view/TableSettingsAdvanced.js index 0539653409..9a567b73c5 100644 --- a/apps/documenteditor/main/app/view/TableSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/TableSettingsAdvanced.js @@ -55,7 +55,8 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat options: { contentWidth: 340, height: 436, - toggleGroup: 'table-adv-settings-group' + toggleGroup: 'table-adv-settings-group', + storageName: 'de-table-settings-adv-category' }, initialize : function(options) { @@ -185,7 +186,7 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat this.cmbUnit.on('selected', _.bind(function(combo, record) { if (this._changedProps) { var maxwidth = Common.Utils.Metric.fnRecalcFromMM(558); - this.nfWidth.setDefaultUnit(record.value ? '%' : Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]); + this.nfWidth.setDefaultUnit(record.value ? '%' : Common.Utils.Metric.getCurrentMetricName()); this.nfWidth.setMaxValue(record.value ? parseFloat((100 * maxwidth/this.pageWidth).toFixed(2)) : maxwidth); 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); @@ -478,7 +479,7 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat this.cmbPrefWidthUnit.on('selected', _.bind(function(combo, record) { if (this._changedProps) { var maxwidth = Common.Utils.Metric.fnRecalcFromMM(558); - this.nfPrefWidth.setDefaultUnit(record.value ? '%' : Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]); + this.nfPrefWidth.setDefaultUnit(record.value ? '%' : Common.Utils.Metric.getCurrentMetricName()); 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); @@ -1133,6 +1134,11 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat } this._UpdateTableBordersStyle(ct, border, size, color, (this._allTable) ? this.TableBorders : this.CellBorders, (this._allTable) ? this.ChangedTableBorders : this.ChangedCellBorders); }, this); + + if (this.storageName) { + var value = Common.localStorage.getItem(this.storageName); + this.setActiveCategory((value!==null) ? parseInt(value) : 0); + } }, getSettings: function() { @@ -1172,7 +1178,7 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat // 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)); this.cmbUnit.setValue(TableWidth<0 ? 1 : 0); - this.nfWidth.setDefaultUnit(TableWidth<0 ? '%' : Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]); + this.nfWidth.setDefaultUnit(TableWidth<0 ? '%' : Common.Utils.Metric.getCurrentMetricName()); if (TableWidth<0) //% this.nfWidth.setMaxValue(parseFloat((100 * Common.Utils.Metric.fnRecalcFromMM(558)/this.pageWidth).toFixed(2))); this.nfWidth.setStep((TableWidth<0 || Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.1); @@ -1236,7 +1242,7 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat 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)); this.cmbPrefWidthUnit.setValue(cellWidth<0 ? 1 : 0); - this.nfPrefWidth.setDefaultUnit(cellWidth<0 ? '%' : Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]); + this.nfPrefWidth.setDefaultUnit(cellWidth<0 ? '%' : Common.Utils.Metric.getCurrentMetricName()); 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); @@ -2071,7 +2077,7 @@ define([ 'text!documenteditor/main/app/template/TableSettingsAdvanced.templat if (this.spinners) { for (var i=0; i1584) { + var value = parseFloat(record.value), + expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(' + me.txtPt + ')?\\s*$'); + if (!(expr.exec(record.value)) || value<0 || value>1584) { this._state.StrokeType = this._state.StrokeWidth = -1; Common.UI.error({ msg: this.textBorderSizeErr, @@ -985,7 +988,7 @@ define([ if (this._state.StrokeType !== strokeType || strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) { if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) { var w = stroke.get_width(); - var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !(/pt\s*$/.test(this.cmbBorderSize.getRawValue())); + var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue())); if ( Math.abs(this._state.StrokeWidth-w)>0.001 || check_value || (this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) { this._state.StrokeWidth = w; @@ -999,7 +1002,7 @@ define([ if (_selectedItem) this.cmbBorderSize.selectRecord(_selectedItem); else { - this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' pt' : ''); + this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : ''); } this.BorderSize = w; } diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index fa38787612..7c8023ac94 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -686,10 +686,10 @@ define([ var pageMarginsTemplate = _.template('
<%= caption %>
' + '<% if (options.value !== null) { %>
' + - '' + - '
' + - ''+ - '
'+ + '' + + '
' + + ''+ + '
'+ '<% } %>'); this.btnPageMargins = new Common.UI.Button({ @@ -713,8 +713,8 @@ define([ this.toolbarControls.push(this.btnPageMargins); var pageSizeTemplate = _.template('
<%= caption %>
' + - '
<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] %> x '+ - '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] %>
'); + '
<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x '+ + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %>
'); this.btnPageSize = new Common.UI.Button({ id : 'id-toolbar-btn-pagesize', diff --git a/apps/documenteditor/main/index.html b/apps/documenteditor/main/index.html index 98e35acf0c..598bae984b 100644 --- a/apps/documenteditor/main/index.html +++ b/apps/documenteditor/main/index.html @@ -244,83 +244,90 @@ - - - - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -351,18 +358,10 @@ - - - - - - - - @@ -372,13 +371,9 @@ - - - - @@ -406,7 +401,6 @@ - diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index e71bd83382..7f180bac3b 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1,4 +1,6 @@ { + "Common.Utils.Metric.txtCm": "cm", + "Common.Utils.Metric.txtPt": "pt", "Common.Controllers.Chat.notcriticalErrorTitle": "Warning", "Common.Controllers.Chat.textEnterMessage": "Enter your message here", "Common.Controllers.Chat.textUserLimit": "You are using ONLYOFFICE Free Edition.
Only two users can co-edit the document simultaneously.
Want more? Consider buying ONLYOFFICE Enterprise Edition.
Read more", @@ -1017,6 +1019,9 @@ "DE.Views.ImageSettingsAdvanced.textWrapThroughTooltip": "Through", "DE.Views.ImageSettingsAdvanced.textWrapTightTooltip": "Tight", "DE.Views.ImageSettingsAdvanced.textWrapTopbottomTooltip": "Top and Bottom", + "DE.Views.ImageSettingsAdvanced.textAspectRatio": "Lock aspect ratio", + "DE.Views.ImageSettingsAdvanced.textAbsoluteWH": "Absolute", + "DE.Views.ImageSettingsAdvanced.textRelativeWH": "Relative", "DE.Views.LeftMenu.tipAbout": "About", "DE.Views.LeftMenu.tipChat": "Chat", "DE.Views.LeftMenu.tipComments": "Comments", diff --git a/apps/documenteditor/main/locale/ru.json b/apps/documenteditor/main/locale/ru.json index 8853942d9f..6153828219 100644 --- a/apps/documenteditor/main/locale/ru.json +++ b/apps/documenteditor/main/locale/ru.json @@ -1,4 +1,6 @@ { + "Common.Utils.Metric.txtCm": "см", + "Common.Utils.Metric.txtPt": "пт", "Common.Controllers.Chat.notcriticalErrorTitle": "Предупреждение", "Common.Controllers.Chat.textEnterMessage": "Введите здесь своё сообщение", "Common.Controllers.Chat.textUserLimit": "Вы используете бесплатную версию ONLYOFFICE.
Только два пользователя одновременно могут совместно редактировать документ.
Требуется больше? Рекомендуем приобрести корпоративную версию ONLYOFFICE.
Читать дальше", diff --git a/apps/presentationeditor/main/app/view/ChartSettings.js b/apps/presentationeditor/main/app/view/ChartSettings.js index 66e269e471..141c896e38 100644 --- a/apps/presentationeditor/main/app/view/ChartSettings.js +++ b/apps/presentationeditor/main/app/view/ChartSettings.js @@ -319,7 +319,7 @@ define([ if (this.spinners) { for (var i=0; i0.001 ) { - this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Width = value; } value = props.get_Height(); if ( Math.abs(this._state.Height-value)>0.001 ) { - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Height = value; } @@ -166,8 +166,8 @@ define([ var w = imgsize.get_ImageWidth(); var h = imgsize.get_ImageHeight(); - this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]; + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); var properties = new Asc.asc_CImgProperty(); properties.put_Width(w); diff --git a/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js index 77e3d51eb3..9ea4a76cad 100644 --- a/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js @@ -50,7 +50,8 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem contentWidth: 340, height: 235, sizeOriginal: {width: 0, height: 0}, - sizeMax: {width: 55.88, height: 55.88} + sizeMax: {width: 55.88, height: 55.88}, + storageName: 'pe-img-settings-adv-category' }, initialize : function(options) { @@ -183,6 +184,10 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem afterRender: function() { this.updateMetricUnit(); this._setDefaults(this._originalProps); + if (this.storageName) { + var value = Common.localStorage.getItem(this.storageName); + this.setActiveCategory((value!==null) ? parseInt(value) : 0); + } }, _setDefaults: function(props) { @@ -233,7 +238,7 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem if (this.spinners) { for (var i=0; i1584) { + var value = parseFloat(record.value), + expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(' + me.txtPt + ')?\\s*$'); + if (!(expr.exec(record.value)) || value<0 || value>1584) { this._state.StrokeType = this._state.StrokeWidth = -1; Common.UI.error({ msg: this.textBorderSizeErr, @@ -1347,7 +1350,7 @@ define([ if (this._state.StrokeType !== strokeType || strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) { if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) { var w = stroke.get_width(); - var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !(/pt\s*$/.test(this.cmbBorderSize.getRawValue())); + var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue())); if ( Math.abs(this._state.StrokeWidth-w)>0.001 || check_value || (this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) { this._state.StrokeWidth = w; @@ -1361,7 +1364,7 @@ define([ if (_selectedItem) this.cmbBorderSize.selectRecord(_selectedItem); else { - this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' pt' : ''); + this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : ''); } this.BorderSize = w; } diff --git a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js index 5760d117f2..6e6590b487 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js @@ -52,7 +52,8 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem toggleGroup: 'shape-adv-settings-group', sizeOriginal: {width: 0, height: 0}, sizeMax: {width: 55.88, height: 55.88}, - properties: null + properties: null, + storageName: 'pe-shape-settings-adv-category' }, initialize : function(options) { @@ -412,6 +413,10 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem afterRender: function() { this.updateMetricUnit(); this._setDefaults(this._originalProps); + if (this.storageName) { + var value = Common.localStorage.getItem(this.storageName); + this.setActiveCategory((value!==null) ? parseInt(value) : 0); + } }, _setDefaults: function(props) { @@ -528,7 +533,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem if (this.spinners) { for (var i=0; i1584) { + var value = parseFloat(record.value), + expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(' + me.txtPt + ')?\\s*$'); + if (!(expr.exec(record.value)) || value<0 || value>1584) { this._state.StrokeType = this._state.StrokeWidth = -1; Common.UI.error({ msg: this.textBorderSizeErr, @@ -1346,7 +1349,7 @@ define([ if (this._state.StrokeType !== strokeType || strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) { if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) { var w = stroke.get_width(); - var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !(/pt\s*$/.test(this.cmbBorderSize.getRawValue())); + var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue())); if ( Math.abs(this._state.StrokeWidth-w)>0.001 || check_value || (this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) { this._state.StrokeWidth = w; @@ -1360,7 +1363,7 @@ define([ if (_selectedItem) this.cmbBorderSize.selectRecord(_selectedItem); else { - this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' pt' : ''); + this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : ''); } this.BorderSize = w; } diff --git a/apps/presentationeditor/main/index.html b/apps/presentationeditor/main/index.html index 12ccad79e2..d78b21c9de 100644 --- a/apps/presentationeditor/main/index.html +++ b/apps/presentationeditor/main/index.html @@ -245,46 +245,83 @@ - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + - - - - - - - - - - - - - - @@ -293,57 +330,21 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -388,7 +389,6 @@ - diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index c7f5cffa41..b56b91066e 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -1,4 +1,6 @@ { + "Common.Utils.Metric.txtCm": "cm", + "Common.Utils.Metric.txtPt": "pt", "Common.Controllers.Chat.notcriticalErrorTitle": "Warning", "Common.Controllers.Chat.textEnterMessage": "Enter your message here", "Common.Controllers.Chat.textUserLimit": "You are using ONLYOFFICE Free Edition.
Only two users can co-edit the document simultaneously.
Want more? Consider buying ONLYOFFICE Enterprise Edition.
Read more", @@ -574,6 +576,7 @@ "PE.Views.SlideSettings.textRadial": "Radial", "PE.Views.SlideSettings.textReset": "Reset Changes", "PE.Views.SlideSettings.textRight": "Right", + "PE.Views.SlideSettings.textSec": "s", "PE.Views.SlideSettings.textSelectTexture": "Select", "PE.Views.SlideSettings.textSmoothly": "Smoothly", "PE.Views.SlideSettings.textSplit": "Split", diff --git a/apps/presentationeditor/main/locale/ru.json b/apps/presentationeditor/main/locale/ru.json index c50819a162..8ad354d954 100644 --- a/apps/presentationeditor/main/locale/ru.json +++ b/apps/presentationeditor/main/locale/ru.json @@ -1,4 +1,6 @@ { + "Common.Utils.Metric.txtCm": "см", + "Common.Utils.Metric.txtPt": "пт", "Common.Controllers.Chat.notcriticalErrorTitle": "Предупреждение", "Common.Controllers.Chat.textEnterMessage": "Введите здесь своё сообщение", "Common.Controllers.Chat.textUserLimit": "Вы используете бесплатную версию ONLYOFFICE.
Только два пользователя одновременно могут совместно редактировать документ.
Требуется больше? Рекомендуем приобрести корпоративную версию ONLYOFFICE.
Читать дальше", @@ -573,6 +575,7 @@ "PE.Views.SlideSettings.textRadial": "Радиальный", "PE.Views.SlideSettings.textReset": "Сбросить изменения", "PE.Views.SlideSettings.textRight": "Справа", + "PE.Views.SlideSettings.textSec": "сек", "PE.Views.SlideSettings.textSelectTexture": "Выбрать", "PE.Views.SlideSettings.textSmoothly": "Плавно", "PE.Views.SlideSettings.textSplit": "Панорама", diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 119585a4e0..e36329f4e7 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -153,6 +153,9 @@ define([ view.pmiDeleteCells.menu.on('item:click', _.bind(me.onDeleteCells, me)); view.pmiSortCells.menu.on('item:click', _.bind(me.onSortCells, me)); view.pmiClear.menu.on('item:click', _.bind(me.onClear, me)); + view.pmiSelectTable.menu.on('item:click', _.bind(me.onSelectTable, me)); + view.pmiInsertTable.menu.on('item:click', _.bind(me.onInsertTable, me)); + view.pmiDeleteTable.menu.on('item:click', _.bind(me.onDeleteTable, me)); view.pmiInsFunction.on('click', _.bind(me.onInsFunction, me)); view.menuAddHyperlink.on('click', _.bind(me.onInsHyperlink, me)); view.menuEditHyperlink.on('click', _.bind(me.onInsHyperlink, me)); @@ -349,6 +352,33 @@ define([ } }, + onSelectTable: function(menu, item) { + if (this.api && this.documentHolder.ssMenu.formatTableName) { + this.api.asc_changeSelectionFormatTable(this.documentHolder.ssMenu.formatTableName, item.value); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + Common.component.Analytics.trackEvent('DocumentHolder', 'Select Table'); + } + }, + + onInsertTable: function(menu, item) { + if (this.api && this.documentHolder.ssMenu.formatTableName) { + this.api.asc_insertCellsInTable(this.documentHolder.ssMenu.formatTableName, item.value); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + Common.component.Analytics.trackEvent('DocumentHolder', 'Insert to Table'); + } + }, + + onDeleteTable: function(menu, item) { + if (this.api && this.documentHolder.ssMenu.formatTableName) { + this.api.asc_deleteCellsInTable(this.documentHolder.ssMenu.formatTableName, item.value); + + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + Common.component.Analytics.trackEvent('DocumentHolder', 'Delete from Table'); + } + }, + onInsFunction: function(item) { var controller = this.getApplication().getController('FormulaDialog'); if (controller && this.api) { @@ -420,7 +450,7 @@ define([ startvalue: item.options.action == 'row-height' ? me.api.asc_getRowHeight() : me.api.asc_getColumnWidth(), maxvalue: item.options.action == 'row-height' ? Asc.c_oAscMaxRowHeight : Asc.c_oAscMaxColumnWidth, step: item.options.action == 'row-height' ? 0.75 : 1, - defaultUnit: item.options.action == 'row-height' ? "pt" : "sym", + defaultUnit: item.options.action == 'row-height' ? Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt) : me.textSym, handler: function(dlg, result) { if (result == 'ok') { var val = dlg.getSettings(); @@ -1147,17 +1177,35 @@ define([ seltype !== Asc.c_oAscSelectionType.RangeChart && seltype !== Asc.c_oAscSelectionType.RangeChartText && seltype !== Asc.c_oAscSelectionType.RangeShapeText)) { if (!showMenu && !documentHolder.ssMenu.isVisible()) return; - var iscelledit = this.api.isCellEdited; + var iscelledit = this.api.isCellEdited, + formatTableInfo = cellinfo.asc_getFormatTableInfo(), + isintable = (formatTableInfo !== null); + documentHolder.ssMenu.formatTableName = (isintable) ? formatTableInfo.asc_getTableName() : null; documentHolder.pmiInsertEntire.setVisible(isrowmenu||iscolmenu); documentHolder.pmiInsertEntire.setCaption((isrowmenu) ? this.textInsertTop : this.textInsertLeft); documentHolder.pmiDeleteEntire.setVisible(isrowmenu||iscolmenu); - documentHolder.pmiInsertCells.setVisible(iscellmenu && !iscelledit); - documentHolder.pmiDeleteCells.setVisible(iscellmenu && !iscelledit); - documentHolder.pmiSortCells.setVisible((iscellmenu||isallmenu||cansort) && !iscelledit); + documentHolder.pmiInsertCells.setVisible(iscellmenu && !iscelledit && !isintable); + documentHolder.pmiDeleteCells.setVisible(iscellmenu && !iscelledit && !isintable); + documentHolder.pmiSelectTable.setVisible(iscellmenu && !iscelledit && isintable); + documentHolder.pmiInsertTable.setVisible(iscellmenu && !iscelledit && isintable); + documentHolder.pmiDeleteTable.setVisible(iscellmenu && !iscelledit && isintable); + documentHolder.pmiSortCells.setVisible((iscellmenu||isallmenu||cansort) && !iscelledit && !isintable); documentHolder.pmiInsFunction.setVisible(iscellmenu||insfunc); documentHolder.pmiAddNamedRange.setVisible(iscellmenu && !iscelledit); + if (isintable) { + documentHolder.pmiInsertTable.menu.items[0].setDisabled(!formatTableInfo.asc_getIsInsertRowAbove()); + documentHolder.pmiInsertTable.menu.items[1].setDisabled(!formatTableInfo.asc_getIsInsertRowBelow()); + documentHolder.pmiInsertTable.menu.items[2].setDisabled(!formatTableInfo.asc_getIsInsertColumnLeft()); + documentHolder.pmiInsertTable.menu.items[3].setDisabled(!formatTableInfo.asc_getIsInsertColumnRight()); + + documentHolder.pmiDeleteTable.menu.items[0].setDisabled(!formatTableInfo.asc_getIsDeleteRow()); + documentHolder.pmiDeleteTable.menu.items[1].setDisabled(!formatTableInfo.asc_getIsDeleteColumn()); + documentHolder.pmiDeleteTable.menu.items[2].setDisabled(!formatTableInfo.asc_getIsDeleteTable()); + + } + var hyperinfo = cellinfo.asc_getHyperlink(); documentHolder.menuHyperlink.setVisible(iscellmenu && hyperinfo && !iscelledit); documentHolder.menuAddHyperlink.setVisible(iscellmenu && !hyperinfo && !iscelledit); @@ -1170,7 +1218,7 @@ define([ documentHolder.pmiFreezePanes.setCaption(this.api.asc_getSheetViewSettings().asc_getIsFreezePane() ? documentHolder.textUnFreezePanes : documentHolder.textFreezePanes); /** coauthoring begin **/ - documentHolder.ssMenu.items[10].setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments); + documentHolder.ssMenu.items[13].setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments); documentHolder.pmiAddComment.setVisible(iscellmenu && !iscelledit && this.permissions.canCoAuthoring && this.permissions.canComments); /** coauthoring end **/ documentHolder.pmiCellMenuSeparator.setVisible(iscellmenu || isrowmenu || iscolmenu || isallmenu || insfunc); @@ -1188,7 +1236,8 @@ define([ documentHolder.pmiClear.menu.items[3].setVisible(!this.permissions.isEditDiagram); documentHolder.pmiClear.menu.items[4].setVisible(!this.permissions.isEditDiagram); - var filterInfo = cellinfo.asc_getAutoFilterInfo() && cellinfo.asc_getAutoFilterInfo().asc_getIsApplyAutoFilter(); + var filterInfo = cellinfo.asc_getAutoFilterInfo(); + filterInfo = (filterInfo) ? filterInfo.asc_getIsApplyAutoFilter() : false; documentHolder.pmiInsertCells.menu.items[0].setDisabled(filterInfo); documentHolder.pmiDeleteCells.menu.items[0].setDisabled(filterInfo); documentHolder.pmiInsertCells.menu.items[1].setDisabled(filterInfo); @@ -1438,7 +1487,8 @@ define([ textChangeColumnWidth : 'Column Width {0} symbols ({1} pixels)', textChangeRowHeight : 'Row Height {0} points ({1} pixels)', textInsertLeft : 'Insert Left', - textInsertTop : 'Insert Top' + textInsertTop : 'Insert Top', + textSym : 'sym' }, SSE.Controllers.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/controller/RightMenu.js b/apps/spreadsheeteditor/main/app/controller/RightMenu.js index 2f0fd3b9c8..b6a014a105 100644 --- a/apps/spreadsheeteditor/main/app/controller/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/RightMenu.js @@ -77,7 +77,8 @@ define([ this._settings[Common.Utils.documentSettingsType.Image] = {panelId: "id-image-settings", panel: rightMenu.imageSettings, btn: rightMenu.btnImage, hidden: 1, locked: false}; this._settings[Common.Utils.documentSettingsType.Shape] = {panelId: "id-shape-settings", panel: rightMenu.shapeSettings, btn: rightMenu.btnShape, hidden: 1, locked: false}; this._settings[Common.Utils.documentSettingsType.TextArt] = {panelId: "id-textart-settings", panel: rightMenu.textartSettings, btn: rightMenu.btnTextArt, hidden: 1, locked: false}; - this._settings[Common.Utils.documentSettingsType.Chart] = {panelId: "id-chart-settings", panel: rightMenu.chartSettings, btn: rightMenu.btnChart, hidden: 1, locked: false}; + this._settings[Common.Utils.documentSettingsType.Chart] = {panelId: "id-chart-settings", panel: rightMenu.chartSettings, btn: rightMenu.btnChart, hidden: 1, locked: false}; + this._settings[Common.Utils.documentSettingsType.Table] = {panelId: "id-table-settings", panel: rightMenu.tableSettings, btn: rightMenu.btnTable, hidden: 1, locked: false}; }, setApi: function(api) { @@ -103,19 +104,20 @@ define([ onSelectionChanged: function(info) { var SelectedObjects = [], - selectType = info.asc_getFlags().asc_getSelectionType(); + selectType = info.asc_getFlags().asc_getSelectionType(), + formatTableInfo = info.asc_getFormatTableInfo(); if (selectType == Asc.c_oAscSelectionType.RangeImage || selectType == Asc.c_oAscSelectionType.RangeShape || selectType == Asc.c_oAscSelectionType.RangeChart || selectType == Asc.c_oAscSelectionType.RangeChartText || selectType == Asc.c_oAscSelectionType.RangeShapeText) { SelectedObjects = this.api.asc_getGraphicObjectProps(); } - - if (SelectedObjects.length<=0 && !this.rightmenu.minimizedMode) { + + if (SelectedObjects.length<=0 && !formatTableInfo && !this.rightmenu.minimizedMode) { this.rightmenu.clearSelection(); this._openRightMenu = true; } - this.onFocusObject(SelectedObjects); + this.onFocusObject(SelectedObjects, formatTableInfo); var need_disable = info.asc_getLocked(), me = this; @@ -128,7 +130,7 @@ define([ } }, - onFocusObject: function(SelectedObjects) { + onFocusObject: function(SelectedObjects, formatTableInfo) { if (!this.editMode) return; @@ -166,6 +168,12 @@ define([ this._settings[settingsType].locked = value.asc_getLocked(); } + if (formatTableInfo) { + settingsType = Common.Utils.documentSettingsType.Table; + this._settings[settingsType].props = formatTableInfo; + this._settings[settingsType].hidden = 0; + } + var lastactive = -1, currentactive, priorityactive = -1; for (i=0; i
+
+
@@ -13,6 +15,7 @@
+ diff --git a/apps/spreadsheeteditor/main/app/template/TableSettings.template b/apps/spreadsheeteditor/main/app/template/TableSettings.template new file mode 100644 index 0000000000..e48e86a7d5 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/template/TableSettings.template @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ + +
+
+
+ +
+
\ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js b/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js index 974833e784..232df0660c 100644 --- a/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js @@ -142,6 +142,8 @@ define([ if (this.api) this.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None); Common.NotificationCenter.trigger('cells:range', Asc.c_oAscSelectionDialogType.None); + + SSE.getController('RightMenu').SetDisabled(false); }, onKeyPress: function(event) { @@ -162,6 +164,11 @@ define([ this.close(); }, + show: function () { + Common.UI.Window.prototype.show.call(this); + SSE.getController('RightMenu').SetDisabled(true); + }, + txtTitle : 'Select Data Range', textCancel : 'Cancel', txtEmpty : 'This field is required', diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettings.js b/apps/spreadsheeteditor/main/app/view/ChartSettings.js index 23a6348671..01ec3e5c60 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettings.js @@ -321,7 +321,7 @@ define([ if (this.spinners) { for (var i=0; i .active').removeClass('active'); @@ -255,6 +254,7 @@ define([ txtImageSettings: 'Image Settings', txtShapeSettings: 'Shape Settings', txtTextArtSettings: 'Text Art Settings', - txtChartSettings: 'Chart Settings' + txtChartSettings: 'Chart Settings', + txtTableSettings: 'Table Settings' }, SSE.Views.RightMenu || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index 4956f2d474..f52372cef1 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -79,6 +79,8 @@ define([ this._sendUndoPoint = true; this._sliderChanged = false; + this.txtPt = Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt); + this._state = { Transparency: null, FillType: Asc.c_oAscFill.FILL_TYPE_SOLID, @@ -998,8 +1000,9 @@ define([ onBorderSizeChanged: function(before, combo, record, e) { var me = this; if (before) { - var value = parseFloat(record.value); - if (!(/^\s*(\d*(\.|,)?\d+)\s*(pt)?\s*$/.exec(record.value)) || value<0 || value>1584) { + var value = parseFloat(record.value), + expr = new RegExp('^\\s*(\\d*(\\.|,)?\\d+)\\s*(' + me.txtPt + ')?\\s*$'); + if (!(expr.exec(record.value)) || value<0 || value>1584) { this._state.StrokeType = this._state.StrokeWidth = -1; Common.UI.error({ msg: this.textBorderSizeErr, @@ -1368,7 +1371,7 @@ define([ if (this._state.StrokeType !== strokeType || strokeType == Asc.c_oAscStrokeType.STROKE_COLOR) { if ( strokeType == Asc.c_oAscStrokeType.STROKE_COLOR ) { var w = stroke.asc_getWidth(); - var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !(/pt\s*$/.test(this.cmbBorderSize.getRawValue())); + var check_value = (Math.abs(this._state.StrokeWidth-w)<0.001) && !((new RegExp(this.txtPt + '\\s*$')).test(this.cmbBorderSize.getRawValue())); if ( Math.abs(this._state.StrokeWidth-w)>0.001 || check_value || (this._state.StrokeWidth===null || w===null)&&(this._state.StrokeWidth!==w)) { this._state.StrokeWidth = w; @@ -1382,7 +1385,7 @@ define([ if (_selectedItem) this.cmbBorderSize.selectRecord(_selectedItem); else { - this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' pt' : ''); + this.cmbBorderSize.setValue((w!==null) ? parseFloat(w.toFixed(2)) + ' ' + this.txtPt : ''); } this.BorderSize = w; } diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js index 0f2cf69a76..74d12de3ef 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js @@ -52,7 +52,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp toggleGroup: 'shape-adv-settings-group', sizeOriginal: {width: 0, height: 0}, sizeMax: {width: 55.88, height: 55.88}, - properties: null + properties: null, + storageName: 'sse-shape-settings-adv-category' }, initialize : function(options) { @@ -436,6 +437,10 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp afterRender: function() { this.updateMetricUnit(); this._setDefaults(this._originalProps); + if (this.storageName) { + var value = Common.localStorage.getItem(this.storageName); + this.setActiveCategory((value!==null) ? parseInt(value) : 0); + } }, _setDefaults: function(props) { @@ -554,7 +559,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp if (this.spinners) { for (var i=0; i', - '
', - '
', + '
', + '
', '
', '