Tag: cws_src680_warnings01
User: sb      
Date: 06/04/07 13:47:21

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

Log:
 RESYNC: (1.65-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.65.28.1&r2=1.65.28.2
Delta lines:  +27 -28
---------------------
--- datasource.cxx      24 Mar 2006 15:35:52 -0000      1.65.28.1
+++ datasource.cxx      7 Apr 2006 20:47:18 -0000       1.65.28.2
@@ -108,6 +108,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
@@ -584,7 +587,7 @@
                                                aRet.push_back( 
*pDataSourceSetting );
                                        }
                                }
-                               
+                               if ( !aRet.empty() )
                                return Sequence< PropertyValue 
>(&(*aRet.begin()),aRet.size()); 
                        }
                        return Sequence< PropertyValue >();
@@ -1254,20 +1257,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();
        }
 }
 
@@ -1336,27 +1346,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