using ::com::sun::star::document::XDocumentEventBroadcaster; using ::com::sun::star::document::XDocumentEventListener; using ::com::sun::star::document::DocumentEvent; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::frame::XModel; using ::com::sun::star::frame::theGlobalEventBroadcaster; using ::com::sun::star::uno::UNO_QUERY;
private: /// determines whether the instance is already disposed bool impl_isDisposed_nothrow(std::unique_lock<std::mutex>& /*rGuard*/) const { return m_pListener == nullptr; }
/// disposes the instance void impl_dispose_nothrow(std::unique_lock<std::mutex>& rGuard);
/// registers or revokes the instance as listener at the global event broadcaster void impl_listenerAction_nothrow( std::unique_lock<std::mutex>& rGuard, ListenerAction _eAction );
OSL_PRECOND( !impl_isDisposed_nothrow(aGuard), "DocumentEventNotifier::Impl::notifyEvent: disposed, but still getting events?" ); if ( impl_isDisposed_nothrow(aGuard) ) return;
for (EventEntry const & aEvent : aEvents)
{ if ( !_rEvent.EventName.equalsAscii( aEvent.pEventName ) ) continue;
// Listener implementations require that we hold the mutex, but to avoid lock ordering issues, // we need to take the solar mutex before we take our own mutex.
aGuard.unlock();
// Listener implements require that we hold the solar mutex.
SolarMutexGuard aSolarGuard;
// Take the lock again, so we can check our local fields.
aGuard.lock(); if ( impl_isDisposed_nothrow(aGuard) ) // somebody took the chance to dispose us -> bail out return;
DocumentEventListener* pListener = m_pListener;
ScriptDocument aDocument( xDocument ); // We cannot call the listener while holding our mutex because the listener // call might trigger an event which call back into us.
aGuard.unlock();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.