diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js
index ef6a0c2874..d02617a23f 100644
--- a/apps/spreadsheeteditor/main/app/controller/Print.js
+++ b/apps/spreadsheeteditor/main/app/controller/Print.js
@@ -601,14 +601,20 @@ define([
handler: function(dlg, result) {
var opt;
if (result == 'ok') {
- opt = dlg.getSettings();
+ 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);
- me._margins[panel.cmbSheet.getValue()] = opt;
+ var currentSheet = panel.cmbSheet.getValue();
+ me._margins[currentSheet] = opt;
+ if (me._changedProps && me._changedProps[currentSheet]) {
+ opt = dlg.getSettings();
+ me._changedProps[currentSheet].asc_setVerticalCentered(opt.vertical);
+ me._changedProps[currentSheet].asc_setHorizontalCentered(opt.horizontal);
+ }
setChanges();
Common.NotificationCenter.trigger('edit:complete');
} else {
diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js
index 32fc0d0a0a..03d2e2a1d4 100644
--- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js
+++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js
@@ -4718,7 +4718,7 @@ define([
win = new SSE.Views.PageMarginsDialog({
handler: function(dlg, result) {
if (result == 'ok') {
- props = dlg.getSettings();
+ 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());
diff --git a/apps/spreadsheeteditor/main/app/view/PageMarginsDialog.js b/apps/spreadsheeteditor/main/app/view/PageMarginsDialog.js
index 904b537c0c..7d48ae3778 100644
--- a/apps/spreadsheeteditor/main/app/view/PageMarginsDialog.js
+++ b/apps/spreadsheeteditor/main/app/view/PageMarginsDialog.js
@@ -45,6 +45,7 @@ define([
SSE.Views.PageMarginsDialog = Common.UI.Window.extend(_.extend({
options: {
width: 215,
+ height: 'auto',
header: true,
style: 'min-width: 216px;',
cls: 'modal-dlg',
@@ -58,8 +59,8 @@ define([
}, options || {});
this.template = [
- '
',
- '
',
+ '',
+ '
',
'',
'| ',
'',
@@ -71,15 +72,30 @@ define([
' | ',
'
',
'',
- '| ',
+ ' | ',
'',
'',
' | ',
- '',
+ ' | ',
'',
'',
' | ',
'
',
+ '',
+ '| ',
+ '',
+ ' | ',
+ '
',
+ '',
+ '| ',
+ '',
+ ' | ',
+ '
',
+ '',
+ '| ',
+ '',
+ ' | ',
+ '
',
'
',
'
',
''
@@ -96,9 +112,10 @@ define([
render: function() {
Common.UI.Window.prototype.render.call(this);
+ var $window = this.getChild();
this.spnTop = new Common.UI.MetricSpinner({
- el: $('#page-margins-spin-top'),
+ el: $('#page-margins-spin-top', $window),
step: .1,
width: 86,
defaultUnit : "cm",
@@ -109,7 +126,7 @@ define([
this.spinners.push(this.spnTop);
this.spnBottom = new Common.UI.MetricSpinner({
- el: $('#page-margins-spin-bottom'),
+ el: $('#page-margins-spin-bottom', $window),
step: .1,
width: 86,
defaultUnit : "cm",
@@ -120,7 +137,7 @@ define([
this.spinners.push(this.spnBottom);
this.spnLeft = new Common.UI.MetricSpinner({
- el: $('#page-margins-spin-left'),
+ el: $('#page-margins-spin-left', $window),
step: .1,
width: 86,
defaultUnit : "cm",
@@ -131,7 +148,7 @@ define([
this.spinners.push(this.spnLeft);
this.spnRight = new Common.UI.MetricSpinner({
- el: $('#page-margins-spin-right'),
+ el: $('#page-margins-spin-right', $window),
step: .1,
width: 86,
defaultUnit : "cm",
@@ -141,7 +158,16 @@ define([
});
this.spinners.push(this.spnRight);
- var $window = this.getChild();
+ this.chVert = new Common.UI.CheckBox({
+ el: $('#page-margins-chk-vert', $window),
+ labelText: this.textVert
+ });
+
+ this.chHor = new Common.UI.CheckBox({
+ el: $('#page-margins-chk-hor', $window),
+ labelText: this.textHor
+ });
+
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
$window.find('input').on('keypress', _.bind(this.onKeyPress, this));
@@ -149,7 +175,7 @@ define([
},
getFocusedComponents: function() {
- return this.spinners;
+ return this.spinners.concat([this.chVert, this.chHor]);
},
getDefaultFocusableComponent: function () {
@@ -220,6 +246,9 @@ define([
this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(margins.asc_getBottom()), true);
this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(margins.asc_getLeft()), true);
this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(margins.asc_getRight()), true);
+
+ this.chVert.setValue(!!props.asc_getVerticalCentered());
+ this.chHor.setValue(!!props.asc_getHorizontalCentered());
}
},
@@ -229,7 +258,10 @@ define([
props.asc_setBottom(Common.Utils.Metric.fnRecalcToMM(this.spnBottom.getNumberValue()));
props.asc_setLeft(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue()));
props.asc_setRight(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue()));
- return props;
+
+ // 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'};
},
updateMetricUnit: function() {
@@ -247,6 +279,9 @@ define([
textBottom: 'Bottom',
textRight: 'Right',
textWarning: 'Warning',
- warnCheckMargings: 'Margins are incorrect'
+ warnCheckMargings: 'Margins are incorrect',
+ textCenter: 'Center on page',
+ textVert: 'Vertically',
+ textHor: 'Horizontally'
}, SSE.Views.PageMarginsDialog || {}))
});
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json
index dcf629347a..e021545dac 100644
--- a/apps/spreadsheeteditor/main/locale/en.json
+++ b/apps/spreadsheeteditor/main/locale/en.json
@@ -3050,6 +3050,9 @@
"SSE.Views.PageMarginsDialog.textTop": "Top",
"SSE.Views.PageMarginsDialog.textWarning": "Warning",
"SSE.Views.PageMarginsDialog.warnCheckMargings": "Margins are incorrect",
+ "SSE.Views.PageMarginsDialog.textCenter": "Center on page",
+ "SSE.Views.PageMarginsDialog.textVert": "Vertically",
+ "SSE.Views.PageMarginsDialog.textHor": "Horizontally",
"SSE.Views.ParagraphSettings.strLineHeight": "Line Spacing",
"SSE.Views.ParagraphSettings.strParagraphSpacing": "Paragraph Spacing",
"SSE.Views.ParagraphSettings.strSpacingAfter": "After",