[Libreoffice-commits] core.git: svx/source

Armin Le Grand (Allotropia) (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 10 09:11:53 UTC 2021


 svx/source/toolbars/extrusionbar.cxx |  106 +++++++----------------------------
 1 file changed, 23 insertions(+), 83 deletions(-)

New commits:
commit e11c3740845959ab25f9b644681c97a7ded24d1c
Author:     Armin Le Grand (Allotropia) <armin.le.grand at me.com>
AuthorDate: Wed Jun 9 20:55:52 2021 +0200
Commit:     Armin Le Grand <Armin.Le.Grand at me.com>
CommitDate: Thu Jun 10 11:11:12 2021 +0200

    tdf#130428 remove unnecessary usage of SfxItemState::UNKNOWN
    
    No need to check for SfxItemState::UNKNOWN, all states depend on
    selected SdrObejcts/E3DObjects anyways
    
    Change-Id: I13be6494229c18f514da3e0229d0896b237508c6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116939
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <Armin.Le.Grand at me.com>

diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx
index 6fe0da43449d..51fecface297 100644
--- a/svx/source/toolbars/extrusionbar.cxx
+++ b/svx/source/toolbars/extrusionbar.cxx
@@ -1227,93 +1227,33 @@ bool checkForSelectedCustomShapes( SdrView const * pSdrView, bool bOnlyExtruded
 
 void ExtrusionBar::getState( SdrView const * pSdrView, SfxItemSet& rSet )
 {
-    if (rSet.GetItemState(SID_EXTRUSION_DIRECTION) != SfxItemState::UNKNOWN)
-    {
-        getExtrusionDirectionState( pSdrView, rSet );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_PROJECTION) != SfxItemState::UNKNOWN)
-    {
-        getExtrusionProjectionState( pSdrView, rSet );
-    }
-    const bool bOnlyExtrudedCustomShapes =
-        checkForSelectedCustomShapes( pSdrView, true );
-    if (rSet.GetItemState(SID_EXTRUSION_TILT_DOWN) != SfxItemState::UNKNOWN)
-    {
-        if (! bOnlyExtrudedCustomShapes)
-            rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_TILT_DOWN) != SfxItemState::UNKNOWN)
-    {
-        if (! bOnlyExtrudedCustomShapes)
-            rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_TILT_UP) != SfxItemState::UNKNOWN)
-    {
-        if (! bOnlyExtrudedCustomShapes)
-            rSet.DisableItem( SID_EXTRUSION_TILT_UP );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_TILT_LEFT) != SfxItemState::UNKNOWN)
-    {
-        if (! bOnlyExtrudedCustomShapes)
-            rSet.DisableItem( SID_EXTRUSION_TILT_LEFT );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_TILT_RIGHT) != SfxItemState::UNKNOWN)
-    {
-        if (! bOnlyExtrudedCustomShapes)
-            rSet.DisableItem( SID_EXTRUSION_TILT_RIGHT );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_3D_COLOR) != SfxItemState::UNKNOWN)
-    {
-        if (! bOnlyExtrudedCustomShapes)
-            rSet.DisableItem( SID_EXTRUSION_3D_COLOR );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_DEPTH_FLOATER) != SfxItemState::UNKNOWN)
-    {
-        if (! bOnlyExtrudedCustomShapes)
-            rSet.DisableItem( SID_EXTRUSION_DEPTH_FLOATER );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_DIRECTION_FLOATER) != SfxItemState::UNKNOWN)
-    {
-        if (! bOnlyExtrudedCustomShapes)
-            rSet.DisableItem( SID_EXTRUSION_DIRECTION_FLOATER );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_FLOATER) != SfxItemState::UNKNOWN)
-    {
-        if (! bOnlyExtrudedCustomShapes)
-            rSet.DisableItem( SID_EXTRUSION_LIGHTING_FLOATER );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_SURFACE_FLOATER) != SfxItemState::UNKNOWN)
-    {
-        if(! bOnlyExtrudedCustomShapes)
-            rSet.DisableItem( SID_EXTRUSION_SURFACE_FLOATER );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_TOGGLE) != SfxItemState::UNKNOWN)
-    {
-        if( !checkForSelectedCustomShapes( pSdrView, false ) )
-            rSet.DisableItem( SID_EXTRUSION_TOGGLE );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_DEPTH) != SfxItemState::UNKNOWN)
-    {
-        getExtrusionDepthState( pSdrView, rSet );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_SURFACE) != SfxItemState::UNKNOWN)
-    {
-        getExtrusionSurfaceState( pSdrView, rSet );
-    }
-    if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_INTENSITY) != SfxItemState::UNKNOWN)
-    {
-        getExtrusionLightingIntensityState( pSdrView, rSet );
-    }
+    getExtrusionDirectionState( pSdrView, rSet );
+    getExtrusionProjectionState( pSdrView, rSet );
 
-    if (rSet.GetItemState(SID_EXTRUSION_LIGHTING_DIRECTION) != SfxItemState::UNKNOWN)
-    {
-        getExtrusionLightingDirectionState( pSdrView, rSet );
-    }
+    const bool bOnlyExtrudedCustomShapes(checkForSelectedCustomShapes( pSdrView, true ));
 
-    if (rSet.GetItemState(SID_EXTRUSION_3D_COLOR) != SfxItemState::UNKNOWN)
+    if (! bOnlyExtrudedCustomShapes)
     {
-        getExtrusionColorState( pSdrView, rSet );
+        rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
+        rSet.DisableItem( SID_EXTRUSION_TILT_DOWN );
+        rSet.DisableItem( SID_EXTRUSION_TILT_UP );
+        rSet.DisableItem( SID_EXTRUSION_TILT_LEFT );
+        rSet.DisableItem( SID_EXTRUSION_TILT_RIGHT );
+        rSet.DisableItem( SID_EXTRUSION_3D_COLOR );
+        rSet.DisableItem( SID_EXTRUSION_DEPTH_FLOATER );
+        rSet.DisableItem( SID_EXTRUSION_DIRECTION_FLOATER );
+        rSet.DisableItem( SID_EXTRUSION_LIGHTING_FLOATER );
+        rSet.DisableItem( SID_EXTRUSION_SURFACE_FLOATER );
     }
+
+    if( !checkForSelectedCustomShapes( pSdrView, false ) )
+        rSet.DisableItem( SID_EXTRUSION_TOGGLE );
+
+    getExtrusionDepthState( pSdrView, rSet );
+    getExtrusionSurfaceState( pSdrView, rSet );
+    getExtrusionLightingIntensityState( pSdrView, rSet );
+    getExtrusionLightingDirectionState( pSdrView, rSet );
+    getExtrusionColorState( pSdrView, rSet );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list