[Libreoffice-commits] core.git: 15 commits - sw/inc sw/source

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Fri Jan 23 15:16:34 PST 2015


 sw/inc/viewsh.hxx                                |    8 ----
 sw/source/core/crsr/crsrsh.cxx                   |   10 ++++-
 sw/source/core/crsr/viscrs.cxx                   |   36 ++++++++++----------
 sw/source/core/doc/DocumentDeviceManager.cxx     |    8 +---
 sw/source/core/doc/DocumentStatisticsManager.cxx |   19 ++++------
 sw/source/core/doc/docdesc.cxx                   |   22 ++++++------
 sw/source/core/doc/doclay.cxx                    |   32 +++++++-----------
 sw/source/core/doc/notxtfrm.cxx                  |   40 ++++++++++-------------
 sw/source/core/draw/dcontact.cxx                 |   28 ++++++++--------
 sw/source/core/draw/dpage.cxx                    |   14 +++++---
 sw/source/core/layout/newfrm.cxx                 |   12 ++++++
 sw/source/core/text/frmcrsr.cxx                  |    2 -
 sw/source/core/view/viewsh.cxx                   |    9 +----
 sw/source/core/view/vnew.cxx                     |   16 +++++++--
 sw/source/core/view/vprint.cxx                   |    2 -
 15 files changed, 133 insertions(+), 125 deletions(-)

New commits:
commit 0a77c9f15bbb38d8c281daef4512d570683d2cb7
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 23:11:32 2015 +0100

    remove manual iteration in SwViewShell
    
    Change-Id: Id7bd121067e86e4f8e4c3fe584cac05a85f47060

diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 89ebbc6..6a73d55 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -586,14 +586,6 @@ public:
     /// Are we doing tiled rendering?
     bool isTiledRendering();
 
-    SwViewShell* GetNext()
-        { return GetNextInRing(); }
-    const SwViewShell* GetNext() const
-        { return GetNextInRing(); }
-    SwViewShell* GetPrev()
-        { return GetPrevInRing(); }
-    const SwViewShell* GetPrev() const
-        { return GetPrevInRing(); }
 };
 
 // manages global ShellPointer
commit 3dbd1e69b94b6e91db5ddc36ed6808d7be0a418c
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 23:10:43 2015 +0100

    do not use manual iteration
    
    Change-Id: If456086bc6195c04794178df22d9c937bb7073b4

diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index c5dead7..4c23e0d 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -119,7 +119,7 @@ bool sw_ChangeOffset( SwTxtFrm* pFrm, sal_Int32 nNew )
             SwViewShell* pVsh = pFrm->getRootFrm()->GetCurrShell();
             if( pVsh )
             {
-                if( pVsh->GetNext() != pVsh ||
+                if( pVsh->GetRingContainer().size() > 1 ||
                     ( pFrm->GetDrawObjs() && pFrm->GetDrawObjs()->size() ) )
                 {
                     if( !pFrm->GetOfst() )
commit 6bb2f330daab558730c0a1a267ac6d09c746d5ef
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 23:09:40 2015 +0100

    do not use manual iteration
    
    Change-Id: Ia7afbea8872618d070dbdf6029cef3cec2425f2c

diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index ef1d456..80ba9ce16 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -601,7 +601,7 @@ void SwViewShell::PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintD
         pSh->maVisArea = aSwRect;
 
         if ( pSh->GetViewOptions()->getBrowseMode() &&
-             pSh->GetNext() == pSh )
+             pSh->GetRingContainer().size() == 1 )
         {
             pSh->CheckBrowseView( false );
             pSh->GetLayout()->Lower()->InvalidateSize();
commit f5c6391b2e3ef703bc4d4efd691f79f1605d5283
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 23:07:01 2015 +0100

    do not use manual iteration
    
    Change-Id: I1911b1dec2acd89c104c2b226fb212b7deb40c3b

diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index 31d0de4..6a951a1 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -360,9 +360,19 @@ SwViewShell::~SwViewShell()
     if ( mpDoc )
     {
         GetLayout()->DeRegisterShell( this );
-        if(mpDoc->getIDocumentLayoutAccess().GetCurrentViewShell()==this)
-            mpDoc->getIDocumentLayoutAccess().SetCurrentViewShell( this->GetNext()!=this ?
-            this->GetNext() : nullptr );
+        auto& rLayoutAccess(mpDoc->getIDocumentLayoutAccess());
+        if(rLayoutAccess.GetCurrentViewShell()==this)
+        {
+            rLayoutAccess.SetCurrentViewShell(nullptr);
+            for(SwViewShell& rShell : GetRingContainer())
+            {
+                if(&rShell != this)
+                {
+                    rLayoutAccess.SetCurrentViewShell(&rShell);
+                    break;
+                }
+            }
+        }
     }
 
     delete mpTmpRef;
commit 512f85f07dc1483ea3ab328597092ec3170fbeaa
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 23:06:26 2015 +0100

    do not use manual iteration
    
    Change-Id: I50c4a9c7e10ddf47a280b2b5e08051ce480985cf

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index b452db5..5e13cd5 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -246,16 +246,13 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
     //will this put the EndAction of the last shell in the sequence?
 
     SwViewShell::mbLstAct = true;
-    SwViewShell *pSh = this->GetNext();
-    while ( pSh != this )
+    for(SwViewShell& rShell : GetRingContainer())
     {
-        if ( pSh->ActionPend() )
+        if(&rShell != this && rShell.ActionPend())
         {
             SwViewShell::mbLstAct = false;
-            pSh = this;
+            break;
         }
-        else
-            pSh = pSh->GetNext();
     }
 
     const bool bIsShellForCheckViewLayout = ( this == GetLayout()->GetCurrShell() );
commit 16e524d565490f740a4105d65f663dacc8aee23d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 23:00:16 2015 +0100

    do not use manual iteration
    
    Change-Id: Id2aaa4171680d8d002d4b2aebf6281ca817c74d9

diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 58dabc8..d7ecf4f 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -415,7 +415,17 @@ void SwRootFrm::DeRegisterShell( SwViewShell *pSh )
 {
     // Activate some shell if possible
     if ( pCurrShell == pSh )
-        pCurrShell = pSh->GetNext() != pSh ? pSh->GetNext() : nullptr;
+    {
+        pCurrShell = nullptr;
+        for(SwViewShell& rShell : pSh->GetRingContainer())
+        {
+            if(&rShell != pSh)
+            {
+                pCurrShell = &rShell;
+                break;
+            }
+        }
+    }
 
     // Doesn't matter anymore
     if ( pWaitingCurrShell == pSh )
commit 35f70c86f2d75cca18a34b2290a71753b3910879
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 22:59:43 2015 +0100

    do not use manual iteration
    
    Change-Id: If53c38b21cad756259f084ad84de090def596eb0

diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx
index 24f2d35..52348ef 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<SwDPage*>(this)->pGridLst->Clear();
         else
commit a5970372925cc4ff2c2a0fd6e615a7282b113505
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 22:59:38 2015 +0100

    do not use manual iteration
    
    Change-Id: Iafb10e4a3cf26138a4a5d2647d115bc435ef61ba

diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index f5d66b4..e3e9a6e 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1058,28 +1058,30 @@ void SwDrawContact::Changed( const SdrObject& rObj,
     }
 
     //Put on Action, but not if presently anywhere an action runs.
-    SwViewShell *pSh = nullptr, *pOrg;
+    bool bHasActions(true);
     SwRootFrm *pTmpRoot = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
     if ( pTmpRoot && pTmpRoot->IsCallbackActionEnabled() )
     {
-        pOrg = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
-        pSh = pOrg;
-        if ( pSh )
-            do
-            {   if ( pSh->Imp()->IsAction() || pSh->Imp()->IsIdleAction() )
-                    pSh = nullptr;
-                else
-                    pSh = pSh->GetNext();
-
-            } while ( pSh && pSh != pOrg );
-
+        SwViewShell* const pSh = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
         if ( pSh )
+        {
+            for(SwViewShell& rShell : pSh->GetRingContainer() )
+            {
+                if ( rShell.Imp()->IsAction() || rShell.Imp()->IsIdleAction() )
+                {
+                    bHasActions = true;
+                    break;
+                }
+                bHasActions = false;
+            }
+        }
+        if(!bHasActions)
             pTmpRoot->StartAllAction();
     }
     SdrObjUserCall::Changed( rObj, eType, rOldBoundRect );
     _Changed( rObj, eType, &rOldBoundRect );    //Attention, possibly suicidal!
 
-    if ( pSh )
+    if(!bHasActions)
         pTmpRoot->EndAllAction();
 }
 
commit 965d09ebb247cd39c145852b231fd0c51e1e50d7
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 22:59:30 2015 +0100

    do not use manual iteration
    
    Change-Id: I7d59985557fd780276c7370daeb6eb3895f33b6e

diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 07c9772..4c50dcd 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -576,24 +576,24 @@ void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
             bComplete = false;
             SwGrfNode* pNd = static_cast<SwGrfNode*>( GetNode());
 
-            SwViewShell *pVSh = pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+            SwViewShell* pVSh = pNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
             if( pVSh )
             {
                 GraphicAttr aAttr;
                 if( pNd->GetGrfObj().IsCached( pVSh->GetOut(), Point(),
                             Prt().SSize(), &pNd->GetGraphicAttr( aAttr, this ) ))
                 {
-                    SwViewShell *pSh = pVSh;
-                    do {
-                        SET_CURR_SHELL( pSh );
-                        if( pSh->GetWin() )
+                    for(SwViewShell rShell : pVSh->GetRingContainer())
+                    {
+                        SET_CURR_SHELL( &rShell );
+                        if( rShell.GetWin() )
                         {
-                            if( pSh->IsPreview() )
-                                ::RepaintPagePreview( pSh, Frm().SVRect() );
+                            if( rShell.IsPreview() )
+                                ::RepaintPagePreview( &rShell, Frm().SVRect() );
                             else
-                                pSh->GetWin()->Invalidate( Frm().SVRect() );
+                                rShell.GetWin()->Invalidate( Frm().SVRect() );
                         }
-                    } while( pVSh != (pSh = static_cast<SwViewShell*>(pSh->GetNext()) ));
+                    }
                 }
             }
         }
@@ -640,23 +640,21 @@ void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
             if( !pVSh )
                 break;
 
-            SwViewShell *pSh = pVSh;
-            do {
-                SET_CURR_SHELL( pSh );
-                if( pSh->IsPreview() )
+            for(SwViewShell& rShell : pVSh->GetRingContainer())
+            {
+                SET_CURR_SHELL( &rShell );
+                if( rShell.IsPreview() )
                 {
-                    if( pSh->GetWin() )
-                        ::RepaintPagePreview( pSh, aRect );
+                    if( rShell.GetWin() )
+                        ::RepaintPagePreview( &rShell, aRect );
                 }
-                else if ( pSh->VisArea().IsOver( aRect ) &&
-                   OUTDEV_WINDOW == pSh->GetOut()->GetOutDevType() )
+                else if ( rShell.VisArea().IsOver( aRect ) &&
+                   OUTDEV_WINDOW == rShell.GetOut()->GetOutDevType() )
                 {
                     // invalidate instead of painting
-                    pSh->GetWin()->Invalidate( aRect.SVRect() );
+                    rShell.GetWin()->Invalidate( aRect.SVRect() );
                 }
-
-                pSh = static_cast<SwViewShell *>(pSh->GetNext());
-            } while( pSh != pVSh );
+            }
         }
         break;
 
commit 1bbb0a9209f6d5c365290684b2f5c18f0ad3c76f
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 22:59:22 2015 +0100

    do not use manual iteration
    
    Change-Id: Ice6579d96f6cefb159e73492ce3bdabba00bd95b

diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 116af59..10a7216 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -1268,18 +1268,17 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel(
 
 IMPL_STATIC_LINK( SwDoc, BackgroundDone, SvxBrushItem*, EMPTYARG )
 {
-    SwViewShell *pSh, *pStartSh;
-    pSh = pStartSh = pThis->getIDocumentLayoutAccess().GetCurrentViewShell();
-    if( pStartSh )
-        do {
-            if( pSh->GetWin() )
+    SwViewShell* pStartSh = pThis->getIDocumentLayoutAccess().GetCurrentViewShell();
+    if(pStartSh)
+        for(SwViewShell& rShell : pStartSh->GetRingContainer())
+        {
+            if(rShell.GetWin())
             {
                 // Make sure to repaint with virtual device
-                pSh->LockPaint();
-                pSh->UnlockPaint( true );
+                rShell.LockPaint();
+                rShell.UnlockPaint( true );
             }
-            pSh = static_cast<SwViewShell*>(pSh->GetNext());
-        } while( pSh != pStartSh );
+        }
     return 0;
 }
 
@@ -1637,19 +1636,14 @@ std::set<SwRootFrm*> SwDoc::GetAllLayouts()
 {
     std::set<SwRootFrm*> aAllLayouts;
     SwViewShell *pStart = getIDocumentLayoutAccess().GetCurrentViewShell();
-    SwViewShell *pTemp = pStart;
-    if ( pTemp )
+    if(pStart)
     {
-        do
+        for(SwViewShell& rShell : pStart->GetRingContainer())
         {
-            if (pTemp->GetLayout())
-            {
-                aAllLayouts.insert(pTemp->GetLayout());
-                pTemp = static_cast<SwViewShell*>(pTemp->GetNext());
-            }
-        } while(pTemp!=pStart);
+            if(rShell.GetLayout())
+                aAllLayouts.insert(rShell.GetLayout());
+        }
     }
-
     return aAllLayouts;
 }
 
commit 01dc078165371c8b225934b53e8544c29d3246f2
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 22:59:16 2015 +0100

    do not use manual iteration
    
    Change-Id: I036bc37c6af1a387c0f05f8fe56375d32ab048bc

diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index d083b43..cce0277 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -710,18 +710,20 @@ extern std::vector<SvGlobalName*> *pGlobalOLEExcludeList;
 
 void SwDoc::PrtOLENotify( bool bAll )
 {
-    SwFEShell *pShell = 0;
-    if ( getIDocumentLayoutAccess().GetCurrentViewShell() )
+    SwFEShell *pShell = nullptr;
     {
         SwViewShell *pSh = getIDocumentLayoutAccess().GetCurrentViewShell();
-        if ( !pSh->ISA(SwFEShell) )
-            do
-            {   pSh = static_cast<SwViewShell*>(pSh->GetNext());
-            } while ( !pSh->ISA(SwFEShell) &&
-                      pSh != getIDocumentLayoutAccess().GetCurrentViewShell() );
-
-        if ( pSh->ISA(SwFEShell) )
-            pShell = static_cast<SwFEShell*>(pSh);
+        if ( pSh )
+        {
+            for(SwViewShell& rShell : pSh->GetRingContainer())
+            {
+                if(rShell.ISA(SwFEShell))
+                {
+                    pShell = static_cast<SwFEShell*>(&rShell);
+                    break;
+                }
+            }
+        }
     }
     if ( !pShell )
     {
commit 07c7c88bc2d9d860ea92ab562ea0431ec1949b29
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 22:58:39 2015 +0100

    do not use manual iteration
    
    Change-Id: Icc19ac8ea555f1b7b553e03596b936f38781a932

diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx
index e71f3c7..6f1d094 100644
--- a/sw/source/core/doc/DocumentStatisticsManager.cxx
+++ b/sw/source/core/doc/DocumentStatisticsManager.cxx
@@ -49,24 +49,19 @@ namespace
         {
             if (!m_pViewShell)
                 return;
-            SwViewShell *pSh = m_pViewShell;
-            do
+            for(SwViewShell& rShell : m_pViewShell->GetRingContainer())
             {
-                if (!pSh->IsViewLocked())
+                if(rShell.IsViewLocked())
                 {
-                    m_aViewWasUnLocked.push_back(pSh);
-                    pSh->LockView(true);
+                    m_aViewWasUnLocked.push_back(&rShell);
+                    rShell.LockView(true);
                 }
-                pSh = static_cast<SwViewShell*>(pSh->GetNext());
-            } while (pSh != m_pViewShell);
+            }
         }
         ~LockAllViews()
         {
-            for (std::vector<SwViewShell*>::iterator aI = m_aViewWasUnLocked.begin(); aI != m_aViewWasUnLocked.end(); ++aI)
-            {
-                SwViewShell *pSh = *aI;
-                pSh->LockView(false);
-            }
+            for(SwViewShell* pShell : m_aViewWasUnLocked)
+                pShell->LockView(false);
         }
     };
 }
