22#include <com/sun/star/frame/DoubleInitializationException.hpp>
33 using ::com::sun::star::uno::Reference;
34 using ::com::sun::star::uno::Exception;
35 using ::com::sun::star::uno::Any;
36 using ::com::sun::star::frame::DoubleInitializationException;
37 using ::com::sun::star::document::XDocumentEventListener;
38 using ::com::sun::star::document::DocumentEvent;
39 using ::com::sun::star::frame::XController2;
71 virtual void SAL_CALL
acquire() noexcept override;
72 virtual
void SAL_CALL
release() noexcept override;
99 const Any& Supplement )
102 m_rDocument, EventName, ViewController, Supplement ) );
106 const Any& Supplement )
109 m_rDocument, EventName, ViewController, Supplement ) );
118 virtual void processEvent( const ::comphelper::AnyEvent& _rEvent )
override;
132 if ( 0 == osl_atomic_decrement( &
m_refCount ) )
140 ::osl::ResettableMutexGuard aGuard(
m_rMutex );
153 if (xEventBroadcaster)
158 xEventBroadcaster->join();
160 rSolarMutex.
acquire(nLockCount);
161 xEventBroadcaster.reset();
175 throw DoubleInitializationException();
188 "DocumentEventNotifier_Impl::impl_notifyEvent_nothrow: only to be called when the document is already initialized!" );
191 document::EventObject aLegacyEvent( _rEvent.Source, _rEvent.EventName );
228 ::osl::MutexGuard aGuard(
m_rMutex );
253 m_pImpl->onDocumentInitialized();
258 m_pImpl->addLegacyEventListener( Listener );
263 m_pImpl->removeLegacyEventListener( Listener );
268 m_pImpl->addDocumentEventListener( Listener );
273 m_pImpl->removeDocumentEventListener( Listener );
277 const Reference< XController2 >& ViewController,
const Any& Supplement )
279 m_pImpl->notifyDocumentEvent( EventName, ViewController, Supplement );
283 const Reference< XController2 >& ViewController,
const Any& Supplement )
285 m_pImpl->notifyDocumentEventAsync( EventName, ViewController, Supplement );
static comphelper::SolarMutex & GetSolarMutex()
static std::shared_ptr< AsyncEventNotifierAutoJoin > newAsyncEventNotifierAutoJoin(char const *name)
static void launch(std::shared_ptr< AsyncEventNotifierAutoJoin > const &)
const EventObjectType & getEventObject() const
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
sal_uInt32 release(bool bUnlockAll=false)
virtual bool IsCurrentThread() const
void acquire(sal_uInt32 nLockCount=1)
std::shared_ptr<::comphelper::AsyncEventNotifierAutoJoin > m_pEventBroadcaster
virtual void processEvent(const ::comphelper::AnyEvent &_rEvent) override
::cppu::OWeakObject & m_rDocument
void notifyDocumentEvent(const OUString &EventName, const Reference< XController2 > &ViewController, const Any &Supplement)
void removeLegacyEventListener(const Reference< document::XEventListener > &Listener)
void onDocumentInitialized()
oslInterlockedCount m_refCount
virtual void SAL_CALL release() noexcept override
::comphelper::OInterfaceContainerHelper3< XDocumentEventListener > m_aDocumentEventListeners
DocumentEventNotifier_Impl(::cppu::OWeakObject &_rBroadcasterDocument, ::osl::Mutex &_rMutex)
void notifyDocumentEventAsync(const OUString &EventName, const Reference< XController2 > &ViewController, const Any &Supplement)
void addDocumentEventListener(const Reference< XDocumentEventListener > &Listener)
void impl_notifyEventAsync_nothrow(const DocumentEvent &_rEvent)
::comphelper::OInterfaceContainerHelper3< css::document::XEventListener > m_aLegacyEventListeners
void addLegacyEventListener(const Reference< document::XEventListener > &Listener)
void removeDocumentEventListener(const Reference< XDocumentEventListener > &Listener)
virtual ~DocumentEventNotifier_Impl()
virtual void SAL_CALL acquire() noexcept override
void impl_notifyEvent_nothrow(const DocumentEvent &_rEvent)
DocumentEventNotifier(::cppu::OWeakObject &_rBroadcasterDocument, ::osl::Mutex &_rMutex)
void addDocumentEventListener(const css::uno::Reference< css::document::XDocumentEventListener > &Listener)
void onDocumentInitialized()
tells the instance that its document is completely initialized now.
void disposing()
disposes the instance @precond the mutex is not locked
void addLegacyEventListener(const css::uno::Reference< css::document::XEventListener > &Listener)
void notifyDocumentEvent(const OUString &EventName, const css::uno::Reference< css::frame::XController2 > &_rxViewController, const css::uno::Any &Supplement)
notifies a document event described by the given parameters
::rtl::Reference< DocumentEventNotifier_Impl > m_pImpl
void removeDocumentEventListener(const css::uno::Reference< css::document::XDocumentEventListener > &Listener)
void notifyDocumentEventAsync(const OUString &EventName, const css::uno::Reference< css::frame::XController2 > &ViewController, const css::uno::Any &Supplement)
notifies a document event, described by the given parameters, asynchronously
void removeLegacyEventListener(const css::uno::Reference< css::document::XEventListener > &Listener)
#define DBG_UNHANDLED_EXCEPTION(...)
::comphelper::EventHolder< DocumentEvent > DocumentEventHolder