Tag: cws_src680_oj17
User: oj      
Date: 06/04/10 00:30:38

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

Log:
 RESYNC: (1.66-1.67); FILE MERGED

File Changes:

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

File [changed]: datasource.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/datasource.cxx?r1=1.66.32.2&r2=1.66.32.3
Delta lines:  +25 -26
---------------------
--- datasource.cxx      22 Mar 2006 07:34:40 -0000      1.66.32.2
+++ datasource.cxx      10 Apr 2006 07:30:35 -0000      1.66.32.3
@@ -109,6 +109,9 @@
 #ifndef _COMPHELPER_GUARDING_HXX_
 #include <comphelper/guarding.hxx>
 #endif
+#ifndef UNOTOOLS_INC_SHAREDUNOCOMPONENT_HXX
+#include <unotools/sharedunocomponent.hxx>
+#endif
 #ifndef DBA_CORE_SHARED_CONNECTION_HXX
 #include "SharedConnection.hxx"
 #endif
@@ -1262,20 +1265,27 @@
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODatabaseSource::flush(  ) throw (RuntimeException)
 {
-    ModelMethodGuard aGuard( *this );
        try
        {
-        SharedModel xModel( impl_getModel( true ) );
-        Reference< css::frame::XStorable> xStorable( xModel, UNO_QUERY );
-        if ( xStorable.is() )
+        {
+            ModelMethodGuard aGuard( *this );
+
+            typedef ::utl::SharedUNOComponent< XModel, 
::utl::CloseableComponent > SharedModel;
+            SharedModel xModel( m_pImpl->getModel_noCreate(), 
SharedModel::NoTakeOwnership );
+
+            if ( !xModel.is() )
+                xModel.reset( m_pImpl->createNewModel_deliverOwnership(), 
SharedModel::TakeOwnership );
+
+            Reference< css::frame::XStorable> xStorable( xModel, 
UNO_QUERY_THROW );
             xStorable->store();
+        }
 
         css::lang::EventObject aFlushedEvent(*this);
-        aGuard.clear();
         m_aFlushListeners.notifyEach( &XFlushListener::flushed, aFlushedEvent 
);
        }
-       catch(Exception&)
+       catch( const Exception& )
        {
+        DBG_UNHANDLED_EXCEPTION();
        }
 }
 
@@ -1344,27 +1354,16 @@
                m_pImpl->setModified(sal_True);
 }
 // 
-----------------------------------------------------------------------------
-ODatabaseSource::SharedModel ODatabaseSource::impl_getModel( bool 
_bTakeOwnershipIfNewlyCreated )
-{
-    SharedModel xModel;
-    if ( m_pImpl.is() )
-    {
-        xModel.reset( m_pImpl->getModel_noCreate(), 
SharedModel::NoTakeOwnership );
-        if ( !xModel.is() )
-            xModel.reset( m_pImpl->createNewModel_deliverOwnership(), 
_bTakeOwnershipIfNewlyCreated ? SharedModel::TakeOwnership : 
SharedModel::NoTakeOwnership );
-    }
-    return xModel;
-}
-// 
-----------------------------------------------------------------------------
 // XDocumentDataSource
 Reference< XOfficeDatabaseDocument > SAL_CALL 
ODatabaseSource::getDatabaseDocument() throw (RuntimeException)
 {
     ModelMethodGuard aGuard( *this );
-    return Reference< XOfficeDatabaseDocument >( impl_getModel( false ), 
UNO_QUERY );
-    // by definition, clients of getDatabaseDocument are responsible for the 
model they obtain,
-    // including responsibility for (attempting to) close the model when they 
don't need it anymore.
-    // Thus the "false" parameter in the call to impl_getModel: We don't take 
the ownership
-    // of the model, even if it had to be newly created during this call.
+
+    Reference< XModel > xModel( m_pImpl->getModel_noCreate() );
+    if ( !xModel.is() )
+        xModel = m_pImpl->createNewModel_deliverOwnership();
+
+    return Reference< XOfficeDatabaseDocument >( xModel, UNO_QUERY );
 }
 // 
-----------------------------------------------------------------------------
 Reference< XInterface > ODatabaseSource::getThis()




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

Reply via email to