offapi/com/sun/star/drawing/XCustomShapeEngine.idl    |   20 --------
 svx/inc/EnhancedCustomShapeEngine.hxx                 |    8 +--
 svx/source/customshapes/EnhancedCustomShapeEngine.cxx |   41 ++----------------
 svx/source/svdraw/svdoashp.cxx                        |    6 +-
 4 files changed, 13 insertions(+), 62 deletions(-)

New commits:
commit 8c43187c2b9b517e9f1d638321b9b54c699a3251
Author:     Noel Grandin <[email protected]>
AuthorDate: Sat Sep 27 19:27:15 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sun Sep 28 12:40:16 2025 +0200

    [API CHANGE] simplify XCustomShapeEngine
    
    this is an internal-only interface which we only need for
    shape export, and we only need one of the existing methods for that.
    
    Change-Id: I89adb32ba6bda43d72731465eb5d62f5d6ddc16b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191571
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/offapi/com/sun/star/drawing/XCustomShapeEngine.idl 
b/offapi/com/sun/star/drawing/XCustomShapeEngine.idl
index e3eb7b00efbf..2788e8c6a9e8 100644
--- a/offapi/com/sun/star/drawing/XCustomShapeEngine.idl
+++ b/offapi/com/sun/star/drawing/XCustomShapeEngine.idl
@@ -25,30 +25,12 @@
  */
 interface XCustomShapeEngine: com::sun::star::uno::XInterface
 {
-
     /**
         @returns
             the shape that is representing the CustomShape
      */
     com::sun::star::drawing::XShape render();
-
-    /**
-        @returns the text bound of the shape
-    */
-    com::sun::star::awt::Rectangle getTextBounds();
-
-    /**
-        @returns the line geometry of the object
-    */
-    com::sun::star::drawing::PolyPolygonBezierCoords getLineGeometry();
-
-    /**
-        @returns
-            a collection of interaction handles
-     */
-    sequence<com::sun::star::drawing::XCustomShapeHandle> getInteraction();
-
- };
+};
 
 
 }; }; }; };
diff --git a/svx/inc/EnhancedCustomShapeEngine.hxx 
b/svx/inc/EnhancedCustomShapeEngine.hxx
index 6fa7cb690946..ef3bc6770742 100644
--- a/svx/inc/EnhancedCustomShapeEngine.hxx
+++ b/svx/inc/EnhancedCustomShapeEngine.hxx
@@ -20,6 +20,7 @@
 
 #include <cppuhelper/implbase.hxx>
 #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
+#include <com/sun/star/drawing/XCustomShapeHandle.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <svx/svxdllapi.h>
 
@@ -49,12 +50,9 @@ public:
 
     // XCustomShapeEngine
     virtual css::uno::Reference<css::drawing::XShape> SAL_CALL render() 
override;
-    virtual css::awt::Rectangle SAL_CALL getTextBounds() override;
-    virtual css::drawing::PolyPolygonBezierCoords SAL_CALL getLineGeometry() 
override;
-    virtual 
css::uno::Sequence<css::uno::Reference<css::drawing::XCustomShapeHandle>>
-        SAL_CALL getInteraction() override;
 
-    tools::Rectangle getTextBounds2() const;
+    std::vector<css::uno::Reference<css::drawing::XCustomShapeHandle>> 
getInteraction();
+    tools::Rectangle getTextBounds() const;
     basegfx::B2DPolyPolygon getB2DLineGeometry() const;
     rtl::Reference<SdrObject> render2() const;
 };
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx 
b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 9b201537eb9c..f0f5d560391e 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -314,27 +314,7 @@ rtl::Reference<SdrObject> 
EnhancedCustomShapeEngine::render2() const
     return xRenderedShape;
 }
 
-awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
-{
-    if (!mpCustomShape)
-        return awt::Rectangle();
-
-    awt::Rectangle aTextRect;
-    uno::Reference< document::XActionLockable > xLockable( 
mpCustomShape->getUnoShape(), uno::UNO_QUERY );
-    if(xLockable.is() && !xLockable->isActionLocked())
-    {
-        EnhancedCustomShape2d aCustomShape2d(*mpCustomShape);
-        tools::Rectangle aRect( aCustomShape2d.GetTextRect() );
-        aTextRect.X = aRect.Left();
-        aTextRect.Y = aRect.Top();
-        aTextRect.Width = aRect.GetWidth();
-        aTextRect.Height = aRect.GetHeight();
-    }
-
-    return aTextRect;
-}
-
-tools::Rectangle EnhancedCustomShapeEngine::getTextBounds2() const
+tools::Rectangle EnhancedCustomShapeEngine::getTextBounds() const
 {
     if (!mpCustomShape)
         return tools::Rectangle();
@@ -347,15 +327,6 @@ tools::Rectangle 
EnhancedCustomShapeEngine::getTextBounds2() const
     return aCustomShape2d.GetTextRect();
 }
 
-drawing::PolyPolygonBezierCoords SAL_CALL 
EnhancedCustomShapeEngine::getLineGeometry()
-{
-    basegfx::B2DPolyPolygon aPolyPolygon = getB2DLineGeometry();
-    drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords;
-    basegfx::utils::B2DPolyPolygonToUnoPolyPolygonBezierCoords( aPolyPolygon,
-                                                          
aPolyPolygonBezierCoords );
-    return aPolyPolygonBezierCoords;
-}
-
 basegfx::B2DPolyPolygon EnhancedCustomShapeEngine::getB2DLineGeometry() const
 {
     if (!mpCustomShape)
@@ -427,7 +398,7 @@ basegfx::B2DPolyPolygon 
EnhancedCustomShapeEngine::getB2DLineGeometry() const
     return aPolyPolygon;
 }
 
-Sequence< Reference< drawing::XCustomShapeHandle > > SAL_CALL 
EnhancedCustomShapeEngine::getInteraction()
+std::vector< Reference< drawing::XCustomShapeHandle > > 
EnhancedCustomShapeEngine::getInteraction()
 {
     if (!mpCustomShape)
         return {};
@@ -435,12 +406,12 @@ Sequence< Reference< drawing::XCustomShapeHandle > > 
SAL_CALL EnhancedCustomShap
     EnhancedCustomShape2d aCustomShape2d(*mpCustomShape);
     sal_uInt32 nHdlCount = aCustomShape2d.GetHdlCount();
 
-    Sequence< Reference< drawing::XCustomShapeHandle > > aSeq( nHdlCount );
-    auto aSeqRange = asNonConstRange(aSeq);
+    std::vector< Reference< drawing::XCustomShapeHandle > > aVec;
+    aVec.reserve( nHdlCount );
 
     for ( sal_uInt32 i = 0; i < nHdlCount; i++ )
-        aSeqRange[ i ] = new EnhancedCustomShapeHandle( mpCustomShape, i );
-    return aSeq;
+        aVec.push_back(new EnhancedCustomShapeHandle( mpCustomShape, i ));
+    return aVec;
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 751b99196bfd..8944177543a1 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -519,7 +519,7 @@ bool SdrObjCustomShape::GetTextBounds( tools::Rectangle& 
rTextBound ) const
     rtl::Reference<EnhancedCustomShapeEngine> xCustomShapeEngine( 
GetCustomShapeEngine() );
     if ( xCustomShapeEngine.is() )
     {
-        tools::Rectangle aR( xCustomShapeEngine->getTextBounds2() );
+        tools::Rectangle aR( xCustomShapeEngine->getTextBounds() );
         if ( aR.GetWidth() > 1 && aR.GetHeight() > 1 )
         {
             rTextBound = aR;
@@ -558,8 +558,8 @@ std::vector< SdrCustomShapeInteraction > 
SdrObjCustomShape::GetInteractionHandle
         if ( !xCustomShapeEngine.is() )
             return aRet;
 
-        uno::Sequence<uno::Reference<drawing::XCustomShapeHandle>> 
xInteractionHandles( xCustomShapeEngine->getInteraction() );
-        for ( int i = 0; i < xInteractionHandles.getLength(); i++ )
+        std::vector<uno::Reference<drawing::XCustomShapeHandle>> 
xInteractionHandles( xCustomShapeEngine->getInteraction() );
+        for ( size_t i = 0; i < xInteractionHandles.size(); i++ )
         {
             SdrCustomShapeInteraction aSdrCustomShapeInteraction;
             aSdrCustomShapeInteraction.xInteraction = xInteractionHandles[ i ];

Reply via email to