diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-01 08:48:48 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-22 12:21:37 +0000 |
commit | d6a70bb641b96e8e5616448c2378131ed62658b4 (patch) | |
tree | 866e377261fd732ca60c8c145426c9aa66457d22 /basegfx | |
parent | 1c17356958b07aa7e202d3f9242c807c5dc447ac (diff) |
loplugin:unocast (basegfx::unotools::UnoPolyPolygon)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)
Change-Id: I166d8f31a13a98caf0bb7a3b5025a9d942808096
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144746
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/tools/canvastools.cxx | 3 | ||||
-rw-r--r-- | basegfx/source/tools/unopolypolygon.cxx | 12 |
2 files changed, 13 insertions, 2 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 ); |