From 35f70c86f2d75cca18a34b2290a71753b3910879 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Fri, 23 Jan 2015 22:59:43 +0100 Subject: do not use manual iteration Change-Id: If53c38b21cad756259f084ad84de090def596eb0 --- sw/source/core/draw/dpage.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'sw') diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx index 24f2d35b5c48..52348ef79398 100644 --- a/sw/source/core/draw/dpage.cxx +++ b/sw/source/core/draw/dpage.cxx @@ -128,11 +128,17 @@ void InsertGridFrame( SdrPageGridFrameList *pLst, const SwFrm *pPg ) const SdrPageGridFrameList* SwDPage::GetGridFrameList( const SdrPageView* pPV, const Rectangle *pRect ) const { - SwViewShell *pSh = static_cast< SwDrawModel* >(GetModel())->GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell(); - while (pSh && pSh->Imp()->GetPageView() != pPV) - pSh = pSh->GetNext(); - if (pSh) + SwViewShell* pSh = static_cast< SwDrawModel* >(GetModel())->GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell(); + if(pSh) { + for(SwViewShell& rShell : pSh->GetRingContainer()) + { + if(rShell.Imp()->GetPageView() == pPV) + { + pSh = &rShell; + break; + } + } if ( pGridLst ) const_cast(this)->pGridLst->Clear(); else -- cgit