diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-14 21:02:27 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-23 14:20:19 +0000 |
commit | 4c0bbe4bd97636207cf71a6aa120c67698891da9 (patch) | |
tree | 163d36a469bf075d0710e09894a29f9726259c53 /canvas | |
parent | 89803666621c07d1b1ac9d3bd883f0ca192a91a0 (diff) |
loplugin:unocast (canvas::ParametricPolyPolygon)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)
Change-Id: I965d6ba17decda1fa055fb548aa9085d2e786bc0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144768
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/inc/parametricpolypolygon.hxx | 7 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_canvashelper.cxx | 3 | ||||
-rw-r--r-- | canvas/source/tools/parametricpolypolygon.cxx | 11 | ||||
-rw-r--r-- | canvas/source/vcl/canvashelper_texturefill.cxx | 3 |
4 files changed, 21 insertions, 3 deletions
diff --git a/canvas/inc/parametricpolypolygon.hxx b/canvas/inc/parametricpolypolygon.hxx index 474bd5da247a..ca2e1cda348e 100644 --- a/canvas/inc/parametricpolypolygon.hxx +++ b/canvas/inc/parametricpolypolygon.hxx @@ -20,6 +20,7 @@ #pragma once #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/rendering/XParametricPolyPolygon2D.hpp> #include <comphelper/compbase.hxx> #include <basegfx/polygon/b2dpolygon.hxx> @@ -36,7 +37,8 @@ namespace com::sun::star::rendering { class XGraphicDevice; } namespace canvas { typedef comphelper::WeakComponentImplHelper< css::rendering::XParametricPolyPolygon2D, - css::lang::XServiceInfo > ParametricPolyPolygon_Base; + css::lang::XServiceInfo, + css::lang::XUnoTunnel > ParametricPolyPolygon_Base; class CANVASTOOLS_DLLPUBLIC ParametricPolyPolygon final : public ParametricPolyPolygon_Base { @@ -104,6 +106,9 @@ namespace canvas virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override; + static css::uno::Sequence<sal_Int8> const & getUnoTunnelId(); + /// Query all defining values of this object atomically Values getValues() const; diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx index 1b84879b005c..28337013e965 100644 --- a/canvas/source/opengl/ogl_canvashelper.cxx +++ b/canvas/source/opengl/ogl_canvashelper.cxx @@ -21,6 +21,7 @@ #include <rtl/crc.h> #include <rtl/math.hxx> #include <comphelper/diagnose_ex.hxx> +#include <comphelper/servicehelper.hxx> #include <vcl/font.hxx> #include <vcl/kernarray.hxx> #include <vcl/metric.hxx> @@ -553,7 +554,7 @@ namespace oglcanvas // try to cast XParametricPolyPolygon2D reference to // our implementation class. ::canvas::ParametricPolyPolygon* pGradient = - dynamic_cast< ::canvas::ParametricPolyPolygon* >( textures[0].Gradient.get() ); + comphelper::getFromUnoTunnel< ::canvas::ParametricPolyPolygon >( textures[0].Gradient ); if( pGradient ) { diff --git a/canvas/source/tools/parametricpolypolygon.cxx b/canvas/source/tools/parametricpolypolygon.cxx index acad3b58b7d6..00b6c4da2850 100644 --- a/canvas/source/tools/parametricpolypolygon.cxx +++ b/canvas/source/tools/parametricpolypolygon.cxx @@ -22,6 +22,7 @@ #include <basegfx/point/b2dpoint.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/range/b2drectangle.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/rendering/XGraphicDevice.hpp> @@ -194,6 +195,16 @@ namespace canvas return { "com.sun.star.rendering.ParametricPolyPolygon" }; } + sal_Int64 ParametricPolyPolygon::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) + { + return comphelper::getSomethingImpl(aIdentifier, this); + } + + css::uno::Sequence<sal_Int8> const & ParametricPolyPolygon::getUnoTunnelId() { + static comphelper::UnoIdInit const id; + return id.getSeq(); + } + ParametricPolyPolygon::~ParametricPolyPolygon() { } diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index 211592685204..02f9f733bdd3 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/rendering/TexturingMode.hpp> #include <rtl/math.hxx> #include <comphelper/diagnose_ex.hxx> +#include <comphelper/servicehelper.hxx> #include <tools/poly.hxx> #include <vcl/bitmapex.hxx> #include <vcl/canvastools.hxx> @@ -637,7 +638,7 @@ namespace vclcanvas // try to cast XParametricPolyPolygon2D reference to // our implementation class. ::canvas::ParametricPolyPolygon* pGradient = - dynamic_cast< ::canvas::ParametricPolyPolygon* >( textures[0].Gradient.get() ); + comphelper::getFromUnoTunnel< ::canvas::ParametricPolyPolygon >( textures[0].Gradient ); if( pGradient && pGradient->getValues().maColors.hasElements() ) { |