Tag: cws_src680_fwkpostbeta03
User: as      
Date: 05/02/15 01:10:07

Modified:
 /dba/dbaccess/source/core/dataaccess/
  databasedocument.cxx, datasource.cxx, datasource.hxx
 /dba/dbaccess/source/filter/xml/
  dbloader2.cxx
 /dba/dbaccess/source/ui/uno/
  DBTypeWizDlgSetup.cxx

Log:
 #i40349# add db models to global model collection; provide document events for 
all db models

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.9&r2=1.9.12.1
Delta lines:  +38 -12
---------------------
--- databasedocument.cxx        2 Feb 2005 14:01:30 -0000       1.9
+++ databasedocument.cxx        15 Feb 2005 09:10:03 -0000      1.9.12.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: databasedocument.cxx,v $
  *
- *  $Revision: 1.9 $
+ *  $Revision: 1.9.12.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/02/02 14:01:30 $
+ *  last change: $Author: as $ $Date: 2005/02/15 09:10:03 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -134,7 +134,7 @@
 using namespace ::com::sun::star::xml::sax;
 using namespace ::cppu;
 using namespace ::osl;
-
+namespace css = ::com::sun::star;
 //........................................................................
 namespace dbaccess
 {
@@ -145,12 +145,12 @@
        OSubComponent::dispose();
 }
 // 
-----------------------------------------------------------------------------
-void SAL_CALL ODatabaseSource::addEventListener( const Reference< 
XEventListener >& _xListener ) throw (RuntimeException)
+void SAL_CALL ODatabaseSource::addEventListener( const Reference< 
css::lang::XEventListener >& _xListener ) throw (RuntimeException)
 {
        OSubComponent::addEventListener(_xListener);
 }
 // 
-----------------------------------------------------------------------------
-void SAL_CALL ODatabaseSource::removeEventListener( const Reference< 
XEventListener >& _xListener ) throw (RuntimeException)
+void SAL_CALL ODatabaseSource::removeEventListener( const Reference< 
css::lang::XEventListener >& _xListener ) throw (RuntimeException)
 {
        OSubComponent::removeEventListener(_xListener);
 }
@@ -565,6 +565,25 @@
        }
 }
 // 
-----------------------------------------------------------------------------
+// ::com::sun::star::document::XEventBroadcaster
+void SAL_CALL ODatabaseSource::addEventListener(const css::uno::Reference< 
css::document::XEventListener >& _xListener ) throw (css::uno::RuntimeException)
+{
+    m_aDocEventListeners.addInterface(_xListener);
+}
+// 
-----------------------------------------------------------------------------
+void SAL_CALL ODatabaseSource::removeEventListener( const css::uno::Reference< 
css::document::XEventListener >& _xListener ) throw (css::uno::RuntimeException)
+{
+    m_aDocEventListeners.removeInterface(_xListener);
+}
+// 
-----------------------------------------------------------------------------
+// ::com::sun::star::document::XEventListener
+void SAL_CALL ODatabaseSource::notifyEvent( const css::document::EventObject& 
aEvent ) throw (css::uno::RuntimeException)
+{
+    // used only to forward external events (e.g. for doc creation) from the 
frame loader
+    // to the global event broadcaster and all other interested doc event 
listener.
+    notifyEvent(aEvent.EventName);
+}
+// 
-----------------------------------------------------------------------------
 // ::com::sun::star::view::XPrintable
 Sequence< PropertyValue > SAL_CALL ODatabaseSource::getPrinter(  ) throw 
(RuntimeException) 
 {
@@ -718,7 +737,7 @@
                                xStorage = 
xMyStorage->openStorageElement(_sStorageName, m_bDocumentReadOnly ? 
ElementModes::READ : nMode);
                                Reference<XComponent> xComp(xStorage,UNO_QUERY);
                                if ( xComp.is() )
-                                       xComp->addEventListener(this);
+                                       xComp->addEventListener(static_cast< 
css::document::XEventListener* >(this));
                                aFind = 
m_aStorages.insert(TStorages::value_type(_sStorageName,xStorage)).first;
                        }
                        catch(Exception&)
