[DE] Change settings for header/footer: page numbering.

This commit is contained in:
Julia Radzhabova 2018-01-18 14:14:33 +03:00
parent 1bbf47dd44
commit 4a43eaa151
3 changed files with 155 additions and 31 deletions

View file

@ -1,28 +1,4 @@
<table cols="1">
<tr>
<td>
<label class="header"><%= scope.textPageNum %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="headerfooter-button-top-left" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-top-center" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-top-right" style="display: inline-block; margin-right:5px;"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="headerfooter-button-bottom-left" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-bottom-center" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-bottom-right" style="display: inline-block; margin-right:5px;"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td>
<label class="header"><%= scope.textPosition %></label>
@ -40,7 +16,7 @@
</td>
</tr>
<tr>
<td>
<td class="padding-small">
<label class="header"><%= scope.textOptions %></label>
</td>
</tr>
@ -55,9 +31,65 @@
</td>
</tr>
<tr>
<td>
<td class="padding-small">
<div id="headerfooter-check-same-as"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="header"><%= scope.textPageNum %></label>
</td>
</tr>
<tr>
<td>
<label><%= scope.textTopPage %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="headerfooter-button-top-left" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-top-center" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-top-right" style="display: inline-block; margin-right:5px;"></div>
</td>
</tr>
<tr>
<td>
<label><%= scope.textBottomPage %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="headerfooter-button-bottom-left" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-bottom-center" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-bottom-right" style="display: inline-block; margin-right:5px;"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<button type="button" class="btn btn-text-default" id="headerfooter-button-current" style="width:100%;"><%= scope.textInsertCurrent %></button>
</td>
</tr>
<tr>
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="header"><%= scope.textPageNumbering %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="headerfooter-radio-prev" style="margin-bottom: 5px;"></div>
<div id="headerfooter-radio-from" style="display: inline-block;vertical-align: middle; margin-right: 2px;"></div>
<div id="headerfooter-spin-from" style="display: inline-block;vertical-align: middle;"></div>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View file

@ -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<this.spinners.length; i++) {
@ -231,12 +277,45 @@ define([
el: $('#headerfooter-check-same-as'),
labelText: this.textSameAs
});
this.lockedControls.push(this.chSameAs);
this.numPosition.on('change', _.bind(this.onNumPositionChange, this));
this.chDiffFirst.on('change', _.bind(this.onDiffFirstChange, this));
this.chDiffOdd.on('change', _.bind(this.onDiffOddChange, this));
this.chSameAs.on('change', _.bind(this.onSameAsChange, this));
this.btnInsertCurrent = new Common.UI.Button({
el: $('#headerfooter-button-current')
});
this.lockedControls.push(this.btnInsertCurrent);
this.btnInsertCurrent.on('click', _.bind(this.onInsertCurrentClick, this));
this.radioPrev = new Common.UI.RadioBox({
el: $('#headerfooter-radio-prev'),
labelText: this.textPrev,
name: 'asc-radio-header-numbering',
checked: true
}).on('change', _.bind(this.onRadioPrev, this));
this.lockedControls.push(this.radioPrev);
this.radioFrom = new Common.UI.RadioBox({
el: $('#headerfooter-radio-from'),
labelText: this.textFrom,
name: 'asc-radio-header-numbering'
}).on('change', _.bind(this.onRadioFrom, this));
this.lockedControls.push(this.radioFrom);
this.numFrom = new Common.UI.MetricSpinner({
el: $('#headerfooter-spin-from'),
step: 1,
width: 85,
value: '1',
defaultUnit : "",
maxValue: 2147483646,
minValue: 1,
allowDecimal: false
});
this.lockedControls.push(this.numFrom);
this.numFrom.on('change', _.bind(this.onNumFromChange, this));
},
createDelayedElements: function() {
@ -257,6 +336,7 @@ define([
_.each(this.lockedControls, function(item) {
item.setDisabled(disable);
});
this.chSameAs.setDisabled(disable || (this._state.SameAs===null));
}
},
@ -273,6 +353,12 @@ define([
textBottomLeft: 'Bottom Left',
textBottomRight: 'Bottom Right',
textBottomCenter: 'Bottom Center',
textSameAs: 'Link to Previous'
textSameAs: 'Link to Previous',
textInsertCurrent: 'Insert to Current Position',
textTopPage: 'Top of Page',
textBottomPage: 'Bottom of Page',
textPageNumbering: 'Page Numbering',
textPrev: 'Continue from previous section',
textFrom: 'Start at'
}, DE.Views.HeaderFooterSettings || {}));
});

View file

@ -1140,6 +1140,12 @@
"DE.Views.HeaderFooterSettings.textTopCenter": "Top center",
"DE.Views.HeaderFooterSettings.textTopLeft": "Top left",
"DE.Views.HeaderFooterSettings.textTopRight": "Top right",
"DE.Views.HeaderFooterSettings.textInsertCurrent": "Insert to Current Position",
"DE.Views.HeaderFooterSettings.textTopPage": "Top of Page",
"DE.Views.HeaderFooterSettings.textBottomPage": "Bottom of Page",
"DE.Views.HeaderFooterSettings.textPageNumbering": "Page Numbering",
"DE.Views.HeaderFooterSettings.textPrev": "Continue from previous section",
"DE.Views.HeaderFooterSettings.textFrom": "Start at",
"DE.Views.HyperlinkSettingsDialog.cancelButtonText": "Cancel",
"DE.Views.HyperlinkSettingsDialog.okButtonText": "OK",
"DE.Views.HyperlinkSettingsDialog.textDefault": "Selected text fragment",