diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index a54a0ba10..292291c02 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -537,7 +537,12 @@ define([ }, onClear: function(menu, item, e) { - Common.NotificationCenter.trigger('protect:check', this.onClearCallback, this, [menu, item]); + if (item.value == Asc.c_oAscCleanOptions.Format && !this._state.wsProps['FormatCells'] || item.value == Asc.c_oAscCleanOptions.All && !this.api.asc_checkLockedCells()) + this.onClearCallback(menu, item); + else if (item.value == Asc.c_oAscCleanOptions.Comments) { + this._state.wsProps['Objects'] ? Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ChangeOnProtectedSheet, Asc.c_oAscError.Level.NoCritical) : this.onClearCallback(menu, item); + } else + Common.NotificationCenter.trigger('protect:check', this.onClearCallback, this, [menu, item]); }, onClearCallback: function(menu, item) { diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 72b37c109..bc87c0955 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -215,6 +215,7 @@ define([ Common.NotificationCenter.on('markfavorite', _.bind(this.markFavorite, this)); Common.NotificationCenter.on('protect:check', _.bind(this.checkProtectedRange, this)); Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this)); + Common.NotificationCenter.on('showerror', _.bind(this.onError, this)); this.stackLongActions = new Common.IrregularStack({ strongCompare : this._compareActionStrong, @@ -2176,7 +2177,7 @@ define([ }, checkProtectedRange: function(callback, scope, args) { - var result = this.api.asc_isProtectedSheet() ? this.api.asc_checkActiveCellProtectedRange() : false; + var result = this.api.asc_isProtectedSheet() ? this.api.asc_checkProtectedRange() : false; if (result===null) { this.onError(Asc.c_oAscError.ID.ChangeOnProtectedSheet, Asc.c_oAscError.Level.NoCritical); return; diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 94e5cbfa0..1c5ead242 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -1462,7 +1462,12 @@ define([ }, onClearStyleMenu: function(menu, item, e) { - Common.NotificationCenter.trigger('protect:check', this.onClearStyleMenuCallback, this, [menu, item]); + if (item.value == Asc.c_oAscCleanOptions.Format && !this._state.wsProps['FormatCells'] || item.value == Asc.c_oAscCleanOptions.All && !this.api.asc_checkLockedCells()) + this.onClearStyleMenuCallback(menu, item); + else if (item.value == Asc.c_oAscCleanOptions.Comments) { + this._state.wsProps['Objects'] ? Common.NotificationCenter.trigger('showerror', Asc.c_oAscError.ID.ChangeOnProtectedSheet, Asc.c_oAscError.Level.NoCritical) : this.onClearStyleMenuCallback(menu, item); + } else + Common.NotificationCenter.trigger('protect:check', this.onClearStyleMenuCallback, this, [menu, item]); }, onClearStyleMenuCallback: function(menu, item, e) {