summaryrefslogtreecommitdiff
path: root/svx/source
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
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')
-rw-r--r--svx/source/svdraw/svdoashp.cxx28
-rw-r--r--svx/source/toolbars/extrusionbar.cxx60
-rw-r--r--svx/source/toolbars/fontworkbar.cxx8
3 files changed, 48 insertions, 48 deletions
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 88058049cf4e..855d6e0e12ec 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -468,8 +468,8 @@ bool SdrObjCustomShape::UseNoFillStyle() const
bool SdrObjCustomShape::IsMirroredX() const
{
bool bMirroredX = false;
- SdrCustomShapeGeometryItem aGeometryItem( GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
- css::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( "MirroredX" );
+ const SdrCustomShapeGeometryItem & rGeometryItem( GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "MirroredX" );
if ( pAny )
*pAny >>= bMirroredX;
return bMirroredX;
@@ -477,8 +477,8 @@ bool SdrObjCustomShape::IsMirroredX() const
bool SdrObjCustomShape::IsMirroredY() const
{
bool bMirroredY = false;
- SdrCustomShapeGeometryItem aGeometryItem( GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
- css::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( "MirroredY" );
+ const SdrCustomShapeGeometryItem & rGeometryItem( GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "MirroredY" );
if ( pAny )
*pAny >>= bMirroredY;
return bMirroredY;
@@ -1101,9 +1101,9 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
bool bIsDefaultGeometry = false;
OUString sShapeType;
- const SdrCustomShapeGeometryItem aGeometryItem( GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+ const SdrCustomShapeGeometryItem & rGeometryItem( GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
- const Any *pAny = aGeometryItem.GetPropertyValueByName( "Type" );
+ const Any *pAny = rGeometryItem.GetPropertyValueByName( "Type" );
if ( pAny )
*pAny >>= sShapeType;
@@ -1115,7 +1115,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
{
case DefaultType::Viewbox :
{
- const Any* pViewBox = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( "ViewBox" );
+ const Any* pViewBox = rGeometryItem.GetPropertyValueByName( "ViewBox" );
css::awt::Rectangle aViewBox;
if (pViewBox && (*pViewBox >>= aViewBox) && pDefCustomShape)
{
@@ -1128,7 +1128,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
case DefaultType::Path :
{
- pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, "Coordinates" );
+ pAny = rGeometryItem.GetPropertyValueByName( sPath, "Coordinates" );
if ( pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices )
{
css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqCoordinates1, seqCoordinates2;
@@ -1152,7 +1152,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
case DefaultType::Gluepoints :
{
- pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, "GluePoints" );
+ pAny = rGeometryItem.GetPropertyValueByName( sPath, "GluePoints" );
if ( pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints )
{
css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqGluePoints1, seqGluePoints2;
@@ -1177,7 +1177,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
case DefaultType::Segments :
{
// Path/Segments
- pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, "Segments" );
+ pAny = rGeometryItem.GetPropertyValueByName( sPath, "Segments" );
if ( pAny )
{
css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments1, seqSegments2;
@@ -1220,7 +1220,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
case DefaultType::StretchX :
{
- pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, "StretchX" );
+ pAny = rGeometryItem.GetPropertyValueByName( sPath, "StretchX" );
if ( pAny && pDefCustomShape )
{
sal_Int32 nStretchX = 0;
@@ -1237,7 +1237,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
case DefaultType::StretchY :
{
- pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, "StretchY" );
+ pAny = rGeometryItem.GetPropertyValueByName( sPath, "StretchY" );
if ( pAny && pDefCustomShape )
{
sal_Int32 nStretchY = 0;
@@ -1254,7 +1254,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
case DefaultType::Equations :
{
- pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( "Equations" );
+ pAny = rGeometryItem.GetPropertyValueByName( "Equations" );
if ( pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation )
{
css::uno::Sequence< OUString > seqEquations1, seqEquations2;
@@ -1278,7 +1278,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
case DefaultType::TextFrames :
{
- pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, "TextFrames" );
+ pAny = rGeometryItem.GetPropertyValueByName( sPath, "TextFrames" );
if ( pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect )
{
css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames1, seqTextFrames2;
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;
}