20#ifndef INCLUDED_COMPHELPER_WEAKEVENTLISTENER_HXX
21#define INCLUDED_COMPHELPER_WEAKEVENTLISTENER_HXX
23#include <config_options.h>
28#include <com/sun/star/lang/XEventListener.hpp>
29#include <com/sun/star/lang/XComponent.hpp>
50 css::uno::WeakReference< css::uno::XInterface >
52 css::uno::Reference< css::uno::XInterface >
56 css::uno::Reference< css::uno::XInterface >
62 const css::uno::Reference< css::uno::XInterface >&
76 const css::uno::Reference< css::uno::XWeak >& _rxListener,
77 css::uno::Reference< css::uno::XInterface > _xBroadcaster
91 template<
class BROADCASTER,
class LISTENER >
110 const css::uno::Reference< css::uno::XWeak >& _rxListener,
111 const css::uno::Reference< BROADCASTER >& _rxBroadcaster
121 virtual void SAL_CALL
disposing(
const css::lang::EventObject& Source )
override;
126 virtual void disposing( std::unique_lock<std::mutex>& rGuard )
override = 0;
133 , css::lang::XEventListener
140 OWeakEventListenerAdapter(
141 css::uno::Reference< css::uno::XWeak >
const & _rxListener,
142 css::uno::Reference< css::lang::XComponent >
const & _rxBroadcaster
150 virtual void disposing( std::unique_lock<std::mutex>& rGuard )
override;
157 template<
class BROADCASTER,
class LISTENER >
159 const css::uno::Reference< css::uno::XWeak >& _rxListener,
160 const css::uno::Reference< BROADCASTER >& _rxBroadcaster
162 : OWeakListenerAdapterBase( _rxListener, _rxBroadcaster )
167 template<
class BROADCASTER,
class LISTENER >
170 css::uno::Reference< LISTENER > xListener( getListener() );
171 if ( xListener.is() )
172 xListener->disposing( _rSource );
(the base for) an adapter which allows to add as listener to a foreign component, without being held ...
css::uno::WeakReference< css::uno::XInterface > m_aListener
const css::uno::Reference< css::uno::XInterface > & getBroadcaster() const
OWeakListenerAdapterBase(const css::uno::Reference< css::uno::XWeak > &_rxListener, css::uno::Reference< css::uno::XInterface > _xBroadcaster)
virtual ~OWeakListenerAdapterBase()
css::uno::Reference< css::uno::XInterface > getListener() const
css::uno::Reference< css::uno::XInterface > m_xBroadcaster
yet another base for weak listener adapters, this time with some type safety
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
OWeakListenerAdapter(const css::uno::Reference< css::uno::XWeak > &_rxListener, const css::uno::Reference< BROADCASTER > &_rxBroadcaster)
ctor
virtual void disposing(std::unique_lock< std::mutex > &rGuard) override=0
Called by dispose for subclasses to do dispose() work.
css::uno::Reference< LISTENER > getListener() const
OWeakListenerAdapter< css::lang::XComponent, css::lang::XEventListener > OWeakEventListenerAdapter_Base