include/vcl/graph.hxx                     |    2 --
 vcl/inc/graphic/UnoGraphic.hxx            |    7 ++-----
 vcl/source/gdi/graph.cxx                  |    8 ++------
 vcl/source/graphic/UnoGraphic.cxx         |    8 --------
 vcl/source/graphic/UnoGraphicProvider.cxx |    3 ++-
 5 files changed, 6 insertions(+), 22 deletions(-)

New commits:
commit 0da2d347a8de0e7480aba900961a1464c753c087
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Jan 23 09:51:14 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jan 23 11:46:09 2023 +0000

    XUnoTunnel->dynamic_cast in vcl::Graphic
    
    Change-Id: Iecbae3570851784f0da75fd2899daf620c8e4c06
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145994
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index c97ee23d41c1..e662987b67e3 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -188,8 +188,6 @@ public:
 
     /// Get the page number of the multi-page source this Graphic is rendered 
from.
     sal_Int32 getPageNumber() const;
-
-    static const css::uno::Sequence<sal_Int8> & getUnoTunnelId();
 };
 
 namespace std {
diff --git a/vcl/inc/graphic/UnoGraphic.hxx b/vcl/inc/graphic/UnoGraphic.hxx
index 0e2f2af7b1b0..ce060c98f40c 100644
--- a/vcl/inc/graphic/UnoGraphic.hxx
+++ b/vcl/inc/graphic/UnoGraphic.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_VCL_SOURCE_GRAPHIC_GRAPHIC_HXX
 
 #include <com/sun/star/graphic/XGraphic.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/awt/XBitmap.hpp>
 #include <com/sun/star/graphic/XGraphicTransformer.hpp>
 
@@ -33,7 +32,6 @@ namespace unographic {
 
 class Graphic final : public css::graphic::XGraphic,
                 public css::awt::XBitmap,
-                public css::lang::XUnoTunnel,
                 public css::graphic::XGraphicTransformer,
                 public ::unographic::GraphicDescriptor
 {
@@ -44,6 +42,8 @@ public:
     using ::unographic::GraphicDescriptor::init;
     void init(const ::Graphic& rGraphic);
 
+    const ::Graphic& GetGraphic() const { return maGraphic; }
+
     // XInterface
     virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & 
rType ) override;
     virtual void SAL_CALL acquire() noexcept override;
@@ -66,9 +66,6 @@ private:
     virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getDIB(  ) override;
     virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getMaskDIB(  ) override;
 
-    // XUnoTunnel
-    virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& rId ) override;
-
     // XGraphicTransformer
     virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL colorChange(
         const css::uno::Reference< css::graphic::XGraphic >& rGraphic,
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 2407744820f8..4c0efa56beba 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -219,7 +219,8 @@ Graphic::Graphic(const GDIMetaFile& rMtf)
 
 Graphic::Graphic( const css::uno::Reference< css::graphic::XGraphic >& 
rxGraphic )
 {
-    const ::Graphic* pGraphic = 
comphelper::getFromUnoTunnel<::Graphic>(rxGraphic);
+    const ::unographic::Graphic* pUnoGraphic = 
dynamic_cast<::unographic::Graphic*>(rxGraphic.get());
+    const ::Graphic* pGraphic = pUnoGraphic ? &pUnoGraphic->GetGraphic() : 
nullptr;
 
     if( pGraphic )
     {
@@ -556,9 +557,4 @@ OString Graphic::getUniqueID() const
     return aUniqueString;
 }
 
-const css::uno::Sequence<sal_Int8> & Graphic::getUnoTunnelId() {
-    static const comphelper::UnoIdInit gId;
-    return gId.getSeq();
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/graphic/UnoGraphic.cxx 
b/vcl/source/graphic/UnoGraphic.cxx
index f26640563862..d1b7fd0238df 100644
--- a/vcl/source/graphic/UnoGraphic.cxx
+++ b/vcl/source/graphic/UnoGraphic.cxx
@@ -57,8 +57,6 @@ uno::Any SAL_CALL Graphic::queryInterface( const uno::Type & 
rType )
         aAny <<= uno::Reference< graphic::XGraphic >( this );
     else if( rType == cppu::UnoType<awt::XBitmap>::get())
         aAny <<= uno::Reference< awt::XBitmap >( this );
-    else if( rType == cppu::UnoType<lang::XUnoTunnel>::get())
-        aAny <<= uno::Reference< lang::XUnoTunnel >(this);
     else if( rType == cppu::UnoType<graphic::XGraphicTransformer>::get())
         aAny <<= uno::Reference< graphic::XGraphicTransformer >(this);
     else
@@ -176,12 +174,6 @@ uno::Sequence<sal_Int8> SAL_CALL Graphic::getMaskDIB()
     }
 }
 
-sal_Int64 SAL_CALL Graphic::getSomething( const uno::Sequence< sal_Int8 >& rId 
)
-{
-    return comphelper::getSomethingImpl(rId, &maGraphic);
-}
-
-
 // XGraphicTransformer
 uno::Reference< graphic::XGraphic > SAL_CALL Graphic::colorChange(
     const uno::Reference< graphic::XGraphic >& rxGraphic, sal_Int32 
nColorFrom, sal_Int8 nTolerance, sal_Int32 nColorTo, sal_Int8 nAlphaTo )
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx 
b/vcl/source/graphic/UnoGraphicProvider.cxx
index f0e0d12e7895..bceb9fbabed1 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -796,7 +796,8 @@ void SAL_CALL GraphicProvider::storeGraphic( const 
uno::Reference< ::graphic::XG
 
     {
         const uno::Reference< XInterface >  xIFace( rxGraphic, uno::UNO_QUERY 
);
-        const ::Graphic*                    pGraphic = 
comphelper::getFromUnoTunnel<::Graphic>( xIFace );
+        const ::unographic::Graphic* pUnoGraphic = 
dynamic_cast<::unographic::Graphic*>(xIFace.get());
+        const ::Graphic* pGraphic = pUnoGraphic ? &pUnoGraphic->GetGraphic() : 
nullptr;
 
         if( pGraphic && ( pGraphic->GetType() != GraphicType::NONE ) )
         {

Reply via email to