svx/source/svdraw/svdoashp.cxx | 146 +++++++++++++++++++---------------------- 1 file changed, 71 insertions(+), 75 deletions(-)
New commits: commit 031ffe9a3963f16cfd0ce32fffdc2b0b2e071d26 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Sep 26 10:55:47 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Sep 26 13:09:59 2025 +0200 simplify callsites of GetCustomShapeEngine Change-Id: I7465d22365167277ceef0ed134692b064d0f7fd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191530 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index d327e1536473..e66fc228dc46 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -392,7 +392,7 @@ const SdrObject* SdrObjCustomShape::GetSdrObjectFromCustomShape() const { if ( !mXRenderedCustomShape.is() ) { - uno::Reference<drawing::XCustomShapeEngine> xCustomShapeEngine( GetCustomShapeEngine() ); + rtl::Reference<EnhancedCustomShapeEngine> xCustomShapeEngine( GetCustomShapeEngine() ); if ( xCustomShapeEngine.is() ) const_cast<SdrObjCustomShape*>(this)->mXRenderedCustomShape = xCustomShapeEngine->render(); } @@ -523,7 +523,7 @@ bool SdrObjCustomShape::GetTextBounds( tools::Rectangle& rTextBound ) const { bool bRet = false; - uno::Reference<drawing::XCustomShapeEngine> xCustomShapeEngine( GetCustomShapeEngine() ); + rtl::Reference<EnhancedCustomShapeEngine> xCustomShapeEngine( GetCustomShapeEngine() ); if ( xCustomShapeEngine.is() ) { awt::Rectangle aR( xCustomShapeEngine->getTextBounds() ); @@ -538,7 +538,7 @@ bool SdrObjCustomShape::GetTextBounds( tools::Rectangle& rTextBound ) const basegfx::B2DPolyPolygon SdrObjCustomShape::GetLineGeometry( const bool bBezierAllowed ) const { basegfx::B2DPolyPolygon aRetval; - uno::Reference<drawing::XCustomShapeEngine> xCustomShapeEngine( GetCustomShapeEngine() ); + rtl::Reference<EnhancedCustomShapeEngine> xCustomShapeEngine( GetCustomShapeEngine() ); if ( xCustomShapeEngine.is() ) { drawing::PolyPolygonBezierCoords aBezierCoords = xCustomShapeEngine->getLineGeometry(); @@ -562,86 +562,82 @@ std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandle std::vector< SdrCustomShapeInteraction > aRet; try { - uno::Reference<drawing::XCustomShapeEngine> xCustomShapeEngine( GetCustomShapeEngine() ); - if ( xCustomShapeEngine.is() ) + rtl::Reference<EnhancedCustomShapeEngine> xCustomShapeEngine( GetCustomShapeEngine() ); + if ( !xCustomShapeEngine.is() ) + return aRet; + + uno::Sequence<uno::Reference<drawing::XCustomShapeHandle>> xInteractionHandles( xCustomShapeEngine->getInteraction() ); + for ( int i = 0; i < xInteractionHandles.getLength(); i++ ) { - int i; - uno::Sequence<uno::Reference<drawing::XCustomShapeHandle>> xInteractionHandles( xCustomShapeEngine->getInteraction() ); - for ( i = 0; i < xInteractionHandles.getLength(); i++ ) + SdrCustomShapeInteraction aSdrCustomShapeInteraction; + aSdrCustomShapeInteraction.xInteraction = xInteractionHandles[ i ]; + aSdrCustomShapeInteraction.aPosition = xInteractionHandles[ i ]->getPosition(); + + CustomShapeHandleModes nMode = CustomShapeHandleModes::NONE; + switch( ImpGetCustomShapeType( *this ) ) { - if ( xInteractionHandles[ i ].is() ) + case mso_sptAccentBorderCallout90 : // 2 ortho { - SdrCustomShapeInteraction aSdrCustomShapeInteraction; - aSdrCustomShapeInteraction.xInteraction = xInteractionHandles[ i ]; - aSdrCustomShapeInteraction.aPosition = xInteractionHandles[ i ]->getPosition(); - - CustomShapeHandleModes nMode = CustomShapeHandleModes::NONE; - switch( ImpGetCustomShapeType( *this ) ) - { - case mso_sptAccentBorderCallout90 : // 2 ortho - { - if (i == 0) - nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED; - else if (i == 1) - nMode |= CustomShapeHandleModes::RESIZE_ABSOLUTE_X | CustomShapeHandleModes::RESIZE_ABSOLUTE_Y | CustomShapeHandleModes::MOVE_SHAPE | CustomShapeHandleModes::ORTHO4; - } - break; + if (i == 0) + nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED; + else if (i == 1) + nMode |= CustomShapeHandleModes::RESIZE_ABSOLUTE_X | CustomShapeHandleModes::RESIZE_ABSOLUTE_Y | CustomShapeHandleModes::MOVE_SHAPE | CustomShapeHandleModes::ORTHO4; + } + break; - case mso_sptChevron : - case mso_sptHomePlate : - nMode |= CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX; - break; + case mso_sptChevron : + case mso_sptHomePlate : + nMode |= CustomShapeHandleModes::RESIZE_ABSOLUTE_NEGX; + break; - case mso_sptWedgeRectCallout : - case mso_sptWedgeRRectCallout : - case mso_sptCloudCallout : - case mso_sptWedgeEllipseCallout : - { - if (i == 0) - nMode |= CustomShapeHandleModes::RESIZE_FIXED; - } - break; + case mso_sptWedgeRectCallout : + case mso_sptWedgeRRectCallout : + case mso_sptCloudCallout : + case mso_sptWedgeEllipseCallout : + { + if (i == 0) + nMode |= CustomShapeHandleModes::RESIZE_FIXED; + } + break; - case mso_sptBorderCallout1 : // 2 diag - { - if (i == 0) - nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED; - else if (i == 1) - nMode |= CustomShapeHandleModes::RESIZE_ABSOLUTE_X | CustomShapeHandleModes::RESIZE_ABSOLUTE_Y | CustomShapeHandleModes::MOVE_SHAPE; - } - break; - case mso_sptBorderCallout2 : // 3 - { - if (i == 0) - nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED; - else if (i == 2) - nMode |= CustomShapeHandleModes::RESIZE_ABSOLUTE_X | CustomShapeHandleModes::RESIZE_ABSOLUTE_Y | CustomShapeHandleModes::MOVE_SHAPE; - } - break; - case mso_sptCallout90 : - case mso_sptAccentCallout90 : - case mso_sptBorderCallout90 : - case mso_sptCallout1 : - case mso_sptCallout2 : - case mso_sptCallout3 : - case mso_sptAccentCallout1 : - case mso_sptAccentCallout2 : - case mso_sptAccentCallout3 : - case mso_sptBorderCallout3 : - case mso_sptAccentBorderCallout1 : - case mso_sptAccentBorderCallout2 : - case mso_sptAccentBorderCallout3 : - { - if (i == 0) - nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED; - } - break; - default: break; - } - aSdrCustomShapeInteraction.nMode = nMode; - aRet.push_back( aSdrCustomShapeInteraction ); + case mso_sptBorderCallout1 : // 2 diag + { + if (i == 0) + nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED; + else if (i == 1) + nMode |= CustomShapeHandleModes::RESIZE_ABSOLUTE_X | CustomShapeHandleModes::RESIZE_ABSOLUTE_Y | CustomShapeHandleModes::MOVE_SHAPE; } + break; + case mso_sptBorderCallout2 : // 3 + { + if (i == 0) + nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED; + else if (i == 2) + nMode |= CustomShapeHandleModes::RESIZE_ABSOLUTE_X | CustomShapeHandleModes::RESIZE_ABSOLUTE_Y | CustomShapeHandleModes::MOVE_SHAPE; + } + break; + case mso_sptCallout90 : + case mso_sptAccentCallout90 : + case mso_sptBorderCallout90 : + case mso_sptCallout1 : + case mso_sptCallout2 : + case mso_sptCallout3 : + case mso_sptAccentCallout1 : + case mso_sptAccentCallout2 : + case mso_sptAccentCallout3 : + case mso_sptBorderCallout3 : + case mso_sptAccentBorderCallout1 : + case mso_sptAccentBorderCallout2 : + case mso_sptAccentBorderCallout3 : + { + if (i == 0) + nMode |= CustomShapeHandleModes::RESIZE_FIXED | CustomShapeHandleModes::CREATE_FIXED; + } + break; + default: break; } + aSdrCustomShapeInteraction.nMode = nMode; + aRet.push_back( aSdrCustomShapeInteraction ); } } catch( const uno::RuntimeException& )