diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-15 21:22:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-17 08:09:14 +0200 |
commit | edb1070f1bb13082f44444bf37821da1ee4503b5 (patch) | |
tree | 5ef72ee7a3eb2c51550f372fde0fb45a4f74af66 | |
parent | ea980b36a7b48a3c9c17cf08d15c5f4f27f79942 (diff) |
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.grandin@collabora.co.uk>
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 16 |
1 files changed, 10 insertions, 6 deletions
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 |