[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - reportdesign/inc reportdesign/source

Maxim Monastirsky momonasmon at gmail.com
Wed Jan 6 07:00:45 PST 2016


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

New commits:
commit d48370043b3759c79340c162048c5f2b4da394b9
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Tue Dec 22 14:40:51 2015 +0200

    tdf#92203 OReportDefinition should implement XDocumentEventListener interface
    
    ... since 252b0c4364690e00b45175693d35eb64a07324b4
    
    Change-Id: I4101dac0078df7cb06f4d33da2a722cfbafb5608
    Reviewed-on: https://gerrit.libreoffice.org/20875
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx
index cf3da36..d2432d2b 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>
@@ -44,9 +45,9 @@
 #include <cppuhelper/propertysetmixin.hxx>
 #include <svx/unomod.hxx>
 
-#ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13
-#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13
-#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 13
+#ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_14
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_14
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 14
 #include <comphelper/implbase_var.hxx>
 #endif
 
@@ -64,8 +65,9 @@ namespace utl
 namespace reportdesign
 {
     class OReportComponentProperties;
-    typedef ::comphelper::PartialWeakComponentImplHelper13 <   ::com::sun::star::report::XReportDefinition
+    typedef ::comphelper::PartialWeakComponentImplHelper14<    ::com::sun::star::report::XReportDefinition
                                                     ,   ::com::sun::star::document::XEventBroadcaster
+                                                    ,   ::com::sun::star::document::XDocumentEventBroadcaster
                                                     ,   ::com::sun::star::lang::XServiceInfo
                                                     ,   ::com::sun::star::frame::XModule
                                                     ,   ::com::sun::star::lang::XUnoTunnel
@@ -350,6 +352,11 @@ namespace reportdesign
         // document::XEventListener
         void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
 
+        // document::XDocumentEventBroadcaster
+        virtual void SAL_CALL addDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& rListener ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+        virtual void SAL_CALL removeDocumentEventListener( const css::uno::Reference< css::document::XDocumentEventListener >& rListener ) throw (css::uno::RuntimeException, std::exception) SAL_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) SAL_OVERRIDE;
+
         // XUIConfigurationManagerSupplier
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > SAL_CALL getUIConfigurationManager(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index a3f4663..40109e0 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 );
 
@@ -1849,11 +1852,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
@@ -1862,14 +1898,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::XEventListener


More information about the Libreoffice-commits mailing list