Tag: cws_dev300_dba30c User: fs Date: 2008-05-13 08:27:25+0000 Modified: dba/dbaccess/source/core/dataaccess/ModelImpl.cxx
Log: joining changes from CWS odbmacros3 to CWS dba30c: 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.26.4.3&r2=1.26.4.4 Delta lines: +25 -24 --------------------- --- ModelImpl.cxx 2008-05-09 08:23:53+0000 1.26.4.3 +++ ModelImpl.cxx 2008-05-13 08:27:22+0000 1.26.4.4 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: ModelImpl.cxx,v $ - * $Revision: 1.26.4.3 $ + * $Revision: 1.26.4.4 $ * * This file is part of OpenOffice.org. * @@ -44,22 +44,9 @@ /** === begin UNO includes === **/ #include <com/sun/star/document/MacroExecMode.hpp> -#include <com/sun/star/document/XExporter.hpp> -#include <com/sun/star/document/XFilter.hpp> -#include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/XTransactionBroadcaster.hpp> -#include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/reflection/XProxyFactory.hpp> #include <com/sun/star/sdb/BooleanComparisonMode.hpp> -#include <com/sun/star/sdbc/XDriverAccess.hpp> -#include <com/sun/star/sdbc/XDriverManager.hpp> -#include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#include <com/sun/star/task/XStatusIndicator.hpp> -#include <com/sun/star/ucb/XInteractionSupplyAuthentication.hpp> -#include <com/sun/star/view/XSelectionSupplier.hpp> -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <com/sun/star/script/DocumentScriptLibraryContainer.hpp> #include <com/sun/star/script/DocumentDialogLibraryContainer.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> @@ -100,7 +87,6 @@ using namespace ::com::sun::star::view; using namespace ::com::sun::star::task; using namespace ::com::sun::star::reflection; -using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::script; using namespace ::cppu; using namespace ::osl; @@ -720,7 +706,7 @@ if ( !m_xDocumentStorage.is() ) { Reference< XSingleServiceFactory> xStorageFactory = createStorageFactory(); - if ( xStorageFactory.is() && m_sDocumentURL.getLength() ) + if ( xStorageFactory.is() ) { Any aSource; ::comphelper::NamedValueCollection aArgs( m_aArgs ); @@ -728,8 +714,9 @@ aSource = aArgs.get( "Stream" ); if ( !aSource.hasValue() ) aSource = aArgs.get( "InputStream" ); - if ( !aSource.hasValue() && m_sDocumentURL.getLength() ) - aSource <<= m_sDocumentURL; + if ( !aSource.hasValue() && m_sDocFileLocation.getLength() ) + aSource <<= m_sDocFileLocation; + // TODO: shouldn't we also check URL? OSL_ENSURE( aSource.hasValue(), "ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from!" ); @@ -1179,6 +1166,22 @@ } // ----------------------------------------------------------------------------- +namespace +{ + static void lcl_rebaseScriptStorage_throw( const Reference< XStorageBasedLibraryContainer >& _rxContainer, + const Reference< XStorage >& _rxNewRootStorage ) + { + if ( _rxContainer.is() ) + { + if ( _rxNewRootStorage.is() ) + _rxContainer->setRootStorage( _rxNewRootStorage ); + else + ; // TODO: what to do here? dispose the container? + } + } +} + +// ----------------------------------------------------------------------------- Reference< XStorage > ODatabaseModelImpl::impl_switchToStorage_throw( const Reference< XStorage >& _rxNewRootStorage ) { // stop listening for modifications at the old storage @@ -1191,10 +1194,8 @@ lcl_modifyListening( *this, m_xDocumentStorage.getTyped(), m_pStorageModifyListener, true ); // forward new storage to Basic and Dialog library containers - if ( m_xBasicLibraries.is() ) - m_xBasicLibraries->setRootStorage( m_xDocumentStorage.getTyped() ); - if ( m_xDialogLibraries.is() ) - m_xDialogLibraries->setRootStorage( m_xDocumentStorage.getTyped() ); + lcl_rebaseScriptStorage_throw( m_xBasicLibraries, m_xDocumentStorage.getTyped() ); + lcl_rebaseScriptStorage_throw( m_xDialogLibraries, m_xDocumentStorage.getTyped() ); m_bReadOnly = !lcl_storageIsWritable_nothrow( m_xDocumentStorage.getTyped() ); // TODO: our data source, if it exists, must broadcast the change of its ReadOnly property @@ -1222,7 +1223,7 @@ } // remember both - m_sDocFileLocation = _rDocumentLocation; + m_sDocFileLocation = _rDocumentLocation.getLength() ? _rDocumentLocation : _rDocumentURL; m_sDocumentURL = _rDocumentURL; } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
