[Libreoffice-commits] core.git: reportdesign/inc reportdesign/source

Maxim Monastirsky momonasmon at gmail.com
Fri Jan 15 01:13:36 PST 2016


 reportdesign/inc/ReportDefinition.hxx             |    7 +++
 reportdesign/source/core/api/ReportDefinition.cxx |   42 ++++++++++++++++++++--
 2 files changed, 46 insertions(+), 3 deletions(-)

New commits:
commit 79fa9bb77c702571de753c739e257ff6c27071ca
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Tue Dec 22 00:12:11 2015 +0200

    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

diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx
index 9e582ea..542bcb0 100644
--- a/reportdesign/inc/ReportDefinition.hxx
+++ b/reportdesign/inc/ReportDefinition.hxx
@@ -25,6 +25,7 @@
 #include "ReportHelperDefines.hxx"
 
 #include <com/sun/star/datatransfer/XTransferable.hpp>
+#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/document/XUndoManagerSupplier.hpp>
 #include <com/sun/star/frame/XModule.hpp>
@@ -61,6 +62,7 @@ namespace reportdesign
     class OReportComponentProperties;
     typedef cppu::PartialWeakComponentImplHelper<   css::report::XReportDefinition
                                                     ,   css::document::XEventBroadcaster
+                                                    ,   css::document::XDocumentEventBroadcaster
                                                     ,   css::lang::XServiceInfo
                                                     ,   css::frame::XModule
                                                     ,   css::lang::XUnoTunnel
@@ -335,6 +337,11 @@ namespace reportdesign
         virtual void SAL_CALL addEventListener( const css::uno::Reference< css::document::XEventListener >& aListener ) throw (css::uno::RuntimeException, std::exception) override;
         virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::document::XEventListener >& aListener ) throw (css::uno::RuntimeException, std::exception) override;
 
+        // document::XDocumentEventBroadcaster
+        virtual void SAL_CALL addDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& rListener ) throw (css::uno::RuntimeException, std::exception) override;
+        virtual void SAL_CALL removeDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& rListener ) throw (css::uno::RuntimeException, std::exception) override;
+        virtual void SAL_CALL notifyDocumentEvent( const OUString& rEventName, const css::uno::Reference< css::frame::XController2 >& rViewController, const css::uno::Any& rSupplement ) throw (css::lang::IllegalArgumentException, css::lang::NoSupportException, css::uno::RuntimeException, std::exception) override;
+
         // XUIConfigurationManagerSupplier
         virtual css::uno::Reference< css::ui::XUIConfigurationManager > SAL_CALL getUIConfigurationManager(  ) throw (css::uno::RuntimeException, std::exception) override;
 
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index c5d3f9c..b8e5314 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


More information about the Libreoffice-commits mailing list