User: obo Date: 06/03/29 04:34:21 Modified: /dba/dbaccess/source/core/dataaccess/ datasource.cxx
Log: INTEGRATION: CWS dba203a (1.66.20); FILE MERGED 2006/03/16 09:54:22 fs 1.66.20.1: #i63162# no SharedModel anymore 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&r2=1.67 Delta lines: +22 -23 --------------------- --- datasource.cxx 25 Jan 2006 13:44:20 -0000 1.66 +++ datasource.cxx 29 Mar 2006 12:34:19 -0000 1.67 @@ -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 @@ -1258,20 +1261,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(); } } @@ -1340,27 +1350,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]
