svx/source/svdraw/svdoashp.cxx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
New commits: commit edb1070f1bb13082f44444bf37821da1ee4503b5 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Sun May 15 21:22:13 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue May 17 08:09:14 2022 +0200 elide some OUString allocation and re-arrange GetCustomShapeEngine so we check if we have a shape before we try to do any work Change-Id: I9496e6fd38d7d7f312226791b942190c56e9d34e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134398 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index edb1dff58010..a21c594157a6 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -375,16 +375,20 @@ Reference< XCustomShapeEngine > const & SdrObjCustomShape::GetCustomShapeEngine( if (mxCustomShapeEngine.is()) return mxCustomShapeEngine; - OUString aEngine(GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE ).GetValue()); - if ( aEngine.isEmpty() ) - aEngine = "com.sun.star.drawing.EnhancedCustomShapeEngine"; + Reference< XShape > aXShape = GetXShapeForSdrObject(const_cast<SdrObjCustomShape*>(this)); + if ( !aXShape ) + return mxCustomShapeEngine; Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - Reference< XShape > aXShape = GetXShapeForSdrObject(const_cast<SdrObjCustomShape*>(this)); - if ( aXShape.is() ) + OUString aEngine(GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE ).GetValue()); + static constexpr OUStringLiteral sEnhancedCustomShapeEngine = u"com.sun.star.drawing.EnhancedCustomShapeEngine"; + if ( aEngine.isEmpty() ) + aEngine = sEnhancedCustomShapeEngine; + { - Sequence< PropertyValue > aPropValues{ comphelper::makePropertyValue("CustomShape", + static constexpr OUStringLiteral sCustomShape = u"CustomShape"; + Sequence< PropertyValue > aPropValues{ comphelper::makePropertyValue(sCustomShape, aXShape) }; Sequence< Any > aArgument{ Any(aPropValues) }; try