tdf#39593 use getUnoTunnelImplementation in pyuno
Change-Id: I2cbbaad921b0a3d2ea6def4da2a2527dc4d94549
Reviewed-on: https://gerrit.libreoffice.org/79075
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index a4d0ddc..d9c9dac 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 @@
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 1c39298..a8efd41 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -68,7 +68,7 @@
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 000f266..91c24b4 100644
--- a/pyuno/source/module/pyuno_impl.hxx
+++ b/pyuno/source/module/pyuno_impl.hxx
@@ -347,7 +347,7 @@
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 d307f9a..62b3861 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 @@
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() );