Tag: cws_src680_dba201 User: fs Date: 05/07/11 01:45:15 Modified: /dba/dbaccess/source/core/dataaccess/ ModelImpl.hxx
Log: RESYNC: (1.4-1.7); FILE MERGED 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.14.1&r2=1.4.14.2 Delta lines: +68 -16 --------------------- --- ModelImpl.hxx 9 May 2005 12:50:45 -0000 1.4.14.1 +++ ModelImpl.hxx 11 Jul 2005 08:45:13 -0000 1.4.14.2 @@ -182,6 +182,7 @@ #ifndef _COM_SUN_STAR_UTIL_XREFRESHABLE_HPP_ #include <com/sun/star/util/XRefreshable.hpp> #endif +#include <memory> //........................................................................ namespace dbaccess @@ -191,17 +192,25 @@ typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XConnection > OWeakConnection; typedef std::vector< OWeakConnection > OWeakConnectionArray; +class ODatabaseContext; +class OSharedConnectionManager; + //============================================================ //= ODatabaseModelImpl //============================================================ 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 +277,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,13 +291,21 @@ 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 */ - void commitStorages(); + void commitStorages() + SAL_THROW(( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException )); + /** dispose all frames for registered controllers */ @@ -346,7 +359,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 +373,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(); @@ -379,18 +392,57 @@ /// commits our storage void commitRootStorage(); + /// commits a given storage if it's not readonly + static bool commitStorageIfWriteable( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage + ) + SAL_THROW(( + ::com::sun::star::io::IOException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException + )); + + /// commits a given storage if it's not readonly, ignoring (but asserting) all errors + static bool commitStorageIfWriteable_ignoreErrors( + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage + ) + SAL_THROW(()); + void clearConnections(); ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage> getStorage(); /** 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]
