[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 <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2025-09-28 12:40:16 +02:00
parent dc5fb0217f
commit 8c43187c2b
4 changed files with 13 additions and 62 deletions
@@ -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();
};
};
}; }; }; };
+3 -5
View File
@@ -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;
};
@@ -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 *
+3 -3
View File
@@ -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 ];