From f7aeef5f23c972e0cf4c6a58cef84eecbc7ca078 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Wed, 1 Dec 2021 19:38:02 +0400 Subject: [PATCH] [SSE mobile] Correct lock shape --- .../mobile/src/controller/Toolbar.jsx | 2 ++ .../mobile/src/store/focusObjects.js | 21 ++++++++++++++----- .../mobile/src/view/Toolbar.jsx | 2 ++ .../mobile/src/view/edit/Edit.jsx | 15 +++++++------ 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx b/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx index 882639130..8b1f1e769 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx @@ -17,6 +17,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn const storeFocusObjects = props.storeFocusObjects; const focusOn = storeFocusObjects.focusOn; const isObjectLocked = storeFocusObjects.isLocked; + const isShapeLocked = storeFocusObjects.isLockedShape; const isEditCell = storeFocusObjects.isEditCell; const editFormulaMode = storeFocusObjects.editFormulaMode; @@ -159,6 +160,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn isDisconnected={isDisconnected} wsProps={wsProps} focusOn={focusOn} + isShapeLocked={isShapeLocked} /> ) })); diff --git a/apps/spreadsheeteditor/mobile/src/store/focusObjects.js b/apps/spreadsheeteditor/mobile/src/store/focusObjects.js index dbf5f226f..dd1b117f8 100644 --- a/apps/spreadsheeteditor/mobile/src/store/focusObjects.js +++ b/apps/spreadsheeteditor/mobile/src/store/focusObjects.js @@ -15,6 +15,8 @@ export class storeFocusObjects { imageObject: computed, chartObject: computed, isLocked: observable, + isLockedText: observable, + isLockedShape: observable, setIsLocked: action, editFormulaMode: observable, setEditFormulaMode: action, @@ -89,9 +91,14 @@ export class storeFocusObjects { } isLocked = false; + isLockedShape = false; + isLockedText = false; setIsLocked(info) { - let islocked = false; + let isLocked = false, + isLockedShape = false, + isLockedText = false; + switch (info.asc_getSelectionType()) { case Asc.c_oAscSelectionType.RangeChart: case Asc.c_oAscSelectionType.RangeImage: @@ -101,15 +108,19 @@ export class storeFocusObjects { const objects = Common.EditorApi.get().asc_getGraphicObjectProps(); for ( let i in objects ) { if ( objects[i].asc_getObjectType() == Asc.c_oAscTypeSelectElement.Image ) { - if ((islocked = objects[i].asc_getObjectValue().asc_getLocked())) - break; + isLocked = objects[i].asc_getObjectValue().asc_getLocked(); + isLockedShape = objects[i].asc_getObjectValue().asc_getProtectionLocked(); + isLockedText = objects[i].asc_getObjectValue().asc_getProtectionLockText(); + break; } } break; default: - islocked = info.asc_getLocked(); + this.isLocked = info.asc_getLocked(); } - this.isLocked = islocked; + this.isLocked = isLocked; + this.isLockedShape = isLockedShape; + this.isLockedText = isLockedText; } editFormulaMode = false; diff --git a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx index 3acadd318..56d314ab6 100644 --- a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx @@ -7,6 +7,7 @@ const ToolbarView = props => { const isDisconnected = props.isDisconnected; const wsProps = props.wsProps; const focusOn = props.focusOn; + const isShapeLocked = props.isShapeLocked; const undo_box = props.isEdit && EditorUIController.toolbarOptions ? EditorUIController.toolbarOptions.getUndoRedo({ disabledUndo: !props.isCanUndo || isDisconnected, disabledRedo: !props.isCanRedo || isDisconnected, @@ -30,6 +31,7 @@ const ToolbarView = props => { disabled: props.disabledEditControls || props.disabledControls || isDisconnected, wsProps, focusOn, + isShapeLocked, onEditClick: () => props.openOptions('edit'), onAddClick: () => props.openOptions('add') })} diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx index 715cee628..d5adc1262 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx @@ -333,7 +333,6 @@ const EditTabs = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); const store = props.storeFocusObjects; - const wsLock = props.wsLock; const wsProps = props.wsProps; const settings = !store.focusOn ? [] : (store.focusOn === 'obj' ? store.objects : store.selections); let editors = []; @@ -351,14 +350,14 @@ const EditTabs = props => { component: }) } + if (!store.isLockedShape && settings.indexOf('shape') > -1) { + editors.push({ + caption: _t.textShape, + id: 'edit-shape', + component: + }) + } if(!wsProps.Objects) { - if (settings.indexOf('shape') > -1) { - editors.push({ - caption: _t.textShape, - id: 'edit-shape', - component: - }) - } if (settings.indexOf('image') > -1) { editors.push({ caption: _t.textImage,