From 4a43eaa15158f6530be9f913568995a779b8ee61 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 18 Jan 2018 14:14:33 +0300 Subject: [PATCH 1/4] [DE] Change settings for header/footer: page numbering. --- .../template/HeaderFooterSettings.template | 84 +++++++++++----- .../main/app/view/HeaderFooterSettings.js | 96 ++++++++++++++++++- apps/documenteditor/main/locale/en.json | 6 ++ 3 files changed, 155 insertions(+), 31 deletions(-) diff --git a/apps/documenteditor/main/app/template/HeaderFooterSettings.template b/apps/documenteditor/main/app/template/HeaderFooterSettings.template index f540f29c5..d1a480419 100644 --- a/apps/documenteditor/main/app/template/HeaderFooterSettings.template +++ b/apps/documenteditor/main/app/template/HeaderFooterSettings.template @@ -1,28 +1,4 @@ - - - - - - - - - - - - - @@ -55,9 +31,65 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- -
-
-
-
-
-
-
-
-
-
-
@@ -40,7 +16,7 @@
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/apps/documenteditor/main/app/view/HeaderFooterSettings.js b/apps/documenteditor/main/app/view/HeaderFooterSettings.js index c1b986128..8a40e8e92 100644 --- a/apps/documenteditor/main/app/view/HeaderFooterSettings.js +++ b/apps/documenteditor/main/app/view/HeaderFooterSettings.js @@ -45,7 +45,8 @@ define([ 'backbone', 'common/main/lib/component/Button', 'common/main/lib/component/MetricSpinner', - 'common/main/lib/component/CheckBox' + 'common/main/lib/component/CheckBox', + 'common/main/lib/component/RadioBox' ], function (menuTemplate, $, _, Backbone) { 'use strict'; @@ -72,7 +73,9 @@ define([ DiffFirst: false, DiffOdd: false, SameAs: false, - DisabledControls: false + DisabledControls: false, + Numbering: true, + From: 1 }; this.spinners = []; this.lockedControls = []; @@ -129,10 +132,23 @@ define([ value = prop.get_LinkToPrevious(); if ( this._state.SameAs!==value ) { - this.chSameAs.setDisabled(value===null); + this.chSameAs.setDisabled(value===null || this._locked); this.chSameAs.setValue(value==true, true); this._state.SameAs=value; } + + // value = prop.get_PageNumbering(); + if ( this._state.Numbering!==value ) { + this.radioPrev.setValue(!!value); + this.radioFrom.setValue(!value); + this._state.Numbering=value; + } + + // value = prop.get_NumberingFrom(); + if ( this._state.From!==value ) { + this.numFrom.setValue(value===null ? '' : value); + this._state.From=value; + } } }, @@ -166,6 +182,36 @@ define([ this.fireEvent('editcomplete', this); }, + onInsertCurrentClick: function() { + if (this.api) + this.api.put_PageNum(-1); + this.fireEvent('editcomplete', this); + }, + + onRadioPrev: function(field, newValue, eOpts) { + if (newValue && this.api) { + // this.api.HeadersAndFooters_FromPrevious(newValue); + } + this.fireEvent('editcomplete', this); + }, + + onRadioFrom: function(field, newValue, eOpts) { + if (newValue && this.api) { + if (_.isEmpty(this.numFrom.getValue())) + this.numFrom.setValue(1); + // this.api.HeadersAndFooters_From(this.numFrom.getNumberValue()); + } + this.fireEvent('editcomplete', this); + }, + + onNumFromChange: function(field, newValue, oldValue, eOpts){ + if (this.api) { + this.radioFrom.setValue(true); + // this.api.HeadersAndFooters_From(field.getNumberValue()); + } + this.fireEvent('editcomplete', this); + }, + updateMetricUnit: function() { if (this.spinners) { for (var i=0; i Date: Mon, 22 Jan 2018 11:49:46 +0300 Subject: [PATCH 2/4] [DE] Debug Header/Footer settings. --- apps/documenteditor/main/app/view/HeaderFooterSettings.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/documenteditor/main/app/view/HeaderFooterSettings.js b/apps/documenteditor/main/app/view/HeaderFooterSettings.js index 8a40e8e92..2794682e5 100644 --- a/apps/documenteditor/main/app/view/HeaderFooterSettings.js +++ b/apps/documenteditor/main/app/view/HeaderFooterSettings.js @@ -139,14 +139,14 @@ define([ // value = prop.get_PageNumbering(); if ( this._state.Numbering!==value ) { - this.radioPrev.setValue(!!value); - this.radioFrom.setValue(!value); + this.radioPrev.setValue(!!value, true); + this.radioFrom.setValue(!value, true); this._state.Numbering=value; } // value = prop.get_NumberingFrom(); if ( this._state.From!==value ) { - this.numFrom.setValue(value===null ? '' : value); + this.numFrom.setValue(value===null ? '' : value, true); this._state.From=value; } } From 02fc85f1f5e12592ad5b2fbd0506e6f59998644a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 22 Jan 2018 13:15:20 +0300 Subject: [PATCH 3/4] [DE] Debug header/footer settings. --- .../main/app/view/HeaderFooterSettings.js | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/apps/documenteditor/main/app/view/HeaderFooterSettings.js b/apps/documenteditor/main/app/view/HeaderFooterSettings.js index 2794682e5..d7aee01f3 100644 --- a/apps/documenteditor/main/app/view/HeaderFooterSettings.js +++ b/apps/documenteditor/main/app/view/HeaderFooterSettings.js @@ -74,8 +74,7 @@ define([ DiffOdd: false, SameAs: false, DisabledControls: false, - Numbering: true, - From: 1 + Numbering: undefined }; this.spinners = []; this.lockedControls = []; @@ -137,17 +136,12 @@ define([ this._state.SameAs=value; } - // value = prop.get_PageNumbering(); - if ( this._state.Numbering!==value ) { - this.radioPrev.setValue(!!value, true); - this.radioFrom.setValue(!value, true); - this._state.Numbering=value; - } - // value = prop.get_NumberingFrom(); - if ( this._state.From!==value ) { - this.numFrom.setValue(value===null ? '' : value, true); - this._state.From=value; + if ( this._state.Numbering!==value && value !== null) { + this.radioPrev.setValue(value<0, true); + this.radioFrom.setValue(value>-1, true); + this.numFrom.setValue(value<0 ? '' : value, true); + this._state.Numbering=value; } } }, @@ -190,7 +184,7 @@ define([ onRadioPrev: function(field, newValue, eOpts) { if (newValue && this.api) { - // this.api.HeadersAndFooters_FromPrevious(newValue); + // this.api.HeadersAndFooters_FromPrevious(-1); } this.fireEvent('editcomplete', this); }, From eb587685230baedf482e95e00e9e83c70c1df34f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Mon, 22 Jan 2018 14:59:26 +0300 Subject: [PATCH 4/4] [DE] Use api methods for header/footer settings. --- .../main/app/view/HeaderFooterSettings.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/documenteditor/main/app/view/HeaderFooterSettings.js b/apps/documenteditor/main/app/view/HeaderFooterSettings.js index d7aee01f3..c482bb516 100644 --- a/apps/documenteditor/main/app/view/HeaderFooterSettings.js +++ b/apps/documenteditor/main/app/view/HeaderFooterSettings.js @@ -136,11 +136,14 @@ define([ this._state.SameAs=value; } - // value = prop.get_NumberingFrom(); + value = prop.get_StartPageNumber(); if ( this._state.Numbering!==value && value !== null) { - this.radioPrev.setValue(value<0, true); - this.radioFrom.setValue(value>-1, true); - this.numFrom.setValue(value<0 ? '' : value, true); + if (value<0) + this.radioPrev.setValue(true, true); + else { + this.radioFrom.setValue(true, true); + this.numFrom.setValue(value, true); + } this._state.Numbering=value; } } @@ -184,7 +187,7 @@ define([ onRadioPrev: function(field, newValue, eOpts) { if (newValue && this.api) { - // this.api.HeadersAndFooters_FromPrevious(-1); + this.api.asc_SetSectionStartPage(-1); } this.fireEvent('editcomplete', this); }, @@ -192,16 +195,16 @@ define([ onRadioFrom: function(field, newValue, eOpts) { if (newValue && this.api) { if (_.isEmpty(this.numFrom.getValue())) - this.numFrom.setValue(1); - // this.api.HeadersAndFooters_From(this.numFrom.getNumberValue()); + this.numFrom.setValue(1, true); + this.api.asc_SetSectionStartPage(this.numFrom.getNumberValue()); } this.fireEvent('editcomplete', this); }, onNumFromChange: function(field, newValue, oldValue, eOpts){ if (this.api) { - this.radioFrom.setValue(true); - // this.api.HeadersAndFooters_From(field.getNumberValue()); + this.radioFrom.setValue(true, true); + this.api.asc_SetSectionStartPage(field.getNumberValue()); } this.fireEvent('editcomplete', this); }, @@ -305,7 +308,7 @@ define([ value: '1', defaultUnit : "", maxValue: 2147483646, - minValue: 1, + minValue: 0, allowDecimal: false }); this.lockedControls.push(this.numFrom);