commit 0717643f4b061b8fd6bd59dcbdbbaf8c98c4a4dd
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 22:58:28 2015 +0100

    do not use manual iteration
    
    Change-Id: Iab5017259e17bbccabdbe7ed660f6235f1301c1e

diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx
index 53be5dc..74e7346 100644
--- a/sw/source/core/doc/DocumentDeviceManager.cxx
+++ b/sw/source/core/doc/DocumentDeviceManager.cxx
@@ -335,12 +335,8 @@ void DocumentDeviceManager::PrtDataChanged()
             std::set<SwRootFrm*> aAllLayouts = m_rDoc.GetAllLayouts();
             std::for_each( aAllLayouts.begin(), aAllLayouts.end(),std::bind2nd(std::mem_fun(&SwRootFrm::InvalidateAllCntnt), INV_SIZE));
 
-            do
-            {
-                pSh->InitPrt( getPrinter(false) );
-                pSh = static_cast<SwViewShell*>(pSh->GetNext());
-            }
-            while ( pSh != m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() );
+            for(SwViewShell& rShell : pSh->GetRingContainer())
+                rShell.InitPrt(getPrinter(false));
         }
     }
     if ( bDraw && m_rDoc.getIDocumentDrawModelAccess().GetDrawModel() )
commit 25df0625880f40dc9f9c2fe5242feb5b7c9db09d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 22:57:08 2015 +0100

    do not use manual iteration
    
    Change-Id: I6f7b97fb625fc2632be5f763fadf8aaa29820a99

diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 5873e93..fadb3e8 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -583,26 +583,28 @@ short SwShellCrsr::MaxReplaceArived()
     {
         // Terminate old actions. The table-frames get constructed and
         // a SSelection can be created.
-        std::vector<sal_uInt16> aArr;
-        sal_uInt16 nActCnt;
-        SwViewShell *pShell = const_cast< SwCrsrShell* >( GetShell() ),
-                  *pSh = pShell;
-        do {
-            for( nActCnt = 0; pSh->ActionPend(); ++nActCnt )
-                pSh->EndAction();
-            aArr.push_back( nActCnt );
-        } while( pShell != ( pSh = pSh->GetNext()) );
-
+        std::vector<sal_uInt16> vActionCounts;
+        for(SwViewShell& rShell : const_cast< SwCrsrShell* >( GetShell() )->GetRingContainer())
         {
-            nRet = MessageDialog(pDlg, "AskSearchDialog",
-                                 "modules/swriter/ui/asksearchdialog.ui").Execute();
+            sal_uInt16 nActCnt = 0;
+            while(rShell.ActionPend())
+            {
+                rShell.EndAction();
+                ++nActCnt;
+            }
+            vActionCounts.push_back(nActCnt);
         }
-
-        for( std::vector<sal_uInt16>::size_type n = 0; n < aArr.size(); ++n )
+        nRet = MessageDialog(pDlg, "AskSearchDialog",
+                "modules/swriter/ui/asksearchdialog.ui").Execute();
+        auto pActionCount = vActionCounts.begin();
+        for(SwViewShell& rShell : const_cast< SwCrsrShell* >( GetShell() )->GetRingContainer())
         {
-            for( nActCnt = aArr[n]; nActCnt--; )
-                pSh->StartAction();
-            pSh = pSh->GetNext();
+            while(*pActionCount)
+            {
+                rShell.StartAction();
+                --(*pActionCount);
+            }
+            ++pActionCount;
         }
     }
     else
