Finished editing spreadsheeteditor

This commit is contained in:
OVSharova 2021-07-10 03:44:48 +03:00
parent 10b2d8e5b2
commit af6e58fd87
2 changed files with 42 additions and 41 deletions

View file

@ -106,7 +106,7 @@ define([
if ( this.cmbLineRule.getRawValue() === '' ) if ( this.cmbLineRule.getRawValue() === '' )
return; return;
if (this.api) if (this.api)
this.api.asc_putPrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this.api.asc_putPrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue(),Common.Utils.Metric.c_MetricUnits.pt));
}, },
onNumSpacingBeforeChange: function(field, newValue, oldValue, eOpts){ onNumSpacingBeforeChange: function(field, newValue, oldValue, eOpts){
@ -115,7 +115,7 @@ define([
if (num<0) if (num<0)
this.api.asc_putLineSpacingBeforeAfter(0, -1); this.api.asc_putLineSpacingBeforeAfter(0, -1);
else else
this.api.asc_putLineSpacingBeforeAfter(0, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this.api.asc_putLineSpacingBeforeAfter(0, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue(), Common.Utils.Metric.c_MetricUnits.pt));
} }
}, },
@ -125,7 +125,7 @@ define([
if (num<0) if (num<0)
this.api.asc_putLineSpacingBeforeAfter(1, -1); this.api.asc_putLineSpacingBeforeAfter(1, -1);
else else
this.api.asc_putLineSpacingBeforeAfter(1, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this.api.asc_putLineSpacingBeforeAfter(1, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue(), Common.Utils.Metric.c_MetricUnits.pt));
} }
}, },
@ -162,7 +162,7 @@ define([
if ( linerule == c_paragraphLinerule.LINERULE_AUTO ) { if ( linerule == c_paragraphLinerule.LINERULE_AUTO ) {
val = line; val = line;
} else if (linerule !== null && line !== null ) { } else if (linerule !== null && line !== null ) {
val = Common.Utils.Metric.fnRecalcFromMM(line); val = Common.Utils.Metric.fnRecalcFromMM(line, Common.Utils.Metric.c_MetricUnits.pt);
} }
this.numLineHeight.setValue((val !== null) ? val : '', true); this.numLineHeight.setValue((val !== null) ? val : '', true);
@ -202,7 +202,7 @@ define([
if ( Spacing.LineRule == c_paragraphLinerule.LINERULE_AUTO ) { if ( Spacing.LineRule == c_paragraphLinerule.LINERULE_AUTO ) {
val = Spacing.Line; val = Spacing.Line;
} else if (Spacing.LineRule !== null && Spacing.Line !== null ) { } else if (Spacing.LineRule !== null && Spacing.Line !== null ) {
val = Common.Utils.Metric.fnRecalcFromMM(Spacing.Line); val = Common.Utils.Metric.fnRecalcFromMM(Spacing.Line, Common.Utils.Metric.c_MetricUnits.pt);
} }
this.numLineHeight.setValue((val !== null) ? val : '', true); this.numLineHeight.setValue((val !== null) ? val : '', true);
@ -212,14 +212,14 @@ define([
if ( Math.abs(this._state.LineSpacingBefore-Spacing.Before)>0.001 || if ( Math.abs(this._state.LineSpacingBefore-Spacing.Before)>0.001 ||
(this._state.LineSpacingBefore===null || Spacing.Before===null)&&(this._state.LineSpacingBefore!==Spacing.Before)) { (this._state.LineSpacingBefore===null || Spacing.Before===null)&&(this._state.LineSpacingBefore!==Spacing.Before)) {
this.numSpacingBefore.setValue((Spacing.Before !== null) ? ((Spacing.Before<0) ? Spacing.Before : Common.Utils.Metric.fnRecalcFromMM(Spacing.Before) ) : '', true); this.numSpacingBefore.setValue((Spacing.Before !== null) ? ((Spacing.Before<0) ? Spacing.Before : Common.Utils.Metric.fnRecalcFromMM(Spacing.Before, Common.Utils.Metric.c_MetricUnits.pt) ) : '', true);
this._state.LineSpacingBefore=Spacing.Before; this._state.LineSpacingBefore=Spacing.Before;
} }
if ( Math.abs(this._state.LineSpacingAfter-Spacing.After)>0.001 || if ( Math.abs(this._state.LineSpacingAfter-Spacing.After)>0.001 ||
(this._state.LineSpacingAfter===null || Spacing.After===null)&&(this._state.LineSpacingAfter!==Spacing.After)) { (this._state.LineSpacingAfter===null || Spacing.After===null)&&(this._state.LineSpacingAfter!==Spacing.After)) {
this.numSpacingAfter.setValue((Spacing.After !== null) ? ((Spacing.After<0) ? Spacing.After : Common.Utils.Metric.fnRecalcFromMM(Spacing.After) ) : '', true); this.numSpacingAfter.setValue((Spacing.After !== null) ? ((Spacing.After<0) ? Spacing.After : Common.Utils.Metric.fnRecalcFromMM(Spacing.After, Common.Utils.Metric.c_MetricUnits.pt) ) : '', true);
this._state.LineSpacingAfter=Spacing.After; this._state.LineSpacingAfter=Spacing.After;
} }
} }
@ -229,19 +229,19 @@ define([
if (this.spinners) { if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) { for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i]; var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()); /*spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01); spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);*/
} }
var val = this._state.LineSpacingBefore; var val = this._state.LineSpacingBefore;
this.numSpacingBefore && this.numSpacingBefore.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val) ) : '', true); this.numSpacingBefore && this.numSpacingBefore.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val, Common.Utils.Metric.c_MetricUnits.pt) ) : '', true);
val = this._state.LineSpacingAfter; val = this._state.LineSpacingAfter;
this.numSpacingAfter && this.numSpacingAfter.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val) ) : '', true); this.numSpacingAfter && this.numSpacingAfter.setValue((val !== null) ? ((val<0) ? val : Common.Utils.Metric.fnRecalcFromMM(val, Common.Utils.Metric.c_MetricUnits.pt) ) : '', true);
} }
if (this.cmbLineRule) { if (this.cmbLineRule) {
var rec = this.cmbLineRule.store.at(1); var rec = this.cmbLineRule.store.at(1);
rec.set({defaultUnit: Common.Utils.Metric.getCurrentMetricName(), /*rec.set({defaultUnit: Common.Utils.Metric.getCurrentMetricName(),
minValue: parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)), minValue: parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)),
step: (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01}); step: (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01});*/
if (this._state.LineRule !== null) { if (this._state.LineRule !== null) {
var obj; var obj;
@ -253,7 +253,7 @@ define([
if ( this._state.LineRule == c_paragraphLinerule.LINERULE_AUTO ) { if ( this._state.LineRule == c_paragraphLinerule.LINERULE_AUTO ) {
val = this._state.LineHeight; val = this._state.LineHeight;
} else if (this._state.LineHeight !== null ) { } else if (this._state.LineHeight !== null ) {
val = Common.Utils.Metric.fnRecalcFromMM(this._state.LineHeight); val = Common.Utils.Metric.fnRecalcFromMM(this._state.LineHeight, Common.Utils.Metric.c_MetricUnits.pt);
} }
this.numLineHeight && this.numLineHeight.setValue((val !== null) ? val : '', true); this.numLineHeight && this.numLineHeight.setValue((val !== null) ? val : '', true);
} }
@ -265,7 +265,7 @@ define([
this._arrLineRule = [ this._arrLineRule = [
{displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''}, {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.66, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 1, defaultUnit: 'pt'}
]; ];
// Short Size // Short Size
@ -292,11 +292,11 @@ define([
this.numSpacingBefore = new Common.UI.MetricSpinner({ this.numSpacingBefore = new Common.UI.MetricSpinner({
el: $('#paragraph-spin-spacing-before'), el: $('#paragraph-spin-spacing-before'),
step: .1, step: 1,
width: 85, width: 85,
value: '0 cm', value: '0 pt',
defaultUnit : "cm", defaultUnit : "pt",
maxValue: 55.88, maxValue: 1584,
minValue: 0, minValue: 0,
allowAuto : true, allowAuto : true,
autoText : this.txtAutoText autoText : this.txtAutoText
@ -306,11 +306,11 @@ define([
this.numSpacingAfter = new Common.UI.MetricSpinner({ this.numSpacingAfter = new Common.UI.MetricSpinner({
el: $('#paragraph-spin-spacing-after'), el: $('#paragraph-spin-spacing-after'),
step: .1, step: 1,
width: 85, width: 85,
value: '0.35 cm', value: '0.35 pt',
defaultUnit : "cm", defaultUnit : "pt",
maxValue: 55.88, maxValue: 1584,
minValue: 0, minValue: 0,
allowAuto : true, allowAuto : true,
autoText : this.txtAutoText autoText : this.txtAutoText

View file

@ -83,7 +83,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
this._arrLineRule = [ this._arrLineRule = [
{displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''}, {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.66, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 1, defaultUnit: 'pt'}
]; ];
var curLineRule = this._originalProps.asc_getSpacing().asc_getLineRule(), var curLineRule = this._originalProps.asc_getSpacing().asc_getLineRule(),
@ -198,11 +198,11 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
this.numSpacingBefore = new Common.UI.MetricSpinner({ this.numSpacingBefore = new Common.UI.MetricSpinner({
el: $('#paragraphadv-spin-spacing-before'), el: $('#paragraphadv-spin-spacing-before'),
step: .1, step: 1,
width: 85, width: 85,
value: '', value: '',
defaultUnit : "cm", defaultUnit : "pt",
maxValue: 55.88, maxValue: 1584,
minValue: 0, minValue: 0,
allowAuto : true, allowAuto : true,
autoText : this.txtAutoText autoText : this.txtAutoText
@ -212,17 +212,17 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.asc_getSpacing(); this.Spacing = properties.asc_getSpacing();
} }
this.Spacing.put_Before(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this.Spacing.put_Before(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue(), Common.Utils.Metric.c_MetricUnits.pt));
}, this)); }, this));
this.spinners.push(this.numSpacingBefore); this.spinners.push(this.numSpacingBefore);
this.numSpacingAfter = new Common.UI.MetricSpinner({ this.numSpacingAfter = new Common.UI.MetricSpinner({
el: $('#paragraphadv-spin-spacing-after'), el: $('#paragraphadv-spin-spacing-after'),
step: .1, step: 1,
width: 85, width: 85,
value: '', value: '',
defaultUnit : "cm", defaultUnit : "pt",
maxValue: 55.88, maxValue: 1584,
minValue: 0, minValue: 0,
allowAuto : true, allowAuto : true,
autoText : this.txtAutoText autoText : this.txtAutoText
@ -232,7 +232,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.asc_getSpacing(); this.Spacing = properties.asc_getSpacing();
} }
this.Spacing.put_After(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this.Spacing.put_After(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue(), Common.Utils.Metric.c_MetricUnits.pt));
}, this)); }, this));
this.spinners.push(this.numSpacingAfter); this.spinners.push(this.numSpacingAfter);
@ -473,14 +473,14 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
this.cmbSpecial.setValue(this.CurSpecial); this.cmbSpecial.setValue(this.CurSpecial);
this.numSpecialBy.setValue(this.FirstLine!== null ? Math.abs(Common.Utils.Metric.fnRecalcFromMM(this.FirstLine)) : '', true); this.numSpecialBy.setValue(this.FirstLine!== null ? Math.abs(Common.Utils.Metric.fnRecalcFromMM(this.FirstLine)) : '', true);
this.numSpacingBefore.setValue((props.asc_getSpacing() !== null && props.asc_getSpacing().asc_getBefore() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.asc_getSpacing().asc_getBefore()) : '', true); this.numSpacingBefore.setValue((props.asc_getSpacing() !== null && props.asc_getSpacing().asc_getBefore() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.asc_getSpacing().asc_getBefore(), Common.Utils.Metric.c_MetricUnits.pt) : '', true);
this.numSpacingAfter.setValue((props.asc_getSpacing() !== null && props.asc_getSpacing().asc_getAfter() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.asc_getSpacing().asc_getAfter()) : '', true); this.numSpacingAfter.setValue((props.asc_getSpacing() !== null && props.asc_getSpacing().asc_getAfter() !== null) ? Common.Utils.Metric.fnRecalcFromMM(props.asc_getSpacing().asc_getAfter(), Common.Utils.Metric.c_MetricUnits.pt) : '', true);
var linerule = props.asc_getSpacing().asc_getLineRule(); var linerule = props.asc_getSpacing().asc_getLineRule();
this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true); this.cmbLineRule.setValue((linerule !== null) ? linerule : '', true);
if(props.asc_getSpacing() !== null && props.asc_getSpacing().asc_getLine() !== null) { if(props.asc_getSpacing() !== null && props.asc_getSpacing().asc_getLine() !== null) {
this.numLineHeight.setValue((linerule==c_paragraphLinerule.LINERULE_AUTO) ? props.asc_getSpacing().asc_getLine() : Common.Utils.Metric.fnRecalcFromMM(props.asc_getSpacing().asc_getLine()), true); this.numLineHeight.setValue((linerule==c_paragraphLinerule.LINERULE_AUTO) ? props.asc_getSpacing().asc_getLine() : Common.Utils.Metric.fnRecalcFromMM(props.asc_getSpacing().asc_getLine(), Common.Utils.Metric.c_MetricUnits.pt), true);
} else { } else {
this.numLineHeight.setValue('', true); this.numLineHeight.setValue('', true);
} }
@ -530,16 +530,17 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
if (this.spinners) { if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) { for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i]; var spinner = this.spinners[i];
if(spinner.el.id != 'paragraphadv-spin-spacing-before' && spinner.el.id != 'paragraphadv-spin-spacing-after'&& spinner.el.id != 'paragraphadv-spin-line-height')
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()); spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position' || spinner.el.id == 'paragraphadv-spin-spacing-before' || spinner.el.id == 'paragraphadv-spin-spacing-after' ) else if (spinner.el.id == 'paragraphadv-spin-spacing' || spinner.el.id == 'paragraphadv-spin-position' )
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01); spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
else else
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1); spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
} }
} }
this._arrLineRule[1].defaultUnit = Common.Utils.Metric.getCurrentMetricName(); /*this._arrLineRule[1].defaultUnit = Common.Utils.Metric.getCurrentMetricName();
this._arrLineRule[1].minValue = parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)); this._arrLineRule[1].minValue = parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2));
this._arrLineRule[1].step = (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01; this._arrLineRule[1].step = (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01;*/
if (this.CurLineRuleIdx !== null) { if (this.CurLineRuleIdx !== null) {
this.numLineHeight.setDefaultUnit(this._arrLineRule[this.CurLineRuleIdx].defaultUnit); this.numLineHeight.setDefaultUnit(this._arrLineRule[this.CurLineRuleIdx].defaultUnit);
this.numLineHeight.setStep(this._arrLineRule[this.CurLineRuleIdx].step); this.numLineHeight.setStep(this._arrLineRule[this.CurLineRuleIdx].step);
@ -791,7 +792,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
if (this.Spacing.get_LineRule() === c_paragraphLinerule.LINERULE_AUTO) { if (this.Spacing.get_LineRule() === c_paragraphLinerule.LINERULE_AUTO) {
this.numLineHeight.setValue(this._arrLineRule[indexSelectItem].defaultValue); this.numLineHeight.setValue(this._arrLineRule[indexSelectItem].defaultValue);
} else { } else {
this.numLineHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrLineRule[indexSelectItem].defaultValue)); this.numLineHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrLineRule[indexSelectItem].defaultValue, Common.Utils.Metric.c_MetricUnits.pt));
} }
this.CurLineRuleIdx = indexSelectItem; this.CurLineRuleIdx = indexSelectItem;
} }
@ -804,7 +805,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.
var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty();
this.Spacing = properties.asc_getSpacing(); this.Spacing = properties.asc_getSpacing();
} }
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() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue(), Common.Utils.Metric.c_MetricUnits.pt));
}, },
textTitle: 'Paragraph - Advanced Settings', textTitle: 'Paragraph - Advanced Settings',