diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-08 10:03:03 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-14 09:54:12 +0000 |
commit | 8ee6cfc9655ce9de4617cea1a0d9cb9d7a4fbfac (patch) | |
tree | bf8c40235b0b603728d52cccd317829f8ad6e88c /ucb | |
parent | 269e1588ced9de990aeb50ed8aedf9117699a99b (diff) |
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 <sbergman@redhat.com>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/ext/ucpext_content.cxx | 11 | ||||
-rw-r--r-- | ucb/source/ucp/ext/ucpext_content.hxx | 8 | ||||
-rw-r--r-- | ucb/source/ucp/ext/ucpext_datasupplier.cxx | 3 |
3 files changed, 20 insertions, 2 deletions
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; |