diff options
-rw-r--r-- | pyuno/source/module/pyuno.cxx | 13 | ||||
-rw-r--r-- | pyuno/source/module/pyuno_adapter.cxx | 2 | ||||
-rw-r--r-- | pyuno/source/module/pyuno_impl.hxx | 2 | ||||
-rw-r--r-- | pyuno/source/module/pyuno_runtime.cxx | 7 |
4 files changed, 9 insertions, 15 deletions
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index a4d0ddc4e314..d9c9dacbb3fd 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/script/XInvocation2.hpp> #include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <comphelper/servicehelper.hxx> #include "pyuno_impl.hxx" @@ -1711,14 +1712,10 @@ PyRef PyUNO_new ( xInvocation.set( ssf->createInstanceWithArguments( Sequence<Any>( &targetInterface, 1 ) ), css::uno::UNO_QUERY_THROW ); - Reference<XUnoTunnel> xUnoTunnel ( - xInvocation->getIntrospection()->queryAdapter(cppu::UnoType<XUnoTunnel>::get()), UNO_QUERY ); - if( xUnoTunnel.is() ) - { - sal_Int64 that = xUnoTunnel->getSomething( ::pyuno::Adapter::getUnoTunnelImplementationId() ); - if( that ) - return reinterpret_cast<Adapter*>(that)->getWrappedObject(); - } + auto that = comphelper::getUnoTunnelImplementation<Adapter>( + xInvocation->getIntrospection()->queryAdapter(cppu::UnoType<XUnoTunnel>::get())); + if( that ) + return that->getWrappedObject(); } if( !Py_IsInitialized() ) throw RuntimeException(); diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx index 1c392989d744..a8efd4153831 100644 --- a/pyuno/source/module/pyuno_adapter.cxx +++ b/pyuno/source/module/pyuno_adapter.cxx @@ -68,7 +68,7 @@ Adapter::~Adapter() static cppu::OImplementationId g_id( false ); -Sequence<sal_Int8> Adapter::getUnoTunnelImplementationId() +Sequence<sal_Int8> Adapter::getUnoTunnelId() { return g_id.getImplementationId(); } diff --git a/pyuno/source/module/pyuno_impl.hxx b/pyuno/source/module/pyuno_impl.hxx index 000f2660469d..91c24b4e7a88 100644 --- a/pyuno/source/module/pyuno_impl.hxx +++ b/pyuno/source/module/pyuno_impl.hxx @@ -347,7 +347,7 @@ public: Adapter( const PyRef &obj, const css::uno::Sequence< css::uno::Type > & types ); - static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId(); + static css::uno::Sequence< sal_Int8 > getUnoTunnelId(); const PyRef& getWrappedObject() const { return mWrappedObject; } const css::uno::Sequence< css::uno::Type >& getWrappedTypes() const { return mTypes; } virtual ~Adapter() override; diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index d307f9af363c..62b3861288c3 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/reflection/theCoreReflection.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> #include <cppuhelper/exc_hlp.hxx> #include <vector> @@ -832,11 +833,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con if( adapterObject.is() ) { // object got already bridged ! - Reference< css::lang::XUnoTunnel > tunnel( adapterObject, UNO_QUERY ); - - Adapter *pAdapter = reinterpret_cast<Adapter*>( - tunnel->getSomething( - ::pyuno::Adapter::getUnoTunnelImplementationId() ) ); + auto pAdapter = comphelper::getUnoTunnelImplementation<Adapter>(adapterObject); mappedObject = impl->cargo->xAdapterFactory->createAdapter( adapterObject, pAdapter->getWrappedTypes() ); |