Tag: cws_src680_hsqldb4
User: fs      
Date: 05/03/31 01:18:38

Modified:
 /dba/dbaccess/source/core/dataaccess/
  ModelImpl.cxx, ModelImpl.hxx, databasedocument.cxx
 /dba/dbaccess/source/filter/xml/
  dbloader2.cxx

Log:
 pseudo-resync to m90, which is not ready yet (and thus not available to real 
resync)

File Changes:

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

File [changed]: ModelImpl.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.cxx?r1=1.3&r2=1.3.6.1
Delta lines:  +50 -47
---------------------
--- ModelImpl.cxx       23 Mar 2005 09:45:22 -0000      1.3
+++ ModelImpl.cxx       31 Mar 2005 09:18:34 -0000      1.3.6.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: ModelImpl.cxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.6.1 $
  *
- *  last change: $Author: vg $ $Date: 2005/03/23 09:45:22 $
+ *  last change: $Author: fs $ $Date: 2005/03/31 09:18:34 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -282,7 +282,7 @@
 // 
-----------------------------------------------------------------------------
 ::rtl::OUString ODatabaseModelImpl::getURL(  )
 {
-      return m_sFileURL;
+      return m_sRealFileURL;
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseModelImpl::disposing( const 
::com::sun::star::lang::EventObject& Source ) throw(RuntimeException)
@@ -290,29 +290,20 @@
        Reference<XConnection> xCon(Source.Source,UNO_QUERY);
        if ( xCon.is() )
        {
-               sal_Bool bStore = sal_False;
+               bool bStore = false;
                OWeakConnectionArray::iterator aEnd = m_aConnections.end();
                for (OWeakConnectionArray::iterator i = m_aConnections.begin(); 
aEnd != i; ++i)
                {
                        if ( xCon == i->get() )
                        {
                                *i = OWeakConnection();
+                bStore = true;
+                break;
                        }
                }
                
                if ( bStore )
-               {
-                       try
-                       {
-                               Reference<XTransactedObject> 
xTransact(getStorage(),UNO_QUERY);
-                               if ( xTransact.is() )
-                                       xTransact->commit();
-                       }
-                       catch(Exception)
-                       {
-                               OSL_ENSURE(0,"Exception Caught: Could not store 
embedded database!");
-                       }
-               }
+            commitRootStorage();
        }
        else // storage
        {
@@ -374,18 +365,7 @@
         sal_Bool bStore = commitEmbeddedStorage();
         disposeStorages();
         if ( bStore )
-        {
-            try
-            {
-                Reference<XTransactedObject> xTransact(getStorage(),UNO_QUERY);
-                if ( xTransact.is() )
-                    xTransact->commit();
-            }
-            catch(Exception)
-            {
-                OSL_ENSURE(0,"Exception Caught: Could not store embedded 
database!");
-            }
-        }
+            commitRootStorage();
 
         if ( m_bOwnStorage )
                    ::comphelper::disposeComponent(m_xStorage);
@@ -438,14 +418,37 @@
     m_bDisposingSubStorages = sal_False;
 }
 // 
-----------------------------------------------------------------------------
+Reference< XSingleServiceFactory > ODatabaseModelImpl::createStorageFactory() 
const
+{
+    return Reference< XSingleServiceFactory >(
+        m_xServiceFactory->createInstance(
+            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.embed.StorageFactory" ) )
+        ),
+        UNO_QUERY
+    );
+}
+// 
-----------------------------------------------------------------------------
+void ODatabaseModelImpl::commitRootStorage()
+{
+       try
+       {
+               Reference< XTransactedObject > xTransact( getStorage(), 
UNO_QUERY );
+        OSL_ENSURE( xTransact.is() || !getStorage().is(), 
"ODatabaseModelImpl::commitRootStorage: cannot commit the storage (missing 
interface)!" );
+               if ( xTransact.is() )
+                       xTransact->commit();
+       }
+       catch(Exception)
+       {
+        OSL_ENSURE( false, "ODatabaseModelImpl::commitRootStorage: caught an 
exception!" );
+       }
+}
+// 
-----------------------------------------------------------------------------
 Reference<XStorage> ODatabaseModelImpl::getStorage()
 {
        if ( !m_xStorage.is() )
        {
-               Reference< XSingleServiceFactory> xStorageFactory;
-               xStorageFactory.set(m_xServiceFactory->createInstance( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory"))),UNO_QUERY);
-
-               if ( xStorageFactory.is() && m_sFileURL.getLength() )
+               Reference< XSingleServiceFactory> xStorageFactory = 
createStorageFactory();
+        if ( xStorageFactory.is() && m_sRealFileURL.getLength() )
                {
                        Sequence<Any> aArgs(2);
             const PropertyValue* pEnd = m_aArgs.getConstArray() + 
m_aArgs.getLength();
@@ -471,8 +474,8 @@
 
                            if ( pValue && pValue != pEnd )
                                    aArgs[0] = pValue->Value;
-                           else if ( m_sFileURL.getLength() )
-                                   aArgs[0] <<= m_sFileURL;
+                else if ( m_sRealFileURL.getLength() )
+                    aArgs[0] <<= m_sRealFileURL;
             }
 
             if ( aArgs[0].hasValue() )
@@ -629,7 +632,7 @@
        {
                clear();
                dispose();
-               m_pDBContext->deregisterPrivate(m_sFileURL);
+        m_pDBContext->deregisterPrivate(m_sRealFileURL);
                delete this;
                return 0;
        }

File [changed]: ModelImpl.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.hxx?r1=1.3&r2=1.3.6.1
Delta lines:  +36 -15
---------------------
--- ModelImpl.hxx       23 Mar 2005 09:45:36 -0000      1.3
+++ ModelImpl.hxx       31 Mar 2005 09:18:34 -0000      1.3.6.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: ModelImpl.hxx,v $
  *
- *  $Revision: 1.3 $
+ *  $Revision: 1.3.6.1 $
  *
- *  last change: $Author: vg $ $Date: 2005/03/23 09:45:36 $
+ *  last change: $Author: fs $ $Date: 2005/03/31 09:18:34 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -74,6 +74,9 @@
 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #endif
+#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#endif
 #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINERLISTENER_HPP_
 #include <com/sun/star/container/XContainerListener.hpp>
 #endif
@@ -222,7 +225,18 @@
        ::com::sun::star::uno::WeakReference< 
::com::sun::star::container::XNameAccess >        m_xForms;
        ::com::sun::star::uno::WeakReference< 
::com::sun::star::container::XNameAccess >        m_xReports;
 
+    /// the URL the document was loaded from
        ::rtl::OUString                                                         
                m_sFileURL;
+    /** the URL which the document should report as it's URL
+
+        This might differ from ->m_sFileURL in case the document was loaded
+        as part of a crash recovery process. In this case, ->m_sFileURL points 
to
+        the temporary file where the DB had been saved to, after a crash.
+        ->m_sRealFileURL then is the URL of the document which actually had
+        been recovered.
+    */
+    ::rtl::OUString                                     m_sRealFileURL;
+
 // <properties>
        ::com::sun::star::uno::Reference< 
::com::sun::star::util::XNumberFormatsSupplier >
                                                                                
                                m_xNumberFormatsSupplier;
@@ -358,6 +372,13 @@
     // disposes all elements in m_aStorages, and clears it
     void    disposeStorages() SAL_THROW(());
 
+    /// creates a ->com::sun::star::embed::StorageFactory
+    ::com::sun::star::uno::Reference< 
::com::sun::star::lang::XSingleServiceFactory >
+            createStorageFactory() const;
+
+    /// commits our storage
+    void    commitRootStorage();
+
        void clearConnections();
        
        ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage> 
getStorage();

File [changed]: databasedocument.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.cxx?r1=1.15&r2=1.15.6.1
Delta lines:  +237 -334
-----------------------
--- databasedocument.cxx        23 Mar 2005 09:46:04 -0000      1.15
+++ databasedocument.cxx        31 Mar 2005 09:18:35 -0000      1.15.6.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: databasedocument.cxx,v $
  *
- *  $Revision: 1.15 $
+ *  $Revision: 1.15.6.1 $
  *
- *  last change: $Author: vg $ $Date: 2005/03/23 09:46:04 $
+ *  last change: $Author: fs $ $Date: 2005/03/31 09:18:35 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -233,25 +233,44 @@
 // 
-----------------------------------------------------------------------------
 // local functions
 // 
-----------------------------------------------------------------------------
-void lcl_convertArguments(const Sequence< PropertyValue >& 
_aArguments,Sequence< PropertyValue >& _rArgs)
+void lcl_stripLoadArguments( ::comphelper::MediaDescriptor& _rDescriptor, 
Sequence< PropertyValue >& _rArgs )
 {
-    static ::rtl::OUString 
s_sStatusIndicator(RTL_CONSTASCII_USTRINGPARAM("StatusIndicator"));
-    static ::rtl::OUString 
s_sInteractionHandler(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler"));
-       static ::rtl::OUString s_sModel(RTL_CONSTASCII_USTRINGPARAM("Model"));
-    ::comphelper::MediaDescriptor aMedia(_aArguments);
-    aMedia.erase(s_sStatusIndicator);
-    aMedia.erase(s_sInteractionHandler);
-       aMedia.erase(s_sModel);
-    aMedia >> _rArgs;
+    _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"StatusIndicator" ) ) );
+    _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"InteractionHandler" ) ) );
+       _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"Model" ) ) );
+    _rDescriptor >> _rArgs;
 }
 // 
