[SSE] Set shape/text protect settings

This commit is contained in:
Julia Radzhabova 2021-08-04 20:54:21 +03:00
parent de3786afae
commit a256c9413b
3 changed files with 29 additions and 3 deletions

View file

@ -254,8 +254,14 @@ define([
this.api.asc_setCellLocked(value=='checked');
break;
case 1: // shape
var props = new Asc.asc_CImgProperty();
props.asc_putProtectionLocked(value=='checked');
this.api.asc_setGraphicObjectProps(props);
break;
case 2: // text
var props = new Asc.asc_CImgProperty();
props.asc_putProtectionLockText(value=='checked');
this.api.asc_setGraphicObjectProps(props);
break;
case 3: // formula
break;
@ -323,6 +329,24 @@ define([
var xfs = info.asc_getXfs();
this.view.chLockedCell.setValue(!!xfs.asc_getLocked(), true);
this.view.chHiddenFormula.setValue(!!xfs.asc_getHidden(), true);
if (selectionType === Asc.c_oAscSelectionType.RangeSlicer || selectionType === Asc.c_oAscSelectionType.RangeImage ||
selectionType === Asc.c_oAscSelectionType.RangeShape || selectionType === Asc.c_oAscSelectionType.RangeShapeText ||
selectionType === Asc.c_oAscSelectionType.RangeChart || selectionType === Asc.c_oAscSelectionType.RangeChartText) {
var selectedObjects = this.api.asc_getGraphicObjectProps();
for (var i = 0; i < selectedObjects.length; i++) {
if (selectedObjects[i].asc_getObjectType() == Asc.c_oAscTypeSelectElement.Image) {
var elValue = selectedObjects[i].asc_getObjectValue();
var locktext = elValue.asc_getProtectionLockText(),
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]});
break;
}
}
}
},
onCoAuthoringDisconnect: function() {

View file

@ -101,7 +101,9 @@ define([
sheetView: 'sheet-view',
wbLock: 'workbook-lock',
wsLock: 'worksheet-lock',
itemsDisabled: 'all-items-disabled'
itemsDisabled: 'all-items-disabled',
wsLockText: 'worksheet-lock-text',
wsLockShape: 'worksheet-lock-shape'
};
SSE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend({

View file

@ -145,13 +145,13 @@ define([
this.chLockedShape = new Common.UI.CheckBox({
labelText: this.txtLockedShape,
lock : [_set.selRange, _set.selRangeEdit, _set.wbLock, _set.lostConnect, _set.coAuth, _set['Objects']]
lock : [_set.selRange, _set.selRangeEdit, _set.wbLock, _set.lostConnect, _set.coAuth, _set['Objects'], _set.wsLockShape]
});
this.lockedControls.push(this.chLockedShape);
this.chLockedText = new Common.UI.CheckBox({
labelText: this.txtLockedText,
lock : [_set.selRange, _set.selRangeEdit, _set.selRangeEdit, _set.selImage, _set.selSlicer, _set.wbLock, _set.lostConnect, _set.coAuth, _set['Objects']]
lock : [_set.selRange, _set.selRangeEdit, _set.selRangeEdit, _set.selImage, _set.selSlicer, _set.wbLock, _set.lostConnect, _set.coAuth, _set['Objects'], _set.wsLockText]
});
this.lockedControls.push(this.chLockedText);