25#include <com/sun/star/reflection/ProxyFactory.hpp>
42 void OProxyAggregation::baseAggregateProxyFor(
const Reference< XInterface >& _rxComponent, oslInterlockedCount& _rRefCount,
50 m_xProxyAggregate =
xFactory->createProxy( _rxComponent );
52 if ( m_xProxyAggregate.is() )
53 m_xProxyAggregate->queryAggregation(
cppu::UnoType<
decltype(m_xProxyTypeAccess)>::get() ) >>= m_xProxyTypeAccess;
56 osl_atomic_increment( &_rRefCount );
57 if ( m_xProxyAggregate.is() )
62 m_xProxyAggregate->setDelegator( _rDelegator );
64 osl_atomic_decrement( &_rRefCount );
68 Any SAL_CALL OProxyAggregation::queryAggregation(
const Type& _rType )
70 return m_xProxyAggregate.is() ? m_xProxyAggregate->queryAggregation( _rType ) :
Any();
74 Sequence< Type > SAL_CALL OProxyAggregation::getTypes( )
77 if ( m_xProxyAggregate.is() )
79 if ( m_xProxyTypeAccess.is() )
80 aTypes = m_xProxyTypeAccess->getTypes();
86 OProxyAggregation::~OProxyAggregation()
88 if ( m_xProxyAggregate.is() )
89 m_xProxyAggregate->setDelegator(
nullptr );
90 m_xProxyAggregate.clear();
91 m_xProxyTypeAccess.clear();
96 OComponentProxyAggregationHelper::OComponentProxyAggregationHelper(
const Reference< XComponentContext >& _rxContext,
99 ,m_rBHelper( _rBHelper )
101 OSL_ENSURE( _rxContext.is(),
"OComponentProxyAggregationHelper::OComponentProxyAggregationHelper: invalid arguments!" );
106 const Reference< XComponent >& _rxComponent, oslInterlockedCount& _rRefCount,
109 OSL_ENSURE( _rxComponent.is(),
"OComponentProxyAggregationHelper::componentAggregateProxyFor: invalid inner component!" );
116 osl_atomic_increment( &_rRefCount );
121 osl_atomic_decrement( &_rRefCount );
128 if ( !aReturn.hasValue() )
139 OSL_ENSURE( m_rBHelper.bDisposed,
"OComponentProxyAggregationHelper::~OComponentProxyAggregationHelper: you should dispose your derived class in the dtor, if necessary!" );
173 m_xInner->removeEventListener(
this );
180 const Reference< XComponent >& _rxComponent )
184 OSL_ENSURE( _rxComponent.is(),
"OComponentProxyAggregation::OComponentProxyAggregation: accessible is no XComponent!" );
185 if ( _rxComponent.is() )
192 if ( !rBHelper.bDisposed )
Reference< XComponentContext > m_xContext
a helper class for aggregating a proxy to an XComponent
virtual void SAL_CALL dispose()=0
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
::cppu::OBroadcastHelper & m_rBHelper
void componentAggregateProxyFor(const css::uno::Reference< css::lang::XComponent > &_rxComponent, oslInterlockedCount &_rRefCount, ::cppu::OWeakObject &_rDelegator)
to be called from within your ctor
css::uno::Reference< css::lang::XComponent > m_xInner
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &_rType) override
virtual void SAL_CALL disposing() override
virtual void SAL_CALL dispose() override
OComponentProxyAggregation(const css::uno::Reference< css::uno::XComponentContext > &_rxContext, const css::uno::Reference< css::lang::XComponent > &_rxComponent)
virtual ~OComponentProxyAggregation() override
helper class for aggregating a proxy for a foreign object
void baseAggregateProxyFor(const css::uno::Reference< css::uno::XInterface > &_rxComponent, oslInterlockedCount &_rRefCount, ::cppu::OWeakObject &_rDelegator)
to be called from within your ctor
css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &_rType)
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
OProxyAggregation(const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
Serves two purposes (1) extracts code that doesn't need to be templated (2) helps to handle the custo...
virtual void SAL_CALL dispose() override
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
css::uno::Type const & get()
Reference< XSingleServiceFactory > xFactory
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
concat several sequences
#define IMPLEMENT_GET_IMPLEMENTATION_ID(classname)
#define IMPLEMENT_FORWARD_XTYPEPROVIDER2(classname, baseclass1, baseclass2)
#define IMPLEMENT_FORWARD_XINTERFACE2(classname, refcountbase, baseclass2)