-----------------------------------------------------------------------------
+void lcl_extractAndStartStatusIndicator( const ::comphelper::MediaDescriptor& 
_rDescriptor, Reference< XStatusIndicator >& _rxStatusIndicator,
+    Sequence< Any >& _rCallArgs )
+{
+    try
+    {
+        _rxStatusIndicator = _rDescriptor.getUnpackedValueOrDefault( 
_rDescriptor.PROP_STATUSINDICATOR(), _rxStatusIndicator );
+        if ( _rxStatusIndicator.is() )
+        {
+                   _rxStatusIndicator->start( ::rtl::OUString(), 
(sal_Int32)1000000 );
+
+            sal_Int32 nLength = _rCallArgs.getLength();
+            _rCallArgs.realloc( nLength + 1 );
+            _rCallArgs[ nLength ] <<= _rxStatusIndicator;
+        }
+    }
+    catch( const Exception& )
+    {
+       OSL_ENSURE( sal_False, "lcl_extractAndStartStatusIndicator: caught an 
exception!" );
+    }
+}
+
+// 
-----------------------------------------------------------------------------
 // XModel
 // ATTENTION: The Application controller attaches the same resource to force a 
reload.
-sal_Bool SAL_CALL ODatabaseDocument::attachResource( const ::rtl::OUString& 
_sURL, const Sequence< PropertyValue >& _aArguments ) throw (RuntimeException) 
+sal_Bool SAL_CALL ODatabaseDocument::attachResource( const ::rtl::OUString& 
_rURL, const Sequence< PropertyValue >& _aArguments ) throw (RuntimeException)
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
+
        try
        {
                m_pImpl->clearConnections();
@@ -284,39 +303,33 @@
        
        m_pImpl->m_bDocumentReadOnly = sal_False;
 
-    lcl_convertArguments(_aArguments,m_pImpl->m_aArgs);
+       ::comphelper::MediaDescriptor aDescriptor( _aArguments );
+    lcl_stripLoadArguments( aDescriptor, m_pImpl->m_aArgs );
+
+    m_pImpl->m_sFileURL = _rURL;
+    m_pImpl->m_sRealFileURL = aDescriptor.getUnpackedValueOrDefault(
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SalvagedFile" ) ), 
_rURL );
+    if ( !m_pImpl->m_sRealFileURL.getLength() )
+        m_pImpl->m_sRealFileURL = m_pImpl->m_sFileURL;
 
-    m_pImpl->m_sFileURL = _sURL;
        if ( !m_pImpl->m_sName.getLength() )
-               m_pImpl->m_sName = m_pImpl->m_sFileURL;
+        m_pImpl->m_sName = m_pImpl->m_sRealFileURL;
        
        m_pImpl->getStorage();
 
        try
        {
-        static ::rtl::OUString 
s_sStatusIndicator(RTL_CONSTASCII_USTRINGPARAM("StatusIndicator"));
-               const PropertyValue* pValue 
=::std::find_if(_aArguments.getConstArray(),
-                                                                               
                        _aArguments.getConstArray() + _aArguments.getLength(),
-                                                                               
                        
::std::bind2nd(::comphelper::TPropertyValueEqualFunctor(),s_sStatusIndicator));
-
                Sequence<Any> aFilterArgs;
         Reference<XStatusIndicator> xStatusIndicator;
-               if ( pValue && pValue != (_aArguments.getConstArray() + 
_aArguments.getLength()) )
-               {
-                       xStatusIndicator.set(pValue->Value,UNO_QUERY);
+        lcl_extractAndStartStatusIndicator( aDescriptor, xStatusIndicator, 
aFilterArgs );
 
-                       // set progress range and start status indicator
-                       sal_Int32 nProgressRange(1000000);
-                       if (xStatusIndicator.is())
-                       {
-                               xStatusIndicator->start(::rtl::OUString(), 
nProgressRange);
-                               aFilterArgs.realloc( 1 );
-                               Any *pArgs = aFilterArgs.getArray();
-                               *pArgs++ <<= xStatusIndicator;
-                       }
-               }
-
-               Reference<XImporter> 
xImporter(m_pImpl->m_xServiceFactory->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sdb.DBFilter")),aFilterArgs),UNO_QUERY);
+               Reference<XImporter> xImporter(
+            m_pImpl->m_xServiceFactory->createInstanceWithArguments(
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"com.sun.star.comp.sdb.DBFilter" ) ),
+                aFilterArgs
+            ),
+            UNO_QUERY
+        );
 
                if ( xImporter.is() )
                {
@@ -341,7 +354,7 @@
        }
     if ( m_pImpl->m_pDBContext )
     {
-               m_pImpl->m_pDBContext->registerPrivate(_sURL,m_pImpl);
+        
m_pImpl->m_pDBContext->registerPrivate(m_pImpl->m_sRealFileURL,m_pImpl);
         m_pImpl->setModified(sal_False);
     }
        return sal_True;
@@ -349,92 +362,98 @@
 // 
-----------------------------------------------------------------------------
 ::rtl::OUString SAL_CALL ODatabaseDocument::getURL(  ) throw 
(RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
-       return m_pImpl->m_sFileURL;
+
+    return m_pImpl->m_sRealFileURL;
 }
 // 
-----------------------------------------------------------------------------
 Sequence< PropertyValue > SAL_CALL ODatabaseDocument::getArgs(  ) throw 
(RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
+
        return m_pImpl->m_aArgs;
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseDocument::connectController( const Reference< 
XController >& _xController ) throw (RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
+
        m_pImpl->m_aControllers.push_back(_xController);
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseDocument::disconnectController( const Reference< 
XController >& _xController ) throw (RuntimeException) 
 {
+       ClearableMutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-    {
-           MutexGuard aGuard(m_aMutex);
+
            
m_pImpl->m_aControllers.erase(::std::find(m_pImpl->m_aControllers.begin(),m_pImpl->m_aControllers.end(),_xController));
            if ( m_pImpl->m_xCurrentController == _xController )
                    m_pImpl->m_xCurrentController = NULL;
-    }
+
        if ( m_pImpl.is() && m_pImpl->m_aControllers.empty() )
+    {
+        aGuard.clear();
                dispose();
+    }
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseDocument::lockControllers(  ) throw (RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);    
+
        ++m_pImpl->m_nControllerLockCount;
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseDocument::unlockControllers(  ) throw 
(RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
        
        --m_pImpl->m_nControllerLockCount;
 }
 // 
-----------------------------------------------------------------------------
 sal_Bool SAL_CALL ODatabaseDocument::hasControllersLocked(  ) throw 
(RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
        
        return m_pImpl->m_nControllerLockCount != 0;
 }
 // 
-----------------------------------------------------------------------------
 Reference< XController > SAL_CALL ODatabaseDocument::getCurrentController() 
throw (RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
        
        return m_pImpl->m_xCurrentController.is() ? 
m_pImpl->m_xCurrentController : ( m_pImpl->m_aControllers.empty() ? Reference< 
XController >() : *m_pImpl->m_aControllers.begin() );
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseDocument::setCurrentController( const Reference< 
XController >& _xController ) throw (NoSuchElementException, RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
        
        m_pImpl->m_xCurrentController = _xController;
 }
 // 
-----------------------------------------------------------------------------
 Reference< XInterface > SAL_CALL ODatabaseDocument::getCurrentSelection(  ) 
throw (RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
-       
 
        Reference< XInterface > xRet;
        Reference< XSelectionSupplier >  xDocView( getCurrentController(), 
UNO_QUERY );
@@ -448,45 +467,47 @@
 // XStorable
 sal_Bool SAL_CALL ODatabaseDocument::hasLocation(  ) throw (RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
        
-       return m_pImpl->m_sFileURL.getLength() != 0;
+    return m_pImpl->m_sRealFileURL.getLength() != 0;
 }
 // 
-----------------------------------------------------------------------------
 ::rtl::OUString SAL_CALL ODatabaseDocument::getLocation(  ) throw 
(RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
        
-       return m_pImpl->m_sFileURL;
+    return m_pImpl->m_sRealFileURL;
 }
 // 
-----------------------------------------------------------------------------
 sal_Bool SAL_CALL ODatabaseDocument::isReadonly(  ) throw (RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
        
        return m_pImpl->m_bDocumentReadOnly;
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseDocument::store(  ) throw (IOException, 
RuntimeException) 
 {
+    MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
-       
        
-       store(m_pImpl->m_sFileURL,m_pImpl->m_aArgs);
+    if ( m_pImpl->m_sFileURL == m_pImpl->m_sRealFileURL )
+           store( m_pImpl->m_sFileURL, m_pImpl->m_aArgs );
+    else
+        storeAsURL( m_pImpl->m_sRealFileURL, m_pImpl->m_aArgs );
 
     notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnSaveDone")));
 }
 // 
-----------------------------------------------------------------------------
-void ODatabaseDocument::store(const ::rtl::OUString& sURL
-                                                        ,const Sequence< 
PropertyValue >& lArguments)
+void ODatabaseDocument::store(const ::rtl::OUString& _rURL
+                                                        ,const Sequence< 
PropertyValue >& _rArguments)
 {
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
        if ( m_pImpl->m_bDocumentReadOnly )
@@ -494,41 +515,38 @@
 
     m_pImpl->commitStorages();
 
-       writeStorage(sURL,lArguments,m_pImpl->getStorage());
+       writeStorage(_rURL,_rArguments,m_pImpl->getStorage());
+
+    m_pImpl->commitRootStorage();
 
-       try
-       {
-               Reference<XTransactedObject> 
xTransact(m_pImpl->getStorage(),UNO_QUERY);
-               if ( xTransact.is() )
-                       xTransact->commit();
-       }
-       catch(Exception)
-       {
-       }
        setModified(sal_False);
 }
 // 
-----------------------------------------------------------------------------
-void SAL_CALL ODatabaseDocument::storeAsURL( const ::rtl::OUString& sURL, 
const Sequence< PropertyValue >& lArguments ) throw (IOException, 
RuntimeException) 
+void SAL_CALL ODatabaseDocument::storeAsURL( const ::rtl::OUString& _rURL, 
const Sequence< PropertyValue >& _rArguments ) throw (IOException, 
RuntimeException)
 {
+       ClearableMutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       ClearableMutexGuard aGuard(m_aMutex);
-       
        
-       Reference<XSingleServiceFactory> 
xStorageFactory(m_pImpl->m_xServiceFactory->createInstance( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory"))
 ),UNO_QUERY);
+    Reference< XSingleServiceFactory > xStorageFactory( 
m_pImpl->createStorageFactory() );
        if ( xStorageFactory.is() )
        {
-        sal_Bool bClearConnections;
-               if ( bClearConnections = (sURL != m_pImpl->m_sFileURL) )
+        // don't use _rURL - we might be recovering/salvaging a file currently 
...
+        // #i45314# / 2005-03-21 / [EMAIL PROTECTED]
+           ::comphelper::MediaDescriptor aDescriptor( _rArguments );
+
+        sal_Bool bLocationChanged = ( _rURL != m_pImpl->m_sFileURL );
+               if ( bLocationChanged )
                {
                        Sequence<Any> aParam(2);
-                       aParam[0] <<= sURL;
+                       aParam[0] <<= _rURL;
                        aParam[1] <<= ElementModes::READWRITE  | 
ElementModes::TRUNCATE;
                        Reference<XStorage> xStorage;
                        try     
                        {       
                                
xStorage.set(xStorageFactory->createInstanceWithArguments( aParam ),UNO_QUERY);
-                       }catch(Exception        &)              
+                       }
+            catch(Exception&)
                        {       
                        }       
                        if ( !xStorage.is() )
@@ -554,54 +572,76 @@
                 m_pImpl->m_bOwnStorage = sal_True;
 
                        m_pImpl->m_bDocumentReadOnly = sal_False;
-                       if ( sURL != m_pImpl->m_sFileURL )
+            if ( _rURL != m_pImpl->m_sRealFileURL )
                        {
                                if ( m_pImpl->m_pDBContext )
                                {
-                    if ( m_pImpl->m_sFileURL.getLength() )
-                        
m_pImpl->m_pDBContext->nameChangePrivate(m_pImpl->m_sFileURL,sURL);
+                    if ( m_pImpl->m_sRealFileURL.getLength() )
+                        
m_pImpl->m_pDBContext->nameChangePrivate(m_pImpl->m_sRealFileURL,_rURL);
                     else
-                        m_pImpl->m_pDBContext->registerPrivate(sURL,m_pImpl);
+                        m_pImpl->m_pDBContext->registerPrivate(_rURL,m_pImpl);
                 }
 
-                               INetURLObject aURL( sURL );
+                               INetURLObject aURL( _rURL );
                                if( aURL.GetProtocol() != INET_PROT_NOT_VALID )
-                                       m_pImpl->m_sName = sURL;
+                                       m_pImpl->m_sName = _rURL;
                        }
-                       m_pImpl->m_sFileURL = sURL;
+            m_pImpl->m_sRealFileURL = m_pImpl->m_sFileURL = _rURL;
                }
-               lcl_convertArguments(lArguments,m_pImpl->m_aArgs);
-               store(m_pImpl->m_sFileURL,lArguments);
+               lcl_stripLoadArguments( aDescriptor, m_pImpl->m_aArgs );
+               store(m_pImpl->m_sFileURL,_rArguments);
         
notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnSaveAsDone")));
        }
        else
                throw IOException();
 }
 // 
-----------------------------------------------------------------------------
-void SAL_CALL ODatabaseDocument::storeToURL( const ::rtl::OUString& sURL, 
const Sequence< PropertyValue >& lArguments ) throw (IOException, 
RuntimeException) 
+void SAL_CALL ODatabaseDocument::storeToURL( const ::rtl::OUString& _rURL, 
const Sequence< PropertyValue >& _rArguments ) throw (IOException, 
RuntimeException)
 {
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
        MutexGuard aGuard(m_aMutex);
        
-       Reference<XSingleServiceFactory> 
xStorageFactory(m_pImpl->m_xServiceFactory->createInstance( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory"))
 ),UNO_QUERY);
+    Reference< XSingleServiceFactory > xStorageFactory( 
m_pImpl->createStorageFactory() );
+       Sequence<Any> aParam(2);
+       aParam[0] <<= _rURL;
+       aParam[1] <<= ElementModes::READWRITE  | ElementModes::TRUNCATE;
+       Reference<XStorage> xStorage;
        if ( xStorageFactory.is() )
+        xStorage = xStorage.query( 
xStorageFactory->createInstanceWithArguments( aParam ) );
+    OSL_ENSURE( xStorage.is(), "ODatabaseDocument::storeToURL: no storage 
factory!" );
+       if ( !xStorage.is() )
        {
+        IOException aError;
+        aError.Message = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Could 
not create a target storage." ) );
+        aError.Context = *this;
+               throw IOException( aError );
+    }
+
                Reference<XStorage> xMyStorage = m_pImpl->getStorage();
-               if ( xMyStorage.is() )
+    OSL_ENSURE( xMyStorage.is(), "ODatabaseDocument::storeToURL: no own 
storage?" );
+       if ( !xMyStorage.is() )
                {
-                       Sequence<Any> aParam(2);
-                       aParam[0] <<= sURL;
-                       aParam[1] <<= ElementModes::READWRITE  | 
ElementModes::TRUNCATE;
-                       Reference<XStorage> 
xStorage(xStorageFactory->createInstanceWithArguments( aParam ),UNO_QUERY);
-                       if ( !xStorage.is() )
-                               throw IOException();
+        IOException aError;
+        aError.Message = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( 
"Internal error: no source storage available." ) );
+        aError.Context = *this;
+               throw IOException( aError );
+    }
+
+    // storeTo - i.e. copying a copy of our document to another location - 
requires
+    // the embedded DB to shut down. To ensure this, we need to dispose all 
connections
+    // which are currently open.
+    // TODO: wouldn't an explicit XEmbeddedDatabase::shutdown be much better 
than this implicit,
+    // error-prone handling?
+    // #i45314# / 2005-03-23 / [EMAIL PROTECTED]
+    if ( m_pImpl->isEmbeddedDatabase() )
+        m_pImpl->clearConnections();
 
             m_bCommitMasterStorage = sal_False;
                        m_pImpl->commitEmbeddedStorage();
             m_bCommitMasterStorage = sal_True;
                        xMyStorage->copyToStorage( xStorage );
-                       writeStorage(sURL,lArguments,xStorage);
+       writeStorage(_rURL,_rArguments,xStorage);
                        try
                {
                        Reference<XTransactedObject> 
xTransact(xStorage,UNO_QUERY);
@@ -613,10 +653,6 @@
                        OSL_ENSURE(0,"Exception Caught: Could not store 
database!");
                                throw IOException();
                }
-               }
-               else
-                       throw IOException();
-       }
 }
 // 
-----------------------------------------------------------------------------
 // XModifyBroadcaster
@@ -635,17 +671,17 @@
 // XModifiable
 sal_Bool SAL_CALL ODatabaseDocument::isModified(  ) throw (RuntimeException) 
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
        
        return m_pImpl->m_bModified;
 }
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseDocument::setModified( sal_Bool _bModified ) throw 
(PropertyVetoException, RuntimeException) 
 {
-    
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     ResettableMutexGuard _rGuard(m_aMutex);
+    
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
        
        if ( m_pImpl->m_bModified != _bModified )
        {
@@ -692,9 +728,9 @@
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseDocument::close( sal_Bool bDeliverOwnership ) throw 
(::com::sun::star::util::CloseVetoException, RuntimeException)
 {
+       ResettableMutexGuard _rGuard(m_aMutex);
        
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
 
-       ResettableMutexGuard _rGuard(m_aMutex);
        lang::EventObject aEvt( static_cast< ::cppu::OWeakObject* >( this ) );
        
NOTIFY_LISTERNERS1(m_aCloseListener,com::sun::star::util::XCloseListener,queryClosing,bDeliverOwnership);
 
@@ -732,10 +768,9 @@
 // 
-----------------------------------------------------------------------------
 Reference< XNameAccess > SAL_CALL ODatabaseDocument::getFormDocuments(  ) 
throw (RuntimeException)
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
-       
 
        Reference< XNameAccess > xContainer = m_pImpl->m_xForms;
        if ( !xContainer.is() )
@@ -755,10 +790,9 @@
 // 
-----------------------------------------------------------------------------
 Reference< XNameAccess > SAL_CALL ODatabaseDocument::getReportDocuments(  ) 
throw (RuntimeException)
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
-       
 
        Reference< XNameAccess > xContainer = m_pImpl->m_xReports;
        if ( !xContainer.is() )
@@ -805,8 +839,7 @@
        Reference<XSeekable> xSeek(xStreamProp,UNO_QUERY);
        if ( xSeek.is() )
        {
-               sal_Int64 nPos = xSeek->getPosition();
-               OSL_TRACE("Length of stream %d",&nPos);
+        OSL_TRACE("Length of stream %i",(int)xSeek->getPosition());
                xSeek->seek(0);
        }
 
@@ -890,57 +923,23 @@
        return xFilter->filter( rMediaDesc );
 }
 // 
-----------------------------------------------------------------------------
-void ODatabaseDocument::writeStorage(const ::rtl::OUString& _sURL
-                                                                       ,const 
Sequence< PropertyValue >& lArguments
+void ODatabaseDocument::writeStorage(const ::rtl::OUString& _rURL
+                                                                       ,const 
Sequence< PropertyValue >& _rArguments
                                                                        ,const 
Reference<XStorage>& _xStorageToSaveTo)
 {
        // create XStatusIndicator
        Reference<XStatusIndicator> xStatusIndicator;
-       try
-       {
-               const PropertyValue* pValue 
=::std::find_if(lArguments.getConstArray(),
-                                                                               
                        lArguments.getConstArray() + lArguments.getLength(),
-                                                                               
                        
::std::bind2nd(::comphelper::TPropertyValueEqualFunctor(),::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StatusIndicator"))));
-
-               if ( pValue && pValue != (lArguments.getConstArray() + 
lArguments.getLength()) )
-               {
-                       xStatusIndicator.set(pValue->Value,UNO_QUERY);
-
-                       // set progress range and start status indicator
-                       sal_Int32 nProgressRange(1000000);
-                       if ( xStatusIndicator.is() )
-                               xStatusIndicator->start(::rtl::OUString(), 
nProgressRange);
-               }
-       }
-       catch( const RuntimeException& )
-       {
-               xStatusIndicator = NULL;
-       }
-
-       // filter arguments
-       // - status indicator
-       // - else empty
-       sal_Int32 nArgs = 0;
-       if( xStatusIndicator.is() )
-               nArgs++;
-
-       Sequence < Any > aEmptyArgs( nArgs );
-       Any *pArgs = aEmptyArgs.getArray();
-       if( xStatusIndicator.is() )
-               *pArgs++ <<= xStatusIndicator;
-
-       Sequence < Any > aFilterArgs( nArgs );
-       pArgs = aFilterArgs.getArray();
-       if( xStatusIndicator.is() )
-               *pArgs++ <<= xStatusIndicator;
+    Sequence< Any > aDelegatorArguments;
+       ::comphelper::MediaDescriptor aDescriptor( _rArguments );
+    lcl_extractAndStartStatusIndicator( aDescriptor, xStatusIndicator, 
aDelegatorArguments );
 
        // properties
-       Sequence < PropertyValue > aProps( _sURL.getLength() ? 1 : 0 );
-       if( _sURL.getLength() )
+       Sequence < PropertyValue > aProps( _rURL.getLength() ? 1 : 0 );
+       if( _rURL.getLength() )
        {
                PropertyValue *pProps = aProps.getArray();
                pProps->Name = ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM("FileName") );
-               (pProps++)->Value <<= _sURL;
+               (pProps++)->Value <<= _rURL;
        }
 
        // export sub streams for package, else full stream into a file
@@ -962,7 +961,7 @@
                if( !WriteThroughComponent(
                        xCom, "settings.xml", 
                        "com.sun.star.comp.sdb.XMLSettingsExporter",
-                       aEmptyArgs, aProps, sal_True,_xStorageToSaveTo ) )
+                       aDelegatorArguments, aProps, sal_True,_xStorageToSaveTo 
) )
                {
                        if( !bWarn )
                        {
@@ -978,7 +977,7 @@
                if( !WriteThroughComponent(
                                xCom, "content.xml", 
                                "com.sun.star.comp.sdb.DBExportFilter",
-                               aFilterArgs, aProps, sal_True,_xStorageToSaveTo 
) )
+                               aDelegatorArguments, aProps, 
sal_True,_xStorageToSaveTo ) )
                {
                        bErr = sal_True;
                        sErrFile = String( 
RTL_CONSTASCII_STRINGPARAM("content.xml"),
@@ -993,9 +992,9 @@
 // 
-----------------------------------------------------------------------------
 Reference< ::com::sun::star::ui::XUIConfigurationManager > SAL_CALL 
ODatabaseDocument::getUIConfigurationManager(  ) throw (RuntimeException)
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
        
        if ( !m_xUIConfigurationManager.is() )
     {
@@ -1038,10 +1037,9 @@
 // 
-----------------------------------------------------------------------------
 Reference< XStorage > SAL_CALL ODatabaseDocument::getDocumentSubStorage( const 
::rtl::OUString& aStorageName, sal_Int32 nMode ) throw (RuntimeException)
 {
+       MutexGuard aGuard(m_aMutex);
     
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
     OSL_ENSURE(m_pImpl.is(),"Impl is NULL");
-       MutexGuard aGuard(m_aMutex);
-       
 
        Reference< XStorage > xResult = 
m_pImpl->getStorage(aStorageName,this,nMode);
        if ( xResult.is() )
@@ -1068,92 +1066,6 @@
        aRet[nPos++] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reports"));
        return aRet;
 }
-/*
-// 
-----------------------------------------------------------------------------
-void SAL_CALL ODatabaseDocument::loadFromStorage( const Reference< XStorage >& 
xStorage, const Sequence< PropertyValue >& aMediaDescriptor ) throw 
(IllegalArgumentException, DoubleInitializationException, 
::com::sun::star::io::IOException, Exception, RuntimeException)
-{
-    MutexGuard aGuard(m_aMutex);
-    
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
-    if ( m_pImpl->m_xStorage.is() )
-        throw DoubleInitializationException();
-}
-// 
-----------------------------------------------------------------------------
-void SAL_CALL ODatabaseDocument::storeToStorage( const Reference< XStorage >& 
xStorage, const Sequence< PropertyValue >& lArguments ) throw 
(IllegalArgumentException, ::com::sun::star::io::IOException, Exception, 
RuntimeException)
-{
-    MutexGuard aGuard(m_aMutex);
-    
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
-    Reference<XStorage> xMyStorage = getStorage();
-    if ( xMyStorage.is() )
-    {
-        if ( !m_pImpl->m_bDocumentReadOnly )
-            store(m_pImpl->m_sFileURL,lArguments);
-        if ( xStorage != xMyStorage )
-            xMyStorage->copyToStorage( xStorage );
-    }
-}
-// 
-----------------------------------------------------------------------------
-void SAL_CALL ODatabaseDocument::switchToStorage( const Reference< XStorage >& 
xStorage ) throw (IllegalArgumentException, ::com::sun::star::io::IOException, 
Exception, RuntimeException)
-{
-    MutexGuard aGuard(m_aMutex);
-    
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
-    sal_Bool bResult = sal_False;
-    Reference<XStorage> xMyStorage = getStorage();
-    Reference<XNameAccess> xMyName(xMyStorage,UNO_QUERY);
-    if ( xMyName.is() )
-    {
-        Sequence< ::rtl::OUString> aSeq = xMyName->getElementNames();
-        const ::rtl::OUString* pIter = aSeq.getConstArray();
-        const ::rtl::OUString* pEnd     = pIter + aSeq.getLength();
-        for(;pIter != pEnd;++pIter)
-        {
-            Reference<XEmbedPersist> 
xPersist(xMyName->getByName(*pIter),UNO_QUERY);
-                   if ( xPersist.is() )
-            {
-                try
-                                   {
-                                           xPersist->setPersistentEntry( 
xStorage,
-                                                    *pIter,
-                                                                               
                    EntryInitModes::NO_INIT,
-                                                                               
                    Sequence< PropertyValue >(),
-                                                                               
                    Sequence< PropertyValue >() );
-
-                                   }
-                                   catch( uno::Exception& )
-                                   {
-                        // TODO/LATER: error handling
-                                           bResult = sal_False;
-                                           break;
-                                   }
-            }
-        }
-        bResult = sal_True;
-    }
-
-    if ( !bResult )
-        throw task::ErrorCodeIOException( ::rtl::OUString(),
-                                                                               
        Reference< XInterface >(),
-                                                                               
        ERRCODE_IO_GENERAL );
-    m_pImpl->m_xStorage = xStorage;
-    m_pImpl->m_bOwnStorage = sal_False;
-}
-// 
-----------------------------------------------------------------------------
-Reference< XStorage > SAL_CALL ODatabaseDocument::getDocumentStorage(  ) throw 
(::com::sun::star::io::IOException, Exception, RuntimeException)
-{
-    MutexGuard aGuard(m_aMutex);
-    
::connectivity::checkDisposed(ODatabaseDocument_OfficeDocument::rBHelper.bDisposed);
-    return getStorage();
-}
-// 
-----------------------------------------------------------------------------
-void SAL_CALL ODatabaseDocument::addStorageChangeListener( const Reference< 
::com::sun::star::document::XStorageChangeListener >& xListener ) throw 
(RuntimeException)
-{
-    m_pImpl->m_aStorageListeners.addInterface(xListener);
-}
-// 
-----------------------------------------------------------------------------
-void SAL_CALL ODatabaseDocument::removeStorageChangeListener( const Reference< 
::com::sun::star::document::XStorageChangeListener >& xListener ) throw 
(RuntimeException)
-{
-    m_pImpl->m_aStorageListeners.removeInterface(xListener);
-}
-*/
 // 
-----------------------------------------------------------------------------
 void ODatabaseDocument::notifyEvent(const ::rtl::OUString& _sEventName)
 {
@@ -1293,16 +1205,7 @@
         Reference<XStorage> xStorage(aEvent.Source,UNO_QUERY);
            if ( aFind != m_pImpl->m_aStorages.end() && aFind->second == 
xStorage )
            {
-            try
-               {
-                       Reference<XTransactedObject> 
xTransact(m_pImpl->getStorage(),UNO_QUERY);
-                       if ( xTransact.is() )
-                               xTransact->commit();
-               }
-               catch(Exception)
-               {
-                       OSL_ENSURE(0,"Exception Caught: Could not store 
embedded database!");
-               }
+            m_pImpl->commitRootStorage();
         }
     }
 }

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.10&r2=1.10.4.1
Delta lines:  +24 -32
---------------------
--- dbloader2.cxx       23 Mar 2005 09:48:21 -0000      1.10
+++ dbloader2.cxx       31 Mar 2005 09:18:35 -0000      1.10.4.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: dbloader2.cxx,v $
  *
- *  $Revision: 1.10 $
+ *  $Revision: 1.10.4.1 $
  *
- *  last change: $Author: vg $ $Date: 2005/03/23 09:48:21 $
+ *  last change: $Author: fs $ $Date: 2005/03/31 09:18:35 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -320,10 +320,6 @@
 class DBContentLoader : public ::cppu::WeakImplHelper2< XFrameLoader, 
XServiceInfo>
 {
 private:
-       ::rtl::OUString                                         m_aURL;
-       Sequence< PropertyValue>                        m_aArgs;
-       Reference< XLoadEventListener >         m_xListener;
-       Reference< XFrame >                             m_xFrame;
        Reference< XMultiServiceFactory >       m_xServiceFactory;
        Reference< XFrameLoader >                       m_xMySelf;
        ::rtl::OUString                                         m_sCurrentURL;
@@ -407,14 +403,14 @@
 }
 
 // -----------------------------------------------------------------------
-void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const 
::rtl::OUString& rURL,
+void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const 
::rtl::OUString& _rURL,
                const Sequence< PropertyValue >& rArgs,
                const Reference< XLoadEventListener > & rListener) 
throw(::com::sun::star::uno::RuntimeException)
 {
 
        // first check if preview is true, if so return with out creating a 
controller. Preview is not supported
        ::comphelper::SequenceAsHashMap lDescriptor(rArgs);
-       sal_Bool            bPreview = 
lDescriptor.getUnpackedValueOrDefault(INFO_PREVIEW          , sal_False         
                        );
+       sal_Bool bPreview = lDescriptor.getUnpackedValueOrDefault(INFO_PREVIEW, 
sal_False );
        if ( bPreview )
        {
                if (rListener.is())
@@ -423,10 +419,9 @@
        }
        Reference< XModel > xModel   = 
lDescriptor.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Model")),
 Reference< XModel >());
 
-       m_xFrame        = rFrame;
-       m_xListener = rListener;
-       m_aURL          = rURL;
-       m_aArgs         = rArgs;
+    ::rtl::OUString sSalvagedURL = lDescriptor.getUnpackedValueOrDefault(
+        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SalvagedFile" ) ), 
_rURL );
+       Sequence< PropertyValue > aLoadArgs( rArgs );
 
        sal_Bool bCreateNew = sal_False;
        sal_Bool bInteractive = sal_False;
@@ -440,12 +435,12 @@
                Reference< XSingleServiceFactory > 
xDatabaseContext(m_xServiceFactory->createInstance(SERVICE_SDB_DATABASECONTEXT),
 UNO_QUERY);         
                if ( xDatabaseContext.is() )
                {               
-                       bCreateNew = 
rURL.match(SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::E_DATABASE));
+                       bCreateNew = 
_rURL.match(SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::E_DATABASE));
                        Sequence<Any> aCreationArgs;
                        if ( !bCreateNew )
                        {
                                aCreationArgs.realloc(1);
-                               aCreationArgs[0] <<= 
NamedValue(INFO_POOLURL,makeAny(rURL));
+                               aCreationArgs[0] <<= NamedValue( INFO_POOLURL, 
makeAny( sSalvagedURL ) );
                        }
                        else
             {
@@ -460,7 +455,7 @@
                     if ( xTransformer.is() )
                     {
                         URL aURL;
-                        aURL.Complete = m_aURL;
+                        aURL.Complete = _rURL;
                         xTransformer->parseStrict( aURL );
                         bInteractive = aURL.Arguments.equalsAscii( 
"Interactive" );
                     }
@@ -481,14 +476,11 @@
        {
                try
                {
-                       // ich benutze nicht maURL, sondern rURL, denn zwischen 
dem Constructor und diesem Load hier kann sich die ::com::sun::star::util::URL 
des Objektes
-                       // schon geaendert haben (zum Beispiel durch Umbenennen)
+                       aLoadArgs.realloc(aLoadArgs.getLength()+1);
+                       aLoadArgs[aLoadArgs.getLength()-1].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FileName"));
+                       aLoadArgs[aLoadArgs.getLength()-1].Value <<= _rURL;
 
-                       m_aArgs.realloc(m_aArgs.getLength()+1);
-                       m_aArgs[m_aArgs.getLength()-1].Name = 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FileName"));
-                       m_aArgs[m_aArgs.getLength()-1].Value <<= rURL;
-
-                       xModel->attachResource(rURL,m_aArgs);
+                       xModel->attachResource( _rURL, aLoadArgs );
                }
                catch(Exception&)
                {
@@ -500,7 +492,7 @@
 
     if ( bInteractive )
     {
-        Sequence< Any > aArgs(2);
+        Sequence< Any > aWizardArgs(2);
         Reference< ::com::sun::star::awt::XWindow> xWindow;
            // get the top most window
            if ( rFrame.is() )
@@ -515,18 +507,18 @@
                            xWindow = xFrame->getContainerWindow();
            }
            // the parent window
-               aArgs[0] <<= PropertyValue( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")),
+               aWizardArgs[0] <<= PropertyValue( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentWindow")),
                                                                        0,
                                                                        
makeAny(xWindow),
                                                                        
PropertyState_DIRECT_VALUE);
-        aArgs[1] <<= PropertyValue( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InitialSelection")),
+        aWizardArgs[1] <<= PropertyValue( 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InitialSelection")),
                                     0,
                                     makeAny(xModel),
                                     PropertyState_DIRECT_VALUE);
 
                // create the dialog
                Reference< XExecutableDialog > xAdminDialog(
-            
m_xServiceFactory->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseWizardDialog")),aArgs),
 UNO_QUERY);
+            
m_xServiceFactory->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.DatabaseWizardDialog")),aWizardArgs),
 UNO_QUERY);
 
                // execute it
                if ( bSuccess = xAdminDialog.is() && RET_OK == 
xAdminDialog->execute() )
@@ -555,23 +547,23 @@
                    {
                            Reference<XInitialization > 
xIni(xController,UNO_QUERY);
                            PropertyValue 
aProp(::rtl::OUString::createFromAscii("Frame"),0,makeAny(rFrame),PropertyState_DIRECT_VALUE);
-                           Sequence< Any > aArgs(m_aArgs.getLength() + 2);
+                           Sequence< Any > aInitArgs( aLoadArgs.getLength() + 
2 );
 
-                           Any* pArgIter = aArgs.getArray();
-                           Any* pEnd   = pArgIter + aArgs.getLength();
+                           Any* pArgIter = aInitArgs.getArray();
+                           Any* pEnd   = pArgIter + aInitArgs.getLength();
                            *pArgIter++ <<= aProp;
 
                            aProp.Name = URL_INTERACTIVE;
                            aProp.Value <<= bInteractive;
                            *pArgIter++ <<= aProp;
 
-                           const PropertyValue* pIter          = 
m_aArgs.getConstArray();
+                           const PropertyValue* pIter = 
aLoadArgs.getConstArray();
                            for(++pArgIter;pArgIter != pEnd;++pArgIter,++pIter)
                            {
                                    *pArgIter <<= *pIter;
                            }
 
-                           xIni->initialize(aArgs);
+                           xIni->initialize(aInitArgs);
                    }
                    catch(Exception&)
                    {




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

Reply via email to