[SSE] Fix protect sheet

This commit is contained in:
Julia Radzhabova 2021-08-05 19:09:21 +03:00
parent d769334e38
commit 4fecc63ba0
2 changed files with 29 additions and 25 deletions

View file

@ -2505,10 +2505,13 @@ define([
toolbar.btnImgAlign.menu.items[8].setDisabled(objcount<3); toolbar.btnImgAlign.menu.items[8].setDisabled(objcount<3);
// disable on protected sheet // disable on protected sheet
// 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 || 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); selectionType === Asc.c_oAscSelectionType.RangeShape || selectionType === Asc.c_oAscSelectionType.RangeShapeText || selectionType === Asc.c_oAscSelectionType.RangeSlicer);
toolbar.lockToolbar(need_disable ? SSE.enumLock['Objects'] : SSE.enumLock['FormatCells'], need_disable ? !!this._state.wsProps['Objects'] : !!this._state.wsProps['FormatCells'], toolbar.lockToolbar(SSE.enumLock.wsLockFormat, need_disable && !!this._state.wsProps['Objects'] || !need_disable && !!this._state.wsProps['FormatCells']);
{ clear: [SSE.enumLock['FormatCells'], SSE.enumLock['Objects']]});
toolbar.lockToolbar(SSE.enumLock['Objects'], !!this._state.wsProps['Objects']);
toolbar.lockToolbar(SSE.enumLock['FormatCells'], !!this._state.wsProps['FormatCells']);
if (editOptionsDisabled) return; if (editOptionsDisabled) return;

View file

@ -103,7 +103,8 @@ define([
wsLock: 'worksheet-lock', wsLock: 'worksheet-lock',
itemsDisabled: 'all-items-disabled', itemsDisabled: 'all-items-disabled',
wsLockText: 'worksheet-lock-text', wsLockText: 'worksheet-lock-text',
wsLockShape: 'worksheet-lock-shape' wsLockShape: 'worksheet-lock-shape',
wsLockFormat: 'worksheet-lock-format'
}; };
SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({ SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({
@ -422,7 +423,7 @@ define([
id : 'id-toolbar-btn-incfont', id : 'id-toolbar-btn-incfont',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-incfont', iconCls : 'toolbar__icon btn-incfont',
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLockFormat],
dataHint : '1', dataHint : '1',
dataHintDirection: 'top' dataHintDirection: 'top'
}); });
@ -431,7 +432,7 @@ define([
id : 'id-toolbar-btn-decfont', id : 'id-toolbar-btn-decfont',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-decfont', iconCls : 'toolbar__icon btn-decfont',
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLockFormat],
dataHint : '1', dataHint : '1',
dataHintDirection: 'top' dataHintDirection: 'top'
}); });
@ -440,7 +441,7 @@ define([
id : 'id-toolbar-btn-bold', id : 'id-toolbar-btn-bold',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-bold', iconCls : 'toolbar__icon btn-bold',
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLockFormat],
enableToggle: true, enableToggle: true,
dataHint : '1', dataHint : '1',
dataHintDirection: 'bottom' dataHintDirection: 'bottom'
@ -450,7 +451,7 @@ define([
id : 'id-toolbar-btn-italic', id : 'id-toolbar-btn-italic',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-italic', iconCls : 'toolbar__icon btn-italic',
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLockFormat],
enableToggle: true, enableToggle: true,
dataHint : '1', dataHint : '1',
dataHintDirection: 'bottom' dataHintDirection: 'bottom'
@ -460,7 +461,7 @@ define([
id : 'id-toolbar-btn-underline', id : 'id-toolbar-btn-underline',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-underline', iconCls : 'toolbar__icon btn-underline',
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLockFormat],
enableToggle: true, enableToggle: true,
dataHint : '1', dataHint : '1',
dataHintDirection: 'bottom' dataHintDirection: 'bottom'
@ -470,7 +471,7 @@ define([
id: 'id-toolbar-btn-strikeout', id: 'id-toolbar-btn-strikeout',
cls: 'btn-toolbar', cls: 'btn-toolbar',
iconCls: 'toolbar__icon btn-strikeout', iconCls: 'toolbar__icon btn-strikeout',
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLockFormat],
enableToggle: true, enableToggle: true,
dataHint : '1', dataHint : '1',
dataHintDirection: 'bottom' dataHintDirection: 'bottom'
@ -483,7 +484,7 @@ define([
icls : 'btn-subscript', icls : 'btn-subscript',
split : true, split : true,
enableToggle: true, enableToggle: true,
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLockFormat],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ {
@ -519,7 +520,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-fontcolor', iconCls : 'toolbar__icon btn-fontcolor',
split : true, split : true,
lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLockFormat],
menu: true, menu: true,
auto: true, auto: true,
dataHint : '1', dataHint : '1',
@ -533,7 +534,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-paracolor', iconCls : 'toolbar__icon btn-paracolor',
split : true, split : true,
lock : [_set.selImage, _set.editCell, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']], lock : [_set.selImage, _set.editCell, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLockFormat],
transparent: true, transparent: true,
menu: true, menu: true,
dataHint: '1', dataHint: '1',
@ -561,7 +562,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-align-left', iconCls : 'toolbar__icon btn-align-left',
enableToggle: true, enableToggle: true,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.wsLockFormat],
toggleGroup : 'alignGroup', toggleGroup : 'alignGroup',
dataHint : '1', dataHint : '1',
dataHintDirection: 'bottom' dataHintDirection: 'bottom'
@ -572,7 +573,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-align-center', iconCls : 'toolbar__icon btn-align-center',
enableToggle: true, enableToggle: true,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.wsLockFormat],
toggleGroup : 'alignGroup', toggleGroup : 'alignGroup',
dataHint : '1', dataHint : '1',
dataHintDirection: 'bottom' dataHintDirection: 'bottom'
@ -583,7 +584,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-align-right', iconCls : 'toolbar__icon btn-align-right',
enableToggle: true, enableToggle: true,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.wsLockFormat],
toggleGroup : 'alignGroup', toggleGroup : 'alignGroup',
dataHint : '1', dataHint : '1',
dataHintDirection: 'bottom' dataHintDirection: 'bottom'
@ -594,7 +595,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-align-just', iconCls : 'toolbar__icon btn-align-just',
enableToggle: true, enableToggle: true,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.wsLockFormat],
toggleGroup: 'alignGroup', toggleGroup: 'alignGroup',
dataHint : '1', dataHint : '1',
dataHintDirection: 'bottom' dataHintDirection: 'bottom'
@ -641,7 +642,7 @@ define([
id : 'id-toolbar-rtn-valign-top', id : 'id-toolbar-rtn-valign-top',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-align-top', iconCls : 'toolbar__icon btn-align-top',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.wsLockFormat],
enableToggle: true, enableToggle: true,
toggleGroup : 'vAlignGroup', toggleGroup : 'vAlignGroup',
dataHint : '1', dataHint : '1',
@ -653,7 +654,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-align-middle', iconCls : 'toolbar__icon btn-align-middle',
enableToggle: true, enableToggle: true,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.wsLockFormat],
toggleGroup : 'vAlignGroup', toggleGroup : 'vAlignGroup',
dataHint : '1', dataHint : '1',
dataHintDirection: 'top' dataHintDirection: 'top'
@ -663,7 +664,7 @@ define([
id : 'id-toolbar-rtn-valign-bottom', id : 'id-toolbar-rtn-valign-bottom',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-align-bottom', iconCls : 'toolbar__icon btn-align-bottom',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.wsLockFormat],
enableToggle: true, enableToggle: true,
toggleGroup : 'vAlignGroup', toggleGroup : 'vAlignGroup',
dataHint : '1', dataHint : '1',
@ -685,7 +686,7 @@ define([
id : 'id-toolbar-rtn-textorient', id : 'id-toolbar-rtn-textorient',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon text-orient-ccw', iconCls : 'toolbar__icon text-orient-ccw',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.wsLockFormat],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ {
@ -747,7 +748,7 @@ define([
cls : 'btn-toolbar x-huge icon-top', cls : 'btn-toolbar x-huge icon-top',
iconCls : 'toolbar__icon btn-insertimage', iconCls : 'toolbar__icon btn-insertimage',
caption : me.capInsertImage, caption : me.capInsertImage,
lock : [_set.editCell, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.lostConnect, _set.coAuth, _set['Objects']],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ caption: me.mniImageFromFile, value: 'file' }, { caption: me.mniImageFromFile, value: 'file' },
@ -775,7 +776,7 @@ define([
id : 'tlbtn-insertchart', id : 'tlbtn-insertchart',
cls : 'btn-toolbar x-huge icon-top', cls : 'btn-toolbar x-huge icon-top',
iconCls : 'toolbar__icon btn-insertchart', iconCls : 'toolbar__icon btn-insertchart',
lock : [_set.editCell, _set.lostConnect, _set.coAuth, _set.coAuthText], lock : [_set.editCell, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['Objects']],
caption : me.capInsertChart, caption : me.capInsertChart,
menu : true, menu : true,
dataHint : '1', dataHint : '1',
@ -801,7 +802,7 @@ define([
iconCls : 'toolbar__icon btn-insertshape', iconCls : 'toolbar__icon btn-insertshape',
enableToggle: true, enableToggle: true,
caption : me.capInsertShape, caption : me.capInsertShape,
lock : [_set.editCell, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.lostConnect, _set.coAuth, _set['Objects']],
menu : new Common.UI.Menu({cls: 'menu-shapes'}), menu : new Common.UI.Menu({cls: 'menu-shapes'}),
dataHint : '1', dataHint : '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
@ -813,7 +814,7 @@ define([
cls : 'btn-toolbar x-huge icon-top', cls : 'btn-toolbar x-huge icon-top',
iconCls : 'toolbar__icon btn-text', iconCls : 'toolbar__icon btn-text',
caption : me.capInsertText, caption : me.capInsertText,
lock : [_set.editCell, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.lostConnect, _set.coAuth, _set['Objects']],
enableToggle: true, enableToggle: true,
dataHint : '1', dataHint : '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
@ -825,7 +826,7 @@ define([
cls : 'btn-toolbar x-huge icon-top', cls : 'btn-toolbar x-huge icon-top',
iconCls : 'toolbar__icon btn-textart', iconCls : 'toolbar__icon btn-textart',
caption : me.capInsertTextart, caption : me.capInsertTextart,
lock : [_set.editCell, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.lostConnect, _set.coAuth, _set['Objects']],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
cls: 'menu-shapes', cls: 'menu-shapes',
items: [ items: [