summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-12-14 21:46:28 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-12-18 17:19:58 +0000
commit9a0b523e0a84d403b9092176ccec4b3e3efe42d0 (patch)
tree99cf8235ae4e71e4f143cb850b9451273901c4f1 /canvas
parent51be46640a4987d839aace354ee8b5e85bdce684 (diff)
loplugin:unocast (cairocanvas::CanvasBitmap)
(See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: I6044567e4027fe1fdc361917d5233157d4ce98d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144399 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/cairo/cairo_canvasbitmap.cxx8
-rw-r--r--canvas/source/cairo/cairo_canvasbitmap.hxx2
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx3
3 files changed, 10 insertions, 3 deletions
diff --git a/canvas/source/cairo/cairo_canvasbitmap.cxx b/canvas/source/cairo/cairo_canvasbitmap.cxx
index a4f172088a17..3e0bcae618f6 100644
--- a/canvas/source/cairo/cairo_canvasbitmap.cxx
+++ b/canvas/source/cairo/cairo_canvasbitmap.cxx
@@ -144,7 +144,13 @@ namespace cairocanvas
}
sal_Int64 CanvasBitmap::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) {
- return RepaintTarget::getSomething(aIdentifier);
+ return comphelper::getSomethingImpl(
+ aIdentifier, this, comphelper::FallbackToGetSomethingOf<RepaintTarget>{});
+ }
+
+ css::uno::Sequence<sal_Int8> const & CanvasBitmap::getUnoTunnelId() {
+ static comphelper::UnoIdInit const id;
+ return id.getSeq();
}
OUString SAL_CALL CanvasBitmap::getImplementationName( )
diff --git a/canvas/source/cairo/cairo_canvasbitmap.hxx b/canvas/source/cairo/cairo_canvasbitmap.hxx
index cc32408c26a1..21479b387069 100644
--- a/canvas/source/cairo/cairo_canvasbitmap.hxx
+++ b/canvas/source/cairo/cairo_canvasbitmap.hxx
@@ -115,8 +115,8 @@ namespace cairocanvas
virtual css::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) override;
virtual void SAL_CALL setFastPropertyValue(sal_Int32, const css::uno::Any&) override {}
- // XUnoTunnel
sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override;
+ static css::uno::Sequence<sal_Int8> const & getUnoTunnelId();
private:
SurfaceProviderRef mpSurfaceProvider;
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 14113e89361f..9279a4c0781b 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
#include <com/sun/star/util/Endianness.hpp>
#include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
#include <cppuhelper/implbase.hxx>
#include <rtl/math.hxx>
#include <comphelper/diagnose_ex.hxx>
@@ -294,7 +295,7 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas::
**/
static SurfaceSharedPtr surfaceFromXBitmap( const uno::Reference< rendering::XBitmap >& xBitmap )
{
- CanvasBitmap* pBitmapImpl = dynamic_cast< CanvasBitmap* >( xBitmap.get() );
+ CanvasBitmap* pBitmapImpl = comphelper::getFromUnoTunnel< CanvasBitmap >( xBitmap );
if( pBitmapImpl )
return pBitmapImpl->getSurface();