Tag: cws_dev300_odbmacros3
User: fs      
Date: 2008-07-29 13:31:11+0000
Modified:
   dba/dbaccess/source/core/dataaccess/databasedocument.cxx
   dba/dbaccess/source/core/dataaccess/databasedocument.hxx
   dba/dbaccess/source/core/dataaccess/documenteventexecutor.cxx
   dba/dbaccess/source/core/dataaccess/documenteventexecutor.hxx
   dba/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
   dba/dbaccess/source/core/dataaccess/documenteventnotifier.hxx
   dba/dbaccess/source/core/dataaccess/documentevents.cxx
   dba/dbaccess/source/core/dataaccess/documentevents.hxx

Log:
 #i76128# use XDocumentEventListener/-Broadcaster instead of (or additionally 
to) XEventListener/Broadcaster

File Changes:

Directory: /dba/dbaccess/source/core/dataaccess/
================================================

File [changed]: databasedocument.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.cxx?r1=1.40.6.14&r2=1.40.6.15
Delta lines:  +31 -3
--------------------
--- databasedocument.cxx        2008-07-29 08:22:35+0000        1.40.6.14
+++ databasedocument.cxx        2008-07-29 13:31:06+0000        1.40.6.15
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: databasedocument.cxx,v $
- * $Revision: 1.40.6.14 $
+ * $Revision: 1.40.6.15 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -134,7 +134,7 @@
     if ( bLoadFinished )
         m_rEventNotifier.notifyDocumentEventAsync( m_bIsNewDocument ? "OnNew" 
: "OnLoad" );
     if ( bViewCreated )
-        m_rEventNotifier.notifyDocumentEventAsync( "OnViewCreated" );
+        m_rEventNotifier.notifyDocumentEventAsync( "OnViewCreated", Reference< 
XController2 >( _rxController, UNO_QUERY ) );
 }
 
 //============================================================
@@ -858,17 +858,45 @@
 void SAL_CALL ODatabaseDocument::addEventListener(const uno::Reference< 
document::XEventListener >& _Listener ) throw (uno::RuntimeException)
 {
     DocumentGuard aGuard( *this, DocumentGuard::MethodWithoutInit );
-    m_aEventNotifier.addDocumentEventListener( _Listener );
+    m_aEventNotifier.addLegacyEventListener( _Listener );
 }
 
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseDocument::removeEventListener( const uno::Reference< 
document::XEventListener >& _Listener ) throw (uno::RuntimeException)
 {
     DocumentGuard aGuard( *this, DocumentGuard::MethodWithoutInit );
+    m_aEventNotifier.removeLegacyEventListener( _Listener );
+}
+
+// 
-----------------------------------------------------------------------------
+void SAL_CALL ODatabaseDocument::addDocumentEventListener( const Reference< 
XDocumentEventListener >& _Listener ) throw (RuntimeException)
+{
+    DocumentGuard aGuard( *this, DocumentGuard::MethodWithoutInit );
+    m_aEventNotifier.addDocumentEventListener( _Listener );
+}
+
+// 
-----------------------------------------------------------------------------
+void SAL_CALL ODatabaseDocument::removeDocumentEventListener( const Reference< 
XDocumentEventListener >& _Listener ) throw (RuntimeException)
+{
+    DocumentGuard aGuard( *this, DocumentGuard::MethodWithoutInit );
     m_aEventNotifier.removeDocumentEventListener( _Listener );
 }
 
 // 
-----------------------------------------------------------------------------
+void SAL_CALL ODatabaseDocument::fireDocumentEvent( const ::rtl::OUString& 
_EventName, const Reference< XController2 >& _ViewController, const Any& 
_Supplement ) throw (IllegalArgumentException, RuntimeException)
+{
+    DocumentGuard aGuard( *this );
+
+    if ( _EventName.getLength() )
+        throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+
+    if ( DocumentEvents::needsSynchronousNotification( _EventName ) )
+        m_aEventNotifier.notifyDocumentEvent( _EventName, _ViewController, 
_Supplement );
+    else
+        m_aEventNotifier.notifyDocumentEventAsync( _EventName, 
_ViewController, _Supplement );
+}
+
+// 
-----------------------------------------------------------------------------
 Sequence< PropertyValue > SAL_CALL ODatabaseDocument::getPrinter(  ) throw 
