Skip to content

Commit

Permalink
[PE] Lock apply to all button in header and footer settings dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Basher0303 committed Feb 6, 2024
1 parent 79db0c6 commit 71a4653
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
13 changes: 11 additions & 2 deletions apps/presentationeditor/main/app/controller/Print.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
},
Expand Down Expand Up @@ -182,6 +186,10 @@ define([
}
},

onLockSlideHdrFtrApplyToAll: function(isLocked) {
this._state.isLockedSlideHeaderAppyToAll = isLocked;
},

onShowMainSettingsPrint: function() {
var me = this;
this.printSettings.$previewBox.removeClass('hidden');
Expand Down Expand Up @@ -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) {
Expand Down
11 changes: 10 additions & 1 deletion apps/presentationeditor/main/app/controller/Toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ define([
no_columns: false,
clrhighlight: undefined,
can_copycut: undefined,
needCallApiBullets: undefined
needCallApiBullets: undefined,
isLockedSlideHeaderAppyToAll: false
};
this._isAddingShape = false;
this.slideSizeArr = [
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -2883,6 +2888,10 @@ define([
}
},

onApiLockSlideHdrFtrApplyToAll: function(isLocked) {
this._state.isLockedSlideHeaderAppyToAll = isLocked;
},

onInsertSmartArt: function (value) {
if (this.api) {
this.api.asc_createSmartArt(value);
Expand Down
9 changes: 8 additions & 1 deletion apps/presentationeditor/main/app/view/HeaderFooterDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
],
Expand Down Expand Up @@ -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 = [];

Expand All @@ -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({
Expand Down Expand Up @@ -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') });
Expand Down

0 comments on commit 71a4653

Please sign in to comment.