[SSE] Header/footer settings: switch between pages

This commit is contained in:
Julia Radzhabova 2019-01-25 11:50:56 +03:00
parent 62b92c6b38
commit a97d311ee8

View file

@ -59,6 +59,7 @@ define([
}, options || {}); }, options || {});
this.api = this.options.api; this.api = this.options.api;
this.props = this.options.props;
this.fontStore = this.options.fontStore; this.fontStore = this.options.fontStore;
this.font = { this.font = {
size: 11, size: 11,
@ -174,9 +175,6 @@ define([
this.btnFirst.setVisible(checked); this.btnFirst.setVisible(checked);
if (!checked && this.btnFirst.isActive()) if (!checked && this.btnFirst.isActive())
(this.btnAll.isVisible()) ? this.btnAll.toggle(true) : this.btnOdd.toggle(true); (this.btnAll.isVisible()) ? this.btnAll.toggle(true) : this.btnOdd.toggle(true);
this.cmbPresetsF.setDisabled(checked);
this.cmbPresetsH.setDisabled(checked);
}, this)); }, this));
this.chOddPage = new Common.UI.CheckBox({ this.chOddPage = new Common.UI.CheckBox({
@ -195,8 +193,6 @@ define([
this.btnAll.toggle(true); this.btnAll.toggle(true);
if (checked && this.btnAll.isActive()) if (checked && this.btnAll.isActive())
this.btnOdd.toggle(true); this.btnOdd.toggle(true);
this.cmbPresetsF.setDisabled(checked);
this.cmbPresetsH.setDisabled(checked);
}, this)); }, this));
this.chScale = new Common.UI.CheckBox({ this.chScale = new Common.UI.CheckBox({
@ -226,6 +222,7 @@ define([
allowDepress: false, allowDepress: false,
pressed: true pressed: true
}); });
this.btnAll.on('toggle', _.bind(this.onPageTypeToggle, this, Asc.c_oAscHeaderFooterType.odd));
this.btnOdd = new Common.UI.Button({ this.btnOdd = new Common.UI.Button({
el: $('#id-dlg-hf-btn-odd'), el: $('#id-dlg-hf-btn-odd'),
@ -233,7 +230,7 @@ define([
toggleGroup: 'hf-pages', toggleGroup: 'hf-pages',
allowDepress: false allowDepress: false
}); });
this.btnOdd.on('click', _.bind(this.onPageTypeClick, this, 0)); this.btnOdd.on('toggle', _.bind(this.onPageTypeToggle, this, Asc.c_oAscHeaderFooterType.odd));
this.btnEven = new Common.UI.Button({ this.btnEven = new Common.UI.Button({
el: $('#id-dlg-hf-btn-even'), el: $('#id-dlg-hf-btn-even'),
@ -241,7 +238,7 @@ define([
toggleGroup: 'hf-pages', toggleGroup: 'hf-pages',
allowDepress: false allowDepress: false
}); });
this.btnEven.on('click', _.bind(this.onPageTypeClick, this, 1)); this.btnEven.on('toggle', _.bind(this.onPageTypeToggle, this, Asc.c_oAscHeaderFooterType.even));
this.btnFirst = new Common.UI.Button({ this.btnFirst = new Common.UI.Button({
el: $('#id-dlg-hf-btn-first'), el: $('#id-dlg-hf-btn-first'),
@ -249,7 +246,7 @@ define([
toggleGroup: 'hf-pages', toggleGroup: 'hf-pages',
allowDepress: false allowDepress: false
}); });
this.btnFirst.on('click', _.bind(this.onPageTypeClick, this, 2)); this.btnFirst.on('toggle', _.bind(this.onPageTypeToggle, this, Asc.c_oAscHeaderFooterType.first));
this.cmbPresetsH = new Common.UI.ComboBox({ this.cmbPresetsH = new Common.UI.ComboBox({
el : $('#id-dlg-h-presets'), el : $('#id-dlg-h-presets'),
@ -568,6 +565,22 @@ define([
this.updateThemeColors(); this.updateThemeColors();
this.HFObject = new AscCommonExcel.CHeaderFooterEditor(['header-left-img', 'header-center-img', 'header-right-img', 'footer-left-img', 'footer-center-img', 'footer-right-img'], 205); this.HFObject = new AscCommonExcel.CHeaderFooterEditor(['header-left-img', 'header-center-img', 'header-right-img', 'footer-left-img', 'footer-center-img', 'footer-right-img'], 205);
this._setDefaults(this.props);
},
_setDefaults: function (props) {
if (props) {
// this.chOddPage.setValue(props.getOdd());
// this.chFirstPage.setValue(props.getFirst());
}
var value = (this.chOddPage.getValue() == 'checked');
this.btnOdd.setVisible(value);
this.btnEven.setVisible(value);
this.btnAll.setVisible(!value);
value ? this.btnOdd.toggle(true) : this.btnAll.toggle(true);
value = (this.chFirstPage.getValue() == 'checked');
this.btnFirst.setVisible(value);
}, },
updateThemeColors: function() { updateThemeColors: function() {
@ -688,8 +701,9 @@ define([
this.HFObject.setTextColor(Common.Utils.ThemeColor.getRgbColor(color)); this.HFObject.setTextColor(Common.Utils.ThemeColor.getRgbColor(color));
}, },
onPageTypeClick: function(type, btn, event) { onPageTypeToggle: function(type, btn, state) {
if (state && this.HFObject)
this.HFObject.switchHeaderFooterType(type);
}, },
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',