From e04d4d196a91fce2370fd44f0bd23a195589860d Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Thu, 4 Dec 2014 14:14:31 +0100 Subject: use C++11 iteration Change-Id: I185b03dc8b747178fc442b7748dfe40762b46d32 --- sw/source/core/doc/doclay.cxx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'sw') 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(&rTmp), aPos, false ); } - pTmp = static_cast(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(&rTmp) ); } - pTmp = static_cast(pTmp->GetNext()); - } while ( &rPam != pTmp ); + } } } while( false ); } -- cgit