User: obo     
Date: 2006/07/13 08:21:04

Modified:
   dba/dbaccess/source/core/dataaccess/databasecontext.cxx

Log:
 INTEGRATION: CWS dba204a (1.33.30); FILE MERGED
 2006/07/06 06:12:53 oj 1.33.30.1: #i66629# listen at documentmodelimpl and not 
any longer at the ds

File Changes:

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

File [changed]: databasecontext.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasecontext.cxx?r1=1.33&r2=1.34
Delta lines:  +32 -62
---------------------
--- databasecontext.cxx 29 Mar 2006 12:33:33 -0000      1.33
+++ databasecontext.cxx 13 Jul 2006 15:21:01 -0000      1.34
@@ -483,33 +483,17 @@
 }
 
 
//------------------------------------------------------------------------------
-void SAL_CALL ODatabaseContext::disposing( const 
com::sun::star::lang::EventObject& _rSource ) throw(RuntimeException)
+void ODatabaseContext::storeTransientProperties( ODatabaseModelImpl& 
_rModelImpl)
 {
-       Reference< XInterface > xSource(_rSource.Source, UNO_QUERY);
-               // the query is for normalizing, else it could be XInterface 
part of any XInterface-derived concrete interface
-               // the object implements
-       ObjectCacheIterator aLookup;
-       for     (       aLookup = m_aDatabaseObjects.begin();
-                       aLookup != m_aDatabaseObjects.end();
-                       ++aLookup
-               )
-       {
-               Reference< XInterface > 
xDataSource(aLookup->second->getDataSource(false), UNO_QUERY);
-               if ( xDataSource == xSource )
-                       break;
-       }
-       DBG_ASSERT(aLookup != m_aDatabaseObjects.end(), 
"ODatabaseContext::disposing(EventObject): where does this come from (not from 
my data sources)?");
-       if (aLookup != m_aDatabaseObjects.end())
-       {
+    Reference< XPropertySet > xSource(_rModelImpl.getDataSource(),UNO_QUERY);
                Sequence< PropertyValue > aRememberProps;
 
                try
                {
                        // get the info about the properties, check which ones 
are transient and not readonly
-                       Reference< XPropertySet > xSourceProps(xSource, 
UNO_QUERY);
                        Reference< XPropertySetInfo > xSetInfo;
-                       if (xSourceProps.is())
-                               xSetInfo = xSourceProps->getPropertySetInfo();
+               if (xSource.is())
+                       xSetInfo = xSource->getPropertySetInfo();
                        Sequence< Property > aProperties;
                        if (xSetInfo.is())
                                aProperties = xSetInfo->getProperties();
@@ -526,7 +510,7 @@
                                                // found such a property
                                                sal_Int32 nTilNow = 
aRememberProps.getLength();
                                                aRememberProps.realloc(nTilNow 
+ 1);
-                                               aRememberProps[nTilNow] = 
PropertyValue(pProperties->Name, 0, 
xSourceProps->getPropertyValue(pProperties->Name), PropertyState_DIRECT_VALUE);
+                                       aRememberProps[nTilNow] = 
PropertyValue(pProperties->Name, 0, 
xSource->getPropertyValue(pProperties->Name), PropertyState_DIRECT_VALUE);
                                        }
                                }
                        }
@@ -536,8 +520,11 @@
                        DBG_ERROR("ODatabaseContext::disposing(EventObject): 
could not collect the session-persistent properties!");
                }
 
-               m_aDatasourceProperties[aLookup->first] = aRememberProps;
-       }
+    if ( m_aDatabaseObjects.find( _rModelImpl.m_sRealFileURL ) != 
m_aDatabaseObjects.end() )
+           m_aDatasourceProperties[_rModelImpl.m_sRealFileURL] = 
aRememberProps;
+    else if ( m_aDatabaseObjects.find( _rModelImpl.m_sName ) != 
m_aDatabaseObjects.end() )
+           m_aDatasourceProperties[_rModelImpl.m_sName] = aRememberProps;
+
 }
 
 
//------------------------------------------------------------------------------
@@ -572,19 +559,7 @@
                // check if URL is already loaded
                ObjectCacheIterator aExistent = m_aDatabaseObjects.find(sURL);
                if ( aExistent != m_aDatabaseObjects.end() )
-               {
-                       xExistent = aExistent->second->getDataSource(false);
-                       if (xExistent.is())
-                       {
-                               Reference< XComponent > xComponent(xExistent, 
UNO_QUERY);
-                               if ( xComponent.is() )
-                               {
-                                       Reference<XEventListener> 
xListenerHelper(*this,UNO_QUERY);
-                                       
xComponent->removeEventListener(xListenerHelper);
-                               }
-                       }
                        m_aDatabaseObjects.erase(aExistent);
-               }
                if (!aDbRegisteredNamesRoot.removeNode(_rName))
                        throw 
Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("An unexpected und 
unknown error occured.")), static_cast<XNamingService*>(this));
                aDbRegisteredNamesRoot.commit();
@@ -726,11 +701,6 @@
 
                Reference<XDataSource> xDs = _pModelImpl->getDataSource();
         setTransientProperties(_sName,xDs);
-               // add as dispose listener to the data source object, so we 
know when it's dying to save the session-persistent
-               // properties
-               Reference< XComponent > xComponent(xDs,UNO_QUERY);
-               if ( xComponent.is() )
-                       xComponent->addEventListener(this);
        }
 }
 // 
-----------------------------------------------------------------------------




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

Reply via email to