[SSE] Fix Custom Scaling

This commit is contained in:
Julia Svinareva 2019-09-05 10:52:49 +03:00
parent b04cc196ad
commit 780dea554b
5 changed files with 19 additions and 14 deletions

View file

@ -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(),

View file

@ -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) {

View file

@ -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({

View file

@ -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();

View file

@ -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<br>at the moment as some of them are being edited.",
"SSE.Views.NamedRangeEditDlg.namePlaceholder": "Defined name",