From 598e20d97391387847dc309158fe0513199fd86a Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Sat, 30 Oct 2021 22:47:44 +0300 Subject: [PATCH] [DE PE SSE] Hide or disable controls for smart arts in right panel and advanced settings --- .../main/app/view/ImageSettingsAdvanced.js | 9 +++++++ .../main/app/template/ShapeSettings.template | 6 ++--- .../app/template/TextArtSettings.template | 6 ++--- .../main/app/view/ShapeSettings.js | 24 ++++++++++++++----- .../main/app/view/ShapeSettingsAdvanced.js | 12 +++++++++- .../main/app/view/TextArtSettings.js | 16 ++++++++++++- .../main/app/template/ShapeSettings.template | 6 ++--- .../app/template/TextArtSettings.template | 6 ++--- .../main/app/view/ShapeSettings.js | 24 ++++++++++++++----- .../main/app/view/ShapeSettingsAdvanced.js | 11 ++++++++- .../main/app/view/TextArtSettings.js | 16 ++++++++++++- 11 files changed, 108 insertions(+), 28 deletions(-) diff --git a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js index 75278fe85..3ab49cfa5 100644 --- a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js @@ -1546,6 +1546,15 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat _setShapeDefaults: function(props) { if (props ){ + if (props.get_FromSmartArt()) { + this.radioHSizePc.setDisabled(true); + this.radioVSizePc.setDisabled(true); + this.btnsCategory[2].setDisabled(true); + } + if (props.get_FromSmartArtInternal()) { + this.chAutofit.setDisabled(true); + } + var stroke = props.get_stroke(); if (stroke) { var value = stroke.get_linejoin(); diff --git a/apps/presentationeditor/main/app/template/ShapeSettings.template b/apps/presentationeditor/main/app/template/ShapeSettings.template index 1d24763b0..bc8a1ba44 100644 --- a/apps/presentationeditor/main/app/template/ShapeSettings.template +++ b/apps/presentationeditor/main/app/template/ShapeSettings.template @@ -142,17 +142,17 @@ - +
- + - + diff --git a/apps/presentationeditor/main/app/template/TextArtSettings.template b/apps/presentationeditor/main/app/template/TextArtSettings.template index d129cfd94..38d4e8846 100644 --- a/apps/presentationeditor/main/app/template/TextArtSettings.template +++ b/apps/presentationeditor/main/app/template/TextArtSettings.template @@ -160,17 +160,17 @@ - + - + - + diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js index b8b7c8ec4..0f7589b5b 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettings.js +++ b/apps/presentationeditor/main/app/view/ShapeSettings.js @@ -97,7 +97,9 @@ define([ DisabledControls: false, HideShapeOnlySettings: false, HideChangeTypeSettings: false, - isFromImage: false + HideRotationSettings: false, + isFromImage: false, + isFromSmartArtInternal: false }; this.lockedControls = []; this._locked = false; @@ -133,6 +135,7 @@ define([ this.TransparencyContainer = $('#shape-panel-transparent-fill'); this.ShapeOnlySettings = $('.shape-only'); this.CanChangeType = $('.change-type'); + this.RotationSettings = $('.shape-rotation'); }, render: function () { @@ -763,16 +766,18 @@ define([ this.disableControls(this._locked==true, props.get_CanFill() !== true); this.hideShapeOnlySettings(props.get_FromChart() || props.get_FromImage()); + this.hideRotationSettings(props.get_FromSmartArt()); - var hidechangetype = props.get_FromChart() || shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' + var hidechangetype = props.get_FromChart() || props.get_FromSmartArt() || shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' || shapetype=='straightConnector1'; this.hideChangeTypeSettings(hidechangetype); this._state.isFromImage = !!props.get_FromImage(); + this._state.isFromSmartArtInternal = !!props.get_FromSmartArtInternal(); if (!hidechangetype && this.btnChangeShape.menu.items.length) { - this.btnChangeShape.menu.items[0].setVisible(props.get_FromImage()); - this.btnChangeShape.menu.items[1].setVisible(!props.get_FromImage()); + this.btnChangeShape.menu.items[0].setVisible(props.get_FromImage() || props.get_FromSmartArtInternal()); + this.btnChangeShape.menu.items[1].setVisible(!props.get_FromImage() && !props.get_FromSmartArtInternal()); } // background colors @@ -1708,8 +1713,8 @@ define([ }); } - me.btnChangeShape.menu.items[0].setVisible(me._state.isFromImage); - me.btnChangeShape.menu.items[1].setVisible(!me._state.isFromImage); + me.btnChangeShape.menu.items[0].setVisible(me._state.isFromImage || me._state.isFromSmartArtInternal); + me.btnChangeShape.menu.items[1].setVisible(!me._state.isFromImage && !me._state.isFromSmartArtInternal); }, UpdateThemeColors: function() { @@ -1855,6 +1860,13 @@ define([ } }, + hideRotationSettings: function(value) { + if (this._state.HideRotationSettings !== value) { + this._state.HideRotationSettings = value; + this.RotationSettings.toggleClass('hidden', value==true); + } + }, + onPositionChange: function(btn) { var pos = btn.getNumberValue(), minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], diff --git a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js index 8023bba9e..388c8ef53 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js @@ -569,6 +569,15 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem _setDefaults: function(props) { if (props ){ + if (props.get_FromSmartArt()) { + this.btnsCategory[1].setDisabled(true); + } + if (props.get_FromSmartArtInternal()) { + this.radioNofit.setDisabled(true); + this.radioShrink.setDisabled(true); + this.radioFit.setDisabled(true); + } + this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_Width()).toFixed(2), true); this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_Height()).toFixed(2), true); @@ -606,7 +615,8 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem this.btnsCategory[3].setDisabled(null === margins); // Margins var shapetype = props.asc_getType(); - this.btnsCategory[4].setDisabled(shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' + this.btnsCategory[4].setDisabled(props.get_FromSmartArtInternal() + || shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' || shapetype=='straightConnector1'); diff --git a/apps/presentationeditor/main/app/view/TextArtSettings.js b/apps/presentationeditor/main/app/view/TextArtSettings.js index 0fc6a8569..611f8cbd8 100644 --- a/apps/presentationeditor/main/app/view/TextArtSettings.js +++ b/apps/presentationeditor/main/app/view/TextArtSettings.js @@ -94,7 +94,9 @@ define([ GradFillType: Asc.c_oAscFillGradType.GRAD_LINEAR, FormId: null, DisabledControls: false, - applicationPixelRatio: Common.Utils.applicationPixelRatio() + applicationPixelRatio: Common.Utils.applicationPixelRatio(), + isFromSmartArtInternal: false, + HideTransformSettings: false }; this.lockedControls = []; this._locked = false; @@ -125,6 +127,8 @@ define([ this.FillGradientContainer = $('#textart-panel-gradient-fill'); this.TransparencyContainer = $('#textart-panel-transparent-fill'); + this.TransformSettings = $('.textart-transform'); + PE.getCollection('Common.Collections.TextArt').bind({ reset: this.fillTextArt.bind(this) }); @@ -691,6 +695,9 @@ define([ if (this._initSettings) this.createDelayedElements(); + this._state.isFromSmartArtInternal = props.get_FromSmartArtInternal(); + this.hideTransformSettings(this._state.isFromSmartArtInternal); + if (props && props.get_TextArtProperties()) { var shapeprops = props.get_TextArtProperties(); @@ -1788,6 +1795,13 @@ define([ this._state.applicationPixelRatio = Common.Utils.applicationPixelRatio(); }, + hideTransformSettings: function(value) { + if (this._state.HideTransformSettings !== value) { + this._state.HideTransformSettings = value; + this.TransformSettings.toggleClass('hidden', value === true); + } + }, + txtNoBorders : 'No Line', strStroke : 'Stroke', strColor : 'Color', diff --git a/apps/spreadsheeteditor/main/app/template/ShapeSettings.template b/apps/spreadsheeteditor/main/app/template/ShapeSettings.template index 1d24763b0..bc8a1ba44 100644 --- a/apps/spreadsheeteditor/main/app/template/ShapeSettings.template +++ b/apps/spreadsheeteditor/main/app/template/ShapeSettings.template @@ -142,17 +142,17 @@ - + - + - +
diff --git a/apps/spreadsheeteditor/main/app/template/TextArtSettings.template b/apps/spreadsheeteditor/main/app/template/TextArtSettings.template index d129cfd94..38d4e8846 100644 --- a/apps/spreadsheeteditor/main/app/template/TextArtSettings.template +++ b/apps/spreadsheeteditor/main/app/template/TextArtSettings.template @@ -160,17 +160,17 @@ - + - + - + diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index c32067a35..d30d74bf9 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -98,7 +98,9 @@ define([ DisabledControls: false, HideShapeOnlySettings: false, HideChangeTypeSettings: false, - isFromImage: false + HideRotationSettings: false, + isFromImage: false, + isFromSmartArtInternal: false }; this.lockedControls = []; this._locked = false; @@ -134,6 +136,7 @@ define([ this.TransparencyContainer = $('#shape-panel-transparent-fill'); this.ShapeOnlySettings = $('.shape-only'); this.CanChangeType = $('.change-type'); + this.RotationSettings = $('.shape-rotation'); }, render: function () { @@ -759,16 +762,18 @@ define([ this.disableControls(this._locked, !shapeprops.asc_getCanFill()); this.hideShapeOnlySettings(shapeprops.asc_getFromChart() || shapeprops.asc_getFromImage()); + this.hideRotationSettings(shapeprops.asc_getFromSmartArt()); - var hidechangetype = shapeprops.get_FromChart() || shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' + var hidechangetype = shapeprops.get_FromChart() || shapeprops.asc_getFromSmartArt() || shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' || shapetype=='straightConnector1'; this.hideChangeTypeSettings(hidechangetype); this._state.isFromImage = !!shapeprops.get_FromImage(); + this._state.isFromSmartArtInternal = !!shapeprops.asc_getFromSmartArtInternal(); if (!hidechangetype && this.btnChangeShape.menu.items.length) { - this.btnChangeShape.menu.items[0].setVisible(shapeprops.get_FromImage()); - this.btnChangeShape.menu.items[1].setVisible(!shapeprops.get_FromImage()); + this.btnChangeShape.menu.items[0].setVisible(shapeprops.get_FromImage() || shapeprops.asc_getFromSmartArtInternal()); + this.btnChangeShape.menu.items[1].setVisible(!shapeprops.get_FromImage() && !shapeprops.asc_getFromSmartArtInternal()); } // background colors @@ -1715,8 +1720,8 @@ define([ me.btnChangeShape.menu.hide(); }); } - me.btnChangeShape.menu.items[0].setVisible(me._state.isFromImage); - me.btnChangeShape.menu.items[1].setVisible(!me._state.isFromImage); + me.btnChangeShape.menu.items[0].setVisible(me._state.isFromImage || me._state.isFromSmartArtInternal); + me.btnChangeShape.menu.items[1].setVisible(!me._state.isFromImage && !me._state.isFromSmartArtInternal); }, onBtnRotateClick: function(btn) { @@ -1874,6 +1879,13 @@ define([ } }, + hideRotationSettings: function(value) { + if (this._state.HideRotationSettings !== value) { + this._state.HideRotationSettings = value; + this.RotationSettings.toggleClass('hidden', value==true); + } + }, + onPositionChange: function(btn) { var pos = btn.getNumberValue(), minValue = (this.GradColor.currentIdx-1<0) ? 0 : this.GradColor.values[this.GradColor.currentIdx-1], diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js index 566045676..ddb8ffd01 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js @@ -629,6 +629,14 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp if (props && props.asc_getShapeProperties()){ var shapeprops = props.asc_getShapeProperties(); + if (shapeprops.asc_getFromSmartArt()) { + this.btnsCategory[1].setDisabled(true); + } + if (shapeprops.asc_getFromSmartArtInternal()) { + this.chAutofit.setDisabled(true); + this.chOverflow.setDisabled(true); + } + this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(props.asc_getWidth()).toFixed(2), true); this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.asc_getHeight()).toFixed(2), true); @@ -657,7 +665,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp this.chOverflow.setValue(shapeprops.asc_getVertOverflowType()==AscFormat.nOTOwerflow); var shapetype = shapeprops.asc_getType(); - this.btnsCategory[4].setDisabled(shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' + this.btnsCategory[4].setDisabled(shapeprops.asc_getFromSmartArtInternal() + || shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' || shapetype=='straightConnector1'); diff --git a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js index c91b60d53..87d413834 100644 --- a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js @@ -95,7 +95,9 @@ define([ GradFillType: Asc.c_oAscFillGradType.GRAD_LINEAR, FormId: null, DisabledControls: false, - applicationPixelRatio: Common.Utils.applicationPixelRatio() + applicationPixelRatio: Common.Utils.applicationPixelRatio(), + isFromSmartArtInternal: false, + HideTransformSettings: false }; this.lockedControls = []; this._locked = false; @@ -126,6 +128,8 @@ define([ this.FillGradientContainer = $('#textart-panel-gradient-fill'); this.TransparencyContainer = $('#textart-panel-transparent-fill'); + this.TransformSettings = $('.textart-transform'); + SSE.getCollection('Common.Collections.TextArt').bind({ reset: this.fillTextArt.bind(this) }); @@ -694,6 +698,9 @@ define([ if (this._initSettings) this.createDelayedElements(); + this._state.isFromSmartArtInternal = props.asc_getShapeProperties() && props.asc_getShapeProperties().asc_getFromSmartArtInternal(); + this.hideTransformSettings(this._state.isFromSmartArtInternal); + if (props && props.asc_getShapeProperties() && props.asc_getShapeProperties().get_TextArtProperties()) { var shapeprops = props.asc_getShapeProperties().get_TextArtProperties(); @@ -1791,6 +1798,13 @@ define([ this._state.applicationPixelRatio = Common.Utils.applicationPixelRatio(); }, + hideTransformSettings: function(value) { + if (this._state.HideTransformSettings !== value) { + this._state.HideTransformSettings = value; + this.TransformSettings.toggleClass('hidden', value === true); + } + }, + txtNoBorders : 'No Line', strStroke : 'Stroke', strColor : 'Color',