diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-12-22 00:12:11 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2016-01-15 11:12:09 +0200 |
commit | 79fa9bb77c702571de753c739e257ff6c27071ca (patch) | |
tree | 87f75ea99592d4b1ca8a6e8804cea5642e89d40a /reportdesign/source | |
parent | f0920199f2983a89b66e3b64d555353d7fe47e52 (diff) |
Implement the XDocumentEventBroadcaster interface in OReportDefinition
On 5-0 branch this change fixed tdf#92203, but it's not needed on
master, because of 22328a224df4619218b88205838307f70612207e. Still
it's nice to have, as the XEventBroadcaster which OReportDefinition
currently implements "should not be used anymore" according to IDL
doc.
Change-Id: I4101dac0078df7cb06f4d33da2a722cfbafb5608
Diffstat (limited to 'reportdesign/source')
-rw-r--r-- | reportdesign/source/core/api/ReportDefinition.cxx | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index c5d3f9cea857..b8e5314f46f0 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -478,6 +478,7 @@ struct OReportDefinitionImpl ::cppu::OInterfaceContainerHelper m_aStorageChangeListeners; ::cppu::OInterfaceContainerHelper m_aCloseListener; ::cppu::OInterfaceContainerHelper m_aModifyListeners; + ::cppu::OInterfaceContainerHelper m_aLegacyEventListeners; ::cppu::OInterfaceContainerHelper m_aDocEventListeners; ::std::vector< uno::Reference< frame::XController> > m_aControllers; uno::Sequence< beans::PropertyValue > m_aArgs; @@ -532,6 +533,7 @@ struct OReportDefinitionImpl :m_aStorageChangeListeners(_aMutex) ,m_aCloseListener(_aMutex) ,m_aModifyListeners(_aMutex) + ,m_aLegacyEventListeners(_aMutex) ,m_aDocEventListeners(_aMutex) ,m_sMimeType(MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII) ,m_sIdentifier(SERVICE_REPORTDEFINITION) @@ -653,6 +655,7 @@ void SAL_CALL OReportDefinition::disposing() lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) ); m_pImpl->m_aModifyListeners.disposeAndClear( aDisposeEvent ); m_pImpl->m_aCloseListener.disposeAndClear( aDisposeEvent ); + m_pImpl->m_aLegacyEventListeners.disposeAndClear( aDisposeEvent ); m_pImpl->m_aDocEventListeners.disposeAndClear( aDisposeEvent ); m_pImpl->m_aStorageChangeListeners.disposeAndClear( aDisposeEvent ); @@ -1848,11 +1851,44 @@ void OReportDefinition::notifyEvent(const OUString& _sEventName) ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); document::EventObject aEvt(*this, _sEventName); aGuard.clear(); - m_pImpl->m_aDocEventListeners.notifyEach(&document::XEventListener::notifyEvent,aEvt); + m_pImpl->m_aLegacyEventListeners.notifyEach(&document::XEventListener::notifyEvent,aEvt); } catch (const uno::Exception&) { } + + notifyDocumentEvent(_sEventName, nullptr, css::uno::Any()); +} + +// document::XDocumentEventBroadcaster +void SAL_CALL OReportDefinition::notifyDocumentEvent( const OUString& rEventName, const uno::Reference< frame::XController2 >& rViewController, const uno::Any& rSupplement ) throw (lang::IllegalArgumentException, lang::NoSupportException, uno::RuntimeException, std::exception) +{ + try + { + ::osl::ResettableMutexGuard aGuard(m_aMutex); + ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); + document::DocumentEvent aEvt(*this, rEventName, rViewController, rSupplement); + aGuard.clear(); + m_pImpl->m_aDocEventListeners.notifyEach(&document::XDocumentEventListener::documentEventOccured,aEvt); + } + catch (const uno::Exception&) + { + } +} + +void SAL_CALL OReportDefinition::addDocumentEventListener( const uno::Reference< document::XDocumentEventListener >& rListener ) throw (uno::RuntimeException, std::exception) +{ + ::osl::MutexGuard aGuard(m_aMutex); + ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); + if ( rListener.is() ) + m_pImpl->m_aDocEventListeners.addInterface(rListener); +} + +void SAL_CALL OReportDefinition::removeDocumentEventListener( const uno::Reference< document::XDocumentEventListener >& rListener ) throw (uno::RuntimeException, std::exception) +{ + ::osl::MutexGuard aGuard(m_aMutex); + ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); + m_pImpl->m_aDocEventListeners.removeInterface(rListener); } // document::XEventBroadcaster @@ -1861,14 +1897,14 @@ void SAL_CALL OReportDefinition::addEventListener(const uno::Reference< document ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); if ( _xListener.is() ) - m_pImpl->m_aDocEventListeners.addInterface(_xListener); + m_pImpl->m_aLegacyEventListeners.addInterface(_xListener); } void SAL_CALL OReportDefinition::removeEventListener( const uno::Reference< document::XEventListener >& _xListener ) throw (uno::RuntimeException, std::exception) { ::osl::MutexGuard aGuard(m_aMutex); ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_aDocEventListeners.removeInterface(_xListener); + m_pImpl->m_aLegacyEventListeners.removeInterface(_xListener); } // document::XViewDataSupplier |