From e7035eace1fa9be6fc8ada62faf8eb3b27a00029 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 6 Sep 2023 13:38:21 +0300 Subject: [PATCH] [SSE] Fix bug 56671 --- .../main/app/controller/Print.js | 18 +++++++-------- .../main/app/controller/Toolbar.js | 22 ++++++++++++------- .../main/app/view/PageMarginsDialog.js | 2 -- .../settings/SpreadsheetSettings.jsx | 2 +- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index d02617a23f..0408c90cbd 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -601,17 +601,17 @@ define([ handler: function(dlg, result) { var opt; if (result == 'ok') { - opt = dlg.getSettings().margins; - Common.localStorage.setItem("sse-pgmargins-top", opt.asc_getTop()); - Common.localStorage.setItem("sse-pgmargins-left", opt.asc_getLeft()); - Common.localStorage.setItem("sse-pgmargins-bottom", opt.asc_getBottom()); - Common.localStorage.setItem("sse-pgmargins-right", opt.asc_getRight()); - Common.NotificationCenter.trigger('margins:update', opt, panel); - me.setMargins(panel, opt); + opt = dlg.getSettings(); + var margins = opt.margins; + Common.localStorage.setItem("sse-pgmargins-top", margins.asc_getTop()); + Common.localStorage.setItem("sse-pgmargins-left", margins.asc_getLeft()); + Common.localStorage.setItem("sse-pgmargins-bottom", margins.asc_getBottom()); + Common.localStorage.setItem("sse-pgmargins-right", margins.asc_getRight()); + Common.NotificationCenter.trigger('margins:update', margins, panel); + me.setMargins(panel, margins); var currentSheet = panel.cmbSheet.getValue(); - me._margins[currentSheet] = opt; + me._margins[currentSheet] = margins; if (me._changedProps && me._changedProps[currentSheet]) { - opt = dlg.getSettings(); me._changedProps[currentSheet].asc_setVerticalCentered(opt.vertical); me._changedProps[currentSheet].asc_setHorizontalCentered(opt.horizontal); } diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 03d2e2a1d4..72a3410207 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -4711,22 +4711,28 @@ define([ if (this.api) { this._state.pgmargins = undefined; if (item.value !== 'advanced') { - this.api.asc_changePageMargins(item.value[1], item.value[3], item.value[0], item.value[2], this.api.asc_getActiveWorksheetIndex()); + var props = new Asc.asc_CPageMargins(); + props.asc_setTop(item.value[0]); + props.asc_setBottom(item.value[2]); + props.asc_setLeft(item.value[1]); + props.asc_setRight(item.value[3]); + this.api.asc_changePageMargins(props, undefined, undefined, undefined, undefined, this.api.asc_getActiveWorksheetIndex()); } else { var win, props, me = this; win = new SSE.Views.PageMarginsDialog({ handler: function(dlg, result) { if (result == 'ok') { - props = dlg.getSettings().margins; - Common.localStorage.setItem("sse-pgmargins-top", props.asc_getTop()); - Common.localStorage.setItem("sse-pgmargins-left", props.asc_getLeft()); - Common.localStorage.setItem("sse-pgmargins-bottom", props.asc_getBottom()); - Common.localStorage.setItem("sse-pgmargins-right", props.asc_getRight()); - Common.NotificationCenter.trigger('margins:update', props); + props = dlg.getSettings(); + var margins = props.margins; + Common.localStorage.setItem("sse-pgmargins-top", margins.asc_getTop()); + Common.localStorage.setItem("sse-pgmargins-left", margins.asc_getLeft()); + Common.localStorage.setItem("sse-pgmargins-bottom", margins.asc_getBottom()); + Common.localStorage.setItem("sse-pgmargins-right", margins.asc_getRight()); + Common.NotificationCenter.trigger('margins:update', margins); me.toolbar.btnPageMargins.menu.items[0].setChecked(true); - me.api.asc_changePageMargins( props.asc_getLeft(), props.asc_getRight(), props.asc_getTop(), props.asc_getBottom(), me.api.asc_getActiveWorksheetIndex()); + me.api.asc_changePageMargins( margins, props.horizontal, props.vertical, undefined, undefined, me.api.asc_getActiveWorksheetIndex()); Common.NotificationCenter.trigger('edit:complete', me.toolbar); } } diff --git a/apps/spreadsheeteditor/main/app/view/PageMarginsDialog.js b/apps/spreadsheeteditor/main/app/view/PageMarginsDialog.js index 7d48ae3778..6aeaf00483 100644 --- a/apps/spreadsheeteditor/main/app/view/PageMarginsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/PageMarginsDialog.js @@ -259,8 +259,6 @@ define([ props.asc_setLeft(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue())); props.asc_setRight(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue())); - // props.asc_setVerticalCentered(this.chVert.getValue()==='checked'); - // props.asc_setHorizontalCentered(this.chHor.getValue()==='checked'); return {margins: props, vertical: this.chVert.getValue()==='checked', horizontal: this.chHor.getValue()==='checked'}; }, diff --git a/apps/spreadsheeteditor/mobile/src/controller/settings/SpreadsheetSettings.jsx b/apps/spreadsheeteditor/mobile/src/controller/settings/SpreadsheetSettings.jsx index b1030ab10a..4c9c8caf5a 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/settings/SpreadsheetSettings.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/settings/SpreadsheetSettings.jsx @@ -59,7 +59,7 @@ class SpreadsheetSettingsController extends Component { case 'bottom': changeProps.asc_setBottom(marginValue); break; } - api.asc_changePageMargins(changeProps.asc_getLeft(), changeProps.asc_getRight(), changeProps.asc_getTop(), changeProps.asc_getBottom(), api.asc_getActiveWorksheetIndex()); + api.asc_changePageMargins(changeProps, undefined, undefined, undefined, undefined, api.asc_getActiveWorksheetIndex()); } onOrientationChange(value) {