[SSE] For bug 56671

This commit is contained in:
Julia Radzhabova
2023-09-05 17:56:51 +03:00
parent bb3420d944
commit 35ef415746
4 changed files with 59 additions and 15 deletions

View File

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

View File

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

View File

@ -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 = [
'<div class="box" style="height: 85px;">',
'<table cols="2" style="width: 100%;margin-bottom: 10px;">',
'<div class="box">',
'<table cols="2" style="width: 100%;margin-bottom: 8px;">',
'<tr>',
'<td class="padding-right-10" style="padding-bottom: 8px;">',
'<label class="input-label">' + this.textTop + '</label>',
@ -71,15 +72,30 @@ define([
'</td>',
'</tr>',
'<tr>',
'<td class="padding-small padding-right-10">',
'<td class="padding-small padding-right-10" style="padding-bottom: 16px;">',
'<label class="input-label">' + this.textLeft + '</label>',
'<div id="page-margins-spin-left"></div>',
'</td>',
'<td class="padding-small">',
'<td class="padding-small" style="padding-bottom: 16px;">',
'<label class="input-label">' + this.textRight + '</label>',
'<div id="page-margins-spin-right"></div>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="2" class="padding-small" style="padding-bottom: 4px;">',
'<label class="input-label">' + this.textCenter + '</label>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="2" class="padding-small" style="padding-bottom: 8px;">',
'<div id="page-margins-chk-vert"></div>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="2" class="padding-small">',
'<div id="page-margins-chk-hor"></div>',
'</td>',
'</tr>',
'</table>',
'</div>',
'<div class="separator horizontal"></div>'
@ -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 || {}))
});

View File

@ -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",