@@ -1090,10 +1109,17 @@
 // 
-----------------------------------------------------------------------------
 void ODatabaseSource::notifyEvent(const ::rtl::OUString& _sEventName)
 {
-    if ( m_xDocEventBroadcaster.is() )
+       try
+       {
+               ResettableMutexGuard _rGuard(m_aMutex);
+               if (OComponentHelper::rBHelper.bDisposed)
+                       throw DisposedException();
+               
+               css::document::EventObject aEvt(*this, _sEventName);
+               
NOTIFY_LISTERNERS(m_aDocEventListeners,css::document::XEventListener,notifyEvent)
+       }
+       catch(Exception&)
     {
-        ::com::sun::star::document::EventObject aEvent(*this, _sEventName);
-        m_xDocEventBroadcaster->notifyEvent(aEvent);
     }
 }
 // 
-----------------------------------------------------------------------------

File [changed]: datasource.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/datasource.cxx?r1=1.54&r2=1.54.12.1
Delta lines:  +8 -13
--------------------
--- datasource.cxx      2 Feb 2005 13:59:34 -0000       1.54
+++ datasource.cxx      15 Feb 2005 09:10:03 -0000      1.54.12.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: datasource.cxx,v $
  *
- *  $Revision: 1.54 $
+ *  $Revision: 1.54.12.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/02/02 13:59:34 $
+ *  last change: $Author: as $ $Date: 2005/02/15 09:10:03 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -164,6 +164,7 @@
 using namespace ::vos;
 using namespace ::dbtools;
 using namespace ::comphelper;
+namespace css = ::com::sun::star;
 
 //........................................................................
 namespace dbaccess
@@ -531,6 +532,7 @@
                        ,m_aModifyListeners(m_aMutex)
                        ,m_aCloseListener(m_aMutex)
                        ,m_aFlushListeners(m_aMutex)
