Tag: cws_src680_oj17 User: oj Date: 06/04/10 00:30:17 Modified: /dba/dbaccess/source/core/dataaccess/ databasedocument.cxx
Log: RESYNC: (1.25-1.26); FILE MERGED File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: databasedocument.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/databasedocument.cxx?r1=1.25.22.3&r2=1.25.22.4 Delta lines: +49 -12 --------------------- --- databasedocument.cxx 20 Mar 2006 11:32:01 -0000 1.25.22.3 +++ databasedocument.cxx 10 Apr 2006 07:30:14 -0000 1.25.22.4 @@ -105,6 +105,9 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif +#ifndef _CPPUHELPER_EXC_HLP_HXX_ +#include <cppuhelper/exc_hlp.hxx> +#endif #ifndef BOOST_BIND_HPP_INCLUDED #include <boost/bind.hpp> @@ -344,6 +347,20 @@ 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->m_aControllers.empty() ) + { + // if this was the last view, close the document as a whole + // #i51157# / 2006-03-16 / [EMAIL PROTECTED] + try + { + close( sal_True ); + } + catch( const CloseVetoException& ) + { + // okay, somebody vetoed and took ownership + } + } } // ----------------------------------------------------------------------------- void SAL_CALL ODatabaseDocument::lockControllers( ) throw (RuntimeException) @@ -445,9 +462,7 @@ if ( m_pImpl->m_bDocumentReadOnly ) throw IOException(); - m_bCommitMasterStorage = sal_False; m_pImpl->commitStorages(); - m_bCommitMasterStorage = sal_True; Reference<XStorage> xMyStorage = m_pImpl->getStorage(); OSL_ENSURE( xMyStorage.is(), "ODatabaseDocument::storeToURL: no own storage?" ); @@ -484,16 +499,39 @@ Sequence<Any> aParam(2); aParam[0] <<= _rURL; aParam[1] <<= ElementModes::READWRITE | ElementModes::TRUNCATE; + Reference<XStorage> xStorage; + ::rtl::OUString sOriginalExceptionType; + ::rtl::OUString sOriginalExceptionMessage; try { xStorage.set(xStorageFactory->createInstanceWithArguments( aParam ),UNO_QUERY); } - catch(Exception&) + catch ( const Exception& e ) { + Any aException( ::cppu::getCaughtException() ); + sOriginalExceptionType = aException.getValueTypeName(); + sOriginalExceptionMessage = e.Message; } + if ( !xStorage.is() ) - throw IOException(); + { + // TODO: localize this + ::rtl::OUString sMessage = ::rtl::OUString::createFromAscii( "Could not store the database document to '" ); + sMessage += _rURL; + sMessage += ::rtl::OUString::createFromAscii( "'." ); + if ( sOriginalExceptionMessage.getLength() ) + { + sMessage += ::rtl::OUString::createFromAscii( "\noriginal error message: " ); + sMessage += sOriginalExceptionMessage; + } + if ( sOriginalExceptionType.getLength() ) + { + sMessage += ::rtl::OUString::createFromAscii( "\noriginal error type: " ); + sMessage += sOriginalExceptionType; + } + throw IOException( sMessage, *this ); + } if ( m_pImpl->isEmbeddedDatabase() ) m_pImpl->clearConnections(); @@ -743,7 +781,6 @@ aGuard.reset(); } - DBG_ASSERT( m_pImpl->m_aControllers.empty(), "ODatabaseDocument::close: aren't controllers expected to veto the closing?" ); impl_closeControllerFrames( _bDeliverOwnership ); { @@ -1038,8 +1075,8 @@ } DBG_ASSERT( m_pImpl->m_aControllers.empty(), "ODatabaseDocument::disposing: there still are controllers!" ); - // normally, nobody should explicitly dispose, but only XCloseable::close the document. And controllers - // are expected to veto the closing, so when we're here, there shouldn't be any controllers anymore. + // normally, nobody should explicitly dispose, but only XCloseable::close the document.An upon + // closing, our controllers are closed, too m_pImpl->m_aControllers.clear(); Reference< XModel > xHoldAlive( this ); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
