Merge branch 'feature/de-lock-refactoring' into develop

This commit is contained in:
Julia Radzhabova 2022-01-13 22:13:24 +03:00
commit 1c17f8bd99
38 changed files with 672 additions and 514 deletions

View file

@ -326,7 +326,7 @@ Common.UI.HintManager = new(function() {
if (!_isItemDisabled(item)) {
var leftBorder = 0,
rightBorder = docW;
if (!_isEditDiagram && $(_currentSection).prop('id') === 'toolbar' && ($(_currentSection).find('.toolbar-mask').length > 0 || item.closest('.group').find('.toolbar-group-mask').length > 0)
if (!_isEditDiagram && $(_currentSection).prop('id') === 'toolbar' && ($(_currentSection).find('.toolbar-mask').length > 0)
|| ($('#about-menu-panel').is(':visible') && item.closest('.hint-section').prop('id') === 'right-menu')) { // don't show right menu hints when about is visible
return;
}
@ -535,7 +535,7 @@ Common.UI.HintManager = new(function() {
} else {
_isComplete = false;
_hideHints();
if (!_isEditDiagram && $(_currentSection).prop('id') === 'toolbar' && ($(_currentSection).find('.toolbar-mask').length > 0 || curr.closest('.group').find('.toolbar-group-mask').length > 0)) {
if (!_isEditDiagram && $(_currentSection).prop('id') === 'toolbar' && ($(_currentSection).find('.toolbar-mask').length > 0)) {
_resetToDefault();
return;
}

View file

@ -100,6 +100,7 @@ define([
onLaunch: function () {
this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges');
this.userCollection = this.getApplication().getCollection('Common.Collections.Users');
this.viewmode = false;
this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null, wsLock: false, wsProps: []};
@ -160,13 +161,23 @@ define([
this.document = data.doc;
},
SetDisabled: function(state) {
SetDisabled: function(state, reviewMode, fillFormMode) {
if (this.dlgChanges)
this.dlgChanges.close();
this.view && this.view.SetDisabled(state, this.langs, {comments: !!this._state.wsProps['Objects']});
if (reviewMode)
this.lockToolbar(Common.enumLock.previewReviewMode, state);
else if (fillFormMode)
this.lockToolbar(Common.enumLock.viewFormMode, state);
else
this.lockToolbar(Common.enumLock.viewMode, state);
this.setPreviewMode(state);
},
lockToolbar: function (causes, lock, opts) {
Common.Utils.lockControls(causes, lock, opts, this.view.getButtons());
},
setPreviewMode: function(mode) { //disable accept/reject in popover
if (this.viewmode === mode) return;
this.viewmode = mode;
@ -203,8 +214,7 @@ define([
var btnlock = lock || !editable;
if (this.appConfig.canReview && !this.appConfig.isReviewOnly && this._state.lock !== btnlock) {
this.view.btnAccept.setDisabled(btnlock);
this.view.btnReject.setDisabled(btnlock);
Common.Utils.lockControls(Common.enumLock.reviewChangelock, btnlock, {array: [this.view.btnAccept, this.view.btnReject]});
if (this.dlgChanges) {
this.dlgChanges.btnAccept.setDisabled(btnlock);
this.dlgChanges.btnReject.setDisabled(btnlock);
@ -765,7 +775,7 @@ define([
Common.NotificationCenter.trigger('editing:disable', disable, {
viewMode: false,
reviewMode: true,
fillFormwMode: false,
fillFormMode: false,
allowMerge: false,
allowSignature: false,
allowProtect: false,
@ -776,22 +786,13 @@ define([
navigation: {disable: false, previewMode: true},
comments: {disable: false, previewMode: true},
chat: false,
review: false,
review: true,
viewport: false,
documentHolder: true,
toolbar: true,
plugins: true
plugins: true,
protect: true
}, 'review');
if (this.view) {
this.view.$el.find('.no-group-mask.review').css('opacity', 1);
this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
if ( button ) {
button.setDisabled(disable || !this.langs || this.langs.length<1);
}
}, this);
}
},
createToolbarPanel: function() {
@ -867,8 +868,8 @@ define([
}
me.onChangeProtectSheet();
if (me.view) {
me.view.btnCommentRemove && me.view.btnCommentRemove.setDisabled(!Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true) || !!this._state.wsProps['Objects']);
me.view.btnCommentResolve && me.view.btnCommentResolve.setDisabled(!Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true) || !!this._state.wsProps['Objects']);
me.lockToolbar(Common.enumLock.hideComments, !Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true), {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]});
me.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects'], {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]});
}
var val = Common.localStorage.getItem(me.view.appPrefix + "settings-review-hover-mode");
@ -930,11 +931,7 @@ define([
setLanguages: function (array) {
this.langs = array;
this.view && this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
if ( button ) {
button.setDisabled(this.langs.length<1);
}
}, this);
this.lockToolbar(Common.enumLock.noSpellcheckLangs, this.langs.length<1, {array: this.view.btnsDocLang});
},
onDocLanguage: function() {
@ -954,6 +951,7 @@ define([
onLostEditRights: function() {
this._readonlyRights = true;
this.view && this.view.onLostEditRights();
this.view && this.lockToolbar(Common.enumLock.cantShare, true, {array: [this.view.btnSharing]});
},
changeAccessRights: function(btn,event,opts) {
@ -985,7 +983,7 @@ define([
},
onCoAuthoringDisconnect: function() {
this.SetDisabled(true);
this.lockToolbar(Common.enumLock.lostConnect, true)
},
onUpdateUsers: function() {
@ -1003,15 +1001,14 @@ define([
if (!item.asc_getView())
length++;
});
this.view.btnCompare.setDisabled(length>1 || this.viewmode);
Common.Utils.lockControls(Common.enumLock.hasCoeditingUsers, length>1, {array: [this.view.btnCompare]});
}
},
commentsShowHide: function(mode) {
if (!this.view) return;
var value = Common.Utils.InternalSettings.get(this.view.appPrefix + "settings-livecomment");
(value!==undefined) && this.view.btnCommentRemove && this.view.btnCommentRemove.setDisabled(mode != 'show' && !value || !!this._state.wsProps['Objects']);
(value!==undefined) && this.view.btnCommentResolve && this.view.btnCommentResolve.setDisabled(mode != 'show' && !value || !!this._state.wsProps['Objects']);
(value!==undefined) && this.lockToolbar(Common.enumLock.hideComments, mode != 'show' && !value, {array: [this.view.btnCommentRemove, this.view.btnCommentResolve]});
},
onChangeProtectSheet: function(props) {
@ -1023,11 +1020,7 @@ define([
this._state.wsLock = props ? props.wsLock : false;
if (!this.view) return;
var leftmenu = this.getApplication().getController('LeftMenu'),
isCommentsVisible = leftmenu && leftmenu.isCommentsVisible();
var value = Common.Utils.InternalSettings.get(this.view.appPrefix + "settings-livecomment");
(value!==undefined) && this.view.btnCommentRemove && this.view.btnCommentRemove.setDisabled(!isCommentsVisible && !value || !!this._state.wsProps['Objects']);
(value!==undefined) && this.view.btnCommentResolve && this.view.btnCommentResolve.setDisabled(!isCommentsVisible && !value || !!this._state.wsProps['Objects']);
this.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects'], {array: [this.view.btnCommentRemove, this.view.btnCommentResolve]});
},
textInserted: '<b>Inserted:</b>',

View file

@ -881,7 +881,7 @@ Common.Utils.lockControls = function(causes, lock, opts, defControls) {
opts.merge && (controls = _.union(defControls,controls));
function doLock(cmp, cause) {
if ( cmp && _.contains(cmp.options.lock, cause) ) {
if ( cmp && cmp.options && _.contains(cmp.options.lock, cause) ) {
var index = cmp.keepState.indexOf(cause);
if (lock) {
if (index < 0) {

View file

@ -54,6 +54,26 @@ define([
], function () {
'use strict';
if (!Common.enumLock)
Common.enumLock = {};
var enumLock = {
noSpellcheckLangs: 'no-spellcheck-langs',
isReviewOnly: 'review-only',
reviewChangelock: 'review-change-lock',
hasCoeditingUsers: 'has-coediting-users',
previewReviewMode: 'preview-review-mode', // display mode on Collaboration tab
viewFormMode: 'view-form-mode', // view form mode on Forms tab
viewMode: 'view-mode', // view mode on disconnect, version history etc (used for locking buttons not in toolbar)
hideComments: 'hide-comments', // no live comments and left panel is closed
cantShare: 'cant-share'
};
for (var key in enumLock) {
if (enumLock.hasOwnProperty(key)) {
Common.enumLock[key] = enumLock[key];
}
}
Common.Views.ReviewChanges = Common.UI.BaseView.extend(_.extend((function(){
var template =
'<section id="review-changes-panel" class="panel" data-tab="review">' +
@ -229,44 +249,52 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options);
this.appConfig = options.mode;
this.lockedControls = [];
var filter = Common.localStorage.getKeysFilter();
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
var _set = Common.enumLock;
if ( this.appConfig.canReview ) {
this.btnAccept = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtAccept,
split: !this.appConfig.canUseReviewPermissions,
iconCls: 'toolbar__icon btn-review-save',
lock: [_set.reviewChangelock, _set.isReviewOnly, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect],
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnAccept);
this.btnReject = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtReject,
split: !this.appConfig.canUseReviewPermissions,
iconCls: 'toolbar__icon btn-review-deny',
lock: [_set.reviewChangelock, _set.isReviewOnly, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect],
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnReject);
if (this.appConfig.canFeatureComparison)
if (this.appConfig.canFeatureComparison) {
this.btnCompare = new Common.UI.Button({
cls : 'btn-toolbar x-huge icon-top',
caption : this.txtCompare,
split : true,
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtCompare,
split: true,
iconCls: 'toolbar__icon btn-compare',
lock: [_set.hasCoeditingUsers, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect],
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnCompare);
}
this.btnTurnOn = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-ic-review',
lock: [_set.previewReviewMode, _set.viewFormMode, _set.lostConnect],
caption: this.txtTurnon,
split: !this.appConfig.isReviewOnly,
enableToggle: true,
@ -275,25 +303,30 @@ define([
dataHintOffset: 'small'
});
this.btnsTurnReview = [this.btnTurnOn];
this.lockedControls.push(this.btnTurnOn);
}
if (this.appConfig.canViewReview) {
this.btnPrev = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-review-prev',
lock: [_set.previewReviewMode, _set.viewFormMode, _set.lostConnect],
caption: this.txtPrev,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnPrev);
this.btnNext = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-review-next',
lock: [_set.previewReviewMode, _set.viewFormMode, _set.lostConnect],
caption: this.txtNext,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnNext);
if (!this.appConfig.isRestrictedEdit && !(this.appConfig.customization && this.appConfig.customization.review && this.appConfig.customization.review.hideReviewDisplay)) {// hide Display mode option for fillForms and commenting mode
var menuTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><%= caption %></div>' +
@ -303,6 +336,7 @@ define([
this.btnReviewView = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-ic-reviewview',
lock: [_set.viewFormMode, _set.lostConnect],
caption: this.txtView,
menu: new Common.UI.Menu({
cls: 'ppm-toolbar',
@ -349,6 +383,7 @@ define([
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnReviewView);
}
}
@ -356,23 +391,27 @@ define([
this.btnSharing = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-ic-sharing',
lock: [_set.viewFormMode, _set.cantShare, _set.lostConnect],
caption: this.txtSharing,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnSharing);
}
if (this.appConfig.isEdit && !this.appConfig.isOffline && this.appConfig.canCoAuthoring && this.appConfig.canChangeCoAuthoring) {
this.btnCoAuthMode = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-ic-coedit',
lock: [_set.viewFormMode, _set.lostConnect],
caption: this.txtCoAuthMode,
menu: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnCoAuthMode);
}
this.btnsSpelling = [];
@ -382,23 +421,27 @@ define([
this.btnHistory = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-ic-history',
lock: [_set.lostConnect],
caption: this.txtHistory,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnHistory);
}
if (this.appConfig.canCoAuthoring && this.appConfig.canChat) {
this.btnChat = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-ic-chat',
lock: [_set.lostConnect],
caption: this.txtChat,
enableToggle: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnChat);
}
if ( this.appConfig.canCoAuthoring && this.appConfig.canComments ) {
@ -407,19 +450,23 @@ define([
caption: this.txtCommentRemove,
split: true,
iconCls: 'toolbar__icon btn-rem-comment',
lock: [_set.previewReviewMode, _set.viewFormMode, _set.hideComments, _set['Objects'], _set.lostConnect],
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnCommentRemove);
this.btnCommentResolve = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtCommentResolve,
split: true,
iconCls: 'toolbar__icon btn-resolve-all',
lock: [_set.previewReviewMode, _set.viewFormMode, _set.hideComments, _set['Objects'], _set.lostConnect],
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnCommentResolve);
}
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
@ -524,8 +571,7 @@ define([
me.btnCompare.updateHint(me.tipCompare);
}
config.isReviewOnly && me.btnAccept.setDisabled(true);
config.isReviewOnly && me.btnReject.setDisabled(true);
Common.Utils.lockControls(Common.enumLock.isReviewOnly, config.isReviewOnly, {array: [me.btnAccept, me.btnReject]});
}
if (me.appConfig.canViewReview) {
me.btnPrev.updateHint(me.hintPrev);
@ -685,6 +731,7 @@ define([
var button = new Common.UI.Button({
cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-ic-review',
lock: [Common.enumLock.viewMode, Common.enumLock.previewReviewMode, Common.enumLock.viewFormMode, Common.enumLock.lostConnect],
hintAnchor : 'top',
hint : this.tipReview,
split : !this.appConfig.isReviewOnly,
@ -724,13 +771,14 @@ define([
});
this.btnsTurnReview.push(button);
this.lockedControls.push(button);
return button;
} else
if ( type == 'spelling' ) {
button = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-ic-docspell',
lock: [Common.enumLock.viewMode, Common.enumLock.viewFormMode, Common.enumLock.previewReviewMode],
hintAnchor : 'top',
hint: this.tipSetSpelling,
enableToggle: true,
@ -740,25 +788,30 @@ define([
visible: Common.UI.FeaturesManager.canChange('spellcheck')
});
this.btnsSpelling.push(button);
this.lockedControls.push(button);
return button;
} else if (type == 'doclang' && parent == 'statusbar' ) {
button = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-ic-doclang',
lock: [Common.enumLock.viewMode, Common.enumLock.previewReviewMode, Common.enumLock.viewFormMode, Common.enumLock.noSpellcheckLangs, Common.enumLock.lostConnect],
hintAnchor : 'top',
hint: this.tipSetDocLang,
disabled: true,
dataHint: '0',
dataHintDirection: 'top',
dataHintOffset: 'small'
});
this.btnsDocLang.push(button);
this.lockedControls.push(button);
Common.Utils.lockControls(Common.enumLock.noSpellcheckLangs, true, {array: [button]});
return button;
}
},
getButtons: function() {
return this.lockedControls;
},
getUserName: function (username) {
return Common.Utils.String.htmlEncode(AscCommon.UserInfoParser.getParsedName(username));
},
@ -814,34 +867,8 @@ define([
}
},
SetDisabled: function (state, langs, protectProps) {
this.btnsSpelling && this.btnsSpelling.forEach(function(button) {
if ( button ) {
button.setDisabled(state);
}
}, this);
this.btnsDocLang && this.btnsDocLang.forEach(function(button) {
if ( button ) {
button.setDisabled(state || langs && langs.length<1);
}
}, this);
this.btnsTurnReview && this.btnsTurnReview.forEach(function(button) {
if ( button ) {
button.setDisabled(state);
}
}, this);
// this.btnChat && this.btnChat.setDisabled(state);
this.btnCommentRemove && this.btnCommentRemove.setDisabled(state || !Common.Utils.InternalSettings.get(this.appPrefix + "settings-livecomment") || protectProps && protectProps.comments);
this.btnCommentResolve && this.btnCommentResolve.setDisabled(state || !Common.Utils.InternalSettings.get(this.appPrefix + "settings-livecomment") || protectProps && protectProps.comments);
},
onLostEditRights: function() {
this._readonlyRights = true;
if (!this.rendered)
return;
this.btnSharing && this.btnSharing.setDisabled(true);
},
txtAccept: 'Accept',

View file

@ -341,7 +341,7 @@
.combo-pivot-template {
.combo-template(60px);
top: -7px;
top: -4px;
padding-right: 12px;
position: absolute;

View file

@ -261,11 +261,11 @@
}
}
&.no-group-mask {
.elset {
position: relative;
}
}
//&.no-group-mask {
// .elset {
// position: relative;
// }
//}
}
.elset {

View file

@ -57,9 +57,7 @@ define([
initialize: function () {
},
onLaunch: function () {
this._state = {
prcontrolsdisable:undefined
};
this._state = {};
},
setApi: function (api) {
@ -145,17 +143,12 @@ define([
control_plain = (in_control&&control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false;
(lock_type===undefined) && (lock_type = Asc.c_oAscSdtLockType.Unlocked);
var content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked;
var need_disable = (paragraph_locked || header_locked || control_plain || content_locked);
if (this._state.prcontrolsdisable !== need_disable) {
this.view.btnTextField.setDisabled(need_disable);
this.view.btnComboBox.setDisabled(need_disable);
this.view.btnDropDown.setDisabled(need_disable);
this.view.btnCheckBox.setDisabled(need_disable);
this.view.btnRadioBox.setDisabled(need_disable);
this.view.btnImageField.setDisabled(need_disable);
this.view.btnTextField.setDisabled(need_disable);
this._state.prcontrolsdisable = need_disable;
}
var arr = [ this.view.btnTextField, this.view.btnComboBox, this.view.btnDropDown, this.view.btnCheckBox,
this.view.btnRadioBox, this.view.btnImageField ];
Common.Utils.lockControls(Common.enumLock.paragraphLock, paragraph_locked, {array: arr});
Common.Utils.lockControls(Common.enumLock.headerLock, header_locked, {array: arr});
Common.Utils.lockControls(Common.enumLock.controlPlain, control_plain, {array: arr});
Common.Utils.lockControls(Common.enumLock.contentLock, content_locked, {array: arr});
},
onChangeSpecialFormsGlobalSettings: function() {
@ -302,7 +295,7 @@ define([
Common.NotificationCenter.trigger('editing:disable', disable, {
viewMode: false,
reviewMode: false,
fillFormwMode: true,
fillFormMode: true,
allowMerge: false,
allowSignature: false,
allowProtect: false,
@ -317,10 +310,11 @@ define([
viewport: false,
documentHolder: true,
toolbar: true,
plugins: false
plugins: true,
protect: true
}, 'forms');
if (this.view)
this.view.$el.find('.no-group-mask.form-view').css('opacity', 1);
// if (this.view)
// this.view.$el.find('.no-group-mask.form-view').css('opacity', 1);
}
},

View file

@ -87,7 +87,6 @@ define([
},
onLaunch: function () {
this._state = {
prcontrolsdisable:undefined,
in_object: undefined
};
Common.Gateway.on('setactionlink', function (url) {
@ -164,7 +163,6 @@ define([
object_type = type;
}
}
this._state.prcontrolsdisable = paragraph_locked || header_locked;
this._state.in_object = object_type;
var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
@ -176,28 +174,31 @@ define([
plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : false,
plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : false;
this.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: this.view.btnsNotes.concat(this.view.btnsHyperlink).concat([this.view.btnBookmarks, this.view.btnTableFiguresUpdate, this.view.btnCrossRef])});
this.lockToolbar(Common.enumLock.inHeader, in_header, {array: this.view.btnsNotes.concat(this.view.btnsContents).concat([this.view.btnBookmarks, this.view.btnTableFigures,
this.view.btnTableFiguresUpdate, this.view.btnCaption])});
this.lockToolbar(Common.enumLock.controlPlain, control_plain, {array: this.view.btnsNotes.concat([this.view.btnBookmarks, this.view.btnCrossRef])});
this.lockToolbar(Common.enumLock.richEditLock, rich_edit_lock, {array: this.view.btnsNotes.concat(this.view.btnsContents).concat([this.view.btnTableFigures, this.view.btnTableFiguresUpdate,
this.view.btnCrossRef])});
this.lockToolbar(Common.enumLock.plainEditLock, plain_edit_lock, {array: this.view.btnsNotes.concat(this.view.btnsContents).concat([this.view.btnTableFigures, this.view.btnTableFiguresUpdate,
this.view.btnCrossRef])});
this.lockToolbar(Common.enumLock.headerLock, header_locked, {array: this.view.btnsHyperlink.concat([this.view.btnBookmarks, this.view.btnCrossRef])});
this.lockToolbar(Common.enumLock.inEquation, in_equation, {array: this.view.btnsNotes});
this.lockToolbar(Common.enumLock.inImage, in_image, {array: this.view.btnsNotes});
this.lockToolbar(Common.enumLock.richDelLock, rich_del_lock, {array: this.view.btnsContents.concat([this.view.btnTableFigures, this.view.btnTableFiguresUpdate])});
this.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: this.view.btnsContents.concat([this.view.btnTableFigures, this.view.btnTableFiguresUpdate])});
this.lockToolbar(Common.enumLock.contentLock, content_locked, {array: [this.view.btnCrossRef]});
this.lockToolbar(Common.enumLock.cantUpdateTOF, !this.api.asc_CanUpdateTablesOfFigures(), {array: [this.view.btnTableFiguresUpdate]});
var need_disable = paragraph_locked || in_equation || in_image || in_header || control_plain || rich_edit_lock || plain_edit_lock;
this.view.btnsNotes.setDisabled(need_disable);
this.dlgCrossRefDialog && this.dlgCrossRefDialog.isVisible() && this.dlgCrossRefDialog.setLocked(this.view.btnCrossRef.isDisabled());
},
need_disable = paragraph_locked || header_locked || in_header || control_plain;
this.view.btnBookmarks.setDisabled(need_disable);
need_disable = in_header || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock;
this.view.btnsContents.setDisabled(need_disable);
this.view.btnTableFigures.setDisabled(need_disable);
this.view.btnTableFiguresUpdate.setDisabled(need_disable || paragraph_locked || !this.api.asc_CanUpdateTablesOfFigures());
need_disable = in_header;
this.view.btnCaption.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || control_plain || rich_edit_lock || plain_edit_lock || content_locked;
this.view.btnCrossRef.setDisabled(need_disable);
this.dlgCrossRefDialog && this.dlgCrossRefDialog.isVisible() && this.dlgCrossRefDialog.setLocked(need_disable);
lockToolbar: function (causes, lock, opts) {
Common.Utils.lockControls(causes, lock, opts, this.view.getButtons());
},
onApiCanAddHyperlink: function(value) {
this.toolbar.editMode && this.view.btnsHyperlink.setDisabled(!value || this._state.prcontrolsdisable);
this.toolbar.editMode && this.lockToolbar(Common.enumLock.hyperlinkLock, !value, {array: this.view.btnsHyperlink});
},
onHyperlinkClick: function(btn) {

View file

@ -736,7 +736,7 @@ define([
Common.NotificationCenter.trigger('editing:disable', disable, {
viewMode: disable,
reviewMode: false,
fillFormwMode: false,
fillFormMode: false,
allowMerge: false,
allowSignature: false,
allowProtect: false,
@ -751,7 +751,8 @@ define([
viewport: true,
documentHolder: true,
toolbar: true,
plugins: false
plugins: false,
protect: false
}, temp ? 'reconnect' : 'disconnect');
},
@ -772,16 +773,16 @@ define([
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
}
if (options.review) {
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable, options.reviewMode, options.fillFormMode);
}
if (options.viewport) {
app.getController('Viewport').SetDisabled(disable);
}
if (options.toolbar) {
app.getController('Toolbar').DisableToolbar(disable, options.viewMode, options.reviewMode, options.fillFormwMode);
app.getController('Toolbar').DisableToolbar(disable, options.viewMode, options.reviewMode, options.fillFormMode);
}
if (options.documentHolder) {
app.getController('DocumentHolder').getView().SetDisabled(disable, options.allowProtect, options.fillFormwMode);
app.getController('DocumentHolder').getView().SetDisabled(disable, options.allowProtect, options.fillFormMode);
}
if (options.leftMenu) {
if (options.leftMenu.disable)
@ -805,6 +806,9 @@ define([
if (options.plugins) {
app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
}
if (options.protect) {
app.getController('Common.Controllers.Protection').SetDisabled(disable, false);
}
if (prev_options) {
this.onEditingDisable(prev_options.disable, prev_options.options, prev_options.type);

View file

@ -124,17 +124,23 @@ define([
if (!this.editMode) return;
var me = this;
var disable = [], type;
var disable = {}, type,
islocked = false,
shapeProps,
canGroupUngroup = false,
wrapping,
content_locked = false,
no_object = true;
for (var i in objects) {
type = objects[i].get_ObjectType();
if ( type === Asc.c_oAscTypeSelectElement.Image ) {
var props = objects[i].get_ObjectValue(),
shapeProps = props.get_ShapeProperties();
var islocked = props.get_Locked();
var notflow = !props.get_CanBeFlow();
var wrapping = props.get_WrappingStyle();
notflow = !props.get_CanBeFlow();
shapeProps = props.get_ShapeProperties();
islocked = props.get_Locked();
wrapping = props.get_WrappingStyle();
no_object = false;
me.onApiWrappingStyleChanged(notflow ? -1 : wrapping);
_.each(me.toolbar.btnImgWrapping.menu.items, function(item) {
@ -143,47 +149,35 @@ define([
me.toolbar.btnImgWrapping.menu.items[10].setDisabled(!me.api.CanChangeWrapPolygon());
var control_props = me.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null,
lock_type = (control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked,
content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked;
lock_type = (control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked;
disable.align = islocked || wrapping == Asc.c_oAscWrapStyle2.Inline || content_locked;
disable.group = islocked || wrapping == Asc.c_oAscWrapStyle2.Inline || content_locked;
disable.arrange = (wrapping == Asc.c_oAscWrapStyle2.Inline) && !props.get_FromGroup() || shapeProps && shapeProps.asc_getFromSmartArtInternal() || content_locked;
disable.wrapping = islocked || props.get_FromGroup() || (notflow && !me.api.CanChangeWrapPolygon()) || content_locked ||
content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked;
disable.arrange = (wrapping == Asc.c_oAscWrapStyle2.Inline) && !props.get_FromGroup();
disable.wrapping = props.get_FromGroup() || (notflow && !me.api.CanChangeWrapPolygon()) ||
(!!control_props && control_props.get_SpecificType()==Asc.c_oAscContentControlSpecificType.Picture && !control_props.get_FormPr());
if ( !disable.group ) {
if (me.api.CanGroup() || me.api.CanUnGroup()) {
var mnuGroup = me.toolbar.btnImgGroup.menu.items[0],
mnuUnGroup = me.toolbar.btnImgGroup.menu.items[1];
mnuGroup.setDisabled(!me.api.CanGroup());
mnuUnGroup.setDisabled(!me.api.CanUnGroup());
} else
disable.group = true;
disable.group = islocked || wrapping == Asc.c_oAscWrapStyle2.Inline || content_locked;
canGroupUngroup = me.api.CanGroup() || me.api.CanUnGroup();
if (!disable.group && canGroupUngroup) {
me.toolbar.btnImgGroup.menu.items[0].setDisabled(!me.api.CanGroup());
me.toolbar.btnImgGroup.menu.items[1].setDisabled(!me.api.CanUnGroup());
}
_imgOriginalProps = props;
break;
}
}
me.toolbar.btnImgAlign.setDisabled(disable.align !== false);
me.toolbar.btnImgGroup.setDisabled(disable.group !== false);
me.toolbar.btnImgForward.setDisabled(disable.arrange !== false);
me.toolbar.btnImgBackward.setDisabled(disable.arrange !== false);
me.toolbar.btnImgWrapping.setDisabled(disable.wrapping !== false);
me.toolbar.lockToolbar(Common.enumLock.noObjectSelected, no_object, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping, me.toolbar.btnImgForward, me.toolbar.btnImgBackward]});
me.toolbar.lockToolbar(Common.enumLock.imageLock, islocked, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping]});
me.toolbar.lockToolbar(Common.enumLock.contentLock, content_locked, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup, me.toolbar.btnImgWrapping, me.toolbar.btnImgForward, me.toolbar.btnImgBackward]});
me.toolbar.lockToolbar(Common.enumLock.inImageInline, wrapping == Asc.c_oAscWrapStyle2.Inline, {array: [me.toolbar.btnImgAlign, me.toolbar.btnImgGroup]});
me.toolbar.lockToolbar(Common.enumLock.inSmartartInternal, shapeProps && shapeProps.asc_getFromSmartArtInternal(), {array: [me.toolbar.btnImgForward, me.toolbar.btnImgBackward]});
me.toolbar.lockToolbar(Common.enumLock.cantGroup, !canGroupUngroup, {array: [me.toolbar.btnImgGroup]});
me.toolbar.lockToolbar(Common.enumLock.cantWrap, disable.wrapping, {array: [me.toolbar.btnImgWrapping]});
me.toolbar.lockToolbar(Common.enumLock.cantArrange, disable.arrange, {array: [me.toolbar.btnImgForward, me.toolbar.btnImgBackward]});
},
onApiCoAuthoringDisconnect: function() {
var me = this;
me.editMode = false;
me.toolbar.btnImgAlign.setDisabled(true);
me.toolbar.btnImgGroup.setDisabled(true);
me.toolbar.btnImgForward.setDisabled(true);
me.toolbar.btnImgBackward.setDisabled(true);
me.toolbar.btnImgWrapping.setDisabled(true);
this.editMode = false;
},
onBeforeShapeAlign: function() {

View file

@ -503,12 +503,12 @@ define([
onApiCanRevert: function(which, can) {
if (which=='undo') {
if (this._state.can_undo !== can) {
this.toolbar.btnUndo.setDisabled(!can);
this.toolbar.lockToolbar(Common.enumLock.undoLock, !can, {array: [this.toolbar.btnUndo]});
this._state.can_undo = can;
}
} else {
if (this._state.can_redo !== can) {
this.toolbar.btnRedo.setDisabled(!can);
this.toolbar.lockToolbar(Common.enumLock.redoLock, !can, {array: [this.toolbar.btnRedo]});
this._state.can_redo = can;
}
}
@ -516,7 +516,7 @@ define([
onApiCanCopyCut: function(can) {
if (this._state.can_copycut !== can) {
this.toolbar.btnCopy.setDisabled(!can);
this.toolbar.lockToolbar(Common.enumLock.copyLock, !can, {array: [this.toolbar.btnCopy]});
this._state.can_copycut = can;
}
},
@ -725,18 +725,21 @@ define([
plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : false,
plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : false;
var need_disable = !this.api.can_AddQuotedComment() || paragraph_locked || header_locked || image_locked || rich_del_lock || rich_edit_lock || plain_del_lock || plain_edit_lock;
if (this.mode.compatibleFeatures) {
need_disable = need_disable || in_image;
}
this.toolbar.lockToolbar(Common.enumLock.cantAddQuotedComment, !this.api.can_AddQuotedComment(), {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.imageLock, image_locked, {array: this.btnsComment});
this.mode.compatibleFeatures && this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: this.btnsComment});
if (this.api.asc_IsContentControl()) {
var control_props = this.api.asc_GetContentControlProperties(),
spectype = control_props ? control_props.get_SpecificType() : Asc.c_oAscContentControlSpecificType.None;
need_disable = need_disable || spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture ||
spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime;
this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture ||
spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime, {array: this.btnsComment});
}
if ( this.btnsComment && this.btnsComment.length > 0 )
this.btnsComment.setDisabled(need_disable);
this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.headerLock, header_locked, {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.richEditLock, rich_edit_lock, {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.plainEditLock, plain_edit_lock, {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.richDelLock, rich_del_lock, {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: this.btnsComment});
},
onApiFocusObject: function(selectedObjects) {
@ -759,7 +762,8 @@ define([
btn_eq_state = false,
in_image = false,
in_control = false,
in_para = false;
in_para = false,
in_footnote = this.api.asc_IsCursorInFootnote() || this.api.asc_IsCursorInEndnote();
while (++i < selectedObjects.length) {
type = selectedObjects[i].get_ObjectType();
@ -802,17 +806,25 @@ define([
var rich_del_lock = (frame_pr) ? !frame_pr.can_DeleteBlockContentControl() : false,
rich_edit_lock = (frame_pr) ? !frame_pr.can_EditBlockContentControl() : false,
plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : false,
plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : false;
var need_disable = paragraph_locked || header_locked || rich_edit_lock || plain_edit_lock;
plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : false,
in_smart_art = shape_pr && shape_pr.asc_getFromSmartArt(),
in_smart_art_internal = shape_pr && shape_pr.asc_getFromSmartArtInternal();
if (this._state.prcontrolsdisable != need_disable) {
if (this._state.activated) this._state.prcontrolsdisable = need_disable;
_.each (toolbar.paragraphControls, function(item){
item.setDisabled(need_disable);
}, this);
}
toolbar.btnDecLeftOffset.setDisabled(need_disable || shape_pr && shape_pr.asc_getFromSmartArtInternal());
toolbar.btnIncLeftOffset.setDisabled(need_disable || shape_pr && shape_pr.asc_getFromSmartArtInternal());
this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: this.toolbar.paragraphControls.concat([toolbar.btnContentControls, toolbar.btnClearStyle])});
this.toolbar.lockToolbar(Common.enumLock.headerLock, header_locked, {array: this.toolbar.paragraphControls.concat([toolbar.btnContentControls, toolbar.btnClearStyle, toolbar.btnWatermark])});
this.toolbar.lockToolbar(Common.enumLock.richEditLock, rich_edit_lock, {array: this.toolbar.paragraphControls.concat([toolbar.btnClearStyle])});
this.toolbar.lockToolbar(Common.enumLock.plainEditLock, plain_edit_lock, {array: this.toolbar.paragraphControls.concat([toolbar.btnClearStyle])});
this.toolbar.lockToolbar(Common.enumLock.richDelLock, rich_del_lock, {array: this.btnsComment.concat(toolbar.btnsPageBreak).concat([toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertTextArt,
toolbar.btnInsDateTime, toolbar.btnBlankPage, toolbar.btnInsertEquation, toolbar.btnInsertSymbol ])});
this.toolbar.lockToolbar(Common.enumLock.plainDelLock, plain_del_lock, {array: this.btnsComment.concat(toolbar.btnsPageBreak).concat([toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertTextArt,
toolbar.btnInsDateTime, toolbar.btnBlankPage, toolbar.btnInsertEquation, toolbar.btnInsertSymbol ])});
this.toolbar.lockToolbar(Common.enumLock.inChart, in_chart, {array: toolbar.textOnlyControls.concat([toolbar.btnClearStyle, toolbar.btnInsertEquation])});
this.toolbar.lockToolbar(Common.enumLock.inSmartart, in_smart_art, {array: toolbar.textOnlyControls.concat([toolbar.btnClearStyle])});
this.toolbar.lockToolbar(Common.enumLock.inSmartartInternal, in_smart_art_internal, {array: toolbar.textOnlyControls.concat([toolbar.btnClearStyle, toolbar.btnDecLeftOffset, toolbar.btnIncLeftOffset])});
this.toolbar.lockToolbar(Common.enumLock.inEquation, in_equation, {array: toolbar.btnsPageBreak.concat([toolbar.btnDropCap, toolbar.btnInsertTable, toolbar.btnBlankPage, toolbar.btnInsertShape,
toolbar.btnInsertText, toolbar.btnInsertTextArt, toolbar.btnInsertImage, toolbar.btnSuperscript, toolbar.btnSubscript, toolbar.btnEditHeader])});
in_control = this.api.asc_IsContentControl();
var control_props = in_control ? this.api.asc_GetContentControlProperties() : null,
@ -821,8 +833,7 @@ define([
(lock_type===undefined) && (lock_type = Asc.c_oAscSdtLockType.Unlocked);
var content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked;
toolbar.btnContentControls.setDisabled(paragraph_locked || header_locked);
if (!(paragraph_locked || header_locked)) {
if (!toolbar.btnContentControls.isDisabled()) {
var control_disable = control_plain || content_locked,
if_form = control_props && control_props.get_FormPr();
for (var i=0; i<7; i++)
@ -831,18 +842,8 @@ define([
toolbar.btnContentControls.menu.items[10].setDisabled(!in_control || if_form);
}
var need_text_disable = paragraph_locked || header_locked || in_chart || rich_edit_lock || plain_edit_lock || shape_pr && (shape_pr.asc_getFromSmartArt() || shape_pr.asc_getFromSmartArtInternal());
if (this._state.textonlycontrolsdisable != need_text_disable) {
if (this._state.activated) this._state.textonlycontrolsdisable = need_text_disable;
if (!need_disable) {
_.each (toolbar.textOnlyControls, function(item){
item.setDisabled(need_text_disable);
}, this);
}
// toolbar.btnCopyStyle.setDisabled(need_text_disable);
toolbar.btnClearStyle.setDisabled(need_text_disable);
}
this.toolbar.lockToolbar(Common.enumLock.controlPlain, control_plain, {array: [toolbar.btnInsertTable, toolbar.btnInsertImage, toolbar.btnInsertChart, toolbar.btnInsertText, toolbar.btnInsertTextArt,
toolbar.btnInsertShape, toolbar.btnInsertEquation, toolbar.btnDropCap, toolbar.btnColumns, toolbar.mnuInsertPageNum ]});
if (enable_dropcap && frame_pr) {
var value = frame_pr.get_FramePr(),
drop_value = Asc.c_oAscDropCap.None;
@ -858,79 +859,49 @@ define([
if (enable_dropcap)
this.onDropCap(drop_value);
}
need_disable = need_disable || !enable_dropcap || in_equation || control_plain;
toolbar.btnDropCap.setDisabled(need_disable);
this.toolbar.lockToolbar(Common.enumLock.dropcapLock, !enable_dropcap, {array: [toolbar.btnDropCap]});
if ( !toolbar.btnDropCap.isDisabled() )
toolbar.mnuDropCapAdvanced.setDisabled(disable_dropcapadv);
need_disable = !can_add_table || header_locked || in_equation || control_plain || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock;
toolbar.btnInsertTable.setDisabled(need_disable);
need_disable = toolbar.mnuPageNumCurrentPos.isDisabled() && toolbar.mnuPageNumberPosPicker.isDisabled() || control_plain;
toolbar.mnuInsertPageNum.setDisabled(need_disable);
var in_footnote = this.api.asc_IsCursorInFootnote() || this.api.asc_IsCursorInEndnote();
need_disable = paragraph_locked || header_locked || in_header || in_image || in_equation && !btn_eq_state || in_footnote || in_control || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock;
toolbar.btnsPageBreak.setDisabled(need_disable);
toolbar.btnBlankPage.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || in_equation || control_plain || content_locked || in_footnote;
toolbar.btnInsertShape.setDisabled(need_disable);
toolbar.btnInsertText.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || in_para && !can_add_image || in_equation || control_plain || rich_del_lock || plain_del_lock || content_locked;
toolbar.btnInsertImage.setDisabled(need_disable);
toolbar.btnInsertTextArt.setDisabled(need_disable || in_footnote);
this.toolbar.lockToolbar(Common.enumLock.cantAddTable, !can_add_table, {array: [toolbar.btnInsertTable]});
this.toolbar.lockToolbar(Common.enumLock.cantAddPageNum, toolbar.mnuPageNumCurrentPos.isDisabled() && toolbar.mnuPageNumberPosPicker.isDisabled(), {array: [toolbar.mnuInsertPageNum]});
this.toolbar.lockToolbar(Common.enumLock.inHeader, in_header, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage])});
this.toolbar.lockToolbar(Common.enumLock.inControl, in_control, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage])});
this.toolbar.lockToolbar(Common.enumLock.cantPageBreak, in_image && !btn_eq_state, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage])});
this.toolbar.lockToolbar(Common.enumLock.contentLock, content_locked, {array: [toolbar.btnInsertShape, toolbar.btnInsertText, toolbar.btnInsertImage, toolbar.btnInsertTextArt, toolbar.btnInsertChart ]});
this.toolbar.lockToolbar(Common.enumLock.inFootnote, in_footnote, {array: toolbar.btnsPageBreak.concat([toolbar.btnBlankPage, toolbar.btnInsertShape, toolbar.btnInsertText, toolbar.btnInsertTextArt ])});
this.toolbar.lockToolbar(Common.enumLock.cantAddImagePara, in_para && !can_add_image, {array: [toolbar.btnInsertImage, toolbar.btnInsertTextArt]});
if (in_chart !== this._state.in_chart) {
toolbar.btnInsertChart.updateHint(in_chart ? toolbar.tipChangeChart : toolbar.tipInsertChart);
this._state.in_chart = in_chart;
}
var need_disable = paragraph_locked || header_locked || in_equation || control_plain || rich_del_lock || plain_del_lock || content_locked || in_para && !can_add_image;
need_disable = !in_chart && need_disable;
this.toolbar.lockToolbar(Common.enumLock.cantAddChart, need_disable, {array: [toolbar.btnInsertChart]});
this.toolbar.lockToolbar(Common.enumLock.chartLock, in_chart && image_locked, {array: [toolbar.btnInsertChart]});
need_disable = in_chart && image_locked || !in_chart && need_disable || control_plain || rich_del_lock || plain_del_lock || content_locked;
toolbar.btnInsertChart.setDisabled(need_disable);
need_disable = paragraph_locked || header_locked || in_chart || !can_add_image&&!in_equation || control_plain || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock;
toolbar.btnInsertEquation.setDisabled(need_disable);
toolbar.btnInsertSymbol.setDisabled(!in_para || paragraph_locked || header_locked || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock);
toolbar.btnInsDateTime.setDisabled(!in_para || paragraph_locked || header_locked || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock);
need_disable = paragraph_locked || header_locked || in_equation || rich_edit_lock || plain_edit_lock;
toolbar.btnSuperscript.setDisabled(need_disable);
toolbar.btnSubscript.setDisabled(need_disable);
toolbar.btnEditHeader.setDisabled(in_equation);
need_disable = paragraph_locked || header_locked || in_image || control_plain || rich_edit_lock || plain_edit_lock || this._state.lock_doc;
if (need_disable != toolbar.btnColumns.isDisabled())
toolbar.btnColumns.setDisabled(need_disable);
toolbar.btnLineNumbers.setDisabled(in_image && in_para || this._state.lock_doc);
this.toolbar.lockToolbar(Common.enumLock.cantAddEquation, !can_add_image&&!in_equation, {array: [toolbar.btnInsertEquation]});
this.toolbar.lockToolbar(Common.enumLock.noParagraphSelected, !in_para, {array: [toolbar.btnInsertSymbol, toolbar.btnInsDateTime]});
this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: [toolbar.btnColumns]});
this.toolbar.lockToolbar(Common.enumLock.inImagePara, in_image && in_para, {array: [toolbar.btnLineNumbers]});
if (toolbar.listStylesAdditionalMenuItem && (frame_pr===undefined) !== toolbar.listStylesAdditionalMenuItem.isDisabled())
toolbar.listStylesAdditionalMenuItem.setDisabled(frame_pr===undefined);
need_disable = !this.api.can_AddQuotedComment() || paragraph_locked || header_locked || image_locked || rich_del_lock || rich_edit_lock || plain_del_lock || plain_edit_lock;
if (this.mode.compatibleFeatures) {
need_disable = need_disable || in_image;
}
// comments
this.toolbar.lockToolbar(Common.enumLock.cantAddQuotedComment, !this.api.can_AddQuotedComment(), {array: this.btnsComment});
this.toolbar.lockToolbar(Common.enumLock.imageLock, image_locked, {array: this.btnsComment});
this.mode.compatibleFeatures && this.toolbar.lockToolbar(Common.enumLock.inImage, in_image, {array: this.btnsComment});
if (control_props) {
var spectype = control_props.get_SpecificType();
need_disable = need_disable || spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture ||
spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime;
this.toolbar.lockToolbar(Common.enumLock.inSpecificForm, spectype==Asc.c_oAscContentControlSpecificType.CheckBox || spectype==Asc.c_oAscContentControlSpecificType.Picture ||
spectype==Asc.c_oAscContentControlSpecificType.ComboBox || spectype==Asc.c_oAscContentControlSpecificType.DropDownList || spectype==Asc.c_oAscContentControlSpecificType.DateTime,
{array: this.btnsComment});
}
if ( this.btnsComment && this.btnsComment.length > 0 )
this.btnsComment.setDisabled(need_disable);
toolbar.btnWatermark.setDisabled(header_locked);
if (frame_pr) {
this._state.suppress_num = !!frame_pr.get_SuppressLineNumbers();
}
this._state.in_equation = in_equation;
},
@ -973,38 +944,34 @@ define([
onApiLockDocumentProps: function() {
if (this._state.lock_doc!==true) {
this.toolbar.btnPageOrient.setDisabled(true);
this.toolbar.btnPageSize.setDisabled(true);
this.toolbar.btnPageMargins.setDisabled(true);
this.toolbar.lockToolbar(Common.enumLock.docPropsLock, true, {array: [this.toolbar.btnPageOrient, this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnColumns, this.toolbar.btnLineNumbers]});
if (this._state.activated) this._state.lock_doc = true;
}
},
onApiUnLockDocumentProps: function() {
if (this._state.lock_doc!==false) {
this.toolbar.btnPageOrient.setDisabled(false);
this.toolbar.btnPageSize.setDisabled(false);
this.toolbar.btnPageMargins.setDisabled(false);
this.toolbar.lockToolbar(Common.enumLock.docPropsLock, false, {array: [this.toolbar.btnPageOrient, this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnColumns, this.toolbar.btnLineNumbers]});
if (this._state.activated) this._state.lock_doc = false;
}
},
onApiLockDocumentSchema: function() {
this.toolbar.btnColorSchemas.setDisabled(true);
this.toolbar.lockToolbar(Common.enumLock.docSchemaLock, true, {array: [this.toolbar.btnColorSchemas]});
},
onApiUnLockDocumentSchema: function() {
this.toolbar.btnColorSchemas.setDisabled(false);
this.toolbar.lockToolbar(Common.enumLock.docSchemaLock, false, {array: [this.toolbar.btnColorSchemas]});
},
onApiLockHeaderFooters: function() {
this.toolbar.mnuPageNumberPosPicker.setDisabled(true);
this.toolbar.mnuInsertPageNum.setDisabled(this.toolbar.mnuPageNumCurrentPos.isDisabled());
this.toolbar.lockToolbar(Common.enumLock.headerFooterLock, true, {array: [this.toolbar.mnuPageNumberPosPicker]});
this.toolbar.lockToolbar(Common.enumLock.cantAddPageNum, this.toolbar.mnuPageNumCurrentPos.isDisabled(), {array: [this.toolbar.mnuInsertPageNum]});
},
onApiUnLockHeaderFooters: function() {
this.toolbar.mnuPageNumberPosPicker.setDisabled(false);
this.toolbar.mnuInsertPageNum.setDisabled(false);
this.toolbar.lockToolbar(Common.enumLock.headerFooterLock, false, {array: [this.toolbar.mnuPageNumberPosPicker]});
this.toolbar.lockToolbar(Common.enumLock.cantAddPageNum, false, {array: [this.toolbar.mnuInsertPageNum]});
},
onApiZoomChange: function(percent, type) {},
@ -2903,16 +2870,12 @@ define([
},
activateControls: function() {
_.each(this.toolbar.toolbarControls, function(item){
item.setDisabled(false);
}, this);
this.toolbar.btnUndo.setDisabled(this._state.can_undo!==true);
this.toolbar.btnRedo.setDisabled(this._state.can_redo!==true);
this.toolbar.btnCopy.setDisabled(this._state.can_copycut!==true);
this.toolbar.btnPrint.setDisabled(!this.toolbar.mode.canPrint);
this.toolbar.btnDarkDocument && this.toolbar.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme());
this.toolbar.lockToolbar(Common.enumLock.disableOnStart, false);
this.toolbar.lockToolbar(Common.enumLock.undoLock, this._state.can_undo!==true, {array: [this.toolbar.btnUndo]});
this.toolbar.lockToolbar(Common.enumLock.redoLock, this._state.can_redo!==true, {array: [this.toolbar.btnRedo]});
this.toolbar.lockToolbar(Common.enumLock.copyLock, this._state.can_copycut!==true, {array: [this.toolbar.btnCopy]});
this.toolbar.lockToolbar(Common.enumLock.mmergeLock, !!this._state.mmdisable, {array: [this.toolbar.btnMailRecepients]});
if (!this._state.mmdisable) {
this.toolbar.btnMailRecepients.setDisabled(false);
this.toolbar.mnuMailRecepients.items[2].setVisible(this.toolbar.mode.fileChoiceUrl || this.toolbar.mode.canRequestMailMergeRecipients);
}
this._state.activated = true;
@ -2923,7 +2886,7 @@ define([
DisableMailMerge: function() {
this._state.mmdisable = true;
this.toolbar && this.toolbar.btnMailRecepients && this.toolbar.btnMailRecepients.setDisabled(true);
this.toolbar && this.toolbar.btnMailRecepients && this.toolbar.lockToolbar(Common.enumLock.mmergeLock, true, {array: [this.toolbar.btnMailRecepients]});
},
updateThemeColors: function() {
@ -3084,38 +3047,21 @@ define([
var toolbar = this.toolbar;
toolbar.hideMoreBtns();
if (reviewmode)
toolbar.lockToolbar(Common.enumLock.previewReviewMode, disable);
else if (fillformmode)
toolbar.lockToolbar(Common.enumLock.viewFormMode, disable);
if(disable) {
if (reviewmode) {
mask = $("<div class='toolbar-group-mask'>").appendTo(toolbar.$el.find('.toolbar section.panel .group:not(.no-mask):not(.no-group-mask.review):not(.no-group-mask.inner-elset)'));
mask = $("<div class='toolbar-group-mask'>").appendTo(toolbar.$el.find('.toolbar section.panel .group.no-group-mask.inner-elset .elset'));
} else if (fillformmode) {
mask = $("<div class='toolbar-group-mask'>").appendTo(toolbar.$el.find('.toolbar section.panel .group:not(.no-mask):not(.no-group-mask.form-view):not(.no-group-mask.inner-elset)'));
mask = $("<div class='toolbar-group-mask'>").appendTo(toolbar.$el.find('.toolbar section.panel .group.no-group-mask.inner-elset .elset:not(.no-group-mask.form-view)'));
} else
if (reviewmode || fillformmode)
mask = $("<div class='toolbar-group-mask'>").appendTo(toolbar.$el.find('.toolbar'));
else
mask = $("<div class='toolbar-mask'>").appendTo(toolbar.$el.find('.toolbar'));
} else {
mask.remove();
}
$('.no-group-mask').each(function(index, item){
var $el = $(item);
if ($el.find('> .toolbar-group-mask').length>0)
$el.css('opacity', 0.4);
else {
$el.css('opacity', reviewmode || fillformmode || !disable ? 1 : 0.4);
$el.find('.elset').each(function(index, elitem){
var $elset = $(elitem);
if ($elset.find('> .toolbar-group-mask').length>0) {
$elset.css('opacity', 0.4);
} else {
$elset.css('opacity', reviewmode || fillformmode || !disable ? 1 : 0.4);
}
$el.css('opacity', 1);
});
}
});
toolbar.$el.find('.toolbar').toggleClass('masked', $('.toolbar-mask').length>0);
disable = disable || ((reviewmode || fillformmode) ? toolbar_mask.length>0 : group_mask.length>0);
toolbar.$el.find('.toolbar').toggleClass('masked', disable);
if ( toolbar.synchTooltip )
toolbar.synchTooltip.hide();
@ -3237,12 +3183,11 @@ define([
var links = me.getApplication().getController('Links');
links.setApi(me.api).setConfig({toolbar: me});
Array.prototype.push.apply(me.toolbar.toolbarControls, links.getView('Links').getButtons());
Array.prototype.push.apply(me.toolbar.lockControls, links.getView('Links').getButtons());
var viewtab = me.getApplication().getController('ViewTab');
viewtab.setApi(me.api).setConfig({toolbar: me, mode: config});
Array.prototype.push.apply(me.toolbar.toolbarControls, viewtab.getView('ViewTab').getButtons());
me.toolbar.btnDarkDocument = viewtab.getView('ViewTab').btnDarkDocument;
Array.prototype.push.apply(me.toolbar.lockControls, viewtab.getView('ViewTab').getButtons());
}
if ( config.isEdit && config.canFeatureContentControl && config.canFeatureForms || config.isRestrictedEdit && config.canFillForms ) {
if (config.isFormCreator) {
@ -3253,7 +3198,7 @@ define([
if ($panel) {
me.toolbar.addTab(tab, $panel, 4);
me.toolbar.setVisible('forms', true);
config.isEdit && config.canFeatureContentControl && config.canFeatureForms && Array.prototype.push.apply(me.toolbar.toolbarControls, forms.getView('FormsTab').getButtons());
config.isEdit && config.canFeatureContentControl && config.canFeatureForms && Array.prototype.push.apply(me.toolbar.lockControls, forms.getView('FormsTab').getButtons());
!compactview && (config.isFormCreator || config.isRestrictedEdit && config.canFillForms) && me.toolbar.setTab('forms');
}
}
@ -3266,7 +3211,10 @@ define([
me.appOptions = config;
if ( config.canCoAuthoring && config.canComments ) {
this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', this.toolbar.capBtnComment, undefined, undefined, undefined, undefined, '1', 'bottom');
this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', this.toolbar.capBtnComment,
[ Common.enumLock.paragraphLock, Common.enumLock.headerLock, Common.enumLock.richEditLock, Common.enumLock.plainEditLock, Common.enumLock.richDelLock, Common.enumLock.plainDelLock,
Common.enumLock.cantAddQuotedComment, Common.enumLock.imageLock, Common.enumLock.inSpecificForm, Common.enumLock.inImage, Common.enumLock.lostConnect, Common.enumLock.disableOnStart],
undefined, undefined, undefined, '1', 'bottom');
if ( this.btnsComment.length ) {
var _comments = DE.getController('Common.Controllers.Comments').getView();
this.btnsComment.forEach(function (btn) {
@ -3278,6 +3226,7 @@ define([
btn.setCaption(me.toolbar.capBtnAddComment);
}, this);
}
Array.prototype.push.apply(this.toolbar.paragraphControls, this.btnsComment);
}
(new Promise(function(accept) {

View file

@ -161,12 +161,12 @@ define([
me.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) {
var value = item.value;
Common.UI.Themes.setTheme(value);
me.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme());
Common.Utils.lockControls(Common.enumLock.inLightTheme, !Common.UI.Themes.isDarkTheme(), {array: [me.view.btnDarkDocument]});
}, me));
setTimeout(function () {
me.onContentThemeChangedToDark(Common.UI.Themes.isContentThemeDark());
me.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme());
Common.Utils.lockControls(Common.enumLock.inLightTheme, !Common.UI.Themes.isDarkTheme(), {array: [me.view.btnDarkDocument]});
}, 0);
}
});
@ -248,7 +248,7 @@ define([
menu_item = _.findWhere(this.view.btnInterfaceTheme.menu.items, {value: current_theme});
this.view.btnInterfaceTheme.menu.clearAll();
menu_item.setChecked(true, true);
this.view.btnDarkDocument.setDisabled(!Common.UI.Themes.isDarkTheme());
Common.Utils.lockControls(Common.enumLock.inLightTheme, !Common.UI.Themes.isDarkTheme(), {array: [this.view.btnDarkDocument]});
}
},

View file

@ -1616,7 +1616,7 @@ define([
: Common.util.Shortcuts.resumeEvents(hkComments);
/** coauthoring end **/
this.editorConfig = {user: m.user};
this._fillFormwMode = !this.mode.isEdit && this.mode.canFillForms;
this._fillFormMode = !this.mode.isEdit && this.mode.canFillForms;
};
me.on('render:after', onAfterRender, me);
@ -2095,9 +2095,9 @@ define([
var disabled = value.paraProps && value.paraProps.locked === true;
var cancopy = me.api && me.api.can_CopyCut();
menuViewCopy.setDisabled(!cancopy);
menuViewCut.setVisible(me._fillFormwMode && canEditControl);
menuViewCut.setVisible(me._fillFormMode && canEditControl);
menuViewCut.setDisabled(disabled || !cancopy);
menuViewPaste.setVisible(me._fillFormwMode && canEditControl);
menuViewPaste.setVisible(me._fillFormMode && canEditControl);
menuViewPaste.setDisabled(disabled);
menuViewPrint.setVisible(me.mode.canPrint);
menuViewPrint.setDisabled(!cancopy);
@ -4507,10 +4507,10 @@ define([
_.defer(function(){ me.cmpEl.focus(); }, 50);
},
SetDisabled: function(state, canProtect, fillFormwMode) {
SetDisabled: function(state, canProtect, fillFormMode) {
this._isDisabled = state;
this._canProtect = canProtect;
this._fillFormwMode = state ? fillFormwMode : false;
this._fillFormMode = state ? fillFormMode : false;
},
alignmentText : 'Alignment',

View file

@ -142,6 +142,7 @@ define([
this.paragraphControls = [];
var me = this;
var _set = Common.enumLock;
if (this.appConfig.isRestrictedEdit && this.appConfig.canFillForms) {
this.btnClear = new Common.UI.Button({
@ -153,8 +154,8 @@ define([
this.btnTextField = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-text-field',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnText,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -164,8 +165,8 @@ define([
this.btnComboBox = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-combo-box',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnComboBox,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -175,8 +176,8 @@ define([
this.btnDropDown = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-dropdown',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnDropDown,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -186,8 +187,8 @@ define([
this.btnCheckBox = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-checkbox',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnCheckBox,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -197,8 +198,8 @@ define([
this.btnRadioBox = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-radio-button',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnRadioBox,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -208,8 +209,8 @@ define([
this.btnImageField = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-insertimage',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnImage,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -219,9 +220,9 @@ define([
this.btnViewForm = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-sheet-view',
lock: [ _set.previewReviewMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnView,
enableToggle: true,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -231,8 +232,8 @@ define([
this.btnClearFields = new Common.UI.Button({
cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-clearstyle',
lock: [ _set.previewReviewMode, _set.lostConnect, _set.disableOnStart],
caption : this.textClearFields,
disabled: true,
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
@ -242,9 +243,9 @@ define([
this.btnHighlight = new Common.UI.ButtonColored({
cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-highlight',
lock: [ _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption : this.textHighlight,
menu : true,
disabled: true,
additionalItems: [ this.mnuNoFormsColor = new Common.UI.MenuItem({
id: 'id-toolbar-menu-no-highlight-form',
caption: this.textNoHighlight,
@ -268,8 +269,9 @@ define([
this.btnPrevForm = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon previous-field',
lock: [ _set.previewReviewMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnPrev,
disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode
// disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -279,8 +281,9 @@ define([
this.btnNextForm = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon next-field',
lock: [ _set.previewReviewMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnNext,
disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode,
// disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -291,8 +294,9 @@ define([
this.btnSubmit = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon submit-form',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.capBtnSubmit,
disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode,
// disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -302,16 +306,17 @@ define([
if (this.appConfig.canDownloadForms) {
this.btnSaveForm = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
lock: [_set.lostConnect, _set.disableOnStart],
iconCls: 'toolbar__icon save-form',
caption: this.capBtnSaveForm,
disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode,
// disabled: this.appConfig.isEdit && this.appConfig.canFeatureContentControl && this.appConfig.canFeatureForms, // disable only for edit mode,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.paragraphControls.push(this.btnSaveForm);
}
Common.Utils.lockControls(Common.enumLock.disableOnStart, true, {array: this.paragraphControls});
this._state = {disabled: false};
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
},

View file

@ -157,23 +157,29 @@ define([
this.btnsPrevEndNote = [];
this.btnsNextEndNote = [];
this.paragraphControls = [];
var _set = Common.enumLock;
var me = this,
$host = me.toolbar.$el;
this.btnsContents = Common.Utils.injectButtons($host.find('.btn-slot.btn-contents'), '', 'toolbar__icon btn-contents', me.capBtnInsContents, undefined, true, true, undefined, '1', 'bottom', 'small');
this.btnsNotes = Common.Utils.injectButtons($host.find('.btn-slot.slot-notes'), '', 'toolbar__icon btn-notes', me.capBtnInsFootnote, undefined, true, true, undefined, '1', 'bottom', 'small');
this.btnsHyperlink = Common.Utils.injectButtons($host.find('.btn-slot.slot-inshyperlink'), '', 'toolbar__icon btn-inserthyperlink', me.capBtnInsLink, undefined, undefined, undefined, undefined, '1', 'bottom', 'small');
this.btnsContents = Common.Utils.injectButtons($host.find('.btn-slot.btn-contents'), '', 'toolbar__icon btn-contents', me.capBtnInsContents,
[_set.inHeader, _set.richEditLock, _set.plainEditLock, _set.richDelLock, _set.plainDelLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
true, true, undefined, '1', 'bottom', 'small');
this.btnsNotes = Common.Utils.injectButtons($host.find('.btn-slot.slot-notes'), '', 'toolbar__icon btn-notes', me.capBtnInsFootnote,
[_set.paragraphLock, _set.inEquation, _set.inImage, _set.inHeader, _set.controlPlain, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
true, true, undefined, '1', 'bottom', 'small');
this.btnsHyperlink = Common.Utils.injectButtons($host.find('.btn-slot.slot-inshyperlink'), '', 'toolbar__icon btn-inserthyperlink', me.capBtnInsLink,
[_set.paragraphLock, _set.headerLock, _set.hyperlinkLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
undefined, undefined, undefined, '1', 'bottom', 'small');
Array.prototype.push.apply(this.paragraphControls, this.btnsContents.concat(this.btnsNotes, this.btnsHyperlink));
this.btnContentsUpdate = new Common.UI.Button({
parentEl: $host.find('#slot-btn-contents-update'),
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-update',
lock: [ _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnContentsUpdate,
split: true,
menu: true,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -184,8 +190,8 @@ define([
parentEl: $host.find('#slot-btn-bookmarks'),
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-bookmarks',
lock: [_set.paragraphLock, _set.inHeader, _set.headerLock, _set.controlPlain, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnBookmarks,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -196,8 +202,8 @@ define([
parentEl: $host.find('#slot-btn-caption'),
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-caption',
lock: [_set.inHeader, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnCaption,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -208,8 +214,8 @@ define([
parentEl: $host.find('#slot-btn-crossref'),
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-cross-reference',
lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.richEditLock, _set.plainEditLock, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnCrossRef,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -220,8 +226,8 @@ define([
parentEl: $host.find('#slot-btn-tof'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-contents',
lock: [_set.inHeader, _set.richEditLock, _set.plainEditLock, _set.richDelLock, _set.plainDelLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnTOF,
disabled: true,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'medium'
@ -232,14 +238,14 @@ define([
parentEl: $host.find('#slot-btn-tof-update'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-update',
lock: [_set.paragraphLock, _set.inHeader, _set.richEditLock, _set.plainEditLock, _set.richDelLock, _set.plainDelLock, _set.cantUpdateTOF, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: this.capBtnContentsUpdate,
disabled: true,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'medium'
});
this.paragraphControls.push(this.btnTableFiguresUpdate);
Common.Utils.lockControls(Common.enumLock.disableOnStart, true, {array: this.paragraphControls});
this._state = {disabled: false};
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
},

View file

@ -840,7 +840,7 @@ define([
Common.NotificationCenter.trigger('editing:disable', disable, {
viewMode: disable,
reviewMode: false,
fillFormwMode: false,
fillFormMode: false,
allowMerge: true,
allowSignature: false,
allowProtect: false,
@ -855,7 +855,8 @@ define([
viewport: false,
documentHolder: true,
toolbar: true,
plugins: false
plugins: false,
protect: false
}, 'mailmerge');
this.lockControls(DE.enumLockMM.preview, disable, {array: [this.btnInsField, this.btnEditData]});

View file

@ -396,7 +396,7 @@ define([
Common.NotificationCenter.trigger('editing:disable', disable, {
viewMode: disable,
reviewMode: false,
fillFormwMode: false,
fillFormMode: false,
allowMerge: false,
allowSignature: true,
allowProtect: true,
@ -411,7 +411,8 @@ define([
viewport: false,
documentHolder: true,
toolbar: true,
plugins: false
plugins: false,
protect: false
}, 'signature');
}
},

View file

@ -39,6 +39,8 @@
* Copyright (c) 2018 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
define([
'jquery',
@ -62,6 +64,64 @@ define([
], function ($, _, Backbone, template, template_view) {
'use strict';
if (!Common.enumLock)
Common.enumLock = {};
var enumLock = {
undoLock: 'can-undo',
redoLock: 'can-redo',
copyLock: 'can-copy',
paragraphLock: 'para-lock',
headerLock: 'header-lock',
headerFooterLock: 'header-footer-lock',
chartLock: 'chart-lock',
imageLock: 'image-lock',
richEditLock: 'rich-edit-lock',
plainEditLock: 'plain-edit-lock',
richDelLock: 'rich-del-lock',
plainDelLock: 'plain-del-lock',
contentLock: 'content-lock',
mmergeLock: 'mmerge-lock',
dropcapLock: 'dropcap-lock',
docPropsLock: 'doc-props-lock',
docSchemaLock: 'doc-schema-lock',
hyperlinkLock: 'can-hyperlink',
inSmartart: 'in-smartart',
inSmartartInternal: 'in-smartart-internal',
inSpecificForm: 'in-specific-form',
inChart: 'in-chart',
inEquation: 'in-equation',
inHeader: 'in-header',
inImage: 'in-image',
inImagePara: 'in-image-para',
inImageInline: 'in-image-inline',
inFootnote: 'in-footnote',
inControl: 'in-control',
inLightTheme: 'light-theme',
controlPlain: 'control-plain',
noParagraphSelected: 'no-paragraph',
cantAddTable: 'cant-add-table',
cantAddQuotedComment: 'cant-add-quoted-comment',
cantPrint: 'cant-print',
cantAddImagePara: 'cant-add-image-para',
cantAddEquation: 'cant-add-equation',
cantAddChart: 'cant-add-chart',
cantAddPageNum: 'cant-add-page-num',
cantPageBreak: 'cant-page-break',
cantUpdateTOF: 'cant-update-tof',
cantGroup: 'cant-group',
cantWrap: 'cant-wrap',
cantArrange: 'cant-arrange',
noObjectSelected: 'no-object',
lostConnect: 'disconnect',
disableOnStart: 'on-start'
};
for (var key in enumLock) {
if (enumLock.hasOwnProperty(key)) {
Common.enumLock[key] = enumLock[key];
}
}
DE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend((function(){
return {
@ -104,7 +164,8 @@ define([
applyLayout: function (config) {
var me = this;
me.lockControls = [];
var _set = Common.enumLock;
if ( config.isEdit ) {
Common.UI.Mixtbar.prototype.initialize.call(this, {
template: _.template(template),
@ -127,6 +188,7 @@ define([
id: 'id-toolbar-btn-print',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-print no-mask',
lock: [_set.cantPrint, _set.disableOnStart],
signals: ['disabled'],
dataHint: '1',
dataHintDirection: 'top',
@ -138,6 +200,7 @@ define([
id: 'id-toolbar-btn-save',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon no-mask ' + this.btnSaveCls,
lock: [_set.lostConnect, _set.disableOnStart],
signals: ['disabled'],
dataHint: '1',
dataHintDirection: 'bottom',
@ -150,6 +213,7 @@ define([
id: 'id-toolbar-btn-undo',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-undo',
lock: [_set.undoLock, _set.previewReviewMode, _set.lostConnect, _set.disableOnStart],
signals: ['disabled'],
dataHint: '1',
dataHintDirection: 'bottom',
@ -161,6 +225,7 @@ define([
id: 'id-toolbar-btn-redo',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-redo',
lock: [_set.redoLock, _set.previewReviewMode, _set.lostConnect, _set.disableOnStart],
signals: ['disabled'],
dataHint: '1',
dataHintDirection: 'bottom',
@ -172,6 +237,7 @@ define([
id: 'id-toolbar-btn-copy',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-copy',
lock: [_set.copyLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'top',
dataHintTitle: 'C'
@ -182,6 +248,7 @@ define([
id: 'id-toolbar-btn-paste',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-paste',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'top',
dataHintTitle: 'V'
@ -192,6 +259,7 @@ define([
id: 'id-toolbar-btn-incfont',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-incfont',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'top'
});
@ -201,6 +269,7 @@ define([
id: 'id-toolbar-btn-decfont',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-decfont',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'top'
});
@ -210,6 +279,7 @@ define([
id: 'id-toolbar-btn-bold',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-bold',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
dataHint: '1',
dataHintDirection: 'bottom'
@ -220,6 +290,7 @@ define([
id: 'id-toolbar-btn-italic',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-italic',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
dataHint: '1',
dataHintDirection: 'bottom'
@ -230,6 +301,7 @@ define([
id: 'id-toolbar-btn-underline',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-underline',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
dataHint: '1',
dataHintDirection: 'bottom'
@ -240,6 +312,7 @@ define([
id: 'id-toolbar-btn-strikeout',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-strikeout',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
dataHint: '1',
dataHintDirection: 'bottom'
@ -250,6 +323,7 @@ define([
id: 'id-toolbar-btn-superscript',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-superscript',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inEquation, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
toggleGroup: 'superscriptGroup',
dataHint: '1',
@ -261,6 +335,7 @@ define([
id: 'id-toolbar-btn-subscript',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-subscript',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inEquation, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
toggleGroup: 'superscriptGroup',
dataHint: '1',
@ -272,6 +347,8 @@ define([
id: 'id-toolbar-btn-highlight',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-highlight',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inChart, _set.inSmartart, _set.inSmartartInternal, _set.previewReviewMode, _set.viewFormMode,
_set.lostConnect, _set.disableOnStart],
enableToggle: true,
allowDepress: true,
split: true,
@ -297,6 +374,7 @@ define([
id: 'id-toolbar-btn-fontcolor',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-fontcolor',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
split: true,
menu: true,
auto: true,
@ -310,6 +388,8 @@ define([
id: 'id-toolbar-btn-paracolor',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-paracolor',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inChart, _set.inSmartart, _set.inSmartartInternal, _set.previewReviewMode, _set.viewFormMode,
_set.lostConnect, _set.disableOnStart],
split: true,
transparent: true,
menu: true,
@ -324,6 +404,7 @@ define([
id: 'id-toolbar-btn-case',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-change-case',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
menu: new Common.UI.Menu({
items: [
{caption: this.mniSentenceCase, value: Asc.c_oAscChangeTextCaseType.SentenceCase},
@ -342,6 +423,7 @@ define([
id: 'id-toolbar-btn-align-left',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-align-left',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
toggleGroup: 'alignGroup',
dataHint: '1',
@ -353,6 +435,7 @@ define([
id: 'id-toolbar-btn-align-center',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-align-center',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
toggleGroup: 'alignGroup',
dataHint: '1',
@ -364,6 +447,7 @@ define([
id: 'id-toolbar-btn-align-right',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-align-right',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
toggleGroup: 'alignGroup',
dataHint: '1',
@ -375,6 +459,7 @@ define([
id: 'id-toolbar-btn-align-just',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-align-just',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
toggleGroup: 'alignGroup',
dataHint: '1',
@ -386,6 +471,7 @@ define([
id: 'id-toolbar-btn-decoffset',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-decoffset',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inSmartartInternal, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'top'
});
@ -395,6 +481,7 @@ define([
id: 'id-toolbar-btn-incoffset',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-incoffset',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inSmartartInternal, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'top'
});
@ -404,6 +491,7 @@ define([
id: 'id-toolbar-btn-linespace',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-linespace',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
menu: new Common.UI.Menu({
style: 'min-width: 60px;',
items: [
@ -425,6 +513,7 @@ define([
id: 'id-toolbar-btn-hidenchars',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-paragraph',
lock: [ _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
split: true,
menu: new Common.UI.Menu({
@ -444,6 +533,8 @@ define([
id: 'id-toolbar-btn-markers',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-setmarkers',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inChart, _set.inSmartart, _set.inSmartartInternal, _set.previewReviewMode, _set.viewFormMode,
_set.lostConnect, _set.disableOnStart],
enableToggle: true,
toggleGroup: 'markersGroup',
split: true,
@ -459,6 +550,8 @@ define([
id: 'id-toolbar-btn-numbering',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-numbering',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inChart, _set.inSmartart, _set.inSmartartInternal, _set.previewReviewMode, _set.viewFormMode,
_set.lostConnect, _set.disableOnStart],
enableToggle: true,
toggleGroup: 'markersGroup',
split: true,
@ -474,6 +567,8 @@ define([
id: 'id-toolbar-btn-multilevels',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-multilevels',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inChart, _set.inSmartart, _set.inSmartartInternal, _set.previewReviewMode, _set.viewFormMode,
_set.lostConnect, _set.disableOnStart],
menu: true,
dataHint: '1',
dataHintDirection: 'top',
@ -505,6 +600,8 @@ define([
id: 'tlbtn-inserttable',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-inserttable',
lock: [_set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inEquation, _set.controlPlain, _set.richDelLock, _set.plainDelLock, _set.cantAddTable, _set.previewReviewMode,
_set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnInsTable,
menu: new Common.UI.Menu({
items: [
@ -525,6 +622,8 @@ define([
id: 'tlbtn-insertimage',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-insertimage',
lock: [_set.paragraphLock, _set.headerLock, _set.inEquation, _set.controlPlain, _set.richDelLock, _set.plainDelLock, _set.contentLock, _set.cantAddImagePara,
_set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnInsImage,
menu: new Common.UI.Menu({
items: [
@ -544,6 +643,8 @@ define([
cls: 'btn-toolbar x-huge icon-top',
caption: me.capBtnInsChart,
iconCls: 'toolbar__icon btn-insertchart',
lock: [ _set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.controlPlain, _set.richDelLock, _set.plainDelLock, _set.contentLock,
_set.chartLock, _set.cantAddChart, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
menu: true,
dataHint: '1',
dataHintDirection: 'bottom',
@ -555,6 +656,8 @@ define([
id: 'tlbtn-inserttext',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-text',
lock: [_set.paragraphLock, _set.headerLock, _set.inEquation, _set.controlPlain, _set.contentLock, _set.inFootnote, _set.previewReviewMode, _set.viewFormMode,
_set.lostConnect, _set.disableOnStart],
caption: me.capBtnInsTextbox,
enableToggle: true,
dataHint: '1',
@ -562,10 +665,13 @@ define([
dataHintOffset: 'small'
});
this.paragraphControls.push(this.btnInsertText);
this.btnInsertTextArt = new Common.UI.Button({
id: 'tlbtn-inserttextart',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-textart',
lock: [_set.paragraphLock, _set.headerLock, _set.inEquation, _set.controlPlain, _set.richDelLock, _set.plainDelLock, _set.contentLock, _set.inFootnote, _set.cantAddImagePara,
_set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnInsTextart,
menu: new Common.UI.Menu({
cls: 'menu-shapes',
@ -583,12 +689,15 @@ define([
id: 'id-toolbar-btn-editheader',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-editheader',
lock: [ _set.previewReviewMode, _set.viewFormMode, _set.inEquation, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnInsHeader,
menu: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.toolbarControls.push(this.btnEditHeader);
this.mnuPageNumberPosPicker = {
conf: {disabled: false},
isDisabled: function () {
@ -596,19 +705,25 @@ define([
},
setDisabled: function (val) {
this.conf.disabled = val;
}
},
options: {}
};
this.mnuPageNumCurrentPos = clone(this.mnuPageNumberPosPicker);
this.mnuInsertPageNum = clone(this.mnuPageNumberPosPicker);
this.mnuInsertPageCount = clone(this.mnuPageNumberPosPicker);
this.mnuPageNumCurrentPos.options.lock = [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock];
this.paragraphControls.push(this.mnuPageNumCurrentPos);
this.mnuInsertPageCount = clone(this.mnuPageNumberPosPicker);
this.mnuInsertPageCount.options.lock = [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock];
this.paragraphControls.push(this.mnuInsertPageCount);
this.toolbarControls.push(this.btnEditHeader);
this.mnuInsertPageNum = clone(this.mnuPageNumberPosPicker);
this.mnuInsertPageNum.options.lock = [_set.cantAddPageNum, _set.controlPlain];
this.mnuPageNumberPosPicker.options.lock = [_set.headerFooterLock];
this.btnInsDateTime = new Common.UI.Button({
id: 'id-toolbar-btn-datetime',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-datetime',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.richDelLock, _set.plainDelLock, _set.noParagraphSelected, _set.previewReviewMode,
_set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnDateTime,
dataHint: '1',
dataHintDirection: 'bottom',
@ -620,6 +735,8 @@ define([
id: 'id-toolbar-btn-blankpage',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-blankpage',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inEquation, _set.richDelLock, _set.plainDelLock, _set.inHeader, _set.inFootnote, _set.inControl,
_set.cantPageBreak, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnBlankPage,
dataHint: '1',
dataHintDirection: 'bottom',
@ -631,6 +748,8 @@ define([
id: 'tlbtn-insertshape',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-insertshape',
lock: [_set.paragraphLock, _set.headerLock, _set.inEquation, _set.controlPlain, _set.contentLock, _set.inFootnote, _set.previewReviewMode, _set.viewFormMode,
_set.lostConnect, _set.disableOnStart],
caption: me.capBtnInsShape,
enableToggle: true,
menu: new Common.UI.Menu({cls: 'menu-shapes menu-insert-shape'}),
@ -644,6 +763,8 @@ define([
id: 'tlbtn-insertequation',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-insertequation',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inChart, _set.controlPlain, _set.richDelLock, _set.plainDelLock, _set.cantAddEquation,
_set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnInsEquation,
split: true,
menu: new Common.UI.Menu({cls: 'menu-shapes'}),
@ -657,6 +778,8 @@ define([
id: 'tlbtn-insertsymbol',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-symbol',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.richDelLock, _set.plainDelLock, _set.noParagraphSelected, _set.previewReviewMode,
_set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnInsSymbol,
dataHint: '1',
dataHintDirection: 'bottom',
@ -668,6 +791,8 @@ define([
id: 'tlbtn-dropcap',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-dropcap',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inEquation, _set.controlPlain, _set.dropcapLock, _set.previewReviewMode, _set.viewFormMode,
_set.lostConnect, _set.disableOnStart],
caption: me.capBtnInsDropcap,
menu: new Common.UI.Menu({
cls: 'ppm-toolbar shifted-right',
@ -711,6 +836,7 @@ define([
id: 'tlbtn-controls',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-controls',
lock: [_set.paragraphLock, _set.headerLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnInsControls,
menu: new Common.UI.Menu({
cls: 'ppm-toolbar shifted-right',
@ -787,12 +913,15 @@ define([
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.toolbarControls.push(this.btnContentControls);
// this.paragraphControls.push(this.btnContentControls);
this.btnColumns = new Common.UI.Button({
id: 'tlbtn-columns',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-columns',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.controlPlain, _set.inImage, _set.docPropsLock, _set.previewReviewMode, _set.viewFormMode,
_set.lostConnect, _set.disableOnStart],
caption: me.capBtnColumns,
menu: new Common.UI.Menu({
cls: 'ppm-toolbar shifted-right',
@ -851,6 +980,7 @@ define([
id: 'tlbtn-pageorient',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-pageorient',
lock: [_set.docPropsLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnPageOrient,
menu: new Common.UI.Menu({
cls: 'ppm-toolbar',
@ -892,6 +1022,7 @@ define([
id: 'tlbtn-pagemargins',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-pagemargins',
lock: [_set.docPropsLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnMargins,
menu: new Common.UI.Menu({
items: [
@ -954,6 +1085,7 @@ define([
id: 'tlbtn-pagesize',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-pagesize',
lock: [_set.docPropsLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnPageSize,
menu: new Common.UI.Menu({
restoreHeight: true,
@ -1077,6 +1209,7 @@ define([
id: 'tlbtn-line-numbers',
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-line-numbering',
lock: [_set.docPropsLock, _set.inImagePara, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnLineNumbers,
menu: new Common.UI.Menu({
cls: 'ppm-toolbar',
@ -1128,6 +1261,8 @@ define([
id: 'id-toolbar-btn-clearstyle',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-clearstyle',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inChart, _set.inSmartart, _set.inSmartartInternal, _set.previewReviewMode, _set.viewFormMode,
_set.lostConnect, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'top'
});
@ -1137,6 +1272,7 @@ define([
id: 'id-toolbar-btn-copystyle',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-copystyle',
lock: [ _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
enableToggle: true,
dataHint: '1',
dataHintDirection: 'bottom'
@ -1147,6 +1283,7 @@ define([
id: 'id-toolbar-btn-colorschemas',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-colorschemas',
lock: [_set.docSchemaLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
menu: new Common.UI.Menu({
cls: 'shifted-left',
items: [],
@ -1162,6 +1299,7 @@ define([
id: 'id-toolbar-btn-mailrecepients',
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-mailmerge',
lock: [_set.mmergeLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
dataHint: '1',
dataHintDirection: 'bottom',
menu: new Common.UI.Menu({
@ -1172,10 +1310,12 @@ define([
]
})
});
this.toolbarControls.push(this.btnMailRecepients);
me.btnImgAlign = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-img-align',
lock: [_set.imageLock, _set.contentLock, _set.inImageInline, _set.noObjectSelected, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capImgAlign,
menu: true,
dataHint: '1',
@ -1186,6 +1326,7 @@ define([
me.btnImgGroup = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-img-group',
lock: [_set.imageLock, _set.contentLock, _set.inImageInline, _set.noObjectSelected, _set.cantGroup, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capImgGroup,
menu: true,
dataHint: '1',
@ -1195,6 +1336,7 @@ define([
me.btnImgForward = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-img-frwd',
lock: [_set.cantArrange, _set.lostConnect, _set.contentLock, _set.noObjectSelected, _set.inSmartartInternal, _set.previewReviewMode, _set.viewFormMode, _set.disableOnStart],
caption: me.capImgForward,
split: true,
menu: true,
@ -1205,6 +1347,7 @@ define([
me.btnImgBackward = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-img-bkwd',
lock: [_set.cantArrange, _set.lostConnect, _set.contentLock, _set.noObjectSelected, _set.inSmartartInternal, _set.previewReviewMode, _set.viewFormMode, _set.disableOnStart],
caption: me.capImgBackward,
split: true,
menu: true,
@ -1215,6 +1358,7 @@ define([
me.btnImgWrapping = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-img-wrap',
lock: [_set.cantWrap, _set.imageLock, _set.contentLock, _set.noObjectSelected, _set.lostConnect, _set.previewReviewMode, _set.viewFormMode, _set.disableOnStart],
caption: me.capImgWrapping,
menu: true,
dataHint: '1',
@ -1225,6 +1369,7 @@ define([
me.btnWatermark = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-watermark',
lock: [_set.headerLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
caption: me.capBtnWatermark,
menu: new Common.UI.Menu({
cls: 'ppm-toolbar',
@ -1263,6 +1408,7 @@ define([
this.cmbFontSize = new Common.UI.ComboBox({
cls: 'input-group-nr',
menuStyle: 'min-width: 55px;',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
hint: this.tipFontSize,
data: [
{value: 8, displayValue: "8"},
@ -1292,6 +1438,7 @@ define([
cls: 'input-group-nr',
menuCls: 'scrollable-menu',
menuStyle: 'min-width: 325px;',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart],
hint: this.tipFontName,
store: new Common.Collections.Fonts(),
dataHint: '1',
@ -1309,6 +1456,8 @@ define([
itemHeight = 40;
this.listStyles = new Common.UI.ComboDataView({
cls: 'combo-styles',
lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.inChart, _set.inSmartart, _set.inSmartartInternal, _set.previewReviewMode,
_set.viewFormMode, _set.lostConnect, _set.disableOnStart],
itemWidth: itemWidth,
itemHeight: itemHeight,
style: 'min-width:150px;',
@ -1367,11 +1516,8 @@ define([
this.textOnlyControls.push(this.listStyles);
// Disable all components before load document
_.each(this.toolbarControls.concat(this.paragraphControls), function (cmp) {
if (_.isFunction(cmp.setDisabled))
cmp.setDisabled(true);
});
this.btnMailRecepients.setDisabled(true);
this.lockControls = me.toolbarControls.concat(me.paragraphControls);
this.lockToolbar(Common.enumLock.disableOnStart, true, {array: this.lockControls});
var editStyleMenuUpdate = new Common.UI.MenuItem({
caption: me.textStyleMenuUpdate
@ -1557,8 +1703,13 @@ define([
_injectComponent('#slot-img-wrapping', this.btnImgWrapping);
_injectComponent('#slot-btn-watermark', this.btnWatermark);
this.btnsPageBreak = Common.Utils.injectButtons($host.find('.btn-slot.btn-pagebreak'), '', 'toolbar__icon btn-pagebreak', this.capBtnInsPagebreak, undefined, true, true, undefined, '1', 'bottom', 'small');
this.btnsPageBreak = Common.Utils.injectButtons($host.find('.btn-slot.btn-pagebreak'), '', 'toolbar__icon btn-pagebreak', this.capBtnInsPagebreak,
[Common.enumLock.paragraphLock, Common.enumLock.headerLock, Common.enumLock.richEditLock, Common.enumLock.plainEditLock, Common.enumLock.inEquation, Common.enumLock.richDelLock,
Common.enumLock.plainDelLock, Common.enumLock.inHeader, Common.enumLock.inFootnote, Common.enumLock.inControl, Common.enumLock.cantPageBreak, Common.enumLock.previewReviewMode,
Common.enumLock.viewFormMode, Common.enumLock.lostConnect, Common.enumLock.disableOnStart],
true, true, undefined, '1', 'bottom', 'small');
Array.prototype.push.apply(this.paragraphControls, this.btnsPageBreak);
Array.prototype.push.apply(this.lockControls, this.btnsPageBreak);
return $host;
},
@ -1943,6 +2094,9 @@ define([
})
);
var keepStateCurr = this.mnuPageNumCurrentPos.keepState,
keepStateCount = this.mnuInsertPageCount.keepState,
keepStateNum = this.mnuInsertPageNum.keepState;
this.btnEditHeader.setMenu(
new Common.UI.Menu({
items: [
@ -1951,6 +2105,7 @@ define([
{caption: '--'},
this.mnuInsertPageNum = new Common.UI.MenuItem({
caption: this.textInsertPageNumber,
lock: this.mnuInsertPageNum.options.lock,
disabled: this.mnuInsertPageNum.isDisabled(),
menu: new Common.UI.Menu({
cls: 'shifted-left',
@ -1960,6 +2115,7 @@ define([
{template: _.template('<div id="id-toolbar-menu-pageposition" class="menu-pageposition"></div>')},
this.mnuPageNumCurrentPos = new Common.UI.MenuItem({
caption: this.textToCurrent,
lock: this.mnuPageNumCurrentPos.options.lock,
disabled: this.mnuPageNumCurrentPos.isDisabled(),
value: 'current'
})
@ -1968,13 +2124,19 @@ define([
}),
this.mnuInsertPageCount = new Common.UI.MenuItem({
caption: this.textInsertPageCount,
lock: this.mnuInsertPageCount.options.lock,
disabled: this.mnuInsertPageCount.isDisabled()
})
]
})
);
this.mnuInsertPageNum.keepState = keepStateNum;
this.mnuPageNumCurrentPos.keepState = keepStateCurr;
this.paragraphControls.push(this.mnuPageNumCurrentPos);
this.lockControls.push(this.mnuPageNumCurrentPos);
this.mnuInsertPageCount.keepState = keepStateCount;
this.paragraphControls.push(this.mnuInsertPageCount);
this.lockControls.push(this.mnuInsertPageCount);
this.btnInsertChart.setMenu( new Common.UI.Menu({
style: 'width: 364px;padding-top: 12px;',
@ -2090,8 +2252,10 @@ define([
_conf && this.mnuMultilevelPicker.selectByIndex(_conf.index, true);
_conf = this.mnuPageNumberPosPicker ? this.mnuPageNumberPosPicker.conf : undefined;
var keepState = this.mnuPageNumberPosPicker ? this.mnuPageNumberPosPicker.keepState : undefined;
this.mnuPageNumberPosPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-pageposition'),
lock: this.mnuPageNumberPosPicker.options.lock,
allowScrollbar: false,
parentMenu: this.mnuInsertPageNum.menu,
outerMenu: {menu: this.mnuInsertPageNum.menu, index: 0},
@ -2142,6 +2306,7 @@ define([
]),
itemTemplate: _.template('<div id="<%= id %>" class="item-pagenumber options__icon options__icon-huge <%= iconname %>"></div>')
});
this.mnuPageNumberPosPicker.keepState = keepState;
_conf && this.mnuPageNumberPosPicker.setDisabled(_conf.disabled);
this.mnuInsertPageNum.menu.setInnerMenu([{menu: this.mnuPageNumberPosPicker, index: 0}]);
@ -2240,14 +2405,13 @@ define([
setMode: function (mode) {
if (mode.isDisconnected) {
this.btnSave.setDisabled(true);
this.btnUndo.setDisabled(true);
this.btnRedo.setDisabled(true);
this.lockToolbar(Common.enumLock.lostConnect, true);
if ( this.synchTooltip )
this.synchTooltip.hide();
if (!mode.enableDownload)
this.btnPrint.setDisabled(true);
}
this.lockToolbar(Common.enumLock.cantPrint, true, {array: [this.btnPrint]});
} else
this.lockToolbar(Common.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]});
this.mode = mode;
@ -2428,6 +2592,10 @@ define([
this.api.asc_RemoveAllCustomStyles();
},
lockToolbar: function (causes, lock, opts) {
Common.Utils.lockControls(causes, lock, opts, this.lockControls);
},
textBold: 'Bold',
textItalic: 'Italic',
textUnderline: 'Underline',

View file

@ -85,14 +85,15 @@ define([
var me = this,
$host = me.toolbar.$el;
var _set = Common.enumLock;
this.btnNavigation = new Common.UI.Button({
parentEl: $host.find('#slot-btn-navigation'),
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-menu-navigation',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.textNavigation,
enableToggle: true,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -102,9 +103,9 @@ define([
this.cmbZoom = new Common.UI.ComboBox({
el: $host.find('#slot-field-zoom'),
cls: 'input-group-nr',
lock: [_set.lostConnect, _set.disableOnStart],
menuStyle: 'min-width: 55px;',
editable: true,
disabled: true,
data: [
{ displayValue: "50%", value: 50 },
{ displayValue: "75%", value: 75 },
@ -130,10 +131,10 @@ define([
parentEl: $host.find('#slot-btn-ftp'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-ic-zoomtopage',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.textFitToPage,
toggleGroup: 'view-zoom',
enableToggle: true,
disabled: true,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'medium'
@ -144,10 +145,10 @@ define([
parentEl: $host.find('#slot-btn-ftw'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-ic-zoomtowidth',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.textFitToWidth,
toggleGroup: 'view-zoom',
enableToggle: true,
disabled: true,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'medium'
@ -158,9 +159,9 @@ define([
parentEl: $host.find('#slot-btn-interface-theme'),
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon day',
lock: [_set.lostConnect, _set.disableOnStart],
caption: this.textInterfaceTheme,
menu: true,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
@ -171,19 +172,20 @@ define([
parentEl: $host.find('#slot-btn-dark-document'),
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon dark-mode',
lock: [_set.inLightTheme, _set.lostConnect, _set.disableOnStart],
caption: this.textDarkDocument,
enableToggle: true,
disabled: true,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnDarkDocument);
this.chStatusbar = new Common.UI.CheckBox({
el: $host.findById('#slot-chk-statusbar'),
lock: [_set.lostConnect, _set.disableOnStart],
labelText: this.textStatusBar,
value: !Common.localStorage.getBool("de-hidden-status"),
disabled: true,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
@ -192,9 +194,9 @@ define([
this.chToolbar = new Common.UI.CheckBox({
el: $host.findById('#slot-chk-toolbar'),
lock: [_set.lostConnect, _set.disableOnStart],
labelText: this.textAlwaysShowToolbar,
value: !options.compactToolbar,
disabled: true,
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
@ -203,9 +205,9 @@ define([
this.chRulers = new Common.UI.CheckBox({
el: $host.findById('#slot-chk-rulers'),
lock: [_set.lostConnect, _set.disableOnStart],
labelText: this.textRulers,
value: !Common.Utils.InternalSettings.get("de-hidden-rulers"),
disabled: true,
dataHint: '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
@ -213,6 +215,7 @@ define([
this.lockedControls.push(this.chRulers);
this.cmpEl = $host;
Common.Utils.lockControls(_set.disableOnStart, true, {array: this.lockedControls});
},
render: function (el) {
@ -236,7 +239,6 @@ define([
button.setDisabled(state);
}
}, this);
this.btnDarkDocument && this.btnDarkDocument.setDisabled(state);
},
turnNavigation: function (state) {

View file

@ -24,12 +24,9 @@
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
background-color: @background-toolbar-ie;
background-color: @background-toolbar;
z-index: @zindex-tooltip + 1;
width: 0;
height: 0;
background-color: transparent;
}
.item-markerlist {

View file

@ -112,7 +112,7 @@ define([
onApiCountPages: function (count) {
if (this._state.no_slides !== (count<=0)) {
this._state.no_slides = (count<=0);
this.lockToolbar(PE.enumLock.noSlides, this._state.no_slides);
this.lockToolbar(Common.enumLock.noSlides, this._state.no_slides);
}
},
@ -413,19 +413,19 @@ define([
setLocked: function() {
if (this._state.noGraphic != undefined)
this.lockToolbar(PE.enumLock.noGraphic, this._state.noGraphic);
this.lockToolbar(Common.enumLock.noGraphic, this._state.noGraphic);
if (this._state.noAnimation != undefined)
this.lockToolbar(PE.enumLock.noAnimation, this._state.noAnimation);
this.lockToolbar(Common.enumLock.noAnimation, this._state.noAnimation);
if (this._state.noAnimationParam != undefined)
this.lockToolbar(PE.enumLock.noAnimationParam, this._state.noAnimationParam);
this.lockToolbar(Common.enumLock.noAnimationParam, this._state.noAnimationParam);
if (this._state.noTriggerObjects != undefined)
this.lockToolbar(PE.enumLock.noTriggerObjects, this._state.noTriggerObjects);
this.lockToolbar(Common.enumLock.noTriggerObjects, this._state.noTriggerObjects);
if (this._state.noMoveAnimationLater != undefined)
this.lockToolbar(PE.enumLock.noMoveAnimationLater, this._state.noMoveAnimationLater);
this.lockToolbar(Common.enumLock.noMoveAnimationLater, this._state.noMoveAnimationLater);
if (this._state.noMoveAnimationEarlier != undefined)
this.lockToolbar(PE.enumLock.noMoveAnimationEarlier, this._state.noMoveAnimationEarlier);
if (PE.enumLock.noAnimationPreview != undefined)
this.lockToolbar(PE.enumLock.noAnimationPreview, this._state.noAnimationPreview);
this.lockToolbar(Common.enumLock.noMoveAnimationEarlier, this._state.noMoveAnimationEarlier);
if (Common.enumLock.noAnimationPreview != undefined)
this.lockToolbar(Common.enumLock.noAnimationPreview, this._state.noAnimationPreview);
}

View file

@ -479,12 +479,12 @@ define([
onApiCanRevert: function(which, can) {
if (which=='undo') {
if (this._state.can_undo !== can) {
this.toolbar.lockToolbar(PE.enumLock.undoLock, !can, {array: [this.toolbar.btnUndo]});
this.toolbar.lockToolbar(Common.enumLock.undoLock, !can, {array: [this.toolbar.btnUndo]});
if (this._state.activated) this._state.can_undo = can;
}
} else {
if (this._state.can_redo !== can) {
this.toolbar.lockToolbar(PE.enumLock.redoLock, !can, {array: [this.toolbar.btnRedo]});
this.toolbar.lockToolbar(Common.enumLock.redoLock, !can, {array: [this.toolbar.btnRedo]});
if (this._state.activated) this._state.can_redo = can;
}
}
@ -492,14 +492,14 @@ define([
onApiCanIncreaseIndent: function(value) {
if (this._state.can_increase !== value) {
this.toolbar.lockToolbar(PE.enumLock.incIndentLock, !value, {array: [this.toolbar.btnIncLeftOffset]});
this.toolbar.lockToolbar(Common.enumLock.incIndentLock, !value, {array: [this.toolbar.btnIncLeftOffset]});
if (this._state.activated) this._state.can_increase = value;
}
},
onApiCanDecreaseIndent: function(value) {
if (this._state.can_decrease !== value) {
this.toolbar.lockToolbar(PE.enumLock.decIndentLock, !value, {array: [this.toolbar.btnDecLeftOffset]});
this.toolbar.lockToolbar(Common.enumLock.decIndentLock, !value, {array: [this.toolbar.btnDecLeftOffset]});
if (this._state.activated) this._state.can_decrease = value;
}
},
@ -636,7 +636,7 @@ define([
onApiCanAddHyperlink: function(value) {
if (this._state.can_hyper !== value && this.editMode) {
this.toolbar.lockToolbar(PE.enumLock.hyperlinkLock, !value, {array: [this.toolbar.btnInsertHyperlink]});
this.toolbar.lockToolbar(Common.enumLock.hyperlinkLock, !value, {array: [this.toolbar.btnInsertHyperlink]});
if (this._state.activated) this._state.can_hyper = value;
}
},
@ -666,17 +666,17 @@ define([
onApiCountPages: function(count) {
if (this._state.no_slides !== (count<=0)) {
this._state.no_slides = (count<=0);
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, {array: this.toolbar.paragraphControls});
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, {array: [
this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, {array: this.toolbar.paragraphControls});
this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, {array: [
this.toolbar.btnChangeSlide, this.toolbar.btnPreview, this.toolbar.btnPrint, this.toolbar.btnCopy, this.toolbar.btnPaste,
this.toolbar.btnCopyStyle, this.toolbar.btnInsertTable, this.toolbar.btnInsertChart,
this.toolbar.btnColorSchemas, this.toolbar.btnShapeAlign,
this.toolbar.btnShapeArrange, this.toolbar.btnSlideSize, this.toolbar.listTheme, this.toolbar.btnEditHeader, this.toolbar.btnInsDateTime, this.toolbar.btnInsSlideNum
]});
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides,
this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides,
{ array: this.toolbar.btnsInsertImage.concat(this.toolbar.btnsInsertText, this.toolbar.btnsInsertShape, this.toolbar.btnInsertEquation, this.toolbar.btnInsertTextArt, this.toolbar.btnInsAudio, this.toolbar.btnInsVideo) });
if (this.btnsComment)
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment });
this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment });
}
},
@ -684,7 +684,7 @@ define([
if (this._state.no_slides !== (count<=0)) {
this._state.no_slides = (count<=0);
if (this.btnsComment)
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment });
this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment });
}
},
@ -760,49 +760,49 @@ define([
if (this._state.prcontrolsdisable !== paragraph_locked) {
if (this._state.activated) this._state.prcontrolsdisable = paragraph_locked;
if (paragraph_locked!==undefined)
this.toolbar.lockToolbar(PE.enumLock.paragraphLock, paragraph_locked, {array: me.toolbar.paragraphControls});
this.toolbar.lockToolbar(PE.enumLock.paragraphLock, paragraph_locked===true, {array: [me.toolbar.btnInsDateTime, me.toolbar.btnInsSlideNum]});
this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked, {array: me.toolbar.paragraphControls});
this.toolbar.lockToolbar(Common.enumLock.paragraphLock, paragraph_locked===true, {array: [me.toolbar.btnInsDateTime, me.toolbar.btnInsSlideNum]});
}
if (this._state.no_paragraph !== no_paragraph) {
if (this._state.activated) this._state.no_paragraph = no_paragraph;
this.toolbar.lockToolbar(PE.enumLock.noParagraphSelected, no_paragraph, {array: me.toolbar.paragraphControls});
this.toolbar.lockToolbar(PE.enumLock.noParagraphSelected, no_paragraph, {array: [me.toolbar.btnCopyStyle]});
this.toolbar.lockToolbar(Common.enumLock.noParagraphSelected, no_paragraph, {array: me.toolbar.paragraphControls});
this.toolbar.lockToolbar(Common.enumLock.noParagraphSelected, no_paragraph, {array: [me.toolbar.btnCopyStyle]});
}
if (this._state.no_text !== no_text) {
if (this._state.activated) this._state.no_text = no_text;
this.toolbar.lockToolbar(PE.enumLock.noTextSelected, no_text, {array: me.toolbar.paragraphControls});
this.toolbar.lockToolbar(Common.enumLock.noTextSelected, no_text, {array: me.toolbar.paragraphControls});
}
if (shape_locked!==undefined && this._state.shapecontrolsdisable !== shape_locked) {
if (this._state.activated) this._state.shapecontrolsdisable = shape_locked;
this.toolbar.lockToolbar(PE.enumLock.shapeLock, shape_locked, {array: me.toolbar.shapeControls.concat(me.toolbar.paragraphControls)});
this.toolbar.lockToolbar(Common.enumLock.shapeLock, shape_locked, {array: me.toolbar.shapeControls.concat(me.toolbar.paragraphControls)});
}
if (this._state.no_object !== no_object ) {
if (this._state.activated) this._state.no_object = no_object;
this.toolbar.lockToolbar(PE.enumLock.noObjectSelected, no_object, {array: [me.toolbar.btnShapeAlign, me.toolbar.btnShapeArrange, me.toolbar.btnVerticalAlign ]});
this.toolbar.lockToolbar(Common.enumLock.noObjectSelected, no_object, {array: [me.toolbar.btnShapeAlign, me.toolbar.btnShapeArrange, me.toolbar.btnVerticalAlign ]});
}
if (slide_layout_lock !== undefined && this._state.slidelayoutdisable !== slide_layout_lock ) {
if (this._state.activated) this._state.slidelayoutdisable = slide_layout_lock;
this.toolbar.lockToolbar(PE.enumLock.slideLock, slide_layout_lock, {array: [me.toolbar.btnChangeSlide]});
this.toolbar.lockToolbar(Common.enumLock.slideLock, slide_layout_lock, {array: [me.toolbar.btnChangeSlide]});
}
if (slide_deleted !== undefined && this._state.slidecontrolsdisable !== slide_deleted) {
if (this._state.activated) this._state.slidecontrolsdisable = slide_deleted;
this.toolbar.lockToolbar(PE.enumLock.slideDeleted, slide_deleted, {array: me.toolbar.slideOnlyControls.concat(me.toolbar.paragraphControls)});
this.toolbar.lockToolbar(Common.enumLock.slideDeleted, slide_deleted, {array: me.toolbar.slideOnlyControls.concat(me.toolbar.paragraphControls)});
}
if (this._state.in_equation !== in_equation) {
if (this._state.activated) this._state.in_equation = in_equation;
this.toolbar.lockToolbar(PE.enumLock.inEquation, in_equation, {array: [me.toolbar.btnSuperscript, me.toolbar.btnSubscript]});
this.toolbar.lockToolbar(Common.enumLock.inEquation, in_equation, {array: [me.toolbar.btnSuperscript, me.toolbar.btnSubscript]});
}
if (this._state.no_columns !== no_columns) {
if (this._state.activated) this._state.no_columns = no_columns;
this.toolbar.lockToolbar(PE.enumLock.noColumns, no_columns, {array: [me.toolbar.btnColumns]});
this.toolbar.lockToolbar(Common.enumLock.noColumns, no_columns, {array: [me.toolbar.btnColumns]});
}
if (this.toolbar.btnChangeSlide) {
@ -813,12 +813,12 @@ define([
}
if (this._state.in_smartart !== in_smartart) {
this.toolbar.lockToolbar(PE.enumLock.inSmartart, in_smartart, {array: me.toolbar.paragraphControls});
this.toolbar.lockToolbar(Common.enumLock.inSmartart, in_smartart, {array: me.toolbar.paragraphControls});
this._state.in_smartart = in_smartart;
}
if (this._state.in_smartart_internal !== in_smartart_internal) {
this.toolbar.lockToolbar(PE.enumLock.inSmartartInternal, in_smartart_internal, {array: me.toolbar.paragraphControls});
this.toolbar.lockToolbar(Common.enumLock.inSmartartInternal, in_smartart_internal, {array: me.toolbar.paragraphControls});
this._state.in_smartart_internal = in_smartart_internal;
this.toolbar.mnuArrangeFront.setDisabled(in_smartart_internal);
@ -868,24 +868,24 @@ define([
onApiLockDocumentProps: function() {
if (this._state.lock_doc!==true) {
this.toolbar.lockToolbar(PE.enumLock.docPropsLock, true, {array: [this.toolbar.btnSlideSize]});
this.toolbar.lockToolbar(Common.enumLock.docPropsLock, true, {array: [this.toolbar.btnSlideSize]});
if (this._state.activated) this._state.lock_doc = true;
}
},
onApiUnLockDocumentProps: function() {
if (this._state.lock_doc!==false) {
this.toolbar.lockToolbar(PE.enumLock.docPropsLock, false, {array: [this.toolbar.btnSlideSize]});
this.toolbar.lockToolbar(Common.enumLock.docPropsLock, false, {array: [this.toolbar.btnSlideSize]});
if (this._state.activated) this._state.lock_doc = false;
}
},
onApiLockDocumentTheme: function() {
this.toolbar.lockToolbar(PE.enumLock.themeLock, true, {array: [this.toolbar.btnColorSchemas, this.toolbar.listTheme]});
this.toolbar.lockToolbar(Common.enumLock.themeLock, true, {array: [this.toolbar.btnColorSchemas, this.toolbar.listTheme]});
},
onApiUnLockDocumentTheme: function() {
this.toolbar.lockToolbar(PE.enumLock.themeLock, false, {array: [this.toolbar.btnColorSchemas, this.toolbar.listTheme]});
this.toolbar.lockToolbar(Common.enumLock.themeLock, false, {array: [this.toolbar.btnColorSchemas, this.toolbar.listTheme]});
},
onApiCoAuthoringDisconnect: function(enableDownload) {
@ -2442,7 +2442,7 @@ define([
activateControls: function() {
this.onApiPageSize(this.api.get_PresentationWidth(), this.api.get_PresentationHeight());
this.toolbar.lockToolbar(PE.enumLock.disableOnStart, false, {array: this.toolbar.slideOnlyControls.concat(this.toolbar.shapeControls)});
this.toolbar.lockToolbar(Common.enumLock.disableOnStart, false, {array: this.toolbar.slideOnlyControls.concat(this.toolbar.shapeControls)});
this._state.activated = true;
},
@ -2458,7 +2458,7 @@ define([
toolbar.$el.find('.toolbar').toggleClass('masked', disable);
if (toolbar.btnsAddSlide) // toolbar buttons are rendered
this.toolbar.lockToolbar(PE.enumLock.menuFileOpen, disable, {array: toolbar.btnsAddSlide.concat(toolbar.btnChangeSlide, toolbar.btnPreview)});
this.toolbar.lockToolbar(Common.enumLock.menuFileOpen, disable, {array: toolbar.btnsAddSlide.concat(toolbar.btnChangeSlide, toolbar.btnPreview)});
if(disable) {
mask = $("<div class='toolbar-mask'>").appendTo(toolbar.$el.find('.toolbar'));
Common.util.Shortcuts.suspendEvents('command+k, ctrl+k, alt+h, command+f5, ctrl+f5');
@ -2541,7 +2541,7 @@ define([
this.btnsComment = [];
if ( config.canCoAuthoring && config.canComments ) {
var _set = PE.enumLock;
var _set = Common.enumLock;
this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', me.toolbar.capBtnComment, [_set.lostConnect, _set.noSlides], undefined, undefined, undefined, '1', 'bottom', 'small');
if ( this.btnsComment.length ) {
@ -2556,7 +2556,7 @@ define([
btn.setCaption(me.toolbar.capBtnAddComment);
}, this);
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment });
this.toolbar.lockToolbar(Common.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment });
}
}
},

View file

@ -102,7 +102,7 @@ define([
onApiCountPages: function (count) {
if (this._state.no_slides !== (count<=0)) {
this._state.no_slides = (count<=0);
this.lockToolbar(PE.enumLock.noSlides, this._state.no_slides);
this.lockToolbar(Common.enumLock.noSlides, this._state.no_slides);
}
},
@ -259,7 +259,7 @@ define([
setLocked: function() {
if (this._state.lockedtransition != undefined)
this.lockToolbar(PE.enumLock.transitLock, this._state.lockedtransition);
this.lockToolbar(Common.enumLock.transitLock, this._state.lockedtransition);
},
setSettings: function () {

View file

@ -155,7 +155,7 @@ define([
this.toolbar = options.toolbar;
this.appConfig = options.mode;
this.$el = this.toolbar.toolbar.$el.find('#animation-panel');
var _set = PE.enumLock;
var _set = Common.enumLock;
this.lockedControls = [];
this._arrEffectName = [{group:'none', value: AscFormat.ANIM_PRESET_NONE, iconCls: 'animation-none', displayValue: this.textNone}].concat(Common.define.effectData.getEffectData());

View file

@ -61,7 +61,10 @@ define([
], function (Backbone, template, template_view) {
'use strict';
PE.enumLock = {
if (!Common.enumLock)
Common.enumLock = {};
var enumLock = {
paragraphLock: 'para-lock',
shapeLock: 'shape-lock',
slideLock: 'slide-lock',
@ -95,6 +98,11 @@ define([
noMoveAnimationLater: 'no-move-animation-later',
noAnimationPreview: 'no-animation-preview'
};
for (var key in enumLock) {
if (enumLock.hasOwnProperty(key)) {
Common.enumLock[key] = enumLock[key];
}
}
PE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend((function(){
@ -155,7 +163,7 @@ define([
/**
* UI Components
*/
var _set = PE.enumLock;
var _set = Common.enumLock;
me.btnChangeSlide = new Common.UI.Button({
id: 'id-toolbar-button-change-slide',
@ -1079,7 +1087,7 @@ define([
menuWidth: 362,
style: 'width: 140px;',
enableKeyEvents: true,
lock: [PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart],
lock: [Common.enumLock.slideDeleted, Common.enumLock.lostConnect, Common.enumLock.noSlides, Common.enumLock.disableOnStart],
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: '-16, 0'
@ -1101,7 +1109,7 @@ define([
if (_.isFunction(cmp.setDisabled))
cmp.setDisabled(true);
});
this.lockToolbar(PE.enumLock.disableOnStart, true, {array: me.slideOnlyControls.concat(me.shapeControls)});
this.lockToolbar(Common.enumLock.disableOnStart, true, {array: me.slideOnlyControls.concat(me.shapeControls)});
this.on('render:after', _.bind(this.onToolbarAfterRender, this));
} else {
Common.UI.Mixtbar.prototype.initialize.call(this, {
@ -1236,16 +1244,16 @@ define([
}
this.btnsInsertImage = Common.Utils.injectButtons($host.find('.slot-insertimg'), 'tlbtn-insertimage-', 'toolbar__icon btn-insertimage', this.capInsertImage,
[PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], false, true, undefined, '1', 'bottom', 'small');
[Common.enumLock.slideDeleted, Common.enumLock.lostConnect, Common.enumLock.noSlides, Common.enumLock.disableOnStart], false, true, undefined, '1', 'bottom', 'small');
this.btnsInsertText = Common.Utils.injectButtons($host.find('.slot-instext'), 'tlbtn-inserttext-', 'toolbar__icon btn-text', this.capInsertText,
[PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], false, false, true, '1', 'bottom', 'small');
[Common.enumLock.slideDeleted, Common.enumLock.lostConnect, Common.enumLock.noSlides, Common.enumLock.disableOnStart], false, false, true, '1', 'bottom', 'small');
this.btnsInsertShape = Common.Utils.injectButtons($host.find('.slot-insertshape'), 'tlbtn-insertshape-', 'toolbar__icon btn-insertshape', this.capInsertShape,
[PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], false, true, true, '1', 'bottom', 'small');
[Common.enumLock.slideDeleted, Common.enumLock.lostConnect, Common.enumLock.noSlides, Common.enumLock.disableOnStart], false, true, true, '1', 'bottom', 'small');
this.btnsAddSlide = Common.Utils.injectButtons($host.find('.slot-addslide'), 'tlbtn-addslide-', 'toolbar__icon btn-addslide', this.capAddSlide,
[PE.enumLock.menuFileOpen, PE.enumLock.lostConnect, PE.enumLock.disableOnStart], true, true, undefined, '1', 'bottom', 'small');
[Common.enumLock.menuFileOpen, Common.enumLock.lostConnect, Common.enumLock.disableOnStart], true, true, undefined, '1', 'bottom', 'small');
var created = this.btnsInsertImage.concat(this.btnsInsertText, this.btnsInsertShape, this.btnsAddSlide);
this.lockToolbar(PE.enumLock.disableOnStart, true, {array: created});
this.lockToolbar(Common.enumLock.disableOnStart, true, {array: created});
Array.prototype.push.apply(this.slideOnlyControls, created);
Array.prototype.push.apply(this.lockControls, created);
@ -1553,14 +1561,14 @@ define([
setMode: function (mode) {
if (mode.isDisconnected) {
this.lockToolbar(PE.enumLock.lostConnect, true);
this.lockToolbar( PE.enumLock.lostConnect, true, {array:[this.btnUndo,this.btnRedo,this.btnSave]} );
this.lockToolbar(Common.enumLock.lostConnect, true);
this.lockToolbar( Common.enumLock.lostConnect, true, {array:[this.btnUndo,this.btnRedo,this.btnSave]} );
if ( this.synchTooltip )
this.synchTooltip.hide();
if (!mode.enableDownload)
this.lockToolbar(PE.enumLock.cantPrint, true, {array: [this.btnPrint]});
this.lockToolbar(Common.enumLock.cantPrint, true, {array: [this.btnPrint]});
} else
this.lockToolbar(PE.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]});
this.lockToolbar(Common.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]});
this.mode = mode;
},

View file

@ -118,7 +118,7 @@ define([
this.toolbar = options.toolbar;
this.appConfig = options.mode;
this.$el = this.toolbar.toolbar.$el.find('#transitions-panel');
var _set = PE.enumLock;
var _set = Common.enumLock;
this.lockedControls = [];
this._arrEffectName = [
@ -269,7 +269,7 @@ define([
});
this.lockedControls.push(this.chDelay);
Common.Utils.lockControls(PE.enumLock.disableOnStart, true, {array: this.lockedControls});
Common.Utils.lockControls(Common.enumLock.disableOnStart, true, {array: this.lockedControls});
this.$el.find('#transit-duration').text(this.strDuration);
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));

View file

@ -77,7 +77,7 @@ define([
Common.UI.BaseView.prototype.initialize.call(this);
this.toolbar = options.toolbar;
this.appConfig = options.mode;
var _set = PE.enumLock;
var _set = Common.enumLock;
this.lockedControls = [];

View file

@ -123,8 +123,8 @@ define([
if (!this.toolbar.editMode || !this.view) return;
// special disable conditions
Common.Utils.lockControls(SSE.enumLock.multiselectCols, info.asc_getSelectedColsCount()>1, {array: [this.view.btnTextToColumns]});
Common.Utils.lockControls(SSE.enumLock.multiselect, info.asc_getMultiselect(), {array: [this.view.btnTextToColumns]});
Common.Utils.lockControls(Common.enumLock.multiselectCols, info.asc_getSelectedColsCount()>1, {array: [this.view.btnTextToColumns]});
Common.Utils.lockControls(Common.enumLock.multiselect, info.asc_getMultiselect(), {array: [this.view.btnTextToColumns]});
},
onUngroup: function(type) {
@ -431,12 +431,12 @@ define([
onWorksheetLocked: function(index,locked) {
if (index == this.api.asc_getActiveWorksheetIndex()) {
Common.Utils.lockControls(SSE.enumLock.sheetLock, locked, {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort, this.view.btnGroup, this.view.btnUngroup)});
Common.Utils.lockControls(Common.enumLock.sheetLock, locked, {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort, this.view.btnGroup, this.view.btnUngroup)});
}
},
onChangeProtectWorkbook: function() {
Common.Utils.lockControls(SSE.enumLock.wbLock, this.api.asc_isProtectedWorkbook(), {array: [this.view.btnDataFromText]});
Common.Utils.lockControls(Common.enumLock.wbLock, this.api.asc_isProtectedWorkbook(), {array: [this.view.btnDataFromText]});
},
onApiSheetChanged: function() {
@ -451,7 +451,7 @@ define([
var wbprotect = this.getApplication().getController('WBProtection');
props = wbprotect ? wbprotect.getWSProps() : null;
}
props && props.wsProps && Common.Utils.lockControls(SSE.enumLock['Sort'], props.wsProps['Sort'], {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort)});
props && props.wsProps && Common.Utils.lockControls(Common.enumLock['Sort'], props.wsProps['Sort'], {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort)});
},
onDocumentReady: function() {

View file

@ -398,9 +398,9 @@ define([
var pivotInfo = info.asc_getPivotTableInfo();
Common.Utils.lockControls(SSE.enumLock.noPivot, !pivotInfo, {array: this.view.lockedControls});
Common.Utils.lockControls(SSE.enumLock.pivotLock, pivotInfo && (info.asc_getLockedPivotTable()===true), {array: this.view.lockedControls});
Common.Utils.lockControls(SSE.enumLock.editPivot, !!pivotInfo, {array: this.view.btnsAddPivot});
Common.Utils.lockControls(Common.enumLock.noPivot, !pivotInfo, {array: this.view.lockedControls});
Common.Utils.lockControls(Common.enumLock.pivotLock, pivotInfo && (info.asc_getLockedPivotTable()===true), {array: this.view.lockedControls});
Common.Utils.lockControls(Common.enumLock.editPivot, !!pivotInfo, {array: this.view.btnsAddPivot});
if (pivotInfo)
this.ChangeSettings(pivotInfo);

View file

@ -2197,10 +2197,10 @@ define([
var toolbar = this.toolbar;
if (toolbar.mode.isEditDiagram || toolbar.mode.isEditMailMerge) {
is_cell_edited = (state == Asc.c_oAscCellEditorState.editStart);
toolbar.lockToolbar(SSE.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {array: [toolbar.btnDecDecimal,toolbar.btnIncDecimal,toolbar.cmbNumberFormat, toolbar.btnEditChartData, toolbar.btnEditChartType]});
toolbar.lockToolbar(Common.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {array: [toolbar.btnDecDecimal,toolbar.btnIncDecimal,toolbar.cmbNumberFormat, toolbar.btnEditChartData, toolbar.btnEditChartType]});
} else
if (state == Asc.c_oAscCellEditorState.editStart || state == Asc.c_oAscCellEditorState.editEnd) {
toolbar.lockToolbar(SSE.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {
toolbar.lockToolbar(Common.enumLock.editCell, state == Asc.c_oAscCellEditorState.editStart, {
array: [
toolbar.btnClearStyle.menu.items[1],
toolbar.btnClearStyle.menu.items[2],
@ -2210,7 +2210,7 @@ define([
toolbar.btnNamedRange.menu.items[1]
].concat(toolbar.itemsNamedRange),
merge: true,
clear: [SSE.enumLock.editFormula, SSE.enumLock.editText]
clear: [Common.enumLock.editFormula, Common.enumLock.editText]
});
var is_cell_edited = (state == Asc.c_oAscCellEditorState.editStart);
@ -2232,10 +2232,10 @@ define([
if (state == Asc.c_oAscCellEditorState.editFormula) is_text = !(is_formula = true); else
if (state == Asc.c_oAscCellEditorState.editEmptyCell) is_text = is_formula = false;
toolbar.lockToolbar(SSE.enumLock.editFormula, is_formula,
toolbar.lockToolbar(Common.enumLock.editFormula, is_formula,
{ array: [toolbar.cmbFontName, toolbar.cmbFontSize, toolbar.btnIncFontSize, toolbar.btnDecFontSize,
toolbar.btnBold, toolbar.btnItalic, toolbar.btnUnderline, toolbar.btnStrikeout, toolbar.btnSubscript, toolbar.btnTextColor]});
toolbar.lockToolbar(SSE.enumLock.editText, is_text, {array: [toolbar.btnInsertFormula].concat(toolbar.btnsFormula)});
toolbar.lockToolbar(Common.enumLock.editText, is_text, {array: [toolbar.btnInsertFormula].concat(toolbar.btnsFormula)});
}
this._state.coauthdisable = undefined;
this._state.selection_type = undefined;
@ -2260,7 +2260,7 @@ define([
this.onApiHeadings(props.asc_getHeadings());
this.api.asc_isLayoutLocked(currentSheet) ? this.onApiLockDocumentProps(currentSheet) : this.onApiUnLockDocumentProps(currentSheet);
this.toolbar.lockToolbar(SSE.enumLock.printAreaLock, this.api.asc_isPrintAreaLocked(currentSheet), {array: [this.toolbar.btnPrintArea]});
this.toolbar.lockToolbar(Common.enumLock.printAreaLock, this.api.asc_isPrintAreaLocked(currentSheet), {array: [this.toolbar.btnPrintArea]});
},
onUpdateDocumentProps: function(nIndex) {
@ -2382,14 +2382,14 @@ define([
onApiLockDocumentProps: function(nIndex) {
if (this._state.lock_doc!==true && nIndex == this.api.asc_getActiveWorksheetIndex()) {
this.toolbar.lockToolbar(SSE.enumLock.docPropsLock, true, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale, this.toolbar.btnPrintTitles]});
this.toolbar.lockToolbar(Common.enumLock.docPropsLock, true, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale, this.toolbar.btnPrintTitles]});
this._state.lock_doc = true;
}
},
onApiUnLockDocumentProps: function(nIndex) {
if (this._state.lock_doc!==false && nIndex == this.api.asc_getActiveWorksheetIndex()) {
this.toolbar.lockToolbar(SSE.enumLock.docPropsLock, false, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale, this.toolbar.btnPrintTitles]});
this.toolbar.lockToolbar(Common.enumLock.docPropsLock, false, {array: [this.toolbar.btnPageSize, this.toolbar.btnPageMargins, this.toolbar.btnPageOrient, this.toolbar.btnScale, this.toolbar.btnPrintTitles]});
this._state.lock_doc = false;
}
},
@ -2531,7 +2531,7 @@ define([
this._state.fontsize = str_size;
}
toolbar.lockToolbar(SSE.enumLock.cantHyperlink, (selectionType === Asc.c_oAscSelectionType.RangeShapeText) && (this.api.asc_canAddShapeHyperlink()===false), { array: [toolbar.btnInsertHyperlink]});
toolbar.lockToolbar(Common.enumLock.cantHyperlink, (selectionType === Asc.c_oAscSelectionType.RangeShapeText) && (this.api.asc_canAddShapeHyperlink()===false), { array: [toolbar.btnInsertHyperlink]});
/*
need_disable = selectionType != Asc.c_oAscSelectionType.RangeCells && selectionType != Asc.c_oAscSelectionType.RangeCol &&
@ -2547,14 +2547,14 @@ define([
need_disable = (selectionType === Asc.c_oAscSelectionType.RangeCells || selectionType === Asc.c_oAscSelectionType.RangeCol ||
selectionType === Asc.c_oAscSelectionType.RangeRow || selectionType === Asc.c_oAscSelectionType.RangeMax);
toolbar.lockToolbar(SSE.enumLock.selRange, need_disable, { array: [toolbar.btnImgAlign, toolbar.btnImgBackward, toolbar.btnImgForward, toolbar.btnImgGroup]});
toolbar.lockToolbar(Common.enumLock.selRange, need_disable, { array: [toolbar.btnImgAlign, toolbar.btnImgBackward, toolbar.btnImgForward, toolbar.btnImgGroup]});
var cangroup = this.api.asc_canGroupGraphicsObjects(),
canungroup = this.api.asc_canUnGroupGraphicsObjects();
toolbar.lockToolbar(SSE.enumLock.cantGroupUngroup, !cangroup && !canungroup, { array: [toolbar.btnImgGroup]});
toolbar.lockToolbar(Common.enumLock.cantGroupUngroup, !cangroup && !canungroup, { array: [toolbar.btnImgGroup]});
toolbar.btnImgGroup.menu.items[0].setDisabled(!cangroup);
toolbar.btnImgGroup.menu.items[1].setDisabled(!canungroup);
toolbar.lockToolbar(SSE.enumLock.cantGroup, !cangroup, { array: [toolbar.btnImgAlign]});
toolbar.lockToolbar(Common.enumLock.cantGroup, !cangroup, { array: [toolbar.btnImgAlign]});
var objcount = this.api.asc_getSelectedDrawingObjectsCount();
toolbar.btnImgAlign.menu.items[7].setDisabled(objcount<3);
@ -2564,11 +2564,11 @@ define([
// lock formatting controls in cell with FormatCells protection or in shape and Objects protection
need_disable = (selectionType === Asc.c_oAscSelectionType.RangeImage || selectionType === Asc.c_oAscSelectionType.RangeChart || selectionType === Asc.c_oAscSelectionType.RangeChartText ||
selectionType === Asc.c_oAscSelectionType.RangeShape || selectionType === Asc.c_oAscSelectionType.RangeShapeText || selectionType === Asc.c_oAscSelectionType.RangeSlicer);
toolbar.lockToolbar(SSE.enumLock.wsLockFormat, need_disable && !!this._state.wsProps['Objects'] && !!this._state.is_lockText || !need_disable && !!this._state.wsProps['FormatCells']);
toolbar.lockToolbar(SSE.enumLock.wsLockFormatFill, need_disable && !!this._state.wsProps['Objects'] && !!this._state.is_lockShape || !need_disable && !!this._state.wsProps['FormatCells']);
toolbar.lockToolbar(Common.enumLock.wsLockFormat, need_disable && !!this._state.wsProps['Objects'] && !!this._state.is_lockText || !need_disable && !!this._state.wsProps['FormatCells']);
toolbar.lockToolbar(Common.enumLock.wsLockFormatFill, need_disable && !!this._state.wsProps['Objects'] && !!this._state.is_lockShape || !need_disable && !!this._state.wsProps['FormatCells']);
toolbar.lockToolbar(SSE.enumLock['Objects'], !!this._state.wsProps['Objects']);
toolbar.lockToolbar(SSE.enumLock['FormatCells'], !!this._state.wsProps['FormatCells']);
toolbar.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects']);
toolbar.lockToolbar(Common.enumLock['FormatCells'], !!this._state.wsProps['FormatCells']);
if (editOptionsDisabled) return;
@ -2770,7 +2770,7 @@ define([
need_disable = this._state.controlsdisabled.filters || formatTableInfo!==null || filterInfo && filterInfo.asc_getIsAutoFilter()===null;
// (need_disable !== toolbar.btnMerge.isDisabled()) && toolbar.btnMerge.setDisabled(need_disable);
toolbar.lockToolbar(SSE.enumLock.ruleMerge, need_disable, {array:[toolbar.btnMerge, toolbar.btnInsertTable]});
toolbar.lockToolbar(Common.enumLock.ruleMerge, need_disable, {array:[toolbar.btnMerge, toolbar.btnInsertTable]});
val = info.asc_getMerge();
if (this._state.merge !== val) {
@ -2794,13 +2794,13 @@ define([
this._state.filter = val;
}
need_disable = this._state.controlsdisabled.filters || (val===null);
toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable,
toolbar.lockToolbar(Common.enumLock.ruleFilter, need_disable,
{ array: toolbar.btnsSetAutofilter.concat(toolbar.btnCustomSort, toolbar.btnTableTemplate, toolbar.btnInsertTable, toolbar.btnRemoveDuplicates, toolbar.btnDataValidation) });
toolbar.lockToolbar(SSE.enumLock.tableHasSlicer, filterInfo && filterInfo.asc_getIsSlicerAdded(), { array: toolbar.btnsSetAutofilter });
toolbar.lockToolbar(Common.enumLock.tableHasSlicer, filterInfo && filterInfo.asc_getIsSlicerAdded(), { array: toolbar.btnsSetAutofilter });
need_disable = (selectionType !== Asc.c_oAscSelectionType.RangeSlicer) && (this._state.controlsdisabled.filters || (val===null));
toolbar.lockToolbar(SSE.enumLock.cantSort, need_disable, { array: toolbar.btnsSortDown.concat(toolbar.btnsSortUp) });
toolbar.lockToolbar(Common.enumLock.cantSort, need_disable, { array: toolbar.btnsSortDown.concat(toolbar.btnsSortUp) });
val = (formatTableInfo) ? formatTableInfo.asc_getTableStyleName() : null;
if (this._state.tablestylename !== val && this.toolbar.mnuTableTemplatePicker) {
@ -2815,7 +2815,7 @@ define([
}
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array: toolbar.btnsClearAutofilter});
toolbar.lockToolbar(Common.enumLock.ruleDelFilter, need_disable, {array: toolbar.btnsClearAutofilter});
var old_name = this._state.tablename;
this._state.tablename = (formatTableInfo) ? formatTableInfo.asc_getTableName() : undefined;
@ -2827,15 +2827,15 @@ define([
this.getApplication().getController('Statusbar').onApiFilterInfo(!need_disable);
this._state.multiselect = info.asc_getMultiselect();
toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink, toolbar.btnInsertTable]});
toolbar.lockToolbar(Common.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink, toolbar.btnInsertTable]});
this._state.inpivot = !!info.asc_getPivotTableInfo();
toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnCustomSort,
toolbar.lockToolbar(Common.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnCustomSort,
toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable, toolbar.btnRemoveDuplicates, toolbar.btnDataValidation)});
toolbar.lockToolbar(SSE.enumLock.noSlicerSource, !(this._state.inpivot || formatTableInfo), { array: [toolbar.btnInsertSlicer]});
toolbar.lockToolbar(Common.enumLock.noSlicerSource, !(this._state.inpivot || formatTableInfo), { array: [toolbar.btnInsertSlicer]});
need_disable = !this.appConfig.canModifyFilter;
toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnTableTemplate,
toolbar.lockToolbar(Common.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnTableTemplate,
toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2], toolbar.btnInsertTable, toolbar.btnRemoveDuplicates, toolbar.btnDataValidation)});
}
@ -2916,31 +2916,31 @@ define([
for (var i=0; i<4; i++) {
!items[i].isDisabled() && (enabled = true);
}
toolbar.lockToolbar(SSE.enumLock.itemsDisabled, !enabled, {array: [toolbar.btnAddCell]});
toolbar.lockToolbar(Common.enumLock.itemsDisabled, !enabled, {array: [toolbar.btnAddCell]});
items = me.toolbar.btnDeleteCell.menu.items;
enabled = false;
for (var i=0; i<4; i++) {
!items[i].isDisabled() && (enabled = true);
}
toolbar.lockToolbar(SSE.enumLock.itemsDisabled, !enabled, {array: [toolbar.btnDeleteCell]});
toolbar.lockToolbar(Common.enumLock.itemsDisabled, !enabled, {array: [toolbar.btnDeleteCell]});
// info.asc_getComments()===null - has comment, but no permissions to view it
toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) ||
toolbar.lockToolbar(Common.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) ||
this.toolbar.mode.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells),
{ array: this.btnsComment });
toolbar.lockToolbar(SSE.enumLock.headerLock, info.asc_getLockedHeaderFooter(), {array: this.toolbar.btnsEditHeader});
toolbar.lockToolbar(Common.enumLock.headerLock, info.asc_getLockedHeaderFooter(), {array: this.toolbar.btnsEditHeader});
},
onApiSelectionChangedRestricted: function(info) {
if (!this.appConfig.isRestrictedEdit) return;
var selectionType = info.asc_getSelectionType();
this.toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) ||
this.toolbar.lockToolbar(Common.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) ||
this.appConfig && this.appConfig.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells),
{ array: this.btnsComment });
this.toolbar.lockToolbar(SSE.enumLock['Objects'], !!this._state.wsProps['Objects'], { array: this.btnsComment });
this.toolbar.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects'], { array: this.btnsComment });
},
onApiSelectionChanged_DiagramEditor: function(info) {
@ -2968,7 +2968,7 @@ define([
} );
}
var _set = SSE.enumLock;
var _set = Common.enumLock;
var type = seltype;
switch ( seltype ) {
case Asc.c_oAscSelectionType.RangeSlicer:
@ -2983,7 +2983,7 @@ define([
clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.coAuth]
});
me.toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked);
me.toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked);
return is_image;
};
@ -2996,7 +2996,7 @@ define([
var need_disable = (selectionType === Asc.c_oAscSelectionType.RangeCells || selectionType === Asc.c_oAscSelectionType.RangeCol ||
selectionType === Asc.c_oAscSelectionType.RangeRow || selectionType === Asc.c_oAscSelectionType.RangeMax);
this.toolbar.lockToolbar( SSE.enumLock.selRange, need_disable, {array:[this.toolbar.btnEditChartData, this.toolbar.btnEditChartType]} );
this.toolbar.lockToolbar( Common.enumLock.selRange, need_disable, {array:[this.toolbar.btnEditChartData, this.toolbar.btnEditChartType]} );
if (selectionType == Asc.c_oAscSelectionType.RangeChart || selectionType == Asc.c_oAscSelectionType.RangeChartText)
return;
@ -3038,7 +3038,7 @@ define([
});
}
me.toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked);
me.toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked);
return is_image;
};
@ -3062,11 +3062,11 @@ define([
}
need_disable = this._state.controlsdisabled.filters || (val===null);
me.toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable,
me.toolbar.lockToolbar(Common.enumLock.ruleFilter, need_disable,
{ array: [me.toolbar.btnSetAutofilter, me.toolbar.btnSortDown, me.toolbar.btnSortUp] });
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
me.toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array: [me.toolbar.btnClearAutofilter]});
me.toolbar.lockToolbar(Common.enumLock.ruleDelFilter, need_disable, {array: [me.toolbar.btnClearAutofilter]});
}
},
@ -3501,9 +3501,9 @@ define([
}
if ( coauth_disable ) {
toolbar.lockToolbar(SSE.enumLock.coAuth, coauth_disable);
toolbar.lockToolbar(Common.enumLock.coAuth, coauth_disable);
} else {
var _set = SSE.enumLock;
var _set = Common.enumLock;
var type = seltype;
switch (seltype) {
case Asc.c_oAscSelectionType.RangeImage: type = _set.selImage; break;
@ -3526,9 +3526,9 @@ define([
clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selSlicer, _set.coAuth]
});
toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked);
toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked && (seltype==Asc.c_oAscSelectionType.RangeChart || seltype==Asc.c_oAscSelectionType.RangeChartText), { array: [toolbar.btnInsertChart] } );
toolbar.lockToolbar(SSE.enumLock.inSmartartInternal, is_smartart_internal);
toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked);
toolbar.lockToolbar(Common.enumLock.coAuthText, is_objLocked && (seltype==Asc.c_oAscSelectionType.RangeChart || seltype==Asc.c_oAscSelectionType.RangeChartText), { array: [toolbar.btnInsertChart] } );
toolbar.lockToolbar(Common.enumLock.inSmartartInternal, is_smartart_internal);
}
this._state.controlsdisabled.filters = is_image || is_mode_2 || coauth_disable;
@ -3664,7 +3664,7 @@ define([
this.onApiEditCell(this.api.isRangeSelection ? Asc.c_oAscCellEditorState.editStart : Asc.c_oAscCellEditorState.editEnd);
var toolbar = this.toolbar;
toolbar.lockToolbar(SSE.enumLock.selRangeEdit, this.api.isRangeSelection);
toolbar.lockToolbar(Common.enumLock.selRangeEdit, this.api.isRangeSelection);
this.setDisabledComponents([toolbar.btnUndo], this.api.isRangeSelection || !this.api.asc_getCanUndo());
this.setDisabledComponents([toolbar.btnRedo], this.api.isRangeSelection || !this.api.asc_getCanRedo());
@ -3675,8 +3675,8 @@ define([
onLockDefNameManager: function(state) {
this._state.namedrange_locked = (state == Asc.c_oAscDefinedNameReason.LockDefNameManager);
this.toolbar.lockToolbar(SSE.enumLock.printAreaLock, this.api.asc_isPrintAreaLocked(this.api.asc_getActiveWorksheetIndex()), {array: [this.toolbar.btnPrintArea]});
this.toolbar.lockToolbar(SSE.enumLock.namedRangeLock, this._state.namedrange_locked, {array: [this.toolbar.btnPrintArea.menu.items[0], this.toolbar.btnPrintArea.menu.items[2]]});
this.toolbar.lockToolbar(Common.enumLock.printAreaLock, this.api.asc_isPrintAreaLocked(this.api.asc_getActiveWorksheetIndex()), {array: [this.toolbar.btnPrintArea]});
this.toolbar.lockToolbar(Common.enumLock.namedRangeLock, this._state.namedrange_locked, {array: [this.toolbar.btnPrintArea.menu.items[0], this.toolbar.btnPrintArea.menu.items[2]]});
},
onLockCFManager: function(index) {
@ -3688,7 +3688,7 @@ define([
},
activateControls: function() {
this.toolbar.lockToolbar(SSE.enumLock.disableOnStart, false, {array: [this.toolbar.btnPrint]});
this.toolbar.lockToolbar(Common.enumLock.disableOnStart, false, {array: [this.toolbar.btnPrint]});
this._state.activated = true;
},
@ -3703,7 +3703,7 @@ define([
toolbar.hideMoreBtns();
toolbar.$el.find('.toolbar').toggleClass('masked', disable);
this.toolbar.lockToolbar(SSE.enumLock.menuFileOpen, disable);
this.toolbar.lockToolbar(Common.enumLock.menuFileOpen, disable);
if(disable) {
mask = $("<div class='toolbar-mask'>").appendTo(toolbar.$el.find('.toolbar'));
Common.util.Shortcuts.suspendEvents('command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h, command+1, ctrl+1');
@ -3825,7 +3825,7 @@ define([
this.btnsComment = [];
if ( config.canCoAuthoring && config.canComments ) {
var _set = SSE.enumLock;
var _set = Common.enumLock;
this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', this.toolbar.capBtnComment,
[_set.lostConnect, _set.commentLock, _set.editCell, _set['Objects']], undefined, undefined, undefined, '1', 'bottom', 'small');
@ -4090,8 +4090,8 @@ define([
this._state.wsProps = props.wsProps;
this._state.wsLock = props.wsLock;
this.toolbar.lockToolbar(SSE.enumLock.wsLock, this._state.wsLock);
this.toolbar.lockToolbar(SSE.enumLock['InsertHyperlinks'], this._state.wsProps['InsertHyperlinks'], {array: [this.toolbar.btnInsertHyperlink]});
this.toolbar.lockToolbar(Common.enumLock.wsLock, this._state.wsLock);
this.toolbar.lockToolbar(Common.enumLock['InsertHyperlinks'], this._state.wsProps['InsertHyperlinks'], {array: [this.toolbar.btnInsertHyperlink]});
this.appConfig && this.appConfig.isEdit ? this.onApiSelectionChanged(this.api.asc_getCellInfo()) : this.onApiSelectionChangedRestricted(this.api.asc_getCellInfo());
}
},

View file

@ -140,7 +140,7 @@ define([
onSelectionChanged: function(info) {
if (!this.toolbar.editMode || !this.view) return;
Common.Utils.lockControls(SSE.enumLock.sheetView, this.api.asc_getActiveNamedSheetView && !this.api.asc_getActiveNamedSheetView(this.api.asc_getActiveWorksheetIndex()),
Common.Utils.lockControls(Common.enumLock.sheetView, this.api.asc_getActiveNamedSheetView && !this.api.asc_getActiveNamedSheetView(this.api.asc_getActiveWorksheetIndex()),
{array: [this.view.btnCloseView]});
},
@ -251,7 +251,7 @@ define([
onWorksheetLocked: function(index,locked) {
if (index == this.api.asc_getActiveWorksheetIndex()) {
Common.Utils.lockControls(SSE.enumLock.sheetLock, locked, {array: [this.view.chHeadings, this.view.chGridlines, this.view.btnFreezePanes, this.view.chZeros]});
Common.Utils.lockControls(Common.enumLock.sheetLock, locked, {array: [this.view.chHeadings, this.view.chGridlines, this.view.btnFreezePanes, this.view.chZeros]});
}
},

View file

@ -71,8 +71,8 @@ define([
this._state = {};
this.wsLockOptions = ['SelectLockedCells', 'SelectUnlockedCells', 'FormatCells', 'FormatColumns', 'FormatRows', 'InsertColumns', 'InsertRows', 'InsertHyperlinks', 'DeleteColumns',
'DeleteRows', 'Sort', 'AutoFilter', 'PivotTables', 'Objects', 'Scenarios'];
SSE.enumLock && this.wsLockOptions.forEach(function(item){
SSE.enumLock[item] = item;
Common.enumLock && this.wsLockOptions.forEach(function(item){
Common.enumLock[item] = item;
});
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
@ -281,8 +281,8 @@ define([
var props = me.getWSProps();
me.view.btnProtectSheet.toggle(props.wsLock, true); //current sheet
Common.Utils.lockControls(SSE.enumLock['Objects'], props.wsProps['Objects'], { array: [me.view.chLockedText, me.view.chLockedShape]});
Common.Utils.lockControls(SSE.enumLock.wsLock, props.wsLock, { array: [me.view.btnAllowRanges]});
Common.Utils.lockControls(Common.enumLock['Objects'], props.wsProps['Objects'], { array: [me.view.chLockedText, me.view.chLockedShape]});
Common.Utils.lockControls(Common.enumLock.wsLock, props.wsLock, { array: [me.view.btnAllowRanges]});
});
},
@ -295,8 +295,8 @@ define([
if (this.view && props) {
this.view.btnProtectSheet.toggle(props.wsLock, true); //current sheet
Common.Utils.lockControls(SSE.enumLock['Objects'], props.wsProps['Objects'], { array: [this.view.chLockedText, this.view.chLockedShape]});
Common.Utils.lockControls(SSE.enumLock.wsLock, props.wsLock, { array: [this.view.btnAllowRanges]});
Common.Utils.lockControls(Common.enumLock['Objects'], props.wsProps['Objects'], { array: [this.view.chLockedText, this.view.chLockedShape]});
Common.Utils.lockControls(Common.enumLock.wsLock, props.wsLock, { array: [this.view.btnAllowRanges]});
}
Common.NotificationCenter.trigger('protect:wslock', props);
},
@ -335,7 +335,7 @@ define([
var selectionType = info.asc_getSelectionType();
var need_disable = (selectionType === Asc.c_oAscSelectionType.RangeCells || selectionType === Asc.c_oAscSelectionType.RangeCol ||
selectionType === Asc.c_oAscSelectionType.RangeRow || selectionType === Asc.c_oAscSelectionType.RangeMax);
Common.Utils.lockControls(SSE.enumLock.selRange, need_disable, { array: [this.view.chLockedText, this.view.chLockedShape]});
Common.Utils.lockControls(Common.enumLock.selRange, need_disable, { array: [this.view.chLockedText, this.view.chLockedShape]});
var xfs = info.asc_getXfs();
this.view.chLockedCell.setValue(!!xfs.asc_getLocked(), true);
@ -352,8 +352,8 @@ define([
lock = elValue.asc_getProtectionLocked();
this.view.chLockedText.setValue(locktext!==undefined ? !!locktext : 'indeterminate', true);
this.view.chLockedShape.setValue(lock!==undefined ? !!lock : 'indeterminate', true);
Common.Utils.lockControls(SSE.enumLock.wsLockText, locktext===null, { array: [this.view.chLockedText]});
Common.Utils.lockControls(SSE.enumLock.wsLockShape, lock===null, { array: [this.view.chLockedShape]});
Common.Utils.lockControls(Common.enumLock.wsLockText, locktext===null, { array: [this.view.chLockedText]});
Common.Utils.lockControls(Common.enumLock.wsLockShape, lock===null, { array: [this.view.chLockedShape]});
break;
}
}

View file

@ -121,7 +121,7 @@ define([
var me = this,
$host = me.toolbar.$el,
_set = SSE.enumLock;
_set = Common.enumLock;
this.btnDataFromText = new Common.UI.Button({
parentEl: $host.find('#slot-btn-data-from-text'),

View file

@ -83,7 +83,7 @@ define([
var me = this,
$host = me.toolbar.$el,
_set = SSE.enumLock;
_set = Common.enumLock;
var formulaDialog = SSE.getController('FormulaDialog');
@ -434,7 +434,7 @@ define([
btn.menu.setInnerMenu([{menu: menu, index: 0}]);
}
}
Common.Utils.lockControls(SSE.enumLock.noSubitems, arr.length<1, {array: [btn]});
Common.Utils.lockControls(Common.enumLock.noSubitems, arr.length<1, {array: [btn]});
},
setMenuItemMenu: function(name) {
@ -552,7 +552,7 @@ define([
menu.cmpEl.attr({tabindex: "-1"});
});
}
Common.Utils.lockControls(SSE.enumLock.noSubitems, morearr.length<1, {array: [btn]});
Common.Utils.lockControls(Common.enumLock.noSubitems, morearr.length<1, {array: [btn]});
}
},

View file

@ -154,7 +154,7 @@ define([
this.toolbar = options.toolbar;
this.lockedControls = [];
var _set = SSE.enumLock;
var _set = Common.enumLock;
this.btnsAddPivot = Common.Utils.injectButtons(this.toolbar.$el.find('.btn-slot.slot-add-pivot'), '', 'toolbar__icon btn-pivot-sum', this.txtPivotTable,
[_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell, _set.wsLock], undefined, undefined, undefined, '1', 'bottom', 'small');
@ -357,7 +357,7 @@ define([
getPanel: function () {
this.$el = $(_.template(template)( {} ));
var _set = SSE.enumLock;
var _set = Common.enumLock;
this.btnsAddPivot = this.btnsAddPivot.concat(Common.Utils.injectButtons(this.$el.find('.btn-slot.slot-add-pivot'), '', 'toolbar__icon btn-pivot-sum', this.txtCreate,
[_set.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell, _set.wsLock], undefined, undefined, undefined, '1', 'bottom', 'small'));

View file

@ -58,7 +58,10 @@ define([
,'common/main/lib/component/Mixtbar'
], function (Backbone, template, simple, template_view) { 'use strict';
SSE.enumLock = {
if (!Common.enumLock)
Common.enumLock = {};
var enumLock = {
editCell: 'cell-editing',
editFormula: 'is-formula',
editText: 'is-text',
@ -108,6 +111,11 @@ define([
inSmartartInternal: 'in-smartart-internal',
wsLockFormatFill: 'worksheet-lock-format-fill'
};
for (var key in enumLock) {
if (enumLock.hasOwnProperty(key)) {
Common.enumLock[key] = enumLock[key];
}
}
SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({
el: '#toolbar',
@ -182,7 +190,7 @@ define([
}
}
var _set = SSE.enumLock;
var _set = Common.enumLock;
me.btnCopy = new Common.UI.Button({
id : 'id-toolbar-btn-copy',
@ -1691,7 +1699,7 @@ define([
if (cmp && _.isFunction(cmp.setDisabled))
cmp.setDisabled(true);
});
this.lockToolbar(SSE.enumLock.disableOnStart, true, {array: [me.btnPrint]});
this.lockToolbar(Common.enumLock.disableOnStart, true, {array: [me.btnPrint]});
this.on('render:after', _.bind(this.onToolbarAfterRender, this));
}
@ -1900,7 +1908,7 @@ define([
_injectComponent('#slot-btn-scale', this.btnScale);
_injectComponent('#slot-btn-condformat', this.btnCondFormat);
this.btnsEditHeader = Common.Utils.injectButtons($host.find('.slot-editheader'), 'tlbtn-editheader-', 'toolbar__icon btn-editheader', this.capBtnInsHeader,
[SSE.enumLock.editCell, SSE.enumLock.selRangeEdit, SSE.enumLock.headerLock, SSE.enumLock.lostConnect, SSE.enumLock.coAuth], undefined, undefined, undefined, '1', 'bottom', 'small');
[Common.enumLock.editCell, Common.enumLock.selRangeEdit, Common.enumLock.headerLock, Common.enumLock.lostConnect, Common.enumLock.coAuth], undefined, undefined, undefined, '1', 'bottom', 'small');
Array.prototype.push.apply(this.lockControls, this.btnsEditHeader);
return $host;
@ -2416,16 +2424,16 @@ define([
setMode: function(mode) {
if (mode.isDisconnected) {
this.lockToolbar( SSE.enumLock.lostConnect, true );
this.lockToolbar( SSE.enumLock.lostConnect, true,
this.lockToolbar( Common.enumLock.lostConnect, true );
this.lockToolbar( Common.enumLock.lostConnect, true,
{array:[this.btnEditChart, this.btnEditChartData, this.btnEditChartType, this.btnUndo,this.btnRedo,this.btnSave]} );
if ( this.synchTooltip )
this.synchTooltip.hide();
if (!mode.enableDownload)
this.lockToolbar(SSE.enumLock.cantPrint, true, {array: [this.btnPrint]});
this.lockToolbar(Common.enumLock.cantPrint, true, {array: [this.btnPrint]});
} else {
this.mode = mode;
this.lockToolbar(SSE.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]});
this.lockToolbar(Common.enumLock.cantPrint, !mode.canPrint, {array: [this.btnPrint]});
}
return this;

View file

@ -106,7 +106,7 @@ define([
var me = this,
$host = me.toolbar.$el,
_set = SSE.enumLock;
_set = Common.enumLock;
if ( me.appConfig.canFeatureViews ) {
this.btnSheetView = new Common.UI.Button({

View file

@ -107,7 +107,7 @@ define([
this.appConfig = options.mode;
var _set = SSE.enumLock;
var _set = Common.enumLock;
this.lockedControls = [];
this._state = {disabled: false};