Tag: cws_src680_odbmacros2 User: fs Date: 2008-02-06 08:31:44+0000 Modified: dba/dbaccess/source/core/dataaccess/ModelImpl.hxx
Log: #i49133# added possibility to lock the modification flag 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.16.2.9&r2=1.16.2.10 Delta lines: +40 -4 -------------------- --- ModelImpl.hxx 2008-02-04 22:23:53+0000 1.16.2.9 +++ ModelImpl.hxx 2008-02-06 08:31:41+0000 1.16.2.10 @@ -4,9 +4,9 @@ * * $RCSfile: ModelImpl.hxx,v $ * - * $Revision: 1.16.2.9 $ + * $Revision: 1.16.2.10 $ * - * last change: $Author: fs $ $Date: 2008/02/04 22:23:53 $ + * last change: $Author: fs $ $Date: 2008/02/06 08:31:41 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -177,6 +177,9 @@ /// do we have any object (forms/reports) which contains macros? bool m_bHasAnyObjectWithMacros; + /// true if setting the Modified flag of the document is currently locked + bool m_bModificationLock; + /** the URL which the document should report as it's URL This might differ from ->m_sDocFileLocation in case the document was loaded @@ -461,6 +464,11 @@ // IModifiableDocument virtual void storageIsModified(); + // don't use directly, use the ModifyLock class instead + void lockModify() { m_bModificationLock = true; } + void unlockModify() { m_bModificationLock = false; } + bool isModifyLocked() const { return m_bModificationLock; } + private: void impl_construct_nothrow(); ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > @@ -489,7 +497,7 @@ } public: - struct GuardAccess { friend class ModelMethodGuard; private: GuardAccess() { } }; + struct GuardAccess { friend class ModelMethodGuard; friend class ModifyLock; private: GuardAccess() { } }; /** returns the mutex used for thread safety @@ -506,11 +514,39 @@ return m_pImpl; } - void checkDisposed() const + inline void checkDisposed() const { if ( !m_pImpl.is() ) throw ::com::sun::star::lang::DisposedException( ::rtl::OUString::createFromAscii( "Component is already disposed." ), getThis() ); } + + inline void lockModify( GuardAccess ) + { + m_pImpl->lockModify(); + } + + inline void unlockModify( GuardAccess ) + { + m_pImpl->unlockModify(); + } +}; + +class ModifyLock +{ +public: + ModifyLock( ModelDependentComponent& _component ) + :m_rComponent( _component ) + { + m_rComponent.lockModify( ModelDependentComponent::GuardAccess() ); + } + + ~ModifyLock() + { + m_rComponent.unlockModify( ModelDependentComponent::GuardAccess() ); + } + +private: + ModelDependentComponent& m_rComponent; }; /** a guard for public methods of objects dependent on a ODatabaseModelImpl instance --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
