diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-04-07 09:26:06 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-04-07 09:26:06 +0200 |
commit | ae91e58350348e0482929230d6c9b281325ff55d (patch) | |
tree | 92a65837fe30964574b5d943eb9f3e0943c4224c /include/sfx2/objsh.hxx | |
parent | 97cfb1fe0163a9dc09734a761c56d149b8c61f4b (diff) |
Unroll sole use of SV_IMPL/DECL_LOCK
Change-Id: I0d4691f700a415d0376e2bc346bc51fbf6a000b2
Diffstat (limited to 'include/sfx2/objsh.hxx')
-rw-r--r-- | include/sfx2/objsh.hxx | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index a3d32c97a06b..e35c618bd2df 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -720,8 +720,51 @@ public: SV_DECL_REF(SfxObjectShell) #endif -SV_DECL_LOCK(SfxObjectShell) -SV_IMPL_LOCK(SfxObjectShell) +class SfxObjectShellLock +{ +protected: + SfxObjectShell * pObj; +public: + inline SfxObjectShellLock() { pObj = 0; } + inline SfxObjectShellLock( const SfxObjectShellLock & rObj ); + inline SfxObjectShellLock( SfxObjectShell * pObjP ); + inline void Clear(); + inline ~SfxObjectShellLock(); + inline SfxObjectShellLock & operator = ( const SfxObjectShellLock & rObj ); + inline SfxObjectShellLock & operator = ( SfxObjectShell * pObj ); + inline bool Is() const { return pObj != NULL; } + inline SfxObjectShell * operator & () const { return pObj; } + inline SfxObjectShell * operator -> () const { return pObj; } + inline SfxObjectShell & operator * () const { return *pObj; } + inline operator SfxObjectShell * () const { return pObj; } +}; +inline SfxObjectShellLock::SfxObjectShellLock( const SfxObjectShellLock & rObj ) + { pObj = rObj.pObj; if( pObj ) { pObj->OwnerLock( true ); } } +inline SfxObjectShellLock::SfxObjectShellLock( SfxObjectShell * pObjP ) +{ pObj = pObjP; if( pObj ) { pObj->OwnerLock( true ); } } +inline void SfxObjectShellLock::Clear() +{ + if( pObj ) + { + SfxObjectShell* const pRefObj = pObj; + pObj = 0; + pRefObj->OwnerLock( false ); + } +} +inline SfxObjectShellLock::~SfxObjectShellLock() +{ if( pObj ) { pObj->OwnerLock( false ); } } +inline SfxObjectShellLock & SfxObjectShellLock:: + operator = ( const SfxObjectShellLock & rObj ) +{ + if( rObj.pObj ) rObj.pObj->OwnerLock( true ); + SfxObjectShell* const pRefObj = pObj; + pObj = rObj.pObj; + if( pRefObj ) { pRefObj->OwnerLock( false ); } + return *this; +} +inline SfxObjectShellLock & SfxObjectShellLock::operator = ( SfxObjectShell * pObjP ) +{ return *this = SfxObjectShellLock( pObjP ); } + SV_IMPL_REF(SfxObjectShell) class AutoReloadTimer_Impl : public Timer |