ucb/source/ucp/ext/ucpext_content.cxx      |   11 +++++++++++
 ucb/source/ucp/ext/ucpext_content.hxx      |    8 +++++++-
 ucb/source/ucp/ext/ucpext_datasupplier.cxx |    3 ++-
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 8ee6cfc9655ce9de4617cea1a0d9cb9d7a4fbfac
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Dec 8 10:03:03 2022 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Dec 14 09:54:12 2022 +0000

    loplugin:unocast (ucb::ucp::ext::Content)
    
    (See the upcoming commit introducing that loplugin:unocast on why such
    dynamic_casts from UNO types are dangerous.)
    
    Change-Id: If35b179b83383d8252a356c5bf43ae6ebb1d63f8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144148
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/ucb/source/ucp/ext/ucpext_content.cxx 
b/ucb/source/ucp/ext/ucpext_content.cxx
index a1d2df55a092..6747c397f952 100644
--- a/ucb/source/ucp/ext/ucpext_content.cxx
+++ b/ucb/source/ucp/ext/ucpext_content.cxx
@@ -37,6 +37,7 @@
 #include <ucbhelper/cancelcommandexecution.hxx>
 #include <ucbhelper/content.hxx>
 #include <comphelper/diagnose_ex.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/uri.hxx>
 #include <sal/macros.h>
@@ -435,6 +436,16 @@ namespace ucb::ucp::ext
     }
 
 
+    sal_Int64 Content::getSomething(css::uno::Sequence<sal_Int8> const & 
aIdentifier) {
+        return comphelper::getSomethingImpl(aIdentifier, this);
+    }
+
+    css::uno::Sequence<sal_Int8> const & Content::getUnoTunnelId() {
+        static comphelper::UnoIdInit const id;
+        return id.getSeq();
+    }
+
+
     Reference< XRow > Content::getPropertyValues( const Sequence< Property >& 
i_rProperties, const Reference< XCommandEnvironment >& i_rEnv )
     {
         ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
diff --git a/ucb/source/ucp/ext/ucpext_content.hxx 
b/ucb/source/ucp/ext/ucpext_content.hxx
index 99df646f73c4..58157c37e769 100644
--- a/ucb/source/ucp/ext/ucpext_content.hxx
+++ b/ucb/source/ucp/ext/ucpext_content.hxx
@@ -21,7 +21,9 @@
 
 #include <com/sun/star/sdbc/XRow.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
 
+#include <cppuhelper/implbase.hxx>
 #include <ucbhelper/contenthelper.hxx>
 
 #include <optional>
@@ -45,7 +47,8 @@ namespace ucb::ucp::ext
 
     //= ContentProvider
 
-    typedef ::ucbhelper::ContentImplHelper  Content_Base;
+    typedef cppu::ImplInheritanceHelper<::ucbhelper::ContentImplHelper, 
css::lang::XUnoTunnel>
+        Content_Base;
     class Content : public Content_Base
     {
     public:
@@ -82,6 +85,9 @@ namespace ucb::ucp::ext
         */
         OUString getPhysicalURL() const;
 
+        sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & 
aIdentifier) override;
+        static css::uno::Sequence<sal_Int8> const & getUnoTunnelId();
+
     protected:
         virtual ~Content() override;
 
diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.cxx 
b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
index b718ef076c34..e0490075d7c9 100644
--- a/ucb/source/ucp/ext/ucpext_datasupplier.cxx
+++ b/ucb/source/ucp/ext/ucpext_datasupplier.cxx
@@ -30,6 +30,7 @@
 #include <ucbhelper/content.hxx>
 #include <ucbhelper/propertyvalueset.hxx>
 #include <comphelper/diagnose_ex.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <sal/log.hxx>
 
@@ -204,7 +205,7 @@ namespace ucb::ucp::ext
             try
             {
                 Reference< XContent > xContent( 
m_xContent->getProvider()->queryContent( xId ) );
-                pContent.set( dynamic_cast< Content* >( xContent.get() ) );
+                pContent.set( comphelper::getFromUnoTunnel< Content >( 
xContent ) );
                 OSL_ENSURE( pContent.is() || !xContent.is(), 
"DataSupplier::queryContent: invalid content implementation!" );
                 m_aResults[ i_nIndex ].pContent = pContent;
                 return pContent;

Reply via email to