+                       ,m_aDocEventListeners(m_aMutex)
                        ,m_pDBContext(_pDBContext)
                        ,m_nControllerLockCount(0)
 {
@@ -565,6 +567,7 @@
                        ,m_aModifyListeners(m_aMutex)
                        ,m_aCloseListener(m_aMutex)
                        ,m_aFlushListeners(m_aMutex)
+                       ,m_aDocEventListeners(m_aMutex)
                        ,m_pDBContext(_pDBContext)
                        ,m_nControllerLockCount(0)
 {
@@ -590,15 +593,6 @@
        m_bReadOnly = sal_False;
        m_aContainer.resize(4);
        m_pChildCommitListen = NULL;
-    try
-    {
-        
m_xDocEventBroadcaster.set(m_xServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.GlobalEventBroadcaster"))),
-            UNO_QUERY);
-    }
-    catch(Exception)
-    {
-        OSL_ENSURE(0,"Could not create GlobalEventBroadcaster!");
-    }
 }
 // 
-----------------------------------------------------------------------------
 void ODatabaseSource::setMeAsParent(const Reference< XNameAccess >& _xName)
@@ -805,6 +799,7 @@
        m_aModifyListeners.disposeAndClear( aDisposeEvent );
        m_aCloseListener.disposeAndClear( aDisposeEvent );
        m_aFlushListeners.disposeAndClear( aDisposeEvent );
+       m_aDocEventListeners.disposeAndClear( aDisposeEvent );
 
        ::std::vector<TContentPtr>::iterator aIter = m_aContainer.begin();
        ::std::vector<TContentPtr>::iterator aEnd = m_aContainer.end();
@@ -1314,7 +1309,7 @@
        {
                Reference< XComponent> xComp(xConn,UNO_QUERY);
                if ( xComp.is() )
-                       xComp->addEventListener(this);
+                       xComp->addEventListener(static_cast< 
css::document::XEventListener* >(this));
                m_aConnections.push_back(OWeakConnection(xConn));
        }
 

File [changed]: datasource.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/datasource.hxx?r1=1.25&r2=1.25.14.1
Delta lines:  +17 -5
--------------------
--- datasource.hxx      2 Feb 2005 13:59:48 -0000       1.25
+++ datasource.hxx      15 Feb 2005 09:10:04 -0000      1.25.14.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: datasource.hxx,v $
  *
- *  $Revision: 1.25 $
+ *  $Revision: 1.25.14.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/02/02 13:59:48 $
+ *  last change: $Author: as $ $Date: 2005/02/15 09:10:04 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -110,6 +110,9 @@
 #ifndef _CPPUHELPER_IMPLBASE9_HXX_
 #include <cppuhelper/implbase9.hxx>
 #endif
+#ifndef _CPPUHELPER_IMPLBASE11_HXX_
+#include <cppuhelper/implbase11.hxx>
+#endif
 #ifndef _DBASHARED_APITOOLS_HXX_
 #include "apitools.hxx"
 #endif
@@ -211,7 +214,7 @@
                                                        >       
ODatabaseSource_Base;
 
 
-typedef ::cppu::ImplHelper9    <       ::com::sun::star::frame::XModel
+typedef ::cppu::ImplHelper11<  ::com::sun::star::frame::XModel
                                                        ,       
::com::sun::star::util::XModifiable
                                                        ,       
::com::sun::star::frame::XStorable
                                                        ,       
::com::sun::star::view::XPrintable
@@ -220,6 +223,8 @@
                                                        ,       
::com::sun::star::util::XCloseable
                                                        ,       
::drafts::com::sun::star::ui::XUIConfigurationManagerSupplier
                                                        ,       
::com::sun::star::document::XDocumentSubStorageSupplier
+                                                       ,       
::com::sun::star::document::XEventBroadcaster
+                                                       ,       
::com::sun::star::document::XEventListener
                                                        >       
ODatabaseSource_OfficeDocument; 
 
 
@@ -288,12 +293,12 @@
        ::cppu::OInterfaceContainerHelper                                       
m_aModifyListeners;
        ::cppu::OInterfaceContainerHelper                                       
m_aCloseListener;
        ::cppu::OInterfaceContainerHelper                                       
m_aFlushListeners;
+       ::cppu::OInterfaceContainerHelper                                       
m_aDocEventListeners;
 
        ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XEventListener>                                       
m_xSharedConnectionManager;
        ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController> 
                                        m_xCurrentController;
        ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >   
                                        m_xStorage;
        ::com::sun::star::uno::Reference< 
::drafts::com::sun::star::ui::XUIConfigurationManager>        
m_xUIConfigurationManager;
-    ::com::sun::star::uno::Reference< 
::com::sun::star::document::XEventListener >              
m_xDocEventBroadcaster;
 
 
        ODatabaseContext*                                                       
                m_pDBContext;
@@ -477,6 +482,13 @@
        virtual sal_Bool SAL_CALL isModified(  ) throw 
(::com::sun::star::uno::RuntimeException) ;
     virtual void SAL_CALL setModified( sal_Bool bModified ) throw 
(::com::sun::star::beans::PropertyVetoException, 
::com::sun::star::uno::RuntimeException) ;
 
+// ::com::sun::star::document::XEventBroadcaster
+    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);
+    
+// ::com::sun::star::document::XEventListener
+    virtual void SAL_CALL notifyEvent( const 
::com::sun::star::document::EventObject& aEvent ) throw 
(::com::sun::star::uno::RuntimeException);
+    
 // ::com::sun::star::view::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) ;

Directory: /dba/dbaccess/source/filter/xml/
===========================================

File [changed]: dbloader2.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/dbloader2.cxx?r1=1.6&r2=1.6.12.1
Delta lines:  +11 -11
---------------------
--- dbloader2.cxx       2 Feb 2005 14:00:07 -0000       1.6
+++ dbloader2.cxx       15 Feb 2005 09:10:04 -0000      1.6.12.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: dbloader2.cxx,v $
  *
- *  $Revision: 1.6 $
+ *  $Revision: 1.6.12.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/02/02 14:00:07 $
+ *  last change: $Author: as $ $Date: 2005/02/15 09:10:04 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -177,6 +177,7 @@
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::document;
 using namespace ::com::sun::star::registry;
