User: kz Date: 05/01/21 08:38:19 Modified: /dba/connectivity/source/commontools/ ConnectionWrapper.cxx
Log: INTEGRATION: CWS dba22 (1.9.44); FILE MERGED 2004/12/16 08:24:10 oj 1.9.44.1: #i39123# new setDelegation method File Changes: Directory: /dba/connectivity/source/commontools/ ================================================ File [changed]: ConnectionWrapper.cxx Url: http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/ConnectionWrapper.cxx?r1=1.9&r2=1.10 Delta lines: +31 -0 -------------------- --- ConnectionWrapper.cxx 2 Aug 2004 16:51:13 -0000 1.9 +++ ConnectionWrapper.cxx 21 Jan 2005 16:38:16 -0000 1.10 @@ -79,6 +79,9 @@ #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ #include <cppuhelper/typeprovider.hxx> #endif +#ifndef _COM_SUN_STAR_REFLECTION_XPROXYFACTORY_HPP_ +#include <com/sun/star/reflection/XProxyFactory.hpp> +#endif #ifndef _RTL_DIGEST_H_ #include <rtl/digest.h> #endif @@ -92,6 +95,7 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::sdbc; +using namespace ::com::sun::star::reflection; // -------------------------------------------------------------------------------- OConnectionWrapper::OConnectionWrapper() { @@ -112,6 +116,33 @@ m_xUnoTunnel.set(m_xConnection,UNO_QUERY); m_xServiceInfo.set(m_xConnection,UNO_QUERY); + // set ourself as delegator + Reference<XInterface> xIf = static_cast< XUnoTunnel* >( this ); + m_xProxyConnection->setDelegator( xIf ); + + } + osl_decrementInterlockedCount( &_rRefCount ); +} +// ----------------------------------------------------------------------------- +void OConnectionWrapper::setDelegation(const Reference< XConnection >& _xConnection + ,const Reference< XMultiServiceFactory>& _xORB + ,oslInterlockedCount& _rRefCount) +{ + OSL_ENSURE(_xConnection.is(),"OConnectionWrapper: Connection must be valid!"); + osl_incrementInterlockedCount( &_rRefCount ); + + m_xConnection = _xConnection; + m_xTypeProvider.set(m_xConnection,UNO_QUERY); + m_xUnoTunnel.set(m_xConnection,UNO_QUERY); + m_xServiceInfo.set(m_xConnection,UNO_QUERY); + + Reference< XProxyFactory > xProxyFactory(_xORB->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.ProxyFactory"))),UNO_QUERY); + Reference< XAggregation > xConProxy = xProxyFactory->createProxy(_xConnection); + if (xConProxy.is()) + { + // transfer the (one and only) real ref to the aggregate to our member + m_xProxyConnection = xConProxy; + // set ourself as delegator Reference<XInterface> xIf = static_cast< XUnoTunnel* >( this ); m_xProxyConnection->setDelegator( xIf ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
