Tag: cws_src680_c03v1 User: fs Date: 05/06/21 02:51:13 Modified: /dba/dbaccess/source/core/dataaccess/ ModelImpl.hxx
Log: #i50905# moved some functionality herein (from the ODatabaseDocument), e.g. the XDocumentSubStorageSupplier, so that clients of the ModelImpl class are not forced to create a DatabaseDocument just because they need this functionality. File Changes: Directory: /dba/dbaccess/source/core/dataaccess/ ================================================ File [changed]: ModelImpl.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/core/dataaccess/ModelImpl.hxx?r1=1.4&r2=1.4.48.1 Delta lines: +49 -18 --------------------- --- ModelImpl.hxx 30 Mar 2005 11:55:09 -0000 1.4 +++ ModelImpl.hxx 21 Jun 2005 09:51:10 -0000 1.4.48.1 @@ -2,9 +2,9 @@ * * $RCSfile: ModelImpl.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.4.48.1 $ * - * last change: $Author: rt $ $Date: 2005/03/30 11:55:09 $ + * last change: $Author: fs $ $Date: 2005/06/21 09:51:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -182,6 +182,7 @@ #ifndef _COM_SUN_STAR_UTIL_XREFRESHABLE_HPP_ #include <com/sun/star/util/XRefreshable.hpp> #endif +#include <memory> //........................................................................ namespace dbaccess @@ -197,11 +198,16 @@ DECLARE_STL_USTRINGACCESS_MAP(::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >,TStorages); +class ODatabaseContext; +class DocumentStorageAccess; +class OSharedConnectionManager; class ODatabaseModelImpl : public ::rtl::IReference { - friend class ODatabaseContext; - friend class OConnection; - friend class OSharedConnectionManager; +private: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> m_xTempModel; + ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDataSource> m_xDataSource; + + DocumentStorageAccess* m_pStorageAccess; public: @@ -268,10 +274,6 @@ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController> m_xCurrentController; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xStorage; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> m_xModel; - ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XDataSource> m_xDataSource; - - ODatabaseContext* m_pDBContext; OSharedConnectionManager* m_pSharedConnectionManager; oslInterlockedCount m_refCount; @@ -286,9 +288,15 @@ inline bool isEmbeddedDatabase() const { return ( m_sConnectURL.compareToAscii( "sdbc:embedded:", 14 ) == 0 ); } /** stores the embedded storage ("database") + + @param _bPreventRootCommits + Normally, committing the embedded storage results in also commiting the root storage + - this is an automatism for data safety reasons. + If you pass <TRUE/> here, committing the root storage is prevented for this particular + call. @return <TRUE/> if the storage could be commited, otherwise <FALSE/> */ - sal_Bool commitEmbeddedStorage(); + sal_Bool commitEmbeddedStorage( sal_Bool _bPreventRootCommits = sal_False ); /** commits all storages */ @@ -346,7 +354,7 @@ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getIsolatedConnection( const ::rtl::OUString& user, const ::rtl::OUString& password ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getIsolatedConnectionWithCompletion( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& handler ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - void dispose( ); + void dispose(); ::rtl::OUString getURL(); @@ -360,7 +368,7 @@ // XCloseable void SAL_CALL close( sal_Bool DeliverOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage> getStorage(const ::rtl::OUString& _sStorageName,const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XTransactionListener>& _xEventListener, sal_Int32 nMode = ::com::sun::star::embed::ElementModes::READWRITE); + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage> getStorage(const ::rtl::OUString& _sStorageName,sal_Int32 nMode = ::com::sun::star::embed::ElementModes::READWRITE); // helper const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& getNumberFormatsSupplier(); @@ -385,12 +393,35 @@ /** returns the data source. If it doesn't exist it will be created */ - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> getDataSource(); - /** returns the model or creates a new one. + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> getDataSource( bool _bCreateIfNecessary = true ); + + /** returns the model, if there already exists one */ - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> getModel(); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel_noCreate(); + + /** returns a new ->ODatabaseDocument + + @precond + No ->ODatabaseDocument exists so far + @seealso + getModel_noCreate + */ + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > createNewModel_deliverOwnership(); + + struct ResetModelAccess { friend class ODatabaseDocument; private: ResetModelAccess() { } }; + /** resets the model to NULL + + Only to be called when the model is being disposed + */ + void modelIsDisposing( ResetModelAccess ) { m_xTempModel = NULL; } + + DocumentStorageAccess* + getDocumentStorageAccess(); + + ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentSubStorageSupplier > + getDocumentSubStorageSupplier(); - void clear(); +// void clear(); /** @see osl_incrementInterlockedCount. */ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
