[PE] Lock apply to all button in header and footer settings dialog

This commit is contained in:
Alexei Koshelev
2024-02-06 19:36:39 +03:00
parent 79db0c6b02
commit 71a465368b
3 changed files with 29 additions and 4 deletions

View File

@ -44,7 +44,9 @@ define([
initialize: function() {
this.adjPrintParams = new Asc.asc_CAdjustPrint();
this._state = {};
this._state = {
isLockedSlideHeaderAppyToAll: false
};
this._paperSize = undefined;
this._navigationPreview = {
pageCount: false,
@ -141,6 +143,8 @@ define([
this.api = o;
this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onCountPages, this));
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(this.onCurrentPage, this));
this.api.asc_registerCallback('asc_onLockSlideHdrFtrApplyToAll', _.bind(this.onLockSlideHdrFtrApplyToAll, this, true));
this.api.asc_registerCallback('asc_onUnLockSlideHdrFtrApplyToAll', _.bind(this.onLockSlideHdrFtrApplyToAll, this, false));
return this;
},
@ -182,6 +186,10 @@ define([
}
},
onLockSlideHdrFtrApplyToAll: function(isLocked) {
this._state.isLockedSlideHeaderAppyToAll = isLocked;
},
onShowMainSettingsPrint: function() {
var me = this;
this.printSettings.$previewBox.removeClass('hidden');
@ -344,7 +352,8 @@ define([
api: this.api,
lang: this.api.asc_getDefaultLanguage(),
props: this.api.asc_getHeaderFooterProperties(),
type: 1,
type: this._state.isLockedSlideHeaderAppyToAll ? 0 : 1,
isLockedApplyToAll: this._state.isLockedSlideHeaderAppyToAll,
handler: function(result, value) {
if (result == 'ok' || result == 'all') {
if (me.api) {

View File

@ -111,7 +111,8 @@ define([
no_columns: false,
clrhighlight: undefined,
can_copycut: undefined,
needCallApiBullets: undefined
needCallApiBullets: undefined,
isLockedSlideHeaderAppyToAll: false
};
this._isAddingShape = false;
this.slideSizeArr = [
@ -434,6 +435,9 @@ define([
this.api.asc_registerCallback('asc_onBeginSmartArtPreview', _.bind(this.onApiBeginSmartArtPreview, this));
this.api.asc_registerCallback('asc_onAddSmartArtPreview', _.bind(this.onApiAddSmartArtPreview, this));
this.api.asc_registerCallback('asc_onEndSmartArtPreview', _.bind(this.onApiEndSmartArtPreview, this));
this.api.asc_registerCallback('asc_onLockSlideHdrFtrApplyToAll', _.bind(this.onApiLockSlideHdrFtrApplyToAll, this, true));
this.api.asc_registerCallback('asc_onUnLockSlideHdrFtrApplyToAll', _.bind(this.onApiLockSlideHdrFtrApplyToAll, this, false));
} else if (this.mode.isRestrictedEdit) {
this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPagesRestricted, this));
}
@ -1967,6 +1971,7 @@ define([
api: this.api,
lang: this.api.asc_getDefaultLanguage(),
props: this.api.asc_getHeaderFooterProperties(),
isLockedApplyToAll: this._state.isLockedSlideHeaderAppyToAll,
handler: function(result, value) {
if (result == 'ok' || result == 'all') {
if (me.api) {
@ -2883,6 +2888,10 @@ define([
}
},
onApiLockSlideHdrFtrApplyToAll: function(isLocked) {
this._state.isLockedSlideHeaderAppyToAll = isLocked;
},
onInsertSmartArt: function (value) {
if (this.api) {
this.api.asc_createSmartArt(value);

View File

@ -57,7 +57,7 @@ define(['text!presentationeditor/main/app/template/HeaderFooterDialog.template',
_.extend(this.options, {
title: this.textHFTitle,
buttons: [
{value: 'all', caption: this.applyAllText},
{value: 'all', caption: this.applyAllText, id: 'hf-dlg-btn-apply-to-all'},
{value: 'ok', caption: this.applyText, id: 'hf-dlg-btn-apply'},
'cancel'
],
@ -93,6 +93,7 @@ define(['text!presentationeditor/main/app/template/HeaderFooterDialog.template',
this.hfProps = options.props;
this.api = options.api;
this.type = options.type || 0;// 0 - slide, 1 - notes
this.isLockedApplyToAll = options.isLockedApplyToAll || false;
this.dateControls = [];
this.inited = [];
@ -118,6 +119,7 @@ define(['text!presentationeditor/main/app/template/HeaderFooterDialog.template',
toggleGroup: 'list-type',
allowDepress: false
});
this.btnNotes.setDisabled(this.isLockedApplyToAll);
this.btnNotes.on('click', _.bind(this.onHFTypeClick, this, 1));
this.chDateTime = new Common.UI.CheckBox({
@ -219,6 +221,11 @@ define(['text!presentationeditor/main/app/template/HeaderFooterDialog.template',
});
this.chNotTitle.on('change', _.bind(this.setNotTitle, this));
this.btnApplyToAll = _.find(this.getFooterButtons(), function (item) {
return (item.$el && item.$el.find('#hf-dlg-btn-apply-to-all').addBack().filter('#hf-dlg-btn-apply-to-all').length>0);
}) || new Common.UI.Button({ el: $('#hf-dlg-btn-apply-to-all') });
this.btnApplyToAll.setDisabled(this.isLockedApplyToAll);
this.btnApply = _.find(this.getFooterButtons(), function (item) {
return (item.$el && item.$el.find('#hf-dlg-btn-apply').addBack().filter('#hf-dlg-btn-apply').length>0);
}) || new Common.UI.Button({ el: $('#hf-dlg-btn-apply') });