commit 0ed7c8b55a026d7d98f9c994ad5e8626dd9504b2
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jan 23 22:56:57 2015 +0100

    do not use manual iteration
    
    Change-Id: I71da7d2810309266b6e37fd531232ca33928f5b9

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 45cfd13..980c278 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -907,8 +907,12 @@ void SwCrsrShell::ClearMark()
     // is there any GetMark?
     if( m_pTblCrsr )
     {
-        while( m_pCurCrsr->GetNext() != m_pCurCrsr )
-            delete m_pCurCrsr->GetNext();
+        std::vector<SwViewShell*> vShells;
+        for(SwViewShell& rShell : GetRingContainer())
+            if(&rShell != this)
+                vShells.push_back(&rShell);
+        for(SwViewShell* pShell : vShells)
+            delete pShell;
         m_pTblCrsr->DeleteMark();
 
         m_pCurCrsr->DeleteMark();
@@ -2678,7 +2682,7 @@ SwCrsrShell::SwCrsrShell( SwDoc& rDoc, vcl::Window *pInitWin,
 SwCrsrShell::~SwCrsrShell()
 {
     // if it is not the last view then at least the field should be updated
-    if( GetNext() != this )
+    if( !unique() )
         CheckTblBoxCntnt( m_pCurCrsr->GetPoint() );
     else
         ClearTblBoxCntnt();


More information about the Libreoffice-commits mailing list