From 93ba07adeb92a754c67c6679f0158d196ff75fb6 Mon Sep 17 00:00:00 2001 From: OVSharova Date: Thu, 8 Jul 2021 04:13:10 +0300 Subject: [PATCH] document spacing psetting --- .../main/app/view/ParagraphSettings.js | 27 ++++++++++++------- .../app/view/ParagraphSettingsAdvanced.js | 12 +++++---- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/apps/documenteditor/main/app/view/ParagraphSettings.js b/apps/documenteditor/main/app/view/ParagraphSettings.js index 56dbef023..3a2df1009 100644 --- a/apps/documenteditor/main/app/view/ParagraphSettings.js +++ b/apps/documenteditor/main/app/view/ParagraphSettings.js @@ -89,9 +89,9 @@ define([ this.isChart = false; this._arrLineRule = [ - {displayValue: this.textAtLeast,defaultValue: 5, value: c_paragraphLinerule.LINERULE_LEAST, minValue: 0.03, step: 0.01, defaultUnit: 'cm'}, - {displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''}, - {displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'cm'} + {displayValue: this.textAtLeast,defaultValue: 4.24, value: c_paragraphLinerule.LINERULE_LEAST, minValue: 0.03, step: 0.01, defaultUnit: 'pt'}, + {displayValue: this.textAuto, defaultValue: 1.08, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''}, + {displayValue: this.textExact, defaultValue: 4.24, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'pt'} ]; this._arrSpecial = [ @@ -273,9 +273,10 @@ define([ onNumLineHeightChange: function(field, newValue, oldValue, eOpts){ if ( this.cmbLineRule.getRawValue() === '' ) return; - var type = c_paragraphLinerule.LINERULE_AUTO; + var type = c_paragraphLinerule.LINERULE_AUTO; if (this.api) - this.api.put_PrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this.api.put_PrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : field.getNumberValue()* 25.4 / 72.0); + // this.api.put_PrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); }, onNumSpacingBeforeChange: function(field, newValue, oldValue, eOpts){ @@ -328,7 +329,8 @@ define([ if ( linerule == c_paragraphLinerule.LINERULE_AUTO ) { val = line; } else if (linerule !== null && line !== null ) { - val = Common.Utils.Metric.fnRecalcFromMM(line); + //val = Common.Utils.Metric.fnRecalcFromMM(line); + val=parseFloat((line * 72.0 / 25.4).toFixed(3)); } this.numLineHeight.setValue((val !== null) ? val : '', true); @@ -558,9 +560,12 @@ define([ spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1); } } - this._arrLineRule[2].defaultUnit = this._arrLineRule[0].defaultUnit = Common.Utils.Metric.getCurrentMetricName(); - this._arrLineRule[2].minValue = this._arrLineRule[0].minValue = parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)); - this._arrLineRule[2].step = this._arrLineRule[0].step = (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01; + //this._arrLineRule[2].defaultUnit = this._arrLineRule[0].defaultUnit = Common.Utils.Metric.getCurrentMetricName(); + //this._arrLineRule[2].minValue = this._arrLineRule[0].minValue = parseFloat(parseFloat((0.3 * 72.0 / 25.4).toFixed(3)).toFixed(2)); + //this._arrLineRule[2].minValue = this._arrLineRule[0].minValue = parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)); + //this._arrLineRule[2].step = this._arrLineRule[0].step = (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01; + //this._arrLineRule[2].step = this._arrLineRule[0].step = 1; + if (this._state.LineRuleIdx !== null) { this.numLineHeight.setDefaultUnit(this._arrLineRule[this._state.LineRuleIdx].defaultUnit); this.numLineHeight.setStep(this._arrLineRule[this._state.LineRuleIdx].step); @@ -568,7 +573,9 @@ define([ if ( this._state.LineRuleIdx == c_paragraphLinerule.LINERULE_AUTO ) { val = this._state.LineHeight; } else if (this._state.LineHeight !== null ) { - val = Common.Utils.Metric.fnRecalcFromMM(this._state.LineHeight); + + val = parseFloat((this._state.LineHeight* 72.0 / 25.4).toFixed(3)); + //val = Common.Utils.Metric.fnRecalcFromMM(this._state.LineHeight); } this.numLineHeight && this.numLineHeight.setValue((val !== null) ? val : '', true); } diff --git a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js index 0ec4e69c2..8fcb8fb90 100644 --- a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js @@ -99,9 +99,9 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem this.CurLineRuleIdx = this._originalProps.get_Spacing().get_LineRule(); this._arrLineRule = [ - {displayValue: this.textAtLeast,defaultValue: 5, value: c_paragraphLinerule.LINERULE_LEAST, minValue: 0.03, step: 0.01, defaultUnit: 'cm'}, + {displayValue: this.textAtLeast,defaultValue: 4.24, value: c_paragraphLinerule.LINERULE_LEAST, minValue: 0.03, step: 0.01, defaultUnit: 'pt'}, {displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''}, - {displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'cm'} + {displayValue: this.textExact, defaultValue: 4.24, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'pt'} ]; this._arrSpecial = [ @@ -950,8 +950,8 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1); } } - this._arrLineRule[2].defaultUnit = this._arrLineRule[0].defaultUnit = Common.Utils.Metric.getCurrentMetricName(); - this._arrLineRule[2].minValue = this._arrLineRule[0].minValue = parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)); + //this._arrLineRule[2].defaultUnit = this._arrLineRule[0].defaultUnit = Common.Utils.Metric.getCurrentMetricName(); + //this._arrLineRule[2].minValue = this._arrLineRule[0].minValue = parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)); this._arrLineRule[2].step = this._arrLineRule[0].step = (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01; if (this.CurLineRuleIdx !== null) { this.numLineHeight.setDefaultUnit(this._arrLineRule[this.CurLineRuleIdx].defaultUnit); @@ -1429,7 +1429,9 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); this.Spacing = properties.get_Spacing(); } - this.Spacing.put_Line((this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this.Spacing.put_Line((this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : (field.getNumberValue()* 25.4 / 72.0)); + + //this.Spacing.put_Line((this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); }, onSpecialSelect: function(combo, record) {