(RuntimeException)
 {
     DBG_ERROR( "ODatabaseDocument::getPrinter: not supported!" );

File [changed]: databasedocument.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.hxx?r1=1.20.2.9&r2=1.20.2.10
Delta lines:  +13 -5
--------------------
--- databasedocument.hxx        2008-07-29 08:22:35+0000        1.20.2.9
+++ databasedocument.hxx        2008-07-29 13:31:07+0000        1.20.2.10
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: databasedocument.hxx,v $
- * $Revision: 1.20.2.9 $
+ * $Revision: 1.20.2.10 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -58,11 +58,13 @@
 #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
 #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
 #include <com/sun/star/frame/XLoadable.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
 /** === end UNO includes === **/
 
-#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_15)
-#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_15
-#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 15
+#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_16)
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_16
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 16
 #include <comphelper/implbase_var.hxx>
 #endif
 
@@ -141,10 +143,11 @@
 //============================================================
 //= ODatabaseDocument
 //============================================================
-typedef ::comphelper::WeakComponentImplHelper15 <   
::com::sun::star::frame::XModel2
+typedef ::comphelper::WeakComponentImplHelper16 <   
::com::sun::star::frame::XModel2
                                                 ,   
::com::sun::star::util::XModifiable
                                                 ,   
::com::sun::star::frame::XStorable
                                                 ,   
::com::sun::star::document::XEventBroadcaster
+                                                ,   
::com::sun::star::document::XDocumentEventBroadcaster
                                                 ,   
::com::sun::star::view::XPrintable
                                                 ,   
::com::sun::star::util::XCloseable
                                                 ,   
::com::sun::star::lang::XServiceInfo
@@ -361,6 +364,11 @@
     virtual void SAL_CALL addEventListener( const 
::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& 
aListener ) throw (::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL removeEventListener( const 
::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& 
aListener ) throw (::com::sun::star::uno::RuntimeException);
     
+    // XDocumentEventBroadcaster
+    virtual void SAL_CALL addDocumentEventListener( const 
::com::sun::star::uno::Reference< 
::com::sun::star::document::XDocumentEventListener >& _Listener ) throw 
(::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL removeDocumentEventListener( const 
::com::sun::star::uno::Reference< 
::com::sun::star::document::XDocumentEventListener >& _Listener ) throw 
(::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL fireDocumentEvent( const ::rtl::OUString& 
_EventName, const ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XController2 >& _ViewController, const 
::com::sun::star::uno::Any& _Supplement ) throw 
(::com::sun::star::lang::IllegalArgumentException, 
::com::sun::star::uno::RuntimeException);
+    
     // XPrintable
        virtual ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue > SAL_CALL getPrinter(  ) throw 
(::com::sun::star::uno::RuntimeException) ;
     virtual void SAL_CALL setPrinter( const ::com::sun::star::uno::Sequence< 
::com::sun::star::beans::PropertyValue >& aPrinter ) throw 
(::com::sun::star::lang::IllegalArgumentException, 
::com::sun::star::uno::RuntimeException) ;

File [changed]: documenteventexecutor.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documenteventexecutor.cxx?r1=1.1.2.3&r2=1.1.2.4
Delta lines:  +7 -6
-------------------
--- documenteventexecutor.cxx   2008-07-29 08:24:38+0000        1.1.2.3
+++ documenteventexecutor.cxx   2008-07-29 13:31:07+0000        1.1.2.4
@@ -7,7 +7,7 @@
 *
 * $RCSfile: documenteventexecutor.cxx,v $
 *
-* $Revision: 1.1.2.3 $
+* $Revision: 1.1.2.4 $
 *
 * This file is part of OpenOffice.org.
 *
@@ -33,7 +33,7 @@
 #include "documenteventexecutor.hxx"
 
 /** === begin UNO includes === **/
-#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
 #include <com/sun/star/util/XURLTransformer.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/frame/XDispatchProvider.hpp>
@@ -64,7 +64,7 @@
     using ::com::sun::star::uno::Sequence;
     using ::com::sun::star::uno::Type;
     using ::com::sun::star::uno::WeakReference;
-    using ::com::sun::star::document::XEventBroadcaster;
+    using ::com::sun::star::document::XDocumentEventBroadcaster;
     using ::com::sun::star::document::XEventsSupplier;
     using ::com::sun::star::container::XNameAccess;
     using ::com::sun::star::frame::XModel;
@@ -74,6 +74,7 @@
     using ::com::sun::star::util::URL;
     using ::com::sun::star::beans::PropertyValue;
     using ::com::sun::star::frame::XController;
+    using ::com::sun::star::document::DocumentEvent;
     /** === end UNO using === **/
     using namespace ::com::sun::star;
 
@@ -138,11 +139,11 @@
             const Reference< XEventsSupplier >& _rxDocument )
         :m_pData( new DocumentEventExecutor_Data( _rxDocument ) )
     {
-        Reference< XEventBroadcaster > xBroadcaster( _rxDocument, 
UNO_QUERY_THROW );
+        Reference< XDocumentEventBroadcaster > xBroadcaster( _rxDocument, 
UNO_QUERY_THROW );
 
         osl_incrementInterlockedCount( &m_refCount );
         {
-            xBroadcaster->addEventListener( this );
+            xBroadcaster->addDocumentEventListener( this );
         }
         osl_decrementInterlockedCount( &m_refCount );
 
@@ -162,7 +163,7 @@
     }
 
     //--------------------------------------------------------------------
-    void SAL_CALL DocumentEventExecutor::notifyEvent( const 
document::EventObject& _Event ) throw (RuntimeException)
+    void SAL_CALL DocumentEventExecutor::documentEventOccured( const 
DocumentEvent& _Event ) throw (RuntimeException)
     {
         Reference< XEventsSupplier > xEventsSupplier( 
m_pData->xDocument.get(), UNO_QUERY );
         if ( !xEventsSupplier.is() )

File [changed]: documenteventexecutor.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documenteventexecutor.hxx?r1=1.1.2.1&r2=1.1.2.2
Delta lines:  +6 -6
-------------------
--- documenteventexecutor.hxx   2008-07-22 06:31:59+0000        1.1.2.1
+++ documenteventexecutor.hxx   2008-07-29 13:31:07+0000        1.1.2.2
@@ -7,7 +7,7 @@
 *
 * $RCSfile: documenteventexecutor.hxx,v $
 *
-* $Revision: 1.1.2.1 $
+* $Revision: 1.1.2.2 $
 *
 * This file is part of OpenOffice.org.
 *
@@ -31,7 +31,7 @@
 #define DBACCESS_DOCUMENTEVENTEXECUTOR_HXX
 
 /** === begin UNO includes === **/
-#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/document/XDocumentEventListener.hpp>
 #include <com/sun/star/document/XEventsSupplier.hpp>
 /** === end UNO includes === **/
 
@@ -53,7 +53,7 @@
        //====================================================================
        //= DocumentEventExecutor
        //====================================================================
-    typedef ::cppu::WeakImplHelper1 <   
::com::sun::star::document::XEventListener
+    typedef ::cppu::WeakImplHelper1 <   
::com::sun::star::document::XDocumentEventListener
                                     >   DocumentEventExecutor_Base;
     class DocumentEventExecutor : public DocumentEventExecutor_Base
        {
@@ -65,8 +65,8 @@
     protected:
         virtual ~DocumentEventExecutor();
 
-        // css.document.XEventListener
-        virtual void SAL_CALL notifyEvent( const 
::com::sun::star::document::EventObject& Event ) throw 
(::com::sun::star::uno::RuntimeException);
+        // css.document.XDocumentEventListener
+        virtual void SAL_CALL documentEventOccured( const 
::com::sun::star::document::DocumentEvent& Event ) throw 
(::com::sun::star::uno::RuntimeException);
         // css.lang.XEventListener
         virtual void SAL_CALL disposing( const 
::com::sun::star::lang::EventObject& Source ) throw 
(::com::sun::star::uno::RuntimeException);
 

File [changed]: documenteventnotifier.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documenteventnotifier.cxx?r1=1.1.2.2&r2=1.1.2.3
Delta lines:  +66 -22
---------------------
--- documenteventnotifier.cxx   2008-07-29 08:24:15+0000        1.1.2.2
+++ documenteventnotifier.cxx   2008-07-29 13:31:07+0000        1.1.2.3
@@ -7,7 +7,7 @@
 *
 * $RCSfile: documenteventnotifier.cxx,v $
 *
-* $Revision: 1.1.2.2 $
+* $Revision: 1.1.2.3 $
 *
 * This file is part of OpenOffice.org.
 *
@@ -59,13 +59,16 @@
        using ::com::sun::star::uno::Sequence;
        using ::com::sun::star::uno::Type;
     using ::com::sun::star::frame::DoubleInitializationException;
+    using ::com::sun::star::document::XDocumentEventListener;
+    using ::com::sun::star::document::DocumentEvent;
+    using ::com::sun::star::frame::XController2;
        /** === end UNO using === **/
        using namespace ::com::sun::star;
 
     //==================================================================
     //= DocumentEventHolder
     //==================================================================
-    typedef ::comphelper::EventHolder< document::EventObject >    
DocumentEventHolder;
+    typedef ::comphelper::EventHolder< DocumentEvent >  DocumentEventHolder;
 
     //====================================================================
        //= DocumentEventNotifier_Impl
@@ -78,6 +81,7 @@
         bool                                                    m_bInitialized;
         bool                                                    m_bDisposed;
         ::rtl::Reference< ::comphelper::AsyncEventNotifier >    
m_pEventBroadcaster;
+        ::cppu::OInterfaceContainerHelper                                      
    m_aLegacyEventListeners;
         ::cppu::OInterfaceContainerHelper                                      
    m_aDocumentEventListeners;
 
     public:
@@ -87,6 +91,7 @@
             ,m_rMutex( _rMutex )
             ,m_bInitialized( false )
             ,m_bDisposed( false )
+            ,m_aLegacyEventListeners( _rMutex )
             ,m_aDocumentEventListeners( _rMutex )
         {
         }
@@ -95,12 +100,22 @@
         virtual void SAL_CALL acquire();
         virtual void SAL_CALL release();
 
-        void addDocumentEventListener( const Reference< 
document::XEventListener >& _Listener ) throw (RuntimeException)
+        void addLegacyEventListener( const Reference< document::XEventListener 
>& _Listener ) throw (RuntimeException)
+        {
+            m_aLegacyEventListeners.addInterface( _Listener );
+        }
+
+        void removeLegacyEventListener( const Reference< 
document::XEventListener >& _Listener ) throw (RuntimeException)
+        {
+            m_aLegacyEventListeners.removeInterface( _Listener );
+        }
+
+        void addDocumentEventListener( const Reference< XDocumentEventListener 
>& _Listener ) throw (RuntimeException)
         {
             m_aDocumentEventListeners.addInterface( _Listener );
         }
 
-        void removeDocumentEventListener( const Reference< 
document::XEventListener >& _Listener ) throw (RuntimeException)
+        void removeDocumentEventListener( const Reference< 
XDocumentEventListener >& _Listener ) throw (RuntimeException)
         {
             m_aDocumentEventListeners.removeInterface( _Listener );
         }
@@ -109,19 +124,20 @@
 
         void onDocumentInitialized();
 
-        void    notifyDocumentEvent( const sal_Char* _pAsciiEventName )
+        void    notifyDocumentEvent( const ::rtl::OUString& _EventName, const 
Reference< XController2 >& _ViewController,
+                    const Any& _Supplement )
         {
-            impl_notifyEvent_nothrow(
-                document::EventObject( m_rDocument, 
::rtl::OUString::createFromAscii( _pAsciiEventName ) ) );
+            impl_notifyEvent_nothrow( DocumentEvent(
+                m_rDocument, _EventName, _ViewController, _Supplement ) );
         }
 
-        void    notifyDocumentEventAsync( const sal_Char* _pAsciiEventName )
+        void    notifyDocumentEventAsync( const ::rtl::OUString& _EventName, 
const Reference< XController2 >& _ViewController,
+                    const Any& _Supplement )
         {
-            impl_notifyEventAsync_nothrow(
-                document::EventObject( m_rDocument, 
::rtl::OUString::createFromAscii( _pAsciiEventName ) ) );
+            impl_notifyEventAsync_nothrow( DocumentEvent(
+                m_rDocument, _EventName, _ViewController, _Supplement ) );
         }
 
-    
     protected:
         virtual ~DocumentEventNotifier_Impl()
         {
@@ -131,8 +147,8 @@
         virtual void processEvent( const ::comphelper::AnyEvent& _rEvent );
 
     private:
-        void impl_notifyEvent_nothrow( const document::EventObject& _rEvent );
-        void impl_notifyEventAsync_nothrow( const document::EventObject& 
_rEvent );
+        void impl_notifyEvent_nothrow( const DocumentEvent& _rEvent );
+        void impl_notifyEventAsync_nothrow( const DocumentEvent& _rEvent );
     };
 
        //--------------------------------------------------------------------
@@ -159,6 +175,11 @@
             m_pEventBroadcaster->terminate();
             m_pEventBroadcaster = NULL;
         }
+
+        lang::EventObject aEvent( m_rDocument );
+        m_aLegacyEventListeners.disposeAndClear( aEvent );
+        m_aDocumentEventListeners.disposeAndClear( aEvent );
+
         m_bDisposed = true;
     }
 
@@ -175,22 +196,31 @@
     }
 
        //--------------------------------------------------------------------
-    void DocumentEventNotifier_Impl::impl_notifyEvent_nothrow( const 
document::EventObject& _rEvent )
+    void DocumentEventNotifier_Impl::impl_notifyEvent_nothrow( const 
DocumentEvent& _rEvent )
     {
         OSL_PRECOND( m_bInitialized,
             "DocumentEventNotifier_Impl::impl_notifyEvent_nothrow: only to be 
called when the document is already initialized!" );
            try
            {
-            m_aDocumentEventListeners.notifyEach( 
&document::XEventListener::notifyEvent, _rEvent );
+            document::EventObject aLegacyEvent( _rEvent.Source, 
_rEvent.EventName );
+            m_aLegacyEventListeners.notifyEach( 
&document::XEventListener::notifyEvent, aLegacyEvent );
            }
            catch(const Exception&)
            {
             DBG_UNHANDLED_EXCEPTION();
            }
+        try
+        {
+            m_aDocumentEventListeners.notifyEach( 
&XDocumentEventListener::documentEventOccured, _rEvent );
+        }
+        catch( const Exception& )
+        {
+               DBG_UNHANDLED_EXCEPTION();
+        }
     }
 
        //--------------------------------------------------------------------
-    void DocumentEventNotifier_Impl::impl_notifyEventAsync_nothrow( const 
document::EventObject& _rEvent )
+    void DocumentEventNotifier_Impl::impl_notifyEventAsync_nothrow( const 
DocumentEvent& _rEvent )
     {
         if ( !m_pEventBroadcaster.is() )
         {
@@ -243,27 +273,41 @@
     }
 
        //--------------------------------------------------------------------
-    void DocumentEventNotifier::addDocumentEventListener( const Reference< 
document::XEventListener >& _Listener ) throw (RuntimeException)
+    void DocumentEventNotifier::addLegacyEventListener( const Reference< 
document::XEventListener >& _Listener ) throw (RuntimeException)
+    {
+        m_pImpl->addLegacyEventListener( _Listener );
+    }
+
+       //--------------------------------------------------------------------
+    void DocumentEventNotifier::removeLegacyEventListener( const Reference< 
document::XEventListener >& _Listener ) throw (RuntimeException)
+    {
+        m_pImpl->removeLegacyEventListener( _Listener );
+    }
+
+       //--------------------------------------------------------------------
+    void DocumentEventNotifier::addDocumentEventListener( const Reference< 
XDocumentEventListener >& _Listener ) throw (RuntimeException)
     {
         m_pImpl->addDocumentEventListener( _Listener );
     }
 
        //--------------------------------------------------------------------
-    void DocumentEventNotifier::removeDocumentEventListener( const Reference< 
document::XEventListener >& _Listener ) throw (RuntimeException)
+    void DocumentEventNotifier::removeDocumentEventListener( const Reference< 
XDocumentEventListener >& _Listener ) throw (RuntimeException)
     {
         m_pImpl->removeDocumentEventListener( _Listener );
     }
 
        //--------------------------------------------------------------------
-    void DocumentEventNotifier::notifyDocumentEvent( const sal_Char* 
_pAsciiEventName )
+    void DocumentEventNotifier::notifyDocumentEvent( const ::rtl::OUString& 
_EventName,
+        const Reference< XController2 >& _ViewController, const Any& 
_Supplement )
     {
-        m_pImpl->notifyDocumentEvent( _pAsciiEventName );
+        m_pImpl->notifyDocumentEvent( _EventName, _ViewController, _Supplement 
);
     }
 
        //--------------------------------------------------------------------
-    void DocumentEventNotifier::notifyDocumentEventAsync( const sal_Char* 
_pAsciiEventName )
+    void DocumentEventNotifier::notifyDocumentEventAsync( const 
::rtl::OUString& _EventName,
+        const Reference< XController2 >& _ViewController, const Any& 
_Supplement )
     {
-        m_pImpl->notifyDocumentEventAsync( _pAsciiEventName );
+        m_pImpl->notifyDocumentEventAsync( _EventName, _ViewController, 
_Supplement );
     }
 
 //........................................................................

File [changed]: documenteventnotifier.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documenteventnotifier.hxx?r1=1.1.2.2&r2=1.1.2.3
Delta lines:  +48 -10
---------------------
--- documenteventnotifier.hxx   2008-07-29 08:24:15+0000        1.1.2.2
+++ documenteventnotifier.hxx   2008-07-29 13:31:08+0000        1.1.2.3
@@ -8,7 +8,7 @@
 *
 * $RCSfile: documenteventnotifier.hxx,v $
 *
-* $Revision: 1.1.2.2 $
+* $Revision: 1.1.2.3 $
 *
 * This file is part of OpenOffice.org.
 *
@@ -33,6 +33,7 @@
 
 /** === begin UNO includes === **/
 #include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/document/XDocumentEventListener.hpp>
 /** === end UNO includes === **/
 
 #include <rtl/ref.hxx>
@@ -57,13 +58,10 @@
         DocumentEventNotifier( ::cppu::OWeakObject& _rBroadcasterDocument, 
::osl::Mutex& _rMutex );
         ~DocumentEventNotifier();
 
-        /** adds an event listener to the list of listeners to be notified of 
document events
-        */
-        void addDocumentEventListener( const ::com::sun::star::uno::Reference< 
::com::sun::star::document::XEventListener >& aListener ) throw 
(::com::sun::star::uno::RuntimeException);
-
-        /** removes an event listener from the list of listeners to be 
notified of document events
-        */
-        void removeDocumentEventListener( const 
::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& 
aListener ) throw (::com::sun::star::uno::RuntimeException);
+        void addLegacyEventListener( const ::com::sun::star::uno::Reference< 
::com::sun::star::document::XEventListener >& _Listener );
+        void removeLegacyEventListener( const 
::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& 
_Listener );
+        void addDocumentEventListener( const ::com::sun::star::uno::Reference< 
::com::sun::star::document::XDocumentEventListener >& _Listener );
+        void removeDocumentEventListener( const 
::com::sun::star::uno::Reference< 
::com::sun::star::document::XDocumentEventListener >& _Listener );
 
         /** disposes the instance
             @precond
@@ -80,6 +78,32 @@
         */
         void    onDocumentInitialized();
 
+        /** notifies a document event described by the given parameters
+
+            @precond
+                the mutex is not locked
+            @precond
+                ->onDocumentInitialized has been called
+        */
+        void    notifyDocumentEvent(
+                    const ::rtl::OUString& _EventName,
+                    const ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XController2 >& _rxViewController = NULL,
+                    const ::com::sun::star::uno::Any& _Supplement = 
::com::sun::star::uno::Any()
+                );
+
+        /** notifies a document event, described by the given parameters, 
asynchronously
+
+            Note that no event is actually notified before you called 
->onDocumentInitialized.
+
+            @precond
+                the mutex is locked
+        */
+        void    notifyDocumentEventAsync(
+                    const ::rtl::OUString& _EventName,
+                    const ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XController2 >& _ViewController = NULL,
+                    const ::com::sun::star::uno::Any& _Supplement = 
::com::sun::star::uno::Any()
+                );
+
         /** notifies a document event to all registered listeners
 
             @precond
@@ -87,7 +111,14 @@
             @precond
                 ->onDocumentInitialized has been called
         */
-        void    notifyDocumentEvent( const sal_Char* _pAsciiEventName );
+        void    notifyDocumentEvent(
+                    const sal_Char* _pAsciiEventName,
+                    const ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XController2 >& _rxViewController = NULL,
+                    const ::com::sun::star::uno::Any& _rSupplement = 
::com::sun::star::uno::Any()
+                )
+        {
+            notifyDocumentEvent( ::rtl::OUString::createFromAscii( 
_pAsciiEventName ), _rxViewController, _rSupplement );
+        }
 
         /** notifies a document event to all registered listeners, 
asynchronously
 
@@ -96,7 +127,14 @@
             @precond
                 the mutex is locked
         */
-        void    notifyDocumentEventAsync( const sal_Char* _pAsciiEventName );
+        void    notifyDocumentEventAsync(
+                    const sal_Char* _pAsciiEventName,
+                    const ::com::sun::star::uno::Reference< 
::com::sun::star::frame::XController2 >& _rxViewController = NULL,
+                    const ::com::sun::star::uno::Any& _rSupplement = 
::com::sun::star::uno::Any()
+                )
+        {
+            notifyDocumentEventAsync( ::rtl::OUString::createFromAscii( 
_pAsciiEventName ), _rxViewController, _rSupplement );
+        }
 
     private:
         ::rtl::Reference< DocumentEventNotifier_Impl >   m_pImpl;

File [changed]: documentevents.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentevents.cxx?r1=1.1.2.4&r2=1.1.2.5
Delta lines:  +15 -1
--------------------
--- documentevents.cxx  2008-07-28 06:25:50+0000        1.1.2.4
+++ documentevents.cxx  2008-07-29 13:31:08+0000        1.1.2.5
@@ -7,7 +7,7 @@
 *
 * $RCSfile: documentevents.cxx,v $
 *
-* $Revision: 1.1.2.4 $
+* $Revision: 1.1.2.5 $
 *
 * This file is part of OpenOffice.org.
 *
@@ -156,6 +156,20 @@
     }
 
     //--------------------------------------------------------------------
+    bool DocumentEvents::needsSynchronousNotification( const ::rtl::OUString& 
_rEventName )
+    {
+        const DocumentEventData* pEventData = lcl_getDocumentEventData();
+        while ( pEventData->pAsciiEventName )
+        {
+            if ( _rEventName.compareToAscii( pEventData->pAsciiEventName ) == 
0 )
+                return pEventData->bNeedsSyncNotify;
+        }
+
+        // this is an unknown event ... assume async notification
+        return false;
+    }
+
+    //--------------------------------------------------------------------
     void SAL_CALL DocumentEvents::replaceByName( const ::rtl::OUString& _Name, 
const Any& _Element ) throw (IllegalArgumentException, NoSuchElementException, 
WrappedTargetException, RuntimeException)
     {
         ::osl::MutexGuard aGuard( m_pData->rMutex );

File [changed]: documentevents.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/documentevents.hxx?r1=1.1.2.1&r2=1.1.2.2
Delta lines:  +4 -2
-------------------
--- documentevents.hxx  2008-07-16 14:22:42+0000        1.1.2.1
+++ documentevents.hxx  2008-07-29 13:31:08+0000        1.1.2.2
@@ -7,7 +7,7 @@
 *
 * $RCSfile: documentevents.hxx,v $
 *
-* $Revision: 1.1.2.1 $
+* $Revision: 1.1.2.2 $
 *
 * This file is part of OpenOffice.org.
 *
@@ -62,6 +62,8 @@
         DocumentEvents( ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex );
         ~DocumentEvents();
 
+        static bool needsSynchronousNotification( const ::rtl::OUString& 
_rEventName );
+
         // XInterface
            virtual void SAL_CALL acquire() throw();
            virtual void SAL_CALL release() throw();




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to