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
protected:
// 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)
SwModify* GetRegisteredInNonConst() const { return pRegisteredIn; }
......@@ -105,7 +105,8 @@ public:
SwClient() : pRegisteredIn(nullptr) {}
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,
// its SwClient objects can decide to get registered to the latter instead by calling this method
......@@ -123,7 +124,7 @@ public:
TYPEINFO();
// get information about attribute
virtual bool GetInfo( SfxPoolItem& ) const;
virtual bool GetInfo( SfxPoolItem& ) const { return true; }
};
......@@ -313,6 +314,12 @@ public:
}
};
SwClient::SwClient( SwModify* pToRegisterIn )
: pRegisteredIn( nullptr )
{
if(pToRegisterIn)
pToRegisterIn->Add(this);
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -26,12 +26,11 @@
TYPEINIT0( SwClient );
SwClient::SwClient( SwModify* pToRegisterIn )
: pRegisteredIn( nullptr )
SwClient::~SwClient()
{
if(pToRegisterIn)
// connect to SwModify
pToRegisterIn->Add(this);
OSL_ENSURE( !pRegisteredIn || pRegisteredIn->GetDepends(), "SwModify still known, but Client already disconnected!" );
if( pRegisteredIn && pRegisteredIn->GetDepends() )
pRegisteredIn->Remove( this );
}
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()
: 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