diff options
author | Armin Le Grand (Allotropia) <armin.le.grand@me.com> | 2021-06-09 20:55:52 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2021-06-10 11:11:12 +0200 |
commit | e11c3740845959ab25f9b644681c97a7ded24d1c (patch) | |
tree | 38892236761bde5f2d06b5e8ff607413a7cd8544 | |
parent | 105ad5dc174d9e894b0c4f9e24d068090ca8c3aa (diff) |
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@me.com>
-rw-r--r-- | svx/source/toolbars/extrusionbar.cxx | 106 |
1 files changed, 23 insertions, 83 deletions
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: */ |