[SSE] Add handlers for print range and header/footer settings in file menu
This commit is contained in:
parent
02a400d75c
commit
e232acc272
|
@ -60,10 +60,11 @@ define([
|
||||||
},*/
|
},*/
|
||||||
'PrintWithPreview': {
|
'PrintWithPreview': {
|
||||||
'show': _.bind(this.onShowMainSettingsPrint, this),
|
'show': _.bind(this.onShowMainSettingsPrint, this),
|
||||||
'render:after': _.bind(this.onAfterRender, this)
|
'render:after': _.bind(this.onAfterRender, this),
|
||||||
|
'changerange': _.bind(this.onChangeRange, this, false)
|
||||||
},
|
},
|
||||||
'PrintSettings': {
|
'PrintSettings': {
|
||||||
'changerange': _.bind(this.onChangeRange,this)
|
'changerange': _.bind(this.onChangeRange, this, true)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Common.NotificationCenter.on('print', _.bind(this.openPrintSettings, this, 'print'));
|
Common.NotificationCenter.on('print', _.bind(this.openPrintSettings, this, 'print'));
|
||||||
|
@ -193,22 +194,24 @@ define([
|
||||||
panel.btnPresetsLeft.menu.items[panel.btnPresetsLeft.menu.items[0].value == 'frozen' ? 0 : 1].setDisabled(!this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, true, sheet));
|
panel.btnPresetsLeft.menu.items[panel.btnPresetsLeft.menu.items[0].value == 'frozen' ? 0 : 1].setDisabled(!this.api.asc_getPrintTitlesRange(Asc.c_oAscPrintTitlesRangeType.frozen, true, sheet));
|
||||||
},
|
},
|
||||||
|
|
||||||
fillPrintOptions: function(props) {
|
fillPrintOptions: function(props, isDlg) {
|
||||||
this.printSettingsDlg.setRange(props.asc_getPrintType());
|
var menu = isDlg ? this.printSettingsDlg : this.printSettings;
|
||||||
this.printSettingsDlg.setIgnorePrintArea(!!props.asc_getIgnorePrintArea());
|
menu.setRange(props.asc_getPrintType());
|
||||||
this.onChangeRange();
|
menu.setIgnorePrintArea(!!props.asc_getIgnorePrintArea());
|
||||||
|
this.onChangeRange(isDlg);
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeRange: function() {
|
onChangeRange: function(isDlg) {
|
||||||
var printtype = this.printSettingsDlg.getRange(),
|
var menu = isDlg ? this.printSettingsDlg : this.printSettings;
|
||||||
store = this.printSettingsDlg.cmbSheet.store,
|
var printtype = menu.getRange(),
|
||||||
|
store = menu.cmbSheet.store,
|
||||||
item = (printtype !== Asc.c_oAscPrintType.EntireWorkbook) ? store.findWhere({value: this.api.asc_getActiveWorksheetIndex()}) : store.at(0);
|
item = (printtype !== Asc.c_oAscPrintType.EntireWorkbook) ? store.findWhere({value: this.api.asc_getActiveWorksheetIndex()}) : store.at(0);
|
||||||
if (item) {
|
if (item) {
|
||||||
this.printSettingsDlg.cmbSheet.setValue(item.get('value'));
|
menu.cmbSheet.setValue(item.get('value'));
|
||||||
this.comboSheetsChange(this.printSettingsDlg, this.printSettingsDlg.cmbSheet, item.toJSON());
|
this.comboSheetsChange(menu, menu.cmbSheet, item.toJSON());
|
||||||
}
|
}
|
||||||
this.printSettingsDlg.cmbSheet.setDisabled(printtype !== Asc.c_oAscPrintType.EntireWorkbook);
|
menu.cmbSheet.setDisabled(printtype !== Asc.c_oAscPrintType.EntireWorkbook);
|
||||||
this.printSettingsDlg.chIgnorePrintArea.setDisabled(printtype == Asc.c_oAscPrintType.Selection);
|
menu.chIgnorePrintArea.setDisabled(printtype == Asc.c_oAscPrintType.Selection);
|
||||||
},
|
},
|
||||||
|
|
||||||
getPageOptions: function(panel) {
|
getPageOptions: function(panel) {
|
||||||
|
@ -270,11 +273,7 @@ define([
|
||||||
this.updateSettings(this.printSettings);
|
this.updateSettings(this.printSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
var item = this.printSettings.cmbSheet.store.findWhere({value: this.api.asc_getActiveWorksheetIndex()});
|
this.fillPrintOptions(this.adjPrintParams, false);
|
||||||
if (item) {
|
|
||||||
this.printSettings.cmbSheet.setValue(item.get('value'));
|
|
||||||
this.comboSheetsChange(this.printSettings, this.printSettings.cmbSheet, item.toJSON());
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
openPrintSettings: function(type, cmp, format, asUrl) {
|
openPrintSettings: function(type, cmp, format, asUrl) {
|
||||||
|
@ -295,7 +294,7 @@ define([
|
||||||
this.updateSettings(this.printSettingsDlg);
|
this.updateSettings(this.printSettingsDlg);
|
||||||
this.printSettingsDlg.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettingsDlg));
|
this.printSettingsDlg.cmbSheet.on('selected', _.bind(this.comboSheetsChange, this, this.printSettingsDlg));
|
||||||
this.fillComponents(this.printSettingsDlg, true);
|
this.fillComponents(this.printSettingsDlg, true);
|
||||||
this.fillPrintOptions(this.adjPrintParams);
|
this.fillPrintOptions(this.adjPrintParams, true);
|
||||||
this.registerControlEvents(this.printSettingsDlg);
|
this.registerControlEvents(this.printSettingsDlg);
|
||||||
},this)
|
},this)
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -2793,6 +2793,7 @@ define([
|
||||||
{ value: Asc.c_oAscPrintType.Selection, displayValue: this.txtSelection }
|
{ value: Asc.c_oAscPrintType.Selection, displayValue: this.txtSelection }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
this.cmbRange.on('selected', _.bind(this.comboRangeChange, this));
|
||||||
|
|
||||||
this.chIgnorePrintArea = new Common.UI.CheckBox({
|
this.chIgnorePrintArea = new Common.UI.CheckBox({
|
||||||
el: $markup.findById('#print-chb-ignore'),
|
el: $markup.findById('#print-chb-ignore'),
|
||||||
|
@ -2964,6 +2965,9 @@ define([
|
||||||
|
|
||||||
this.$el = $(node).html($markup);
|
this.$el = $(node).html($markup);
|
||||||
|
|
||||||
|
this.$el.on('click', '#print-header-footer-settings', _.bind(this.openHeaderSettings, this));
|
||||||
|
this.$headerSettings = $('#print-header-footer-settings');
|
||||||
|
|
||||||
if (_.isUndefined(this.scroller)) {
|
if (_.isUndefined(this.scroller)) {
|
||||||
this.scroller = new Common.UI.Scroller({
|
this.scroller = new Common.UI.Scroller({
|
||||||
el: this.pnlSettings,
|
el: this.pnlSettings,
|
||||||
|
@ -3067,6 +3071,30 @@ define([
|
||||||
return (this.$el || $(this.el)).is(":visible");
|
return (this.$el || $(this.el)).is(":visible");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setRange: function(value) {
|
||||||
|
this.cmbRange.setValue(value);
|
||||||
|
},
|
||||||
|
|
||||||
|
getRange: function() {
|
||||||
|
return this.cmbRange.getValue();
|
||||||
|
},
|
||||||
|
|
||||||
|
setIgnorePrintArea: function(value) {
|
||||||
|
this.chIgnorePrintArea.setValue(value);
|
||||||
|
},
|
||||||
|
|
||||||
|
getIgnorePrintArea: function() {
|
||||||
|
return (this.chIgnorePrintArea.getValue()=='checked');
|
||||||
|
},
|
||||||
|
|
||||||
|
comboRangeChange: function(combo, record) {
|
||||||
|
this.fireEvent('changerange', this);
|
||||||
|
},
|
||||||
|
|
||||||
|
openHeaderSettings: function() {
|
||||||
|
SSE.getController('Toolbar').onEditHeaderClick();
|
||||||
|
},
|
||||||
|
|
||||||
txtPrint: 'Print',
|
txtPrint: 'Print',
|
||||||
txtSave: 'Save',
|
txtSave: 'Save',
|
||||||
txtPrintRange: 'Print range',
|
txtPrintRange: 'Print range',
|
||||||
|
|
Loading…
Reference in a new issue