From e258200a94148f3d99c54093962b45c429bb7cf3 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 7 Feb 2017 12:56:32 +0300 Subject: [PATCH] [SSE] Fill format settings info. --- .../main/app/controller/Toolbar.js | 5 ++++- .../main/app/view/FormatSettingsDialog.js | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 226a67d4a..b82c4dec0 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -103,6 +103,7 @@ define([ fontsize: undefined, multiselect: false, sparklines_disabled: false, + numformatinfo: undefined, numformattype: undefined, numformat: undefined, langId: undefined @@ -846,6 +847,7 @@ define([ width: 500, title: this.txtSorting, msg: this.txtExpandSort, + buttons: [ {caption: this.txtExpand, primary: true, value: 'expand'}, {caption: this.txtSortSelected, primary: true, value: 'sort'}, 'cancel'], @@ -927,7 +929,7 @@ define([ } Common.NotificationCenter.trigger('edit:complete', me.toolbar); }, - props : {formatType: me._state.numformattype, format: me._state.numformat, langId: value} + props : {format: me._state.numformat, formatInfo: me._state.numformatinfo, langId: value} })).show(); Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.component.Analytics.trackEvent('ToolBar', 'Number Format'); @@ -1963,6 +1965,7 @@ define([ val = info.asc_getNumFormatInfo(); if (val) { this._state.numformat = info.asc_getNumFormat(); + this._state.numformatinfo = val; val = val.asc_getType(); if (this._state.numformattype !== val) { toolbar.cmbNumberFormat.setValue(val, toolbar.txtCustom); diff --git a/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js b/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js index 20333d96f..37678959c 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/FormatSettingsDialog.js @@ -157,6 +157,7 @@ define([ this.api = options.api; this.handler = options.handler; this.props = options.props; + this._state = {hasDecimal: false, hasNegative: false, hasSeparator: false, hasType: false, hasSymbols: false, hasCode: false}; Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); @@ -258,15 +259,22 @@ define([ }, _setDefaults: function (props) { - if (props) { + if (props && props.formatInfo) { if (this.langId) this.langId = props.langId; - this.cmbFormat.setValue(props.formatType, this.txtCustom); + this.cmbFormat.setValue(props.formatInfo.asc_getType(), this.txtCustom); - if ((props.formatType == Asc.c_oAscNumFormatType.Custom) && props.format) + if ((props.formatInfo.asc_getType() == Asc.c_oAscNumFormatType.Custom) && props.format) this.CustomFormat = this.Format = props.format; this.onFormatSelect(this.cmbFormat, this.cmbFormat.getSelectedRecord()); + if (this._state.hasDecimal) + this.spnDecimal.setValue(props.formatInfo.asc_getDecimalPlaces()); + if (this._state.hasSeparator) + this.chSeparator.setValue(props.formatInfo.asc_getSeparator()); + if (this._state.hasSymbols) + this.cmbSymbols.setValue(props.formatInfo.asc_getSymbol()); + // for fraction - if props.format not in cmbType - setValue(this.txtCustom) // for date/time - if props.format not in cmbType - setValue(this.api.asc_getLocaleExample(props.format, 37973)) // for cmbNegative - if props.format not in cmbNegative - setValue(this.api.asc_getLocaleExample(props.format)) @@ -459,6 +467,7 @@ define([ this._typePanel.toggleClass('hidden', !hasType); this._symbolsPanel.toggleClass('hidden', !hasSymbols); this._codePanel.toggleClass('hidden', !hasCode); + this._state = { hasDecimal: hasDecimal, hasNegative: hasNegative, hasSeparator: hasSeparator, hasType: hasType, hasSymbols: hasSymbols, hasCode: hasCode}; }, textTitle: 'Number Format',