[SSE] Bug 56443

This commit is contained in:
JuliaSvinareva 2022-04-07 17:12:39 +03:00
parent 930e73890c
commit a3ed7dd01b
4 changed files with 15 additions and 13 deletions

View file

@ -65,7 +65,8 @@ 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) 'changerange': _.bind(this.onChangeRange, this, false),
'openheader': _.bind(this.onOpenHeaderSettings, this),
}, },
'PrintSettings': { 'PrintSettings': {
'changerange': _.bind(this.onChangeRange, this, true) 'changerange': _.bind(this.onChangeRange, this, true)
@ -115,7 +116,6 @@ define([
this.api = o; this.api = o;
this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.updateSheetsInfo, this)); this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.updateSheetsInfo, this));
this.api.asc_registerCallback('asc_onPrintPreviewSheetChanged', _.bind(this.onApiChangePreviewSheet, this)); this.api.asc_registerCallback('asc_onPrintPreviewSheetChanged', _.bind(this.onApiChangePreviewSheet, this));
this.api.asc_registerCallback('asc_onUpdateDocumentProps', _.bind(this.updateDocumentProps, this));
}, },
updateSheetsInfo: function() { updateSheetsInfo: function() {
@ -749,11 +749,11 @@ define([
this.printSettings.btnNextPage.setDisabled(curPage > pageCount - 2); this.printSettings.btnNextPage.setDisabled(curPage > pageCount - 2);
}, },
updateDocumentProps: function (index) { onOpenHeaderSettings: function () {
if (this._isPreviewVisible) { var props = props = (this._changedProps.length > 0 && this._changedProps[this.printSettings.cmbSheet.getValue()]) ?
this._changedProps[index] = this.api.asc_getPageOptions(index); this._changedProps[this.printSettings.cmbSheet.getValue()] :
this.updatePreview(); this.api.asc_getPageOptions(this.printSettings.cmbSheet.getValue(), true);
} SSE.getController('Toolbar').onEditHeaderClick(props.asc_getPageSetup());
}, },
warnCheckMargings: 'Margins are incorrect', warnCheckMargings: 'Margins are incorrect',

View file

@ -401,7 +401,7 @@ define([
toolbar.btnImgForward.on('click', this.onImgArrangeSelect.bind(this, 'forward')); toolbar.btnImgForward.on('click', this.onImgArrangeSelect.bind(this, 'forward'));
toolbar.btnImgBackward.on('click', this.onImgArrangeSelect.bind(this, 'backward')); toolbar.btnImgBackward.on('click', this.onImgArrangeSelect.bind(this, 'backward'));
toolbar.btnsEditHeader.forEach(function(button) { toolbar.btnsEditHeader.forEach(function(button) {
button.on('click', _.bind(me.onEditHeaderClick, me)); button.on('click', _.bind(me.onEditHeaderClick, me, undefined));
}); });
toolbar.btnPrintTitles.on('click', _.bind(this.onPrintTitlesClick, this)); toolbar.btnPrintTitles.on('click', _.bind(this.onPrintTitlesClick, this));
toolbar.chPrintGridlines.on('change', _.bind(this.onPrintGridlinesChange, this)); toolbar.chPrintGridlines.on('change', _.bind(this.onPrintGridlinesChange, this));
@ -3964,7 +3964,7 @@ define([
this.toolbar.btnPrintArea.menu.items[2].setVisible(this.api.asc_CanAddPrintArea()); this.toolbar.btnPrintArea.menu.items[2].setVisible(this.api.asc_CanAddPrintArea());
}, },
onEditHeaderClick: function(btn) { onEditHeaderClick: function(pageSetup, btn) {
var me = this; var me = this;
if (_.isUndefined(me.fontStore)) { if (_.isUndefined(me.fontStore)) {
me.fontStore = new Common.Collections.Fonts(); me.fontStore = new Common.Collections.Fonts();
@ -3981,6 +3981,7 @@ define([
var win = new SSE.Views.HeaderFooterDialog({ var win = new SSE.Views.HeaderFooterDialog({
api: me.api, api: me.api,
fontStore: me.fontStore, fontStore: me.fontStore,
pageSetup: pageSetup,
handler: function(dlg, result) { handler: function(dlg, result) {
if (result === 'ok') { if (result === 'ok') {
me.getApplication().getController('Print').updatePreview(); me.getApplication().getController('Print').updatePreview();

View file

@ -2778,7 +2778,7 @@ define([
}, },
openHeaderSettings: function() { openHeaderSettings: function() {
SSE.getController('Toolbar').onEditHeaderClick(); this.fireEvent('openheader', this);
}, },
updateCountOfPages: function (count) { updateCountOfPages: function (count) {

View file

@ -63,6 +63,7 @@ define([
this.api = this.options.api; this.api = this.options.api;
this.props = this.options.props; this.props = this.options.props;
this.fontStore = this.options.fontStore; this.fontStore = this.options.fontStore;
this.pageSetup = this.options.pageSetup;
this.isFooter = false; this.isFooter = false;
this.currentCanvas = null; this.currentCanvas = null;
this.headerControls = []; this.headerControls = [];
@ -619,7 +620,7 @@ define([
Common.UI.Window.prototype.close.apply(this, arguments); Common.UI.Window.prototype.close.apply(this, arguments);
if (this.HFObject) if (this.HFObject)
this.HFObject.destroy(); this.HFObject.destroy(false, this.pageSetup);
}, },
afterRender: function () { afterRender: function () {
@ -631,7 +632,7 @@ define([
this.cmbFonts[1].fillFonts(this.fontStore); this.cmbFonts[1].fillFonts(this.fontStore);
this.updateThemeColors(); this.updateThemeColors();
this.HFObject = new Asc.asc_CHeaderFooterEditor(['header-left-img', 'header-center-img', 'header-right-img', 'footer-left-img', 'footer-center-img', 'footer-right-img'], 205); this.HFObject = new Asc.asc_CHeaderFooterEditor(['header-left-img', 'header-center-img', 'header-right-img', 'footer-left-img', 'footer-center-img', 'footer-right-img'], 205, undefined, this.pageSetup);
this._setDefaults(this.props); this._setDefaults(this.props);
this.editorCanvas = this.$window.find('#ce-canvas-menu'); this.editorCanvas = this.$window.find('#ce-canvas-menu');
var me = this; var me = this;
@ -697,7 +698,7 @@ define([
_handleInput: function(state) { _handleInput: function(state) {
if (this.HFObject) { if (this.HFObject) {
var id = this.HFObject.destroy(state=='ok'); var id = this.HFObject.destroy(state=='ok', this.pageSetup);
if (id) { if (id) {
var me = this; var me = this;
this.showError(function() { this.showError(function() {