summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-13 14:14:09 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2015-03-14 02:23:44 +0100
commit9bfd0481dc7d37da994eb215b238c12f2f68b485 (patch)
tree7229795036940e94016b252235984d6caa003ad2
parent8152cf6df78c7a7bb632f708311b17a50eb091c8 (diff)
simplify SwClientIter iteration
Change-Id: I078fd3808768cd49190984278207045cc73aa8e6
-rw-r--r--sw/inc/calbck.hxx8
-rw-r--r--sw/source/core/attr/calbck.cxx19
2 files changed, 13 insertions, 14 deletions
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 5955a7dd28dc..3520416b1b7f 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -276,6 +276,14 @@ public:
// otherwise it returns the next SwClient that still is
SwClient* operator()() const
{ return m_pPosition; }
+ // returns the current SwClient object, wether it is still a client or not
+ SwClient& operator*() const
+ { return *m_pCurrent; }
+ // returns the current SwClient object, wether it is still a client or not
+ SwClient* operator->() const
+ { return m_pCurrent; }
+ explicit operator bool() const
+ { return m_pCurrent!=nullptr; }
// return "true" if an object was removed from a client chain in iteration
// adding objects to a client chain in iteration is forbidden
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 6c32760a2b46..a268b3de9939 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -272,24 +272,15 @@ void SwModify::CheckCaching( const sal_uInt16 nWhich )
void SwModify::CallSwClientNotify( const SfxHint& rHint ) const
{
- SwClientIter aIter(*this);
- SwClient* pClient = aIter.GoStart();
- while( pClient )
- {
- pClient->SwClientNotify( *this, rHint );
- pClient = ++aIter;
- }
+ for(SwClientIter aIter(*this); aIter; ++aIter)
+ aIter->SwClientNotify( *this, rHint );
}
void SwModify::ModifyBroadcast( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, TypeId nType )
{
- SwClientIter aIter( *this );
- SwClient* pClient = aIter.First( nType );
- while( pClient )
- {
- pClient->Modify( pOldValue, pNewValue );
- pClient = aIter.Next();
- }
+ SwClientIter aIter(*this);
+ for(aIter.First(nType); aIter; aIter.Next())
+ aIter->Modify( pOldValue, pNewValue );
}
SwDepend::SwDepend( SwClient* pTellHim, SwModify* pDepend )