Kaydet (Commit) 3fc8c700 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

inline trivial SwClient functions

Change-Id: I1672844d0ad7f95d5c5add62703729588190d20f
üst e07c6a6f
...@@ -96,7 +96,7 @@ class SW_DLLPUBLIC SwClient : ::sw::WriterListener ...@@ -96,7 +96,7 @@ class SW_DLLPUBLIC SwClient : ::sw::WriterListener
protected: protected:
// single argument ctors shall be explicit. // single argument ctors shall be explicit.
explicit SwClient(SwModify *pToRegisterIn); inline explicit SwClient( SwModify* pToRegisterIn );
// write access to pRegisteredIn shall be granted only to the object itself (protected access) // write access to pRegisteredIn shall be granted only to the object itself (protected access)
SwModify* GetRegisteredInNonConst() const { return pRegisteredIn; } SwModify* GetRegisteredInNonConst() const { return pRegisteredIn; }
...@@ -105,7 +105,8 @@ public: ...@@ -105,7 +105,8 @@ public:
SwClient() : pRegisteredIn(nullptr) {} SwClient() : pRegisteredIn(nullptr) {}
virtual ~SwClient(); virtual ~SwClient();
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew); virtual void Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
{ CheckRegistration( pOldValue, pNewValue ); }
// in case an SwModify object is destroyed that itself is registered in another SwModify, // in case an SwModify object is destroyed that itself is registered in another SwModify,
// its SwClient objects can decide to get registered to the latter instead by calling this method // its SwClient objects can decide to get registered to the latter instead by calling this method
...@@ -114,7 +115,7 @@ public: ...@@ -114,7 +115,7 @@ public:
// controlled access to Modify method // controlled access to Modify method
// mba: this is still considered a hack and it should be fixed; the name makes grep-ing easier // mba: this is still considered a hack and it should be fixed; the name makes grep-ing easier
void ModifyNotification( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue ) { this->Modify ( pOldValue, pNewValue ); } void ModifyNotification( const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue ) { this->Modify ( pOldValue, pNewValue ); }
void SwClientNotifyCall( const SwModify& rModify, const SfxHint& rHint ) { SwClientNotify( rModify, rHint ); } void SwClientNotifyCall( const SwModify& rModify, const SfxHint& rHint ) { SwClientNotify( rModify, rHint ); }
const SwModify* GetRegisteredIn() const { return pRegisteredIn; } const SwModify* GetRegisteredIn() const { return pRegisteredIn; }
SwModify* GetRegisteredIn() { return pRegisteredIn; } SwModify* GetRegisteredIn() { return pRegisteredIn; }
...@@ -123,7 +124,7 @@ public: ...@@ -123,7 +124,7 @@ public:
TYPEINFO(); TYPEINFO();
// get information about attribute // get information about attribute
virtual bool GetInfo( SfxPoolItem& ) const; virtual bool GetInfo( SfxPoolItem& ) const { return true; }
}; };
...@@ -313,6 +314,12 @@ public: ...@@ -313,6 +314,12 @@ public:
} }
}; };
SwClient::SwClient( SwModify* pToRegisterIn )
: pRegisteredIn( nullptr )
{
if(pToRegisterIn)
pToRegisterIn->Add(this);
}
#endif #endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -26,12 +26,11 @@ ...@@ -26,12 +26,11 @@
TYPEINIT0( SwClient ); TYPEINIT0( SwClient );
SwClient::SwClient( SwModify* pToRegisterIn ) SwClient::~SwClient()
: pRegisteredIn( nullptr )
{ {
if(pToRegisterIn) OSL_ENSURE( !pRegisteredIn || pRegisteredIn->GetDepends(), "SwModify still known, but Client already disconnected!" );
// connect to SwModify if( pRegisteredIn && pRegisteredIn->GetDepends() )
pToRegisterIn->Add(this); pRegisteredIn->Remove( this );
} }
void SwClient::CheckRegistration( const SfxPoolItem* pOld, const SfxPoolItem* ) void SwClient::CheckRegistration( const SfxPoolItem* pOld, const SfxPoolItem* )
...@@ -57,23 +56,6 @@ void SwClient::CheckRegistration( const SfxPoolItem* pOld, const SfxPoolItem* ) ...@@ -57,23 +56,6 @@ void SwClient::CheckRegistration( const SfxPoolItem* pOld, const SfxPoolItem* )
} }
} }
void SwClient::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
{
CheckRegistration( pOldValue, pNewValue );
}
SwClient::~SwClient()
{
OSL_ENSURE( !pRegisteredIn || pRegisteredIn->GetDepends(), "SwModify still known, but Client already disconnected!" );
if( pRegisteredIn && pRegisteredIn->GetDepends() )
// still connected
pRegisteredIn->Remove( this );
}
bool SwClient::GetInfo( SfxPoolItem& ) const
{
return true;
}
SwModify::SwModify() SwModify::SwModify()
: SwClient(nullptr), pRoot(nullptr) : SwClient(nullptr), pRoot(nullptr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment