From 7c9cd0ebbe4a3c2c6b6cfd3a1f13108a426afe4f Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Wed, 13 Nov 2019 17:21:23 +0300 Subject: [PATCH 1/6] [DE] Margins Dialog: change layout --- .../main/app/view/PageMarginsDialog.js | 113 +++++++++++++++--- 1 file changed, 94 insertions(+), 19 deletions(-) diff --git a/apps/documenteditor/main/app/view/PageMarginsDialog.js b/apps/documenteditor/main/app/view/PageMarginsDialog.js index b1c6f83cb..571b796bb 100644 --- a/apps/documenteditor/main/app/view/PageMarginsDialog.js +++ b/apps/documenteditor/main/app/view/PageMarginsDialog.js @@ -45,9 +45,9 @@ define([ DE.Views.PageMarginsDialog = Common.UI.Window.extend(_.extend({ options: { - width: 215, + width: 404, header: true, - style: 'min-width: 216px;', + style: 'min-width: 404px;', cls: 'modal-dlg', id: 'window-page-margins', buttons: ['ok', 'cancel'] @@ -59,31 +59,50 @@ define([ }, options || {}); this.template = [ - '
', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '
', + '
', + '
' + this.textMultiplePages + '', + '
', + '
', + '
', '', '
', - '
', + '', + '
', '', '
', - '
', + '', + '', + '
', + '
', '', '
', - '
', + '', + '
', '', '
', - '
', + '
', + '', + '
', + '
', + '', + '
', + '
', + '
', + '', + '
', + '
', + '
', + '
', + '', + '
', + '
', + '', + '
', + '', + '
', + '
', '', - '
' ].join(''); this.options.tpl = _.template(this.template)(this.options); @@ -98,6 +117,18 @@ define([ render: function() { Common.UI.Window.prototype.render.call(this); + this.cmbMultiplePages = new Common.UI.ComboBox({ + el : $('#page-margins-cmb-multiple-pages'), + menuStyle : 'min-width: 180px;', + style : 'width: 180px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 0, displayValue: this.textNormal }, + { value: 1, displayValue: this.textMirrorMargins } + ] + }); + this.spnTop = new Common.UI.MetricSpinner({ el: $('#page-margins-spin-top'), step: .1, @@ -142,6 +173,41 @@ define([ }); this.spinners.push(this.spnRight); + this.spnGutter = new Common.UI.MetricSpinner({ + el: $('#page-margins-spin-gutter'), + step: .1, + width: 86, + defaultUnit : "cm", + value: '1 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spinners.push(this.spnLeft); + + this.cmbGutterPosition = new Common.UI.ComboBox({ + el : $('#page-margins-spin-gutter-position'), + menuStyle : 'min-width: 86px;', + style : 'width: 86px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 0, displayValue: this.textLeft }, + { value: 1, displayValue: this.textTop } + ] + }); + + this.cmbOrientation = new Common.UI.ComboBox({ + el : $('#page-margins-cmb-orientation'), + menuStyle : 'min-width: 180px;', + style : 'width: 180px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 0, displayValue: this.textPortrait }, + { value: 1, displayValue: this.textLandscape } + ] + }); + var $window = this.getChild(); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); @@ -221,6 +287,15 @@ define([ textRight: 'Right', notcriticalErrorTitle: 'Warning', txtMarginsW: 'Left and right margins are too high for a given page wight', - txtMarginsH: 'Top and bottom margins are too high for a given page height' + txtMarginsH: 'Top and bottom margins are too high for a given page height', + textMultiplePages: 'Multiple pages', + textGutter: 'Gutter', + textGutterPosition: 'Gutter position', + textOrientation: 'Orientation', + textPreview: 'Preview', + textPortrait: 'Portrait', + textLandscape: 'Landscape', + textMirrorMargins: 'Mirror margins', + textNormal: 'Normal' }, DE.Views.PageMarginsDialog || {})) }); \ No newline at end of file From 6f4fbd5f47b01c7e584fa1a0a1be1d98fcec68b2 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Mon, 18 Nov 2019 11:12:35 +0300 Subject: [PATCH 2/6] [DE] Bug 43059 ( Margins Dialog) --- .../main/app/view/PageMarginsDialog.js | 83 +++++++++++-------- 1 file changed, 48 insertions(+), 35 deletions(-) diff --git a/apps/documenteditor/main/app/view/PageMarginsDialog.js b/apps/documenteditor/main/app/view/PageMarginsDialog.js index 571b796bb..5ed6ab1e3 100644 --- a/apps/documenteditor/main/app/view/PageMarginsDialog.js +++ b/apps/documenteditor/main/app/view/PageMarginsDialog.js @@ -55,15 +55,14 @@ define([ initialize : function(options) { _.extend(this.options, { - title: this.textTitle + title: this.textMargins }, options || {}); this.template = [ - '
', - '
' + this.textMultiplePages + '', - '
', - '
', + '
', + '
', + '', + '
', '
', '', '
', @@ -73,34 +72,35 @@ define([ '
', '
', '
', - '
', + '
', '
', - '', + '', '
', '
', '
', - '', + '', '
', '
', '
', '
', - '
', - '', - '
', - '
', - '
', - '', - '
', + '', + '
', + '
', + '
', '
', '
', '
', - '', + '', '
', '
', + '
', + '', + '
', + '
', '
', '
', - '', - '
', + '', + '
', '
', '
', ].join(''); @@ -117,18 +117,6 @@ define([ render: function() { Common.UI.Window.prototype.render.call(this); - this.cmbMultiplePages = new Common.UI.ComboBox({ - el : $('#page-margins-cmb-multiple-pages'), - menuStyle : 'min-width: 180px;', - style : 'width: 180px;', - editable : false, - cls : 'input-group-nr', - data : [ - { value: 0, displayValue: this.textNormal }, - { value: 1, displayValue: this.textMirrorMargins } - ] - }); - this.spnTop = new Common.UI.MetricSpinner({ el: $('#page-margins-spin-top'), step: .1, @@ -208,8 +196,29 @@ define([ ] }); - var $window = this.getChild(); - $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); + this.cmbMultiplePages = new Common.UI.ComboBox({ + el : $('#page-margins-cmb-multiple-pages'), + menuStyle : 'min-width: 180px;', + style : 'width: 180px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 0, displayValue: this.textNormal }, + { value: 1, displayValue: this.textMirrorMargins } + ] + }); + this.cmbMultiplePages.on('selected', _.bind(function(combo, record) { + if (record.value === 0) { + this.window.find('#margin-left-label').html(this.textLeft); + this.window.find('#margin-right-label').html(this.textRight); + } else { + this.window.find('#margin-left-label').html(this.textInside); + this.window.find('#margin-right-label').html(this.textOutside); + } + }, this)); + + this.window = this.getChild(); + this.window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.updateMetricUnit(); }, @@ -258,6 +267,7 @@ define([ this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_BottomMargin()), true); this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_LeftMargin()), true); this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_RightMargin()), true); + this.cmbOrientation.setValue(props.get_Orientation()); } }, @@ -267,6 +277,7 @@ define([ props.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(this.spnBottom.getNumberValue())); props.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue())); props.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue())); + props.put_Orientation(this.cmbOrientation.getValue()); return props; }, @@ -280,7 +291,7 @@ define([ } }, - textTitle: 'Margins', + textMargins: 'Margins', textTop: 'Top', textLeft: 'Left', textBottom: 'Bottom', @@ -296,6 +307,8 @@ define([ textPortrait: 'Portrait', textLandscape: 'Landscape', textMirrorMargins: 'Mirror margins', - textNormal: 'Normal' + textNormal: 'Normal', + textInside: 'Inside', + textOutside: 'Outside' }, DE.Views.PageMarginsDialog || {})) }); \ No newline at end of file From 026233f10e6d5f05ed3d95c51768f754f20802bd Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Wed, 27 Nov 2019 10:32:32 +0300 Subject: [PATCH 3/6] [DE] Bug 43059 ( Margins Dialog: Preview) --- .../main/app/view/PageMarginsDialog.js | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/apps/documenteditor/main/app/view/PageMarginsDialog.js b/apps/documenteditor/main/app/view/PageMarginsDialog.js index 5ed6ab1e3..279c5f7fc 100644 --- a/apps/documenteditor/main/app/view/PageMarginsDialog.js +++ b/apps/documenteditor/main/app/view/PageMarginsDialog.js @@ -126,6 +126,13 @@ define([ maxValue: 55.88, minValue: -55.87 }); + this.spnTop.on('change', _.bind(function (field, newValue, oldValue) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); this.spinners.push(this.spnTop); this.spnBottom = new Common.UI.MetricSpinner({ @@ -137,6 +144,13 @@ define([ maxValue: 55.88, minValue: -55.87 }); + this.spnBottom.on('change', _.bind(function (field, newValue, oldValue) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); this.spinners.push(this.spnBottom); this.spnLeft = new Common.UI.MetricSpinner({ @@ -148,6 +162,13 @@ define([ maxValue: 55.88, minValue: 0 }); + this.spnLeft.on('change', _.bind(function (field, newValue, oldValue) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); this.spinners.push(this.spnLeft); this.spnRight = new Common.UI.MetricSpinner({ @@ -159,6 +180,13 @@ define([ maxValue: 55.88, minValue: 0 }); + this.spnRight.on('change', _.bind(function (field, newValue, oldValue) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); this.spinners.push(this.spnRight); this.spnGutter = new Common.UI.MetricSpinner({ @@ -170,6 +198,13 @@ define([ maxValue: 55.88, minValue: 0 }); + this.spnGutter.on('change', _.bind(function (field, newValue, oldValue) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_Gutter(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); this.spinners.push(this.spnLeft); this.cmbGutterPosition = new Common.UI.ComboBox({ @@ -183,6 +218,13 @@ define([ { value: 1, displayValue: this.textTop } ] }); + this.cmbGutterPosition.on('selected', _.bind(function (combo, record) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_GutterAtTop(record.value); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); this.cmbOrientation = new Common.UI.ComboBox({ el : $('#page-margins-cmb-orientation'), @@ -195,6 +237,13 @@ define([ { value: 1, displayValue: this.textLandscape } ] }); + this.cmbOrientation.on('selected', _.bind(function (combo, record) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_Orientation(record.value); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); this.cmbMultiplePages = new Common.UI.ComboBox({ el : $('#page-margins-cmb-multiple-pages'), @@ -215,6 +264,11 @@ define([ this.window.find('#margin-left-label').html(this.textInside); this.window.find('#margin-right-label').html(this.textOutside); } + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_MirrorMargins(record.value); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } }, this)); this.window = this.getChild(); @@ -256,6 +310,7 @@ define([ setSettings: function (props) { if (props) { + this.properties = props; this.maxMarginsH = Common.Utils.Metric.fnRecalcFromMM(props.get_H() - 2.6); this.maxMarginsW = Common.Utils.Metric.fnRecalcFromMM(props.get_W() - 12.7); this.spnTop.setMaxValue(this.maxMarginsH); @@ -268,6 +323,10 @@ define([ this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_LeftMargin()), true); this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_RightMargin()), true); this.cmbOrientation.setValue(props.get_Orientation()); + + if (this.api) { + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } } }, From 3b2f238f0dc169af178f4a6105db5cfae96d2701 Mon Sep 17 00:00:00 2001 From: Julia Svinareva Date: Thu, 28 Nov 2019 12:01:45 +0300 Subject: [PATCH 4/6] [DE] Bug 43059 ( Margins Dialog) --- .../main/app/view/PageMarginsDialog.js | 20 ++++++++++++++++++- apps/documenteditor/main/locale/en.json | 11 ++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/view/PageMarginsDialog.js b/apps/documenteditor/main/app/view/PageMarginsDialog.js index 279c5f7fc..a30b935a0 100644 --- a/apps/documenteditor/main/app/view/PageMarginsDialog.js +++ b/apps/documenteditor/main/app/view/PageMarginsDialog.js @@ -205,7 +205,7 @@ define([ //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); } }, this)); - this.spinners.push(this.spnLeft); + this.spinners.push(this.spnGutter); this.cmbGutterPosition = new Common.UI.ComboBox({ el : $('#page-margins-spin-gutter-position'), @@ -260,9 +260,12 @@ define([ if (record.value === 0) { this.window.find('#margin-left-label').html(this.textLeft); this.window.find('#margin-right-label').html(this.textRight); + this.cmbGutterPosition.setDisabled(false); } else { this.window.find('#margin-left-label').html(this.textInside); this.window.find('#margin-right-label').html(this.textOutside); + this.cmbGutterPosition.setValue(0); + this.cmbGutterPosition.setDisabled(true); } if (this.api) { this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); @@ -324,6 +327,18 @@ define([ this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_RightMargin()), true); this.cmbOrientation.setValue(props.get_Orientation()); + this.spnGutter.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_Gutter()), true); + this.cmbGutterPosition.setValue(props.get_GutterAtTop() ? 1 : 0); + var mirrorMargins = props.get_MirrorMargins(); + this.cmbMultiplePages.setValue(mirrorMargins ? 1 : 0); + + if (mirrorMargins) { + this.window.find('#margin-left-label').html(this.textInside); + this.window.find('#margin-right-label').html(this.textOutside); + this.cmbGutterPosition.setValue(0); + } + this.cmbGutterPosition.setDisabled(mirrorMargins); + if (this.api) { //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); } @@ -337,6 +352,9 @@ define([ props.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue())); props.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue())); props.put_Orientation(this.cmbOrientation.getValue()); + props.put_Gutter(Common.Utils.Metric.fnRecalcToMM(this.spnGutter.getNumberValue())); + props.put_GutterAtTop(this.cmbGutterPosition.getValue() ? true : false); + props.put_MirrorMargins(this.cmbMultiplePages.getValue() ? true : false); return props; }, diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 3b2bac95c..c39000730 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1757,6 +1757,17 @@ "DE.Views.PageMarginsDialog.textTop": "Top", "DE.Views.PageMarginsDialog.txtMarginsH": "Top and bottom margins are too high for a given page height", "DE.Views.PageMarginsDialog.txtMarginsW": "Left and right margins are too wide for a given page width", + "DE.Views.PageMarginsDialog.textMultiplePages": "Multiple pages", + "DE.Views.PageMarginsDialog.textGutter": "Gutter", + "DE.Views.PageMarginsDialog.textGutterPosition": "Gutter position", + "DE.Views.PageMarginsDialog.textOrientation": "Orientation", + "DE.Views.PageMarginsDialog.textPreview": "Preview", + "DE.Views.PageMarginsDialog.textPortrait": "Portrait", + "DE.Views.PageMarginsDialog.textLandscape": "Landscape", + "DE.Views.PageMarginsDialog.textMirrorMargins": "Mirror margins", + "DE.Views.PageMarginsDialog.textNormal": "Normal", + "DE.Views.PageMarginsDialog.textInside": "Inside", + "DE.Views.PageMarginsDialog.textOutside": "Outside", "DE.Views.PageSizeDialog.textHeight": "Height", "DE.Views.PageSizeDialog.textPreset": "Preset", "DE.Views.PageSizeDialog.textTitle": "Page Size", From d2e157abc7a883bd17363a114e2ab4c62d722a2f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 Nov 2019 15:04:53 +0300 Subject: [PATCH 5/6] [DE] Page margins refactoring --- apps/documenteditor/main/app/view/PageMarginsDialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/view/PageMarginsDialog.js b/apps/documenteditor/main/app/view/PageMarginsDialog.js index a30b935a0..71a6be5fc 100644 --- a/apps/documenteditor/main/app/view/PageMarginsDialog.js +++ b/apps/documenteditor/main/app/view/PageMarginsDialog.js @@ -102,7 +102,7 @@ define([ '', '
', '
', - '
', + '
' ].join(''); this.options.tpl = _.template(this.template)(this.options); From c140cb85b2a83f9abc5033cb220657b6a0a6983b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 28 Nov 2019 15:12:04 +0300 Subject: [PATCH 6/6] [DE] Change translation --- apps/documenteditor/main/app/view/PageMarginsDialog.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/main/app/view/PageMarginsDialog.js b/apps/documenteditor/main/app/view/PageMarginsDialog.js index 71a6be5fc..a195a093f 100644 --- a/apps/documenteditor/main/app/view/PageMarginsDialog.js +++ b/apps/documenteditor/main/app/view/PageMarginsDialog.js @@ -55,13 +55,13 @@ define([ initialize : function(options) { _.extend(this.options, { - title: this.textMargins + title: this.textTitle }, options || {}); this.template = [ '
', '
', - '', + '', '
', '
', '', @@ -368,7 +368,7 @@ define([ } }, - textMargins: 'Margins', + textTitle: 'Margins', textTop: 'Top', textLeft: 'Left', textBottom: 'Bottom',