diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-12-04 14:14:31 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-12-04 17:46:18 +0100 |
commit | e04d4d196a91fce2370fd44f0bd23a195589860d (patch) | |
tree | 4a1e646901d94a21444e1cd075ce7318e3954cf2 /sw | |
parent | e95ae3278b71fc56fa6cdab9ecff4c5bdbdda583 (diff) |
use C++11 iteration
Change-Id: I185b03dc8b747178fc442b7748dfe40762b46d32
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 7c4b58ff1c3c..8accb57c063e 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -430,34 +430,32 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, else { // copy all Pams and then delete all - SwPaM* pTmp = (SwPaM*)&rPam; bool bOldFlag = mbCopyIsMove; bool const bOldUndo = GetIDocumentUndoRedo().DoesUndo(); bool const bOldRedlineMove(getIDocumentRedlineAccess().IsRedlineMove()); mbCopyIsMove = true; GetIDocumentUndoRedo().DoUndo(false); getIDocumentRedlineAccess().SetRedlineMove(true); - do { - if( pTmp->HasMark() && - *pTmp->GetPoint() != *pTmp->GetMark() ) + for(const SwPaM& rTmp : rPam.GetRingContainer()) + { + if( rTmp.HasMark() && + *rTmp.GetPoint() != *rTmp.GetMark() ) { - getIDocumentContentOperations().CopyRange( *pTmp, aPos, false ); + getIDocumentContentOperations().CopyRange( *const_cast<SwPaM*>(&rTmp), aPos, false ); } - pTmp = static_cast<SwPaM*>(pTmp->GetNext()); - } while ( &rPam != pTmp ); + } getIDocumentRedlineAccess().SetRedlineMove(bOldRedlineMove); mbCopyIsMove = bOldFlag; GetIDocumentUndoRedo().DoUndo(bOldUndo); - pTmp = (SwPaM*)&rPam; - do { - if( pTmp->HasMark() && - *pTmp->GetPoint() != *pTmp->GetMark() ) + for(const SwPaM& rTmp : rPam.GetRingContainer()) + { + if( rTmp.HasMark() && + *rTmp.GetPoint() != *rTmp.GetMark() ) { - getIDocumentContentOperations().DeleteAndJoin( *pTmp ); + getIDocumentContentOperations().DeleteAndJoin( *const_cast<SwPaM*>(&rTmp) ); } - pTmp = static_cast<SwPaM*>(pTmp->GetNext()); - } while ( &rPam != pTmp ); + } } } while( false ); } |