[PE] Fix Bug 35231.

This commit is contained in:
Julia Radzhabova 2017-07-05 15:33:23 +03:00
parent 781f9f4cd2
commit 4ddd175b0f

View file

@ -92,6 +92,7 @@ define([
_.extend(this, options); _.extend(this, options);
this.pages = new PE.Models.Pages({current:1, count:1}); this.pages = new PE.Models.Pages({current:1, count:1});
this.pages.on('change', _.bind(_updatePagesCaption,this)); this.pages.on('change', _.bind(_updatePagesCaption,this));
this._state = {no_paragraph: true};
}, },
render: function () { render: function () {
@ -301,6 +302,7 @@ define([
if (this.api) { if (this.api) {
this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this)); this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this));
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this)); this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
} }
return this; return this;
@ -341,7 +343,7 @@ define([
this.langMenu.doLayout(); this.langMenu.doLayout();
if (this.langMenu.items.length>0) { if (this.langMenu.items.length>0) {
this.btnLanguage.setDisabled(false); this.btnLanguage.setDisabled(false || this._state.no_paragraph);
this.btnDocLanguage.setDisabled(false); this.btnDocLanguage.setDisabled(false);
} }
}, },
@ -365,10 +367,26 @@ define([
SetDisabled: function(disable) { SetDisabled: function(disable) {
var langs = this.langMenu.items.length>0; var langs = this.langMenu.items.length>0;
this.btnLanguage.setDisabled(disable || !langs); this.btnLanguage.setDisabled(disable || !langs || this._state.no_paragraph);
this.btnDocLanguage.setDisabled(disable || !langs); this.btnDocLanguage.setDisabled(disable || !langs);
}, },
onApiFocusObject: function(selectedObjects) {
if (!this.mode.isEdit) return;
this._state.no_paragraph = true;
var i = -1;
while (++i < selectedObjects.length) {
if (selectedObjects[i].get_ObjectType() == Asc.c_oAscTypeSelectElement.Paragraph) {
this._state.no_paragraph = selectedObjects[i].get_ObjectValue().get_Locked();
break;
}
}
this._state.no_paragraph = this._state.no_paragraph || this.langMenu.items.length<1;
if (this._state.no_paragraph !== this.btnLanguage.isDisabled())
this.btnLanguage.setDisabled(this._state.no_paragraph);
},
pageIndexText : 'Slide {0} of {1}', pageIndexText : 'Slide {0} of {1}',
goToPageText : 'Go to Slide', goToPageText : 'Go to Slide',
tipFitPage : 'Fit to Slide', tipFitPage : 'Fit to Slide',