diff options
author | Noel Grandin <noel@peralex.com> | 2012-11-27 11:00:51 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-28 13:06:18 +0100 |
commit | 7470cc532fe408dc9d8735cde0e2eb5bb62fd69c (patch) | |
tree | 3815c10cbd2473a19915d8057ca1eb19046592bc /comphelper | |
parent | 56ea15091c69d280310aa8b28bb1e9488eaad756 (diff) |
fdo#46808, Adapt reflection::ProxyFactory UNO service to new style
The service is deprecated, but we still have a handful of in-tree
users, and converting it lets me thread XComponentContext through
a bunch of classes.
Change-Id: Iffdfe537ada6b9e4a89f9b3c8dd82ca85f4bfaba
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/inc/comphelper/accessiblewrapper.hxx | 18 | ||||
-rw-r--r-- | comphelper/inc/comphelper/proxyaggregation.hxx | 14 | ||||
-rw-r--r-- | comphelper/source/misc/accessiblewrapper.cxx | 22 | ||||
-rw-r--r-- | comphelper/source/misc/proxyaggregation.cxx | 53 |
4 files changed, 50 insertions, 57 deletions
diff --git a/comphelper/inc/comphelper/accessiblewrapper.hxx b/comphelper/inc/comphelper/accessiblewrapper.hxx index dfd144becd1b..1b4ab52cf69b 100644 --- a/comphelper/inc/comphelper/accessiblewrapper.hxx +++ b/comphelper/inc/comphelper/accessiblewrapper.hxx @@ -76,7 +76,7 @@ namespace comphelper public: /** ctor - @param _rxORB + @param _rxContext a service factory @param _rxInnerAccessible @@ -86,7 +86,7 @@ namespace comphelper The XAccessible which is our parent */ OAccessibleWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxInnerAccessible, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible ); @@ -160,7 +160,7 @@ namespace comphelper protected: /** ctor - @param _rxORB + @param _rxContext a service factory @param _rxInnerAccessibleContext @@ -176,7 +176,7 @@ namespace comphelper The XAccessible to return in the getAccessibleParent call */ OAccessibleContextWrapperHelper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, ::cppu::OBroadcastHelper& _rBHelper, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerAccessibleContext, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxOwningAccessible, @@ -247,7 +247,7 @@ namespace comphelper public: /** ctor - @param _rxORB + @param _rxContext a service factory @param _rxInnerAccessibleContext @@ -263,7 +263,7 @@ namespace comphelper The XAccessible to return in the getAccessibleParent call */ OAccessibleContextWrapper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerAccessibleContext, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxOwningAccessible, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible @@ -330,8 +330,8 @@ namespace comphelper class COMPHELPER_DLLPUBLIC OWrappedAccessibleChildrenManager : public OWrappedAccessibleChildrenManager_Base { protected: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xContext; ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > m_aOwningAccessible; // the XAccessible which belongs to the XAccessibleContext which we work for AccessibleMap m_aChildrenMap; // for caching children @@ -340,7 +340,7 @@ namespace comphelper public: /// ctor OWrappedAccessibleChildrenManager( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); /** specifies if the children are to be consideren transient (i.e.: not cached) diff --git a/comphelper/inc/comphelper/proxyaggregation.hxx b/comphelper/inc/comphelper/proxyaggregation.hxx index de32f583c6ab..2d78b865b547 100644 --- a/comphelper/inc/comphelper/proxyaggregation.hxx +++ b/comphelper/inc/comphelper/proxyaggregation.hxx @@ -82,16 +82,16 @@ namespace comphelper private: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xProxyAggregate; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider > m_xProxyTypeAccess; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; protected: - inline const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& getORB() + inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getComponentContext() { - return m_xORB; + return m_xContext; } protected: - OProxyAggregation( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); + OProxyAggregation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext ); ~OProxyAggregation(); /// to be called from within your ctor @@ -138,7 +138,7 @@ namespace comphelper protected: // OProxyAggregation - using OProxyAggregation::getORB; + using OProxyAggregation::getComponentContext; // XInterface ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); @@ -148,7 +148,7 @@ namespace comphelper protected: OComponentProxyAggregationHelper( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, ::cppu::OBroadcastHelper& _rBHelper ); virtual ~OComponentProxyAggregationHelper( ); @@ -183,7 +183,7 @@ namespace comphelper { protected: OComponentProxyAggregation( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxComponent ); diff --git a/comphelper/source/misc/accessiblewrapper.cxx b/comphelper/source/misc/accessiblewrapper.cxx index 20276067a117..929eb5f76dde 100644 --- a/comphelper/source/misc/accessiblewrapper.cxx +++ b/comphelper/source/misc/accessiblewrapper.cxx @@ -73,8 +73,8 @@ namespace comphelper }; //------------------------------------------------------------------------- - OWrappedAccessibleChildrenManager::OWrappedAccessibleChildrenManager( const Reference< XMultiServiceFactory >& _rxORB ) - :m_xORB( _rxORB ) + OWrappedAccessibleChildrenManager::OWrappedAccessibleChildrenManager( const Reference< XComponentContext >& _rxContext ) + :m_xContext( _rxContext ) ,m_bTransientChildren( sal_True ) { } @@ -142,7 +142,7 @@ namespace comphelper else if ( _bCreate ) { // not found in the cache, and allowed to create // -> new wrapper - xValue = new OAccessibleWrapper( m_xORB, _rxKey, (Reference< XAccessible >)m_aOwningAccessible ); + xValue = new OAccessibleWrapper( m_xContext, _rxKey, (Reference< XAccessible >)m_aOwningAccessible ); // see if we do cache children if ( !m_bTransientChildren ) @@ -298,10 +298,10 @@ namespace comphelper //= OAccessibleWrapper (implementation) //========================================================================= //------------------------------------------------------------------------- - OAccessibleWrapper::OAccessibleWrapper( const Reference< XMultiServiceFactory >& _rxORB, + OAccessibleWrapper::OAccessibleWrapper( const Reference< XComponentContext >& _rxContext, const Reference< XAccessible >& _rxInnerAccessible, const Reference< XAccessible >& _rxParentAccessible ) :OAccessibleWrapper_Base( ) - ,OComponentProxyAggregation( _rxORB, Reference< XComponent >( _rxInnerAccessible, UNO_QUERY ) ) + ,OComponentProxyAggregation( _rxContext, Reference< XComponent >( _rxInnerAccessible, UNO_QUERY ) ) ,m_xParentAccessible( _rxParentAccessible ) ,m_xInnerAccessible( _rxInnerAccessible ) { @@ -341,7 +341,7 @@ namespace comphelper //-------------------------------------------------------------------- OAccessibleContextWrapper* OAccessibleWrapper::createAccessibleContext( const Reference< XAccessibleContext >& _rxInnerContext ) { - return new OAccessibleContextWrapper( getORB(), _rxInnerContext, this, m_xParentAccessible ); + return new OAccessibleContextWrapper( getComponentContext(), _rxInnerContext, this, m_xParentAccessible ); } //-------------------------------------------------------------------- @@ -369,19 +369,19 @@ namespace comphelper //========================================================================= //------------------------------------------------------------------------- OAccessibleContextWrapperHelper::OAccessibleContextWrapperHelper( - const Reference< XMultiServiceFactory >& _rxORB, + const Reference< XComponentContext >& _rxContext, ::cppu::OBroadcastHelper& _rBHelper, const Reference< XAccessibleContext >& _rxInnerAccessibleContext, const Reference< XAccessible >& _rxOwningAccessible, const Reference< XAccessible >& _rxParentAccessible ) - :OComponentProxyAggregationHelper( _rxORB, _rBHelper ) + :OComponentProxyAggregationHelper( _rxContext, _rBHelper ) ,m_xInnerContext( _rxInnerAccessibleContext ) ,m_xOwningAccessible( _rxOwningAccessible ) ,m_xParentAccessible( _rxParentAccessible ) ,m_pChildMapper( NULL ) { // initialize the mapper for our children - m_pChildMapper = new OWrappedAccessibleChildrenManager( getORB() ); + m_pChildMapper = new OWrappedAccessibleChildrenManager( getComponentContext() ); m_pChildMapper->acquire(); // determine if we're allowed to cache children @@ -526,11 +526,11 @@ namespace comphelper IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleContextWrapper, OAccessibleContextWrapper_CBase, OAccessibleContextWrapperHelper ) //-------------------------------------------------------------------- - OAccessibleContextWrapper::OAccessibleContextWrapper( const Reference< XMultiServiceFactory >& _rxORB, + OAccessibleContextWrapper::OAccessibleContextWrapper( const Reference< XComponentContext >& _rxContext, const Reference< XAccessibleContext >& _rxInnerAccessibleContext, const Reference< XAccessible >& _rxOwningAccessible, const Reference< XAccessible >& _rxParentAccessible ) :OAccessibleContextWrapper_CBase( m_aMutex ) - ,OAccessibleContextWrapperHelper( _rxORB, rBHelper, _rxInnerAccessibleContext, _rxOwningAccessible, _rxParentAccessible ) + ,OAccessibleContextWrapperHelper( _rxContext, rBHelper, _rxInnerAccessibleContext, _rxOwningAccessible, _rxParentAccessible ) ,m_nNotifierClient( 0 ) { aggregateProxy( m_refCount, *this ); diff --git a/comphelper/source/misc/proxyaggregation.cxx b/comphelper/source/misc/proxyaggregation.cxx index 6d190ff91b14..a8771d6a2249 100644 --- a/comphelper/source/misc/proxyaggregation.cxx +++ b/comphelper/source/misc/proxyaggregation.cxx @@ -18,7 +18,7 @@ */ #include <comphelper/proxyaggregation.hxx> -#include <com/sun/star/reflection/XProxyFactory.hpp> +#include <com/sun/star/reflection/ProxyFactory.hpp> //............................................................................. namespace comphelper @@ -33,8 +33,8 @@ namespace comphelper //= OProxyAggregation //========================================================================= //------------------------------------------------------------------------- - OProxyAggregation::OProxyAggregation( const Reference< XMultiServiceFactory >& _rxORB ) - :m_xORB( _rxORB ) + OProxyAggregation::OProxyAggregation( const Reference< XComponentContext >& _rxContext ) + :m_xContext( _rxContext ) { } @@ -43,32 +43,25 @@ namespace comphelper ::cppu::OWeakObject& _rDelegator ) { // first a factory for the proxy - Reference< XProxyFactory > xFactory( - m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.reflection.ProxyFactory" ) ) ), - UNO_QUERY - ); - OSL_ENSURE( xFactory.is(), "OProxyAggregation::baseAggregateProxyFor: could not create a proxy factory!" ); + Reference< XProxyFactory > xFactory = ProxyFactory::create( m_xContext ); // then the proxy itself - if ( xFactory.is() ) + { // i36686 OJ: achieve the desctruction of the tempoary -> otherwise it leads to _rRefCount -= 2 + m_xProxyAggregate = xFactory->createProxy( _rxComponent ); + } + if ( m_xProxyAggregate.is() ) + m_xProxyAggregate->queryAggregation( ::getCppuType( &m_xProxyTypeAccess ) ) >>= m_xProxyTypeAccess; + + // aggregate the proxy + osl_atomic_increment( &_rRefCount ); + if ( m_xProxyAggregate.is() ) { - { // i36686 OJ: achieve the desctruction of the tempoary -> otherwise it leads to _rRefCount -= 2 - m_xProxyAggregate = xFactory->createProxy( _rxComponent ); - } - if ( m_xProxyAggregate.is() ) - m_xProxyAggregate->queryAggregation( ::getCppuType( &m_xProxyTypeAccess ) ) >>= m_xProxyTypeAccess; - - // aggregate the proxy - osl_atomic_increment( &_rRefCount ); - if ( m_xProxyAggregate.is() ) - { - // At this point in time, the proxy has a ref count of exactly two - in m_xControlContextProxy, - // and in m_xProxyTypeAccess. - // Remember to _not_ reset these members unless the delegator of the proxy has been reset, too! - m_xProxyAggregate->setDelegator( _rDelegator ); - } - osl_atomic_decrement( &_rRefCount ); + // At this point in time, the proxy has a ref count of exactly two - in m_xControlContextProxy, + // and in m_xProxyTypeAccess. + // Remember to _not_ reset these members unless the delegator of the proxy has been reset, too! + m_xProxyAggregate->setDelegator( _rDelegator ); } + osl_atomic_decrement( &_rRefCount ); } //------------------------------------------------------------------------- @@ -104,12 +97,12 @@ namespace comphelper //= OComponentProxyAggregationHelper //========================================================================= //------------------------------------------------------------------------- - OComponentProxyAggregationHelper::OComponentProxyAggregationHelper( const Reference< XMultiServiceFactory >& _rxORB, + OComponentProxyAggregationHelper::OComponentProxyAggregationHelper( const Reference< XComponentContext >& _rxContext, ::cppu::OBroadcastHelper& _rBHelper ) - :OProxyAggregation( _rxORB ) + :OProxyAggregation( _rxContext ) ,m_rBHelper( _rBHelper ) { - OSL_ENSURE( _rxORB.is(), "OComponentProxyAggregationHelper::OComponentProxyAggregationHelper: invalid arguments!" ); + OSL_ENSURE( _rxContext.is(), "OComponentProxyAggregationHelper::OComponentProxyAggregationHelper: invalid arguments!" ); } //------------------------------------------------------------------------- @@ -192,10 +185,10 @@ namespace comphelper //= OComponentProxyAggregation //========================================================================= //------------------------------------------------------------------------- - OComponentProxyAggregation::OComponentProxyAggregation( const Reference< XMultiServiceFactory >& _rxORB, + OComponentProxyAggregation::OComponentProxyAggregation( const Reference< XComponentContext >& _rxContext, const Reference< XComponent >& _rxComponent ) :OComponentProxyAggregation_CBase( m_aMutex ) - ,OComponentProxyAggregationHelper( _rxORB, rBHelper ) + ,OComponentProxyAggregationHelper( _rxContext, rBHelper ) { OSL_ENSURE( _rxComponent.is(), "OComponentProxyAggregation::OComponentProxyAggregation: accessible is no XComponent!" ); if ( _rxComponent.is() ) |