diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-31 12:40:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-10-31 13:17:54 +0000 |
commit | 06babf60ce9edd17e02930e60b9afdc12b40b553 (patch) | |
tree | bfb4b8c397d99b7aa6f1fb8670d3b48f4074d242 /svx/source/toolbars | |
parent | c8b09c0024cc8fb5444ca422d2ddf729a5117d1d (diff) |
loplugin:oncevar in svl..svx
Change-Id: I80b11a7b698de4b84d7a2f4c7dc62b2e4fd8bb01
Reviewed-on: https://gerrit.libreoffice.org/30438
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/toolbars')
-rw-r--r-- | svx/source/toolbars/extrusionbar.cxx | 90 | ||||
-rw-r--r-- | svx/source/toolbars/fontworkbar.cxx | 5 |
2 files changed, 30 insertions, 65 deletions
diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx index b956061ab902..4f25576861c4 100644 --- a/svx/source/toolbars/extrusionbar.cxx +++ b/svx/source/toolbars/extrusionbar.cxx @@ -114,12 +114,7 @@ void getLightingDirectionDefaults( const Direction3D **pLighting1Defaults, const static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem& rGeometryItem, SdrObject* pObj ) { static const char sExtrusion[] = "Extrusion"; - static const char sProjectionMode[] = "ProjectionMode"; static const char sRotateAngle[] = "RotateAngle"; - static const char sViewPoint[] = "ViewPoint"; - static const char sOrigin[] = "Origin"; - static const char sSkew[] = "Skew"; - static const char sDepth[] = "Depth"; sal_uInt16 nSID = rReq.GetSlot(); switch( nSID ) @@ -237,7 +232,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem css::beans::PropertyValue aPropValue; - aPropValue.Name = sViewPoint; + aPropValue.Name = "ViewPoint"; aPropValue.Value <<= aViewPoint; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); @@ -247,7 +242,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem aOriginPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL; aOriginPropPair.Second.Value <<= fOriginY; aOriginPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL; - aPropValue.Name = sOrigin; + aPropValue.Name = "Origin"; aPropValue.Value <<= aOriginPropPair; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); @@ -256,7 +251,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem aSkewPropPair.First.Type = EnhancedCustomShapeParameterType::NORMAL; aSkewPropPair.Second.Value <<= fSkewAngle; aSkewPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL; - aPropValue.Name = sSkew; + aPropValue.Name = "Skew"; aPropValue.Value <<= aSkewPropPair; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); } @@ -269,7 +264,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem sal_Int32 nProjection = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_PROJECTION))->GetValue(); ProjectionMode eProjectionMode = nProjection == 1 ? ProjectionMode_PARALLEL : ProjectionMode_PERSPECTIVE; css::beans::PropertyValue aPropValue; - aPropValue.Name = sProjectionMode; + aPropValue.Name = "ProjectionMode"; aPropValue.Value <<= eProjectionMode; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); } @@ -288,7 +283,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem aDepthPropPair.Second.Type = EnhancedCustomShapeParameterType::NORMAL; css::beans::PropertyValue aPropValue; - aPropValue.Name = sDepth; + aPropValue.Name = "Depth"; aPropValue.Value <<= aDepthPropPair; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); } @@ -296,8 +291,6 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem break; case SID_EXTRUSION_3D_COLOR: { - static const char sExtrusionColor[] = "Color"; - if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_3D_COLOR ) == SfxItemState::SET) { Color aColor( static_cast<const SvxColorItem&>(rReq.GetArgs()->Get(SID_EXTRUSION_3D_COLOR)).GetValue() ); @@ -305,7 +298,7 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem const bool bAuto = aColor == COL_AUTO; css::beans::PropertyValue aPropValue; - aPropValue.Name = sExtrusionColor; + aPropValue.Name = "Color"; aPropValue.Value <<= !bAuto; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); @@ -323,11 +316,6 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem break; case SID_EXTRUSION_SURFACE: { - static const char sShadeMode[] = "ShadeMode"; - static const char sSpecularity[] = "Specularity"; - static const char sDiffusion[] = "Diffusion"; - static const char sMetal[] = "Metal"; - if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_SURFACE ) == SfxItemState::SET) { sal_Int32 nSurface = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_SURFACE))->GetValue(); @@ -355,19 +343,19 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem } css::beans::PropertyValue aPropValue; - aPropValue.Name = sShadeMode; + aPropValue.Name = "ShadeMode"; aPropValue.Value <<= eShadeMode; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); - aPropValue.Name = sMetal; + aPropValue.Name = "Metal"; aPropValue.Value <<= bMetal; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); - aPropValue.Name = sSpecularity; + aPropValue.Name = "Specularity"; aPropValue.Value <<= fSpecularity; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); - aPropValue.Name = sDiffusion; + aPropValue.Name = "Diffusion"; aPropValue.Value <<= fDiffusion; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); } @@ -375,13 +363,6 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem break; case SID_EXTRUSION_LIGHTING_INTENSITY: { - static const char sBrightness[] = "Brightness"; - static const char sLightFace[] = "LightFace"; - static const char sFirstLightHarsh[] = "FirstLightHarsh"; - static const char sSecondLightHarsh[] = "SecondLightHarsh"; - static const char sFirstLightLevel[] = "FirstLightLevel"; - static const char sSecondLightLevel[] = "SecondLightLevel"; - if( rReq.GetArgs() && rReq.GetArgs()->GetItemState( SID_EXTRUSION_LIGHTING_INTENSITY ) == SfxItemState::SET) { sal_Int32 nLevel = static_cast<const SfxInt32Item*>(rReq.GetArgs()->GetItem(SID_EXTRUSION_LIGHTING_INTENSITY))->GetValue(); @@ -414,27 +395,27 @@ static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem } css::beans::PropertyValue aPropValue; - aPropValue.Name = sBrightness; + aPropValue.Name = "Brightness"; aPropValue.Value <<= fBrightness; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); - aPropValue.Name = sLightFace; + aPropValue.Name = "LightFace"; aPropValue.Value <<= true; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); - aPropValue.Name = sFirstLightHarsh; + aPropValue.Name = "FirstLightHarsh"; aPropValue.Value <<= true; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); - aPropValue.Name = sSecondLightHarsh; + aPropValue.Name = "SecondLightHarsh"; aPropValue.Value <<= bHarsh2; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); - aPropValue.Name = sFirstLightLevel; + aPropValue.Name = "FirstLightLevel"; aPropValue.Value <<= fLevel1; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); - aPropValue.Name = sSecondLightLevel; + aPropValue.Name = "SecondLightLevel"; aPropValue.Value <<= fLevel2; rGeometryItem.SetPropertyValue( sExtrusion, aPropValue ); } @@ -634,10 +615,6 @@ void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet ) const size_t nCount = rMarkList.GetMarkCount(); static const char sExtrusion[] = "Extrusion"; - static const char sViewPoint[] = "ViewPoint"; - static const char sOrigin[] = "Origin"; - static const char sSkew[] = "Skew"; - static const char sProjectionMode[] = "ProjectionMode"; const css::uno::Any* pAny; @@ -666,7 +643,7 @@ void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet ) Position3D aViewPoint( 3472, -3472, 25000 ); double fSkewAngle = -135; - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "ProjectionMode" ); sal_Int16 nProjectionMode = sal_Int16(); if( pAny && ( *pAny >>= nProjectionMode ) ) bParallel = nProjectionMode == ProjectionMode_PARALLEL; @@ -675,7 +652,7 @@ void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet ) { double fSkew = 50.0; EnhancedCustomShapeParameterPair aSkewPropPair; - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSkew ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Skew" ); if( pAny && ( *pAny >>= aSkewPropPair ) ) { aSkewPropPair.First.Value >>= fSkew; @@ -690,12 +667,12 @@ void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet ) { double fOriginX = 0.50; double fOriginY = -0.50; - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sViewPoint ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "ViewPoint" ); if( pAny ) *pAny >>= aViewPoint; EnhancedCustomShapeParameterPair aOriginPropPair; - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sOrigin ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Origin" ); if( pAny && ( *pAny >>= aOriginPropPair ) ) { aOriginPropPair.First.Value >>= fOriginX; @@ -785,7 +762,6 @@ void getExtrusionProjectionState( SdrView* pSdrView, SfxItemSet& rSet ) const size_t nCount = rMarkList.GetMarkCount(); static const char sExtrusion[] = "Extrusion"; - static const char sProjectionMode[] = "ProjectionMode"; const css::uno::Any* pAny; @@ -812,7 +788,7 @@ void getExtrusionProjectionState( SdrView* pSdrView, SfxItemSet& rSet ) const SdrCustomShapeGeometryItem aGeometryItem( static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )) ); bool bParallel = true; - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "ProjectionMode" ); ProjectionMode eProjectionMode; if( pAny && ( *pAny >>= eProjectionMode ) ) bParallel = eProjectionMode == ProjectionMode_PARALLEL; @@ -841,9 +817,6 @@ void getExtrusionSurfaceState( SdrView* pSdrView, SfxItemSet& rSet ) const size_t nCount = rMarkList.GetMarkCount(); static const char sExtrusion[] = "Extrusion"; - static const char sShadeMode[] = "ShadeMode"; - static const char sSpecularity[] = "Specularity"; - static const char sMetal[] = "Metal"; const css::uno::Any* pAny; @@ -871,14 +844,14 @@ void getExtrusionSurfaceState( SdrView* pSdrView, SfxItemSet& rSet ) sal_Int32 nSurface = 0; // wire frame ShadeMode eShadeMode( ShadeMode_FLAT ); - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sShadeMode ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "ShadeMode" ); if( pAny ) *pAny >>= eShadeMode; if( eShadeMode == ShadeMode_FLAT ) { bool bMetal = false; - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sMetal ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Metal" ); if( pAny ) *pAny >>= bMetal; @@ -889,7 +862,7 @@ void getExtrusionSurfaceState( SdrView* pSdrView, SfxItemSet& rSet ) else { double fSpecularity = 0; - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSpecularity ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Specularity" ); if( pAny ) *pAny >>= fSpecularity; @@ -929,7 +902,6 @@ void getExtrusionDepthState( SdrView* pSdrView, SfxItemSet& rSet ) const size_t nCount = rMarkList.GetMarkCount(); static const char sExtrusion[] = "Extrusion"; - static const char sDepth[] = "Depth"; const css::uno::Any* pAny; @@ -955,7 +927,7 @@ void getExtrusionDepthState( SdrView* pSdrView, SfxItemSet& rSet ) } double fDepth = 1270.0; - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sDepth ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Depth" ); if( pAny ) { EnhancedCustomShapeParameterPair aDepthPropPair; @@ -1009,8 +981,6 @@ void getExtrusionLightingDirectionState( SdrView* pSdrView, SfxItemSet& rSet ) const size_t nCount = rMarkList.GetMarkCount(); static const char sExtrusion[] = "Extrusion"; - static const char sFirstLightDirection[] = "FirstLightDirection"; - static const char sSecondLightDirection[] = "SecondLightDirection"; const Direction3D * pLighting1Defaults; const Direction3D * pLighting2Defaults; @@ -1043,11 +1013,11 @@ void getExtrusionLightingDirectionState( SdrView* pSdrView, SfxItemSet& rSet ) Direction3D aFirstLightDirection( 50000, 0, 10000 ); Direction3D aSecondLightDirection( -50000, 0, 10000 ); - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sFirstLightDirection ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "FirstLightDirection" ); if( pAny ) *pAny >>= aFirstLightDirection; - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sSecondLightDirection ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "SecondLightDirection" ); if( pAny ) *pAny >>= aSecondLightDirection; @@ -1090,7 +1060,6 @@ void getExtrusionLightingIntensityState( SdrView* pSdrView, SfxItemSet& rSet ) const size_t nCount = rMarkList.GetMarkCount(); static const char sExtrusion[] = "Extrusion"; - static const char sBrightness[] = "Brightness"; const css::uno::Any* pAny; @@ -1116,7 +1085,7 @@ void getExtrusionLightingIntensityState( SdrView* pSdrView, SfxItemSet& rSet ) } double fBrightness = 22178.0 / 655.36; - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sBrightness ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Brightness" ); if( pAny ) *pAny >>= fBrightness; @@ -1158,7 +1127,6 @@ void getExtrusionColorState( SdrView* pSdrView, SfxItemSet& rSet ) const size_t nCount = rMarkList.GetMarkCount(); static const char sExtrusion[] = "Extrusion"; - static const char sExtrusionColor[] = "Color"; const css::uno::Any* pAny; @@ -1188,7 +1156,7 @@ void getExtrusionColorState( SdrView* pSdrView, SfxItemSet& rSet ) Color aColor; bool bUseColor = false; - pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusionColor ); + pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Color" ); if( pAny ) *pAny >>= bUseColor; diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index 0dcad4f989a2..d075c31be641 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -245,15 +245,12 @@ bool checkForSelectedFontWork( SdrView* pSdrView, sal_uInt32& nCheckStatus ) static void impl_execute( SdrView*, SfxRequest& rReq, SdrCustomShapeGeometryItem& rGeometryItem, SdrObject* pObj ) { - static const char sTextPath[] = "TextPath"; - static const char sSameLetterHeights[] = "SameLetterHeights"; - sal_uInt16 nSID = rReq.GetSlot(); switch( nSID ) { case SID_FONTWORK_SAME_LETTER_HEIGHTS: { - css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sSameLetterHeights ); + css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "SameLetterHeights" ); if( pAny ) { bool bOn = false; |