20#include <osl/diagnose.h>
25#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
26#include <com/sun/star/uno/RuntimeException.hpp>
44OComponentHelper::~OComponentHelper()
52Any OComponentHelper::queryAggregation(
Type const & rType )
56 void *
p =
static_cast< lang::XComponent *
>( this );
57 return Any( &
p, rType );
61 void *
p =
static_cast< lang::XTypeProvider *
>( this );
62 return Any( &
p, rType );
64 return OWeakAggObject::queryAggregation( rType );
66void OComponentHelper::acquire() noexcept
68 OWeakAggObject::acquire();
71void OComponentHelper::release() noexcept
78 if (! rBHelper.bDisposed)
82 disposeWeakConnectionPoint();
90 catch (css::uno::RuntimeException & exc)
105 OWeakAggObject::release();
120void OComponentHelper::disposing()
125void OComponentHelper::dispose()
134 bool bDoDispose =
false;
136 MutexGuard aGuard( rBHelper.rMutex );
137 if( !rBHelper.bDisposed && !rBHelper.bInDispose )
140 rBHelper.bInDispose =
true;
156 aEvt.Source = xSource;
159 rBHelper.aLC.disposeAndClear( aEvt );
165 MutexGuard aGuard( rBHelper.rMutex );
167 rBHelper.bDisposed =
true;
168 rBHelper.bInDispose =
false;
171 MutexGuard aGuard( rBHelper.rMutex );
173 rBHelper.bDisposed =
true;
174 rBHelper.bInDispose =
false;
183 throw lang::WrappedTargetRuntimeException(
184 "unexpected UNO exception caught: " + exc.Message,
193 SAL_WARN(
"cppuhelper",
"OComponentHelper::dispose() - dispose called twice" );
198void OComponentHelper::addEventListener(
201 ClearableMutexGuard aGuard( rBHelper.rMutex );
202 if (rBHelper.bDisposed || rBHelper.bInDispose)
206 rxListener->disposing( EventObject(
x ) );
210 rBHelper.addListener(
cppu::UnoType<
decltype(rxListener)>::get(), rxListener );
215void OComponentHelper::removeEventListener(
218 rBHelper.removeListener(
cppu::UnoType<
decltype(rxListener)>::get(), rxListener );
OComponentHelper(::osl::Mutex &rMutex)
Constructor.
Helper class to implement css::lang::XTypeProvider.
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
Called upon XTypeProvider::getTypes().
#define SAL_WARN(area, stream)
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Any SAL_CALL getCaughtException()
Use this function to get the dynamic type of a caught C++-UNO exception; completes the above function...