+namespace css = ::com::sun::star;
 
 // -------------------------------------------------------------------------
 namespace dbaxml
@@ -466,17 +467,16 @@
 
         try
         {
-            Reference< ::com::sun::star::document::XEventListener > 
xDocEventBroadcaster(m_xServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.GlobalEventBroadcaster"))),
-                UNO_QUERY);
-            if ( xDocEventBroadcaster.is() )
-            {
-                ::com::sun::star::document::EventObject aEvent(xModel, 
bCreateNew ? ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnNew")) : 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnLoad")));
+            Reference< css::container::XSet > 
xModelCollection(m_xServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.GlobalEventBroadcaster"))),UNO_QUERY_THROW);
+            xModelCollection->insert(css::uno::makeAny(xModel));
+
+            Reference< css::document::XEventListener > 
xDocEventBroadcaster(xModel,UNO_QUERY_THROW);
+            css::document::EventObject aEvent(xModel, bCreateNew ? 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnNew")) : 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnLoad")));
                 xDocEventBroadcaster->notifyEvent(aEvent);
             }
-        }
         catch(Exception)
         {
-            OSL_ENSURE(0,"Could not create GlobalEventBroadcaster!");
+            OSL_ENSURE(0,"Could not add database model to global model 
collection and broadcast the events OnNew/OnLoad!");
         }
                rListener->loadFinished(this);        
        }

Directory: /dba/dbaccess/source/ui/uno/
=======================================

File [changed]: DBTypeWizDlgSetup.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/uno/DBTypeWizDlgSetup.cxx?r1=1.3&r2=1.3.12.1
Delta lines:  +14 -11
---------------------
--- DBTypeWizDlgSetup.cxx       2 Feb 2005 14:00:23 -0000       1.3
+++ DBTypeWizDlgSetup.cxx       15 Feb 2005 09:10:04 -0000      1.3.12.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: DBTypeWizDlgSetup.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.12.1 $
  *
- *  last change: $Author: rt $ $Date: 2005/02/02 14:00:23 $
+ *  last change: $Author: as $ $Date: 2005/02/15 09:10:04 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -65,6 +65,9 @@
 #ifndef _COM_SUN_STAR_DOCUMENT_XEVENTLISTENER_HPP_
 #include <com/sun/star/document/XEventListener.hpp>
 #endif
+#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
+#include <com/sun/star/container/XSet.hpp>
+#endif
 #ifndef DBAUI_DBTYPEWIZDLGSETUP_HXX
 #include "DBTypeWizDlgSetup.hxx"
 #endif
@@ -73,6 +76,7 @@
 #endif
 
 using namespace dbaui;
+namespace css = ::com::sun::star;
                          
 extern "C" void SAL_CALL createRegistryInfo_ODBTypeWizDialogSetup()
 {
@@ -119,17 +123,16 @@
 
     try
     {
-        Reference< ::com::sun::star::document::XEventListener > 
xDocEventBroadcaster(_rxFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.GlobalEventBroadcaster"))),
-            UNO_QUERY);
-        if ( xDocEventBroadcaster.is() )
-        {
-            ::com::sun::star::document::EventObject aEvent(xDBContext, 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnNew")) );
+        Reference< css::container::XSet > 
xModelCollection(_rxFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.GlobalEventBroadcaster"))),UNO_QUERY_THROW);
+        xModelCollection->insert(css::uno::makeAny(xDBContext));
+
+        Reference< css::document::XEventListener > 
xDocEventBroadcaster(xDBContext,UNO_QUERY_THROW);
+        ::com::sun::star::document::EventObject aEvent(xDBContext, 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnNew")));
             xDocEventBroadcaster->notifyEvent(aEvent);
         }
-    }
     catch(Exception)
     {
-        OSL_ENSURE(0,"Could not create GlobalEventBroadcaster!");
+        OSL_ENSURE(0,"Could not create append model to global model 
collectiona and broadcaste document events for it!");
     }
     Reference <com::sun::star::ui::dialogs::XExecutableDialog> 
xDBWizardExecute( xDBWizard, UNO_QUERY );
     xDBWizardExecute->execute();




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

Reply via email to