[SSE] Lock format editing on protected sheet

This commit is contained in:
Julia Radzhabova 2021-07-16 15:47:24 +03:00
parent be22bc97a5
commit 2e9391d907
6 changed files with 103 additions and 51 deletions

View file

@ -194,7 +194,9 @@ define([
pgorient: undefined, pgorient: undefined,
lock_doc: undefined, lock_doc: undefined,
cf_locked: [], cf_locked: [],
selectedCells: 0 selectedCells: 0,
wsLock: false,
wsProps: {}
}; };
this.binding = {}; this.binding = {};
@ -1818,6 +1820,7 @@ define([
this.api.asc_registerCallback('asc_onUpdateDocumentProps', _.bind(this.onUpdateDocumentProps, this)); this.api.asc_registerCallback('asc_onUpdateDocumentProps', _.bind(this.onUpdateDocumentProps, this));
this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this)); this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this));
this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this)); this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this));
Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this));
} }
if ( !this.appConfig.isEditMailMerge ) { if ( !this.appConfig.isEditMailMerge ) {
@ -2500,6 +2503,12 @@ define([
toolbar.btnImgAlign.menu.items[7].setDisabled(objcount<3); toolbar.btnImgAlign.menu.items[7].setDisabled(objcount<3);
toolbar.btnImgAlign.menu.items[8].setDisabled(objcount<3); toolbar.btnImgAlign.menu.items[8].setDisabled(objcount<3);
// disable on protected sheet
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(need_disable ? SSE.enumLock['Objects'] : SSE.enumLock['FormatCells'], need_disable ? this._state.wsProps['Objects'] : this._state.wsProps['FormatCells'],
{ clear: [SSE.enumLock['FormatCells'], SSE.enumLock['Objects']]});
if (editOptionsDisabled) return; if (editOptionsDisabled) return;
/* read font params */ /* read font params */
@ -3709,8 +3718,10 @@ define([
var $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); var $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
if ($panel) { if ($panel) {
config.canProtect && $panel.append($('<div class="separator long"></div>')); config.canProtect && $panel.append($('<div class="separator long"></div>'));
$panel.append(me.getApplication().getController('WBProtection').createToolbarPanel()); var wbtab = me.getApplication().getController('WBProtection');
$panel.append(wbtab.createToolbarPanel());
me.toolbar.addTab(tab, $panel, 7); me.toolbar.addTab(tab, $panel, 7);
Array.prototype.push.apply(me.toolbar.lockControls, wbtab.getView('WBProtection').getButtons());
} }
var viewtab = me.getApplication().getController('ViewTab'); var viewtab = me.getApplication().getController('ViewTab');
@ -3981,6 +3992,11 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.toolbar); Common.NotificationCenter.trigger('edit:complete', this.toolbar);
}, },
onChangeProtectSheet: function(props) {
this._state.wsProps = props;
this.onApiSelectionChanged(this.api.asc_getCellInfo());
},
textEmptyImgUrl : 'You need to specify image URL.', textEmptyImgUrl : 'You need to specify image URL.',
warnMergeLostData : 'Operation can destroy data in the selected cells.<br>Continue?', warnMergeLostData : 'Operation can destroy data in the selected cells.<br>Continue?',
textWarning : 'Warning', textWarning : 'Warning',

View file

@ -68,7 +68,12 @@ define([
}); });
}, },
onLaunch: function () { onLaunch: function () {
this._state = {}; this._state = {wsLock: false};
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.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
@ -86,6 +91,7 @@ define([
this.api.asc_registerCallback('asc_onChangeProtectWorkbook',_.bind(this.onChangeProtectWorkbook, this)); this.api.asc_registerCallback('asc_onChangeProtectWorkbook',_.bind(this.onChangeProtectWorkbook, this));
this.api.asc_registerCallback('asc_onChangeProtectWorksheet',_.bind(this.onChangeProtectSheet, this)); this.api.asc_registerCallback('asc_onChangeProtectWorksheet',_.bind(this.onChangeProtectSheet, this));
this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.onApiSheetChanged, this)); this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.onApiSheetChanged, this));
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChanged, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
} }
}, },
@ -272,11 +278,32 @@ define([
}, },
onChangeProtectSheet: function() { onChangeProtectSheet: function() {
var wsProtected = this.api.asc_isProtectedSheet();
if (this._state.wsLock===wsProtected && !wsProtected) return;
this.view.btnProtectSheet.toggle(this.api.asc_isProtectedSheet(), true); //current sheet this.view.btnProtectSheet.toggle(this.api.asc_isProtectedSheet(), true); //current sheet
var arr = [];
if (wsProtected) {
var props = this.api.asc_getProtectedSheet();
props && this.wsLockOptions.forEach(function(item){
arr[item] = props['asc_get' + item] ? props['asc_get' + item]() : false;
});
}
this._state.wsLock = wsProtected;
Common.NotificationCenter.trigger('protect:wslock', arr);
}, },
onApiSheetChanged: function() { onApiSheetChanged: function() {
this.view.btnProtectSheet.toggle(this.api.asc_isProtectedSheet(), true); //current sheet this.onChangeProtectSheet(); //current sheet
},
onApiSelectionChanged: function(info) {
if ($('.asc-window.enable-key-events:visible').length>0) return;
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]});
}, },
onCoAuthoringDisconnect: function() { onCoAuthoringDisconnect: function() {

View file

@ -157,29 +157,29 @@ define([
var _set = SSE.enumLock; var _set = SSE.enumLock;
this.btnsAddPivot = Common.Utils.injectButtons(this.toolbar.$el.find('.btn-slot.slot-add-pivot'), '', 'toolbar__icon btn-pivot-sum', this.txtPivotTable, 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.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell, _set.wsLock]);
this.chRowHeader = new Common.UI.CheckBox({ this.chRowHeader = new Common.UI.CheckBox({
labelText: this.textRowHeader, labelText: this.textRowHeader,
lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock] lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells']]
}); });
this.lockedControls.push(this.chRowHeader); this.lockedControls.push(this.chRowHeader);
this.chColHeader = new Common.UI.CheckBox({ this.chColHeader = new Common.UI.CheckBox({
labelText: this.textColHeader, labelText: this.textColHeader,
lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock] lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells']]
}); });
this.lockedControls.push(this.chColHeader); this.lockedControls.push(this.chColHeader);
this.chRowBanded = new Common.UI.CheckBox({ this.chRowBanded = new Common.UI.CheckBox({
labelText: this.textRowBanded, labelText: this.textRowBanded,
lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock] lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells']]
}); });
this.lockedControls.push(this.chRowBanded); this.lockedControls.push(this.chRowBanded);
this.chColBanded = new Common.UI.CheckBox({ this.chColBanded = new Common.UI.CheckBox({
labelText: this.textColBanded, labelText: this.textColBanded,
lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock] lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells']]
}); });
this.lockedControls.push(this.chColBanded); this.lockedControls.push(this.chColBanded);
@ -246,7 +246,7 @@ define([
itemWidth : 61, itemWidth : 61,
itemHeight : 49, itemHeight : 49,
menuMaxHeight : 300, menuMaxHeight : 300,
lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock], lock : [_set.lostConnect, _set.coAuth, _set.noPivot, _set.selRangeEdit, _set.pivotLock, _set['FormatCells']],
beforeOpenHandler: function(e) { beforeOpenHandler: function(e) {
var cmp = this, var cmp = this,
menu = cmp.openButton.menu; menu = cmp.openButton.menu;
@ -326,7 +326,7 @@ define([
var _set = SSE.enumLock; var _set = SSE.enumLock;
this.btnsAddPivot = this.btnsAddPivot.concat(Common.Utils.injectButtons(this.$el.find('.btn-slot.slot-add-pivot'), '', 'toolbar__icon btn-pivot-sum', this.txtCreate, 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.lostConnect, _set.coAuth, _set.editPivot, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.editCell, _set.wsLock]));
this.chRowHeader.render(this.$el.find('#slot-chk-header-row')); this.chRowHeader.render(this.$el.find('#slot-chk-header-row'));
this.chColHeader.render(this.$el.find('#slot-chk-header-column')); this.chColHeader.render(this.$el.find('#slot-chk-header-column'));

View file

@ -299,6 +299,8 @@ define([
updateCellCheck: function (listView, record) { updateCellCheck: function (listView, record) {
if (record && listView) { if (record && listView) {
record.set('check', !record.get('check')); record.set('check', !record.get('check'));
if (record.get('optionName') == 'SelectLockedCells' && record.get('check'))
this.optionsList.store.findWhere({optionName: 'SelectUnlockedCells'}).set('check', true);
// listView.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true}); // listView.scroller.update({minScrollbarLength : 40, alwaysVisibleY: true, suppressScrollX: true});
} }
}, },

View file

@ -99,7 +99,8 @@ define([
pivotLock: 'pivot-lock', pivotLock: 'pivot-lock',
tableHasSlicer: 'table-has-slicer', tableHasSlicer: 'table-has-slicer',
sheetView: 'sheet-view', sheetView: 'sheet-view',
wbLock: 'workbook-lock' wbLock: 'workbook-lock',
wsLock: 'worksheet-lock'
}; };
SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({ SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({
@ -405,21 +406,21 @@ 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] lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']]
}); });
me.btnDecFontSize = new Common.UI.Button({ me.btnDecFontSize = new Common.UI.Button({
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] lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']]
}); });
me.btnBold = new Common.UI.Button({ me.btnBold = new Common.UI.Button({
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], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']],
enableToggle: true enableToggle: true
}); });
@ -427,7 +428,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], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']],
enableToggle: true enableToggle: true
}); });
@ -435,7 +436,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], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']],
enableToggle: true enableToggle: true
}); });
@ -443,7 +444,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], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']],
enableToggle: true enableToggle: true
}); });
@ -454,7 +455,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], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ {
@ -487,7 +488,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], lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
cls: 'shifted-left', cls: 'shifted-left',
items: [ items: [
@ -509,7 +510,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], lock : [_set.selImage, _set.editCell, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set['FormatCells'], _set['Objects']],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ template: _.template('<div id="id-toolbar-menu-paracolor" style="width: 169px; height: 216px; margin: 10px;"></div>') }, { template: _.template('<div id="id-toolbar-menu-paracolor" style="width: 169px; height: 216px; margin: 10px;"></div>') },
@ -525,7 +526,7 @@ define([
icls : 'btn-border-out', icls : 'btn-border-out',
borderId : 'outer', borderId : 'outer',
borderswidth: Asc.c_oAscBorderStyles.Thin, borderswidth: Asc.c_oAscBorderStyles.Thin,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']],
split : true, split : true,
menu : true menu : true
}); });
@ -535,7 +536,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], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']],
toggleGroup : 'alignGroup' toggleGroup : 'alignGroup'
}); });
@ -544,7 +545,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], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']],
toggleGroup : 'alignGroup' toggleGroup : 'alignGroup'
}); });
@ -553,7 +554,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], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']],
toggleGroup : 'alignGroup' toggleGroup : 'alignGroup'
}); });
@ -562,7 +563,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], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']],
toggleGroup: 'alignGroup' toggleGroup: 'alignGroup'
}); });
@ -573,7 +574,7 @@ define([
enableToggle: true, enableToggle: true,
allowDepress: true, allowDepress: true,
split : true, split : true,
lock : [_set.editCell, _set.selShape, _set.selShapeText, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleMerge, _set.editPivot], lock : [_set.editCell, _set.selShape, _set.selShapeText, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleMerge, _set.editPivot, _set.wsLock],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ {
@ -604,7 +605,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], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']],
enableToggle: true, enableToggle: true,
toggleGroup : 'vAlignGroup' toggleGroup : 'vAlignGroup'
}); });
@ -614,7 +615,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], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']],
toggleGroup : 'vAlignGroup' toggleGroup : 'vAlignGroup'
}); });
@ -622,7 +623,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], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']],
enableToggle: true, enableToggle: true,
toggleGroup : 'vAlignGroup' toggleGroup : 'vAlignGroup'
}); });
@ -631,7 +632,7 @@ define([
id : 'id-toolbar-rtn-wrap', id : 'id-toolbar-rtn-wrap',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-wrap', iconCls : 'toolbar__icon btn-wrap',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']],
enableToggle: true, enableToggle: true,
allowDepress: true allowDepress: true
}); });
@ -640,7 +641,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], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.coAuthText, _set['FormatCells'], _set['Objects']],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ {
@ -715,7 +716,7 @@ define([
cls : 'btn-toolbar x-huge icon-top', cls : 'btn-toolbar x-huge icon-top',
iconCls : 'toolbar__icon btn-inserthyperlink', iconCls : 'toolbar__icon btn-inserthyperlink',
caption : me.capInsertHyperlink, caption : me.capInsertHyperlink,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.cantHyperlink, _set.selSlicer, _set.multiselect, _set.lostConnect, _set.coAuth, _set.editPivot] lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.cantHyperlink, _set.selSlicer, _set.multiselect, _set.lostConnect, _set.coAuth, _set.editPivot, _set.wsLock]
}); });
me.btnInsertChart = new Common.UI.Button({ me.btnInsertChart = new Common.UI.Button({
@ -731,7 +732,7 @@ define([
id : 'tlbtn-insertsparkline', id : 'tlbtn-insertsparkline',
cls : 'btn-toolbar x-huge icon-top', cls : 'btn-toolbar x-huge icon-top',
iconCls : 'toolbar__icon btn-sparkline', iconCls : 'toolbar__icon btn-sparkline',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.selSlicer, _set.multiselect, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.editPivot], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.selSlicer, _set.multiselect, _set.lostConnect, _set.coAuth, _set.coAuthText, _set.editPivot, _set.wsLock],
caption : me.capInsertSpark, caption : me.capInsertSpark,
menu : true menu : true
}); });
@ -784,7 +785,7 @@ define([
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon btn-symbol', iconCls: 'toolbar__icon btn-symbol',
caption: me.capBtnInsSymbol, caption: me.capBtnInsSymbol,
lock: [_set.selImage, _set.selChart, _set.selShape, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect] lock: [_set.selImage, _set.selChart, _set.selShape, _set.editFormula, _set.selRangeEdit, _set.selSlicer, _set.coAuth, _set.coAuthText, _set.lostConnect, _set.wsLock]
}); });
me.btnInsertSlicer = new Common.UI.Button({ me.btnInsertSlicer = new Common.UI.Button({
@ -799,7 +800,7 @@ define([
id : 'id-toolbar-btn-ttempl', id : 'id-toolbar-btn-ttempl',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-menu-table', iconCls : 'toolbar__icon btn-menu-table',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set['FormatCells']],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ template: _.template('<div id="id-toolbar-menu-table-templates" style="width: 494px; height: 300px; margin: 0px 4px;"></div>') } { template: _.template('<div id="id-toolbar-menu-table-templates" style="width: 494px; height: 300px; margin: 0px 4px;"></div>') }
@ -812,7 +813,7 @@ define([
cls : 'btn-toolbar x-huge icon-top', cls : 'btn-toolbar x-huge icon-top',
iconCls : 'toolbar__icon btn-inserttable', iconCls : 'toolbar__icon btn-inserttable',
caption : me.capInsertTable, caption : me.capInsertTable,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set.ruleMerge, _set.editPivot] lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set.ruleMerge, _set.editPivot, _set['FormatCells']]
}); });
me.listStyles = new Common.UI.ComboDataView({ me.listStyles = new Common.UI.ComboDataView({
@ -821,7 +822,7 @@ define([
itemWidth : 112, itemWidth : 112,
itemHeight : 38, itemHeight : 38,
menuMaxHeight : 226, menuMaxHeight : 226,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']],
beforeOpenHandler: function(e) { beforeOpenHandler: function(e) {
var cmp = this, var cmp = this,
menu = cmp.openButton.menu, menu = cmp.openButton.menu,
@ -869,7 +870,7 @@ define([
cls : 'input-group-nr', cls : 'input-group-nr',
menuStyle : 'min-width: 180px;', menuStyle : 'min-width: 180px;',
hint : me.tipNumFormat, hint : me.tipNumFormat,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.selRangeEdit, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set['FormatCells']],
itemsTemplate: formatTemplate, itemsTemplate: formatTemplate,
editable : false, editable : false,
data : me.numFormatData data : me.numFormatData
@ -879,7 +880,7 @@ define([
id : 'id-toolbar-btn-percent-style', id : 'id-toolbar-btn-percent-style',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-percent-style', iconCls : 'toolbar__icon btn-percent-style',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']],
styleName : 'Percent' styleName : 'Percent'
}); });
@ -887,7 +888,7 @@ define([
id : 'id-toolbar-btn-accounting-style', id : 'id-toolbar-btn-accounting-style',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-currency-style', iconCls : 'toolbar__icon btn-currency-style',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']],
styleName : 'Currency', styleName : 'Currency',
split : true, split : true,
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
@ -925,14 +926,14 @@ define([
id : 'id-toolbar-btn-decdecimal', id : 'id-toolbar-btn-decdecimal',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-decdecimal', iconCls : 'toolbar__icon btn-decdecimal',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth] lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']]
}); });
me.btnIncDecimal = new Common.UI.Button({ me.btnIncDecimal = new Common.UI.Button({
id : 'id-toolbar-btn-incdecimal', id : 'id-toolbar-btn-incdecimal',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-incdecimal', iconCls : 'toolbar__icon btn-incdecimal',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth] lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.lostConnect, _set.coAuth, _set['FormatCells']]
}); });
me.btnInsertFormula = new Common.UI.Button({ me.btnInsertFormula = new Common.UI.Button({
@ -1088,7 +1089,7 @@ define([
id : 'id-toolbar-btn-condformat', id : 'id-toolbar-btn-condformat',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'toolbar__icon btn-cond-format', iconCls : 'toolbar__icon btn-cond-format',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set['FormatCells']],
menu : true menu : true
}); });

View file

@ -116,7 +116,7 @@ define([
iconCls: 'toolbar__icon protect-workbook', iconCls: 'toolbar__icon protect-workbook',
enableToggle: true, enableToggle: true,
caption: this.txtProtectWB, caption: this.txtProtectWB,
lock : [_set.lostConnect, _set.coAuth] lock : [_set.selRangeEdit, _set.lostConnect, _set.coAuth]
}); });
this.lockedControls.push(this.btnProtectWB); this.lockedControls.push(this.btnProtectWB);
@ -125,7 +125,7 @@ define([
iconCls: 'toolbar__icon protect-sheet', iconCls: 'toolbar__icon protect-sheet',
enableToggle: true, enableToggle: true,
caption: this.txtProtectSheet, caption: this.txtProtectSheet,
lock : [_set.lostConnect, _set.coAuth] lock : [_set.selRangeEdit, _set.lostConnect, _set.coAuth]
}); });
this.lockedControls.push(this.btnProtectSheet); this.lockedControls.push(this.btnProtectSheet);
@ -133,31 +133,31 @@ define([
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon allow-edit-ranges', iconCls: 'toolbar__icon allow-edit-ranges',
caption: this.txtAllowRanges, caption: this.txtAllowRanges,
lock : [_set.lostConnect, _set.coAuth] lock : [_set.selRangeEdit, _set.lostConnect, _set.coAuth]
}); });
this.lockedControls.push(this.btnAllowRanges); this.lockedControls.push(this.btnAllowRanges);
this.chLockedCell = new Common.UI.CheckBox({ this.chLockedCell = new Common.UI.CheckBox({
labelText: this.txtLockedCell, labelText: this.txtLockedCell,
lock : [_set.lostConnect, _set.coAuth] lock : [_set.editCell, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.wsLock, _set.wbLock, _set.lostConnect, _set.coAuth]
}); });
this.lockedControls.push(this.chLockedCell); this.lockedControls.push(this.chLockedCell);
this.chLockedShape = new Common.UI.CheckBox({ this.chLockedShape = new Common.UI.CheckBox({
labelText: this.txtLockedShape, labelText: this.txtLockedShape,
lock : [_set.lostConnect, _set.coAuth] lock : [_set.selRange, _set.selRangeEdit, _set.wsLock, _set.wbLock, _set.lostConnect, _set.coAuth]
}); });
this.lockedControls.push(this.chLockedShape); this.lockedControls.push(this.chLockedShape);
this.chLockedText = new Common.UI.CheckBox({ this.chLockedText = new Common.UI.CheckBox({
labelText: this.txtLockedText, labelText: this.txtLockedText,
lock : [_set.lostConnect, _set.coAuth] lock : [_set.selRange, _set.selRangeEdit, _set.selRangeEdit, _set.wsLock, _set.wbLock, _set.lostConnect, _set.coAuth]
}); });
this.lockedControls.push(this.chLockedText); this.lockedControls.push(this.chLockedText);
this.chHiddenFormula = new Common.UI.CheckBox({ this.chHiddenFormula = new Common.UI.CheckBox({
labelText: this.txtHiddenFormula, labelText: this.txtHiddenFormula,
lock : [_set.lostConnect, _set.coAuth] lock : [_set.editCell, _set.selRangeEdit, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selSlicer, _set.wsLock, _set.wbLock, _set.lostConnect, _set.coAuth]
}); });
this.lockedControls.push(this.chHiddenFormula); this.lockedControls.push(this.chHiddenFormula);
@ -195,6 +195,12 @@ define([
return this.$el; return this.$el;
}, },
getButtons: function(type) {
if (type===undefined)
return this.lockedControls;
return [];
},
show: function () { show: function () {
Common.UI.BaseView.prototype.show.call(this); Common.UI.BaseView.prototype.show.call(this);
this.fireEvent('show', this); this.fireEvent('show', this);