summaryrefslogtreecommitdiff
path: root/svx/source/toolbars
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-04-13 16:10:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-04-13 18:42:00 +0200
commit851505db4f0514c2651d9fee6d5de9f63dd73217 (patch)
treed5c9bb7325ad729ab0a13de1eecff01d7dc44e74 /svx/source/toolbars
parent19fb87c8a1aab9b172f07a1a1526854cfddd8dc5 (diff)
no need to make copies of these objects
when querying their values. The copy triggers heap allocation, which shows up when loading lots of shapes. Change-Id: I4b70e0c64b2397a97216065bd6da61daaac7f3ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114054 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/toolbars')
-rw-r--r--svx/source/toolbars/extrusionbar.cxx60
-rw-r--r--svx/source/toolbars/fontworkbar.cxx8
2 files changed, 34 insertions, 34 deletions
diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx
index 82d42ddb81ef..6fe0da43449d 100644
--- a/svx/source/toolbars/extrusionbar.cxx
+++ b/svx/source/toolbars/extrusionbar.cxx
@@ -627,12 +627,12 @@ static void getExtrusionDirectionState( SdrView const * pSdrView, SfxItemSet& rS
SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
{
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const SdrCustomShapeGeometryItem & rGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
// see if this is an extruded customshape
if( !bHasCustomShape )
{
- const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
if( pAny_ )
*pAny_ >>= bHasCustomShape;
@@ -644,7 +644,7 @@ static void getExtrusionDirectionState( SdrView const * pSdrView, SfxItemSet& rS
Position3D aViewPoint( 3472, -3472, 25000 );
double fSkewAngle = -135;
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "ProjectionMode" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "ProjectionMode" );
sal_Int16 nProjectionMode = sal_Int16();
if( pAny && ( *pAny >>= nProjectionMode ) )
bParallel = static_cast<ProjectionMode>(nProjectionMode) == ProjectionMode_PARALLEL;
@@ -653,7 +653,7 @@ static void getExtrusionDirectionState( SdrView const * pSdrView, SfxItemSet& rS
{
double fSkew = 50.0;
EnhancedCustomShapeParameterPair aSkewPropPair;
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Skew" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "Skew" );
if( pAny && ( *pAny >>= aSkewPropPair ) )
{
aSkewPropPair.First.Value >>= fSkew;
@@ -668,12 +668,12 @@ static void getExtrusionDirectionState( SdrView const * pSdrView, SfxItemSet& rS
{
double fOriginX = 0.50;
double fOriginY = -0.50;
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "ViewPoint" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "ViewPoint" );
if( pAny )
*pAny >>= aViewPoint;
EnhancedCustomShapeParameterPair aOriginPropPair;
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Origin" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "Origin" );
if( pAny && ( *pAny >>= aOriginPropPair ) )
{
aOriginPropPair.First.Value >>= fOriginX;
@@ -777,8 +777,8 @@ static void getExtrusionProjectionState( SdrView const * pSdrView, SfxItemSet& r
// see if this is an extruded customshape
if( !bHasCustomShape )
{
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
- const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ const SdrCustomShapeGeometryItem & rGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
if( pAny_ )
*pAny_ >>= bHasCustomShape;
@@ -786,10 +786,10 @@ static void getExtrusionProjectionState( SdrView const * pSdrView, SfxItemSet& r
continue;
}
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const SdrCustomShapeGeometryItem & rGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
bool bParallel = true;
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "ProjectionMode" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "ProjectionMode" );
ProjectionMode eProjectionMode;
if( pAny && ( *pAny >>= eProjectionMode ) )
bParallel = eProjectionMode == ProjectionMode_PARALLEL;
@@ -829,12 +829,12 @@ static void getExtrusionSurfaceState( SdrView const * pSdrView, SfxItemSet& rSet
SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
{
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const SdrCustomShapeGeometryItem & rGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
// see if this is an extruded customshape
if( !bHasCustomShape )
{
- const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
if( pAny_ )
*pAny_ >>= bHasCustomShape;
@@ -845,14 +845,14 @@ static void getExtrusionSurfaceState( SdrView const * pSdrView, SfxItemSet& rSet
sal_Int32 nSurface = 0; // wire frame
ShadeMode eShadeMode( ShadeMode_FLAT );
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "ShadeMode" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "ShadeMode" );
if( pAny )
*pAny >>= eShadeMode;
if( eShadeMode == ShadeMode_FLAT )
{
bool bMetal = false;
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Metal" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "Metal" );
if( pAny )
*pAny >>= bMetal;
@@ -863,7 +863,7 @@ static void getExtrusionSurfaceState( SdrView const * pSdrView, SfxItemSet& rSet
else
{
double fSpecularity = 0;
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Specularity" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "Specularity" );
if( pAny )
*pAny >>= fSpecularity;
@@ -914,12 +914,12 @@ static void getExtrusionDepthState( SdrView const * pSdrView, SfxItemSet& rSet )
SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
{
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const SdrCustomShapeGeometryItem & rGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
// see if this is an extruded customshape
if( !bHasCustomShape )
{
- const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
if( pAny_ )
*pAny_ >>= bHasCustomShape;
@@ -928,7 +928,7 @@ static void getExtrusionDepthState( SdrView const * pSdrView, SfxItemSet& rSet )
}
double fDepth = 1270.0;
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Depth" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "Depth" );
if( pAny )
{
EnhancedCustomShapeParameterPair aDepthPropPair;
@@ -998,12 +998,12 @@ static void getExtrusionLightingDirectionState( SdrView const * pSdrView, SfxIte
SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
{
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const SdrCustomShapeGeometryItem & rGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
// see if this is an extruded customshape
if( !bHasCustomShape )
{
- const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
if( pAny_ )
*pAny_ >>= bHasCustomShape;
@@ -1014,11 +1014,11 @@ static void getExtrusionLightingDirectionState( SdrView const * pSdrView, SfxIte
Direction3D aFirstLightDirection( 50000, 0, 10000 );
Direction3D aSecondLightDirection( -50000, 0, 10000 );
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "FirstLightDirection" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "FirstLightDirection" );
if( pAny )
*pAny >>= aFirstLightDirection;
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "SecondLightDirection" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "SecondLightDirection" );
if( pAny )
*pAny >>= aSecondLightDirection;
@@ -1072,12 +1072,12 @@ static void getExtrusionLightingIntensityState( SdrView const * pSdrView, SfxIte
SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
{
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const SdrCustomShapeGeometryItem & rGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
// see if this is an extruded customshape
if( !bHasCustomShape )
{
- const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
if( pAny_ )
*pAny_ >>= bHasCustomShape;
@@ -1086,7 +1086,7 @@ static void getExtrusionLightingIntensityState( SdrView const * pSdrView, SfxIte
}
double fBrightness = 22178.0 / 655.36;
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Brightness" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "Brightness" );
if( pAny )
*pAny >>= fBrightness;
@@ -1141,12 +1141,12 @@ static void getExtrusionColorState( SdrView const * pSdrView, SfxItemSet& rSet )
SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
{
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const SdrCustomShapeGeometryItem & rGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
// see if this is an extruded customshape
if( !bHasCustomShape )
{
- const Any* pAny_ = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ const Any* pAny_ = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
if( pAny_ )
*pAny_ >>= bHasCustomShape;
@@ -1157,7 +1157,7 @@ static void getExtrusionColorState( SdrView const * pSdrView, SfxItemSet& rSet )
Color aColor;
bool bUseColor = false;
- pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, "Color" );
+ pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, "Color" );
if( pAny )
*pAny >>= bUseColor;
@@ -1209,8 +1209,8 @@ bool checkForSelectedCustomShapes( SdrView const * pSdrView, bool bOnlyExtruded
{
if( bOnlyExtruded )
{
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
- const Any* pAny = aGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
+ const SdrCustomShapeGeometryItem & rGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sExtrusion );
if( pAny )
*pAny >>= bFound;
}
diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx
index 0fc4da30e1bf..4bb7a769ec05 100644
--- a/svx/source/toolbars/fontworkbar.cxx
+++ b/svx/source/toolbars/fontworkbar.cxx
@@ -151,8 +151,8 @@ static void SetFontWorkShapeTypeState( SdrView const * pSdrView, SfxItemSet& rSe
SdrObject* pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
{
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
- const Any* pAny = aGeometryItem.GetPropertyValueByName( "Type" );
+ const SdrCustomShapeGeometryItem & rGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const Any* pAny = rGeometryItem.GetPropertyValueByName( "Type" );
if( pAny )
{
OUString aType;
@@ -212,8 +212,8 @@ bool checkForFontWork( SdrObject* pObj )
if( dynamic_cast<const SdrObjCustomShape*>( pObj) != nullptr )
{
- const SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
- const Any* pAny = aGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
+ const SdrCustomShapeGeometryItem & rGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
if( pAny )
*pAny >>= bFound;
}