diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index a05707370..f393929ee 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -193,8 +193,11 @@ define([ var value = panel.cmbLayout.getValue(); if (value !== 4) { - opt.asc_setFitToWidth((value==1 || value==2) ? 1 : 0); - opt.asc_setFitToHeight((value==1 || value==3) ? 1 : 0); + var fitToWidth = (value==1 || value==2) ? 1 : 0, + fitToHeight = (value==1 || value==3) ? 1 : 0; + opt.asc_setFitToWidth(fitToWidth); + opt.asc_setFitToHeight(fitToHeight); + !fitToWidth && !fitToHeight && opt.asc_setScale(100); } else { opt.asc_setFitToWidth(this.fitWidth); opt.asc_setFitToHeight(this.fitHeight); @@ -353,9 +356,11 @@ define([ propertyChange: function(panel, scale, combo, record) { if (scale === 'scale' && record.value === 4) { - var me = this; + var me = this, + props = (me._changedProps.length > 0 && me._changedProps[panel.cmbSheet.getValue()]) ? me._changedProps[panel.cmbSheet.getValue()] : me.api.asc_getPageOptions(panel.cmbSheet.getValue()); var win = new SSE.Views.ScaleDialog({ api: me.api, + props: props, handler: function(dlg, result) { if (dlg == 'ok') { if (me.api && result) { @@ -368,12 +373,6 @@ define([ } } } else { - var props; - if (me._changedProps.length > 0) { - props = me._changedProps[panel.cmbSheet.getValue()]; - } else { - props = new Asc.asc_CPageOptions(); - } var opt = props.asc_getPageSetup(), fitwidth = opt.asc_getFitToWidth(), fitheight = opt.asc_getFitToHeight(), diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 1d5b80492..70b1daaf5 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -3363,6 +3363,7 @@ define([ var me = this; var win = new SSE.Views.ScaleDialog({ api: me.api, + props: null, handler: function(dlg, result) { if (dlg == 'ok') { if (me.api && result) { diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 69f1b40bc..b26937aa4 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -361,7 +361,8 @@ define([ { value: 0, displayValue: this.textActualSize }, { value: 1, displayValue: this.textFitPage }, { value: 2, displayValue: this.textFitCols }, - { value: 3, displayValue: this.textFitRows } + { value: 3, displayValue: this.textFitRows }, + { value: 4, displayValue: this.textCustomOptions} ] }); @@ -489,7 +490,8 @@ define([ textActualSize: 'Actual Size', textFitPage: 'Fit Sheet on One Page', textFitCols: 'Fit All Columns on One Page', - textFitRows: 'Fit All Rows on One Page' + textFitRows: 'Fit All Rows on One Page', + textCustomOptions: 'Custom Options' }, SSE.Views.MainSettingsPrint || {})); SSE.Views.FileMenuPanels.MainSettingsGeneral = Common.UI.BaseView.extend(_.extend({ diff --git a/apps/spreadsheeteditor/main/app/view/ScaleDialog.js b/apps/spreadsheeteditor/main/app/view/ScaleDialog.js index 98f37621e..11141b990 100644 --- a/apps/spreadsheeteditor/main/app/view/ScaleDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ScaleDialog.js @@ -89,6 +89,7 @@ define([ this.options.tpl = _.template(this.template)(this.options); this.api = this.options.api; + this._originalProps = this.options.props; Common.UI.Window.prototype.initialize.call(this, this.options); }, @@ -143,7 +144,7 @@ define([ }, afterRender: function() { - this._setDefaults(); + this._setDefaults(this._originalProps); }, _handleInput: function(state) { @@ -170,9 +171,10 @@ define([ } }, - _setDefaults: function () { + _setDefaults: function (props) { if (this.api) { - var pageSetup = this.api.asc_getPageOptions().asc_getPageSetup(), + var pageProps = props ? props : this.api.asc_getPageOptions(); + var pageSetup = pageProps.asc_getPageSetup(), width = pageSetup.asc_getFitToWidth(), height = pageSetup.asc_getFitToHeight(), scale = pageSetup.asc_getScale(); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 0f08d6bc9..e3f389c51 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -1750,6 +1750,7 @@ "SSE.Views.MainSettingsPrint.textPrintGrid": "Print Gridlines", "SSE.Views.MainSettingsPrint.textPrintHeadings": "Print Row and Column Headings", "SSE.Views.MainSettingsPrint.textSettings": "Settings for", + "SSE.Views.MainSettingsPrint.textCustomOptions": "Custom Options", "SSE.Views.NamedRangeEditDlg.cancelButtonText": "Cancel", "SSE.Views.NamedRangeEditDlg.errorCreateDefName": "The existing named ranges cannot be edited and the new ones cannot be created
at the moment as some of them are being edited.", "SSE.Views.NamedRangeEditDlg.namePlaceholder": "Defined name",