[SSE] Bug 53654: don't show hidden sheets in protected workbook

This commit is contained in:
Julia Radzhabova 2021-11-11 16:53:43 +03:00
parent d3c4c325ab
commit db75fdd255
2 changed files with 7 additions and 7 deletions

View file

@ -193,15 +193,16 @@ define([
},
onChangeProtectWorkbook: function() {
this.statusbar.btnAddWorksheet.setDisabled(this.api.isCellEdited || this.api.asc_isWorkbookLocked() || this.api.asc_isProtectedWorkbook() || this.statusbar.rangeSelectionMode!=Asc.c_oAscSelectionDialogType.None);
var count = this.statusbar.tabbar.getCount(), tab;
var wbprotected = this.api.asc_isProtectedWorkbook();
this.statusbar.btnAddWorksheet.setDisabled(this.api.isCellEdited || this.api.asc_isWorkbookLocked() || wbprotected || this.statusbar.rangeSelectionMode!=Asc.c_oAscSelectionDialogType.None);
var count = this.statusbar.tabbar.getCount(), tab;
for (var i = count; i-- > 0; ) {
tab = this.statusbar.tabbar.getAt(i);
var islocked = tab.hasClass('coauth-locked');
tab.isLockTheDrag = islocked || wbprotected || (this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable) || (this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.PrintTitles);
tab.$el.children(':first-child').attr('draggable', tab.isLockTheDrag?'false':'true');
}
this.statusbar.update();
},
/** coauthoring end **/

View file

@ -553,10 +553,9 @@ define([
iconTitle : name,
iconVisible : name!==''
};
this.api.asc_isWorksheetHidden(i)? hidentems.push(tab) : items.push(tab);
allItems.push(tab);
var hidden = this.api.asc_isWorksheetHidden(i);
hidden ? hidentems.push(tab) : items.push(tab);
(!hidden || !wbprotected) && allItems.push(tab);
}
if (hidentems.length) {
@ -600,7 +599,7 @@ define([
if (!this.tabbar.isTabVisible(sindex))
this.tabbar.setTabVisible(sindex);
this.btnAddWorksheet.setDisabled(me.mode.isDisconnected || me.api.asc_isWorkbookLocked() || me.api.asc_isProtectedWorkbook() || me.api.isCellEdited);
this.btnAddWorksheet.setDisabled(me.mode.isDisconnected || me.api.asc_isWorkbookLocked() || wbprotected || me.api.isCellEdited);
if (this.mode.isEdit) {
this.tabbar.addDataHint(_.findIndex(items, function (item) {
return item.sheetindex === sindex;