diff options
-rw-r--r-- | basegfx/source/tools/canvastools.cxx | 3 | ||||
-rw-r--r-- | basegfx/source/tools/unopolypolygon.cxx | 12 | ||||
-rw-r--r-- | include/basegfx/utils/unopolypolygon.hxx | 8 |
3 files changed, 20 insertions, 3 deletions
diff --git a/basegfx/source/tools/canvastools.cxx b/basegfx/source/tools/canvastools.cxx index d388356199a2..1f65e89b182b 100644 --- a/basegfx/source/tools/canvastools.cxx +++ b/basegfx/source/tools/canvastools.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/rendering/XPolyPolygon2D.hpp> #include <com/sun/star/rendering/XGraphicDevice.hpp> #include <com/sun/star/awt/Rectangle.hpp> +#include <comphelper/servicehelper.hxx> #include <basegfx/utils/unopolypolygon.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b3dhommatrix.hxx> @@ -251,7 +252,7 @@ namespace basegfx::unotools ::basegfx::B2DPolyPolygon b2DPolyPolygonFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly ) { ::basegfx::unotools::UnoPolyPolygon* pPolyImpl = - dynamic_cast< ::basegfx::unotools::UnoPolyPolygon* >( xPoly.get() ); + comphelper::getFromUnoTunnel< ::basegfx::unotools::UnoPolyPolygon >( xPoly ); if( pPolyImpl ) { diff --git a/basegfx/source/tools/unopolypolygon.cxx b/basegfx/source/tools/unopolypolygon.cxx index 0c3b59abac9b..099cbee5eb75 100644 --- a/basegfx/source/tools/unopolypolygon.cxx +++ b/basegfx/source/tools/unopolypolygon.cxx @@ -27,6 +27,7 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/utils/unopolypolygon.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <utility> @@ -60,7 +61,7 @@ namespace basegfx::unotools } B2DPolyPolygon aSrcPoly; - const UnoPolyPolygon* pSrc( dynamic_cast< UnoPolyPolygon* >(polyPolygon.get()) ); + const UnoPolyPolygon* pSrc( comphelper::getFromUnoTunnel< UnoPolyPolygon >(polyPolygon) ); // try to extract polygon data from interface. First, // check whether it's the same implementation object, @@ -434,6 +435,15 @@ namespace basegfx::unotools return { "com.sun.star.rendering.PolyPolygon2D" }; } + sal_Int64 UnoPolyPolygon::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) { + return comphelper::getSomethingImpl(aIdentifier, this); + } + + css::uno::Sequence<sal_Int8> const & UnoPolyPolygon::getUnoTunnelId() { + static comphelper::UnoIdInit const id; + return id.getSeq(); + } + B2DPolyPolygon UnoPolyPolygon::getPolyPolygon() const { std::unique_lock const guard( m_aMutex ); diff --git a/include/basegfx/utils/unopolypolygon.hxx b/include/basegfx/utils/unopolypolygon.hxx index 48788b074ede..4392f798c6ce 100644 --- a/include/basegfx/utils/unopolypolygon.hxx +++ b/include/basegfx/utils/unopolypolygon.hxx @@ -22,6 +22,7 @@ #include <comphelper/compbase.hxx> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/rendering/FillRule.hpp> #include <com/sun/star/rendering/XLinePolyPolygon2D.hpp> #include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp> @@ -34,7 +35,8 @@ namespace basegfx::unotools typedef comphelper::WeakComponentImplHelper< css::rendering::XLinePolyPolygon2D, css::rendering::XBezierPolyPolygon2D, - css::lang::XServiceInfo > UnoPolyPolygonBase; + css::lang::XServiceInfo, + css::lang::XUnoTunnel > UnoPolyPolygonBase; class BASEGFX_DLLPUBLIC UnoPolyPolygon : public UnoPolyPolygonBase @@ -68,6 +70,10 @@ namespace basegfx::unotools SAL_DLLPRIVATE virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; SAL_DLLPRIVATE virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + SAL_DLLPRIVATE sal_Int64 SAL_CALL getSomething( + css::uno::Sequence<sal_Int8> const & aIdentifier) override; + static SAL_DLLPRIVATE css::uno::Sequence<sal_Int8> const & getUnoTunnelId(); + SAL_DLLPRIVATE B2DPolyPolygon getPolyPolygon() const; protected: |