From 89803666621c07d1b1ac9d3bd883f0ca192a91a0 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 14 Dec 2022 20:45:25 +0100 Subject: loplugin:unocast (vclcanas::CanvasBitmap) (See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: If79f69507e939a25a5bbf82f818c44f26077dfce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144767 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- canvas/source/vcl/canvas.cxx | 3 +-- canvas/source/vcl/canvasbitmap.cxx | 3 ++- canvas/source/vcl/canvascustomsprite.cxx | 3 +-- canvas/source/vcl/impltools.cxx | 3 ++- canvas/source/vcl/repainttarget.hxx | 4 ++++ canvas/source/vcl/spritecanvas.cxx | 3 +-- 6 files changed, 11 insertions(+), 8 deletions(-) (limited to 'canvas') diff --git a/canvas/source/vcl/canvas.cxx b/canvas/source/vcl/canvas.cxx index 48527380f38b..2f6b513f35a0 100644 --- a/canvas/source/vcl/canvas.cxx +++ b/canvas/source/vcl/canvas.cxx @@ -24,7 +24,6 @@ #include #include #include -#include #include #include "outdevholder.hxx" @@ -98,7 +97,7 @@ namespace vclcanvas } sal_Int64 Canvas::getSomething(css::uno::Sequence const & aIdentifier) { - return comphelper::getSomethingImpl(aIdentifier, this); + return RepaintTarget::getSomething(aIdentifier); } bool Canvas::repaint( const GraphicObjectSharedPtr& rGrf, diff --git a/canvas/source/vcl/canvasbitmap.cxx b/canvas/source/vcl/canvasbitmap.cxx index 70ad59f24afa..5a913836ebe7 100644 --- a/canvas/source/vcl/canvasbitmap.cxx +++ b/canvas/source/vcl/canvasbitmap.cxx @@ -86,7 +86,8 @@ namespace vclcanvas } sal_Int64 CanvasBitmap::getSomething(css::uno::Sequence const & aIdentifier) { - return comphelper::getSomethingImpl(aIdentifier, this); + return comphelper::getSomethingImpl( + aIdentifier, this, comphelper::FallbackToGetSomethingOf{}); } BitmapEx CanvasBitmap::getBitmap() const diff --git a/canvas/source/vcl/canvascustomsprite.cxx b/canvas/source/vcl/canvascustomsprite.cxx index 1cd22bd3559b..58112d1955a3 100644 --- a/canvas/source/vcl/canvascustomsprite.cxx +++ b/canvas/source/vcl/canvascustomsprite.cxx @@ -23,7 +23,6 @@ #include #include #include -#include #include #include "canvascustomsprite.hxx" @@ -118,7 +117,7 @@ namespace vclcanvas } sal_Int64 CanvasCustomSprite::getSomething(css::uno::Sequence const & aIdentifier) { - return comphelper::getSomethingImpl(aIdentifier, this); + return RepaintTarget::getSomething(aIdentifier); } // Sprite diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index 5539a92d1734..04209f94ac47 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -50,7 +51,7 @@ namespace vclcanvas::tools { // TODO(F3): CanvasCustomSprite should also be tunnelled // through (also implements XIntegerBitmap interface) - CanvasBitmap* pBitmapImpl = dynamic_cast< CanvasBitmap* >( xBitmap.get() ); + CanvasBitmap* pBitmapImpl = comphelper::getFromUnoTunnel< CanvasBitmap >( xBitmap ); if( pBitmapImpl ) { diff --git a/canvas/source/vcl/repainttarget.hxx b/canvas/source/vcl/repainttarget.hxx index 57c45882a3cd..3ef832fb3426 100644 --- a/canvas/source/vcl/repainttarget.hxx +++ b/canvas/source/vcl/repainttarget.hxx @@ -51,6 +51,10 @@ namespace vclcanvas const ::Size& rSz, const GraphicAttr& rAttr ) const = 0; + sal_Int64 getSomething(css::uno::Sequence const & id) { + return comphelper::getSomethingImpl(id, this); + } + static css::uno::Sequence const & getUnoTunnelId() { static comphelper::UnoIdInit const id; return id.getSeq(); diff --git a/canvas/source/vcl/spritecanvas.cxx b/canvas/source/vcl/spritecanvas.cxx index 04780d8f0375..b7984e70ddce 100644 --- a/canvas/source/vcl/spritecanvas.cxx +++ b/canvas/source/vcl/spritecanvas.cxx @@ -24,7 +24,6 @@ #include #include #include -#include #include "spritecanvas.hxx" #include "outdevholder.hxx" @@ -163,7 +162,7 @@ namespace vclcanvas } sal_Int64 SpriteCanvas::getSomething(css::uno::Sequence const & aIdentifier) { - return comphelper::getSomethingImpl(aIdentifier, this); + return RepaintTarget::getSomething(aIdentifier); } bool SpriteCanvas::repaint( const GraphicObjectSharedPtr& rGrf, -- cgit