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

Julien Nabet serval2412 at yahoo.fr
Mon Dec 15 13:06:28 PST 2014


 sw/source/core/frmedt/fecopy.cxx |  428 +++++++++++++++++++--------------------
 sw/source/core/frmedt/fedesc.cxx |   11 -
 sw/source/core/frmedt/fefly1.cxx |    7 
 3 files changed, 224 insertions(+), 222 deletions(-)

New commits:
commit 8286e92417794e68f6a53f887a426d5708fef0f6
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Dec 13 18:41:06 2014 +0100

    Related fdo#86929: Kill FOREACHPAM_START for good (part1)
    
    Change-Id: Ifdb896108cf0db0a9be7ba419df785da536c0fab
    Reviewed-on: https://gerrit.libreoffice.org/13465
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
    Tested-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 907bb9b..2fb7377 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -812,286 +812,286 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
     }
     else
     {
-        FOREACHPAM_START(GetCrsr())
-
-        if( pSrcNd &&
-            0 != ( pDestNd = GetDoc()->IsIdxInTbl( PCURCRSR->GetPoint()->nNode )))
+        for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
         {
-            SwPosition aDestPos( *PCURCRSR->GetPoint() );
-
-            bool bParkTblCrsr = false;
-            const SwStartNode* pSttNd =  PCURCRSR->GetNode().FindTableBoxStartNode();
 
-            // TABLE IN TABLE: copy table in table
-            // search boxes via the layout
-            SwSelBoxes aBoxes;
-            if( IsTableMode() )     // table selection?
+            if( pSrcNd &&
+                0 != ( pDestNd = GetDoc()->IsIdxInTbl( rPaM.GetPoint()->nNode )))
             {
-                GetTblSel( *this, aBoxes );
-                ParkTblCrsr();
-                bParkTblCrsr = true;
-            }
-            else if( !PCURCRSR->HasMark() && PCURCRSR->GetNext() == PCURCRSR &&
+                SwPosition aDestPos( *rPaM.GetPoint() );
+
+                bool bParkTblCrsr = false;
+                const SwStartNode* pSttNd =  rPaM.GetNode().FindTableBoxStartNode();
+
+                // TABLE IN TABLE: copy table in table
+                // search boxes via the layout
+                SwSelBoxes aBoxes;
+                if( IsTableMode() )     // table selection?
+                {
+                    GetTblSel( *this, aBoxes );
+                    ParkTblCrsr();
+                    bParkTblCrsr = true;
+                }
+                else if( !rPaM.HasMark() && rPaM.GetNext() == &rPaM &&
                      ( !pSrcNd->GetTable().IsTblComplex() ||
                        pDestNd->GetTable().IsNewModel() ) )
-            {
-                // make relative table copy
-                SwTableBox* pBox = pDestNd->GetTable().GetTblBox(
+                {
+                    // make relative table copy
+                    SwTableBox* pBox = pDestNd->GetTable().GetTblBox(
                                         pSttNd->GetIndex() );
-                OSL_ENSURE( pBox, "Box steht nicht in dieser Tabelle" );
-                aBoxes.insert( pBox );
-            }
+                    OSL_ENSURE( pBox, "Box steht nicht in dieser Tabelle" );
+                    aBoxes.insert( pBox );
+                }
 
-            SwNodeIndex aNdIdx( *pDestNd->EndOfSectionNode());
-            if( !bParkTblCrsr )
-            {
-                // exit first the complete table
-                // ???? what about only table in a frame ?????
-                SwCntntNode* pCNd = GetDoc()->GetNodes().GoNext( &aNdIdx );
-                SwPosition aPos( aNdIdx, SwIndex( pCNd, 0 ));
-                // #i59539: Don't remove all redline
-                SwPaM const tmpPaM(*pDestNd, *pDestNd->EndOfSectionNode());
-                ::PaMCorrAbs(tmpPaM, aPos);
-            }
+                SwNodeIndex aNdIdx( *pDestNd->EndOfSectionNode());
+                if( !bParkTblCrsr )
+                {
+                    // exit first the complete table
+                    // ???? what about only table in a frame ?????
+                    SwCntntNode* pCNd = GetDoc()->GetNodes().GoNext( &aNdIdx );
+                    SwPosition aPos( aNdIdx, SwIndex( pCNd, 0 ));
+                    // #i59539: Don't remove all redline
+                    SwPaM const tmpPaM(*pDestNd, *pDestNd->EndOfSectionNode());
+                    ::PaMCorrAbs(tmpPaM, aPos);
+                }
 
-            bRet = GetDoc()->InsCopyOfTbl( aDestPos, aBoxes, &pSrcNd->GetTable(),
+                bRet = GetDoc()->InsCopyOfTbl( aDestPos, aBoxes, &pSrcNd->GetTable(),
                                             false, false );
 
-            if( bParkTblCrsr )
-                GetCrsr();
-            else
-            {
-                // return to the box
-                aNdIdx = *pSttNd;
-                SwCntntNode* pCNd = GetDoc()->GetNodes().GoNext( &aNdIdx );
-                SwPosition aPos( aNdIdx, SwIndex( pCNd, 0 ));
-                // #i59539: Don't remove all redline
-                SwNode & rNode(PCURCRSR->GetPoint()->nNode.GetNode());
-                SwCntntNode *const pCntntNode( rNode.GetCntntNode() );
-                SwPaM const tmpPam(rNode, 0,
+                if( bParkTblCrsr )
+                    GetCrsr();
+                else
+                {
+                    // return to the box
+                    aNdIdx = *pSttNd;
+                    SwCntntNode* pCNd = GetDoc()->GetNodes().GoNext( &aNdIdx );
+                    SwPosition aPos( aNdIdx, SwIndex( pCNd, 0 ));
+                    // #i59539: Don't remove all redline
+                    SwNode & rNode(rPaM.GetPoint()->nNode.GetNode());
+                    SwCntntNode *const pCntntNode( rNode.GetCntntNode() );
+                    SwPaM const tmpPam(rNode, 0,
                                    rNode, (pCntntNode) ? pCntntNode->Len() : 0);
-                ::PaMCorrAbs(tmpPam, aPos);
-            }
+                    ::PaMCorrAbs(tmpPam, aPos);
+                }
 
-            break;      // exit the "while-loop"
-        }
-        else if( *aCpyPam.GetPoint() == *aCpyPam.GetMark() &&
+                break;      // exit the "while-loop"
+            }
+            else if( *aCpyPam.GetPoint() == *aCpyPam.GetMark() &&
                  pClpDoc->GetSpzFrmFmts()->size() )
-        {
-            // we need a DrawView
-            if( !Imp()->GetDrawView() )
-                MakeDrawView();
-
-            std::set<const SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pClpDoc);
-            for ( sal_uInt16 i = 0; i < pClpDoc->GetSpzFrmFmts()->size(); ++i )
             {
-                bool bInsWithFmt = true;
-                const SwFrmFmt& rCpyFmt = *(*pClpDoc->GetSpzFrmFmts())[i];
+                // we need a DrawView
+                if( !Imp()->GetDrawView() )
+                    MakeDrawView();
 
-                if( Imp()->GetDrawView()->IsGroupEntered() &&
-                    RES_DRAWFRMFMT == rCpyFmt.Which() &&
-                    (FLY_AS_CHAR != rCpyFmt.GetAnchor().GetAnchorId()) )
+                std::set<const SwFrmFmt*> aTextBoxes = SwTextBoxHelper::findTextBoxes(pClpDoc);
+                for ( sal_uInt16 i = 0; i < pClpDoc->GetSpzFrmFmts()->size(); ++i )
                 {
-                    const SdrObject* pSdrObj = rCpyFmt.FindSdrObject();
-                    if( pSdrObj )
+                    bool bInsWithFmt = true;
+                    const SwFrmFmt& rCpyFmt = *(*pClpDoc->GetSpzFrmFmts())[i];
+
+                    if( Imp()->GetDrawView()->IsGroupEntered() &&
+                        RES_DRAWFRMFMT == rCpyFmt.Which() &&
+                        (FLY_AS_CHAR != rCpyFmt.GetAnchor().GetAnchorId()) )
                     {
-                        SdrObject* pNew = GetDoc()->CloneSdrObj( *pSdrObj,
+                        const SdrObject* pSdrObj = rCpyFmt.FindSdrObject();
+                        if( pSdrObj )
+                        {
+                            SdrObject* pNew = GetDoc()->CloneSdrObj( *pSdrObj,
                                                             false, false );
 
-                        // Insert object sets any anchor position to 0.
-                        // Therefore we calculate the absolute position here
-                        // and after the insert the anchor of the object
-                        // is set to the anchor of the group object.
-                        Rectangle aSnapRect = pNew->GetSnapRect();
-                        if( pNew->GetAnchorPos().X() || pNew->GetAnchorPos().Y() )
-                        {
-                            const Point aPoint( 0, 0 );
-                            // OD 2004-04-05 #i26791# - direct drawing object
-                            // positioning for group members
-                            pNew->NbcSetAnchorPos( aPoint );
-                            pNew->NbcSetSnapRect( aSnapRect );
-                        }
+                            // Insert object sets any anchor position to 0.
+                            // Therefore we calculate the absolute position here
+                            // and after the insert the anchor of the object
+                            // is set to the anchor of the group object.
+                            Rectangle aSnapRect = pNew->GetSnapRect();
+                            if( pNew->GetAnchorPos().X() || pNew->GetAnchorPos().Y() )
+                            {
+                                const Point aPoint( 0, 0 );
+                                // OD 2004-04-05 #i26791# - direct drawing object
+                                // positioning for group members
+                                pNew->NbcSetAnchorPos( aPoint );
+                                pNew->NbcSetSnapRect( aSnapRect );
+                            }
 
-                        Imp()->GetDrawView()->InsertObjectAtView( pNew, *Imp()->GetPageView() );
+                            Imp()->GetDrawView()->InsertObjectAtView( pNew, *Imp()->GetPageView() );
 
-                        Point aGrpAnchor( 0, 0 );
-                        SdrObjList* pList = pNew->GetObjList();
-                        if ( pList )
-                        {
-                            SdrObject* pOwner = pList->GetOwnerObj();
-                            if ( pOwner )
+                            Point aGrpAnchor( 0, 0 );
+                            SdrObjList* pList = pNew->GetObjList();
+                            if ( pList )
                             {
-                                SdrObjGroup* pThisGroup = PTR_CAST(SdrObjGroup, pOwner);
-                                aGrpAnchor = pThisGroup->GetAnchorPos();
+                                SdrObject* pOwner = pList->GetOwnerObj();
+                                if ( pOwner )
+                                {
+                                    SdrObjGroup* pThisGroup = PTR_CAST(SdrObjGroup, pOwner);
+                                    aGrpAnchor = pThisGroup->GetAnchorPos();
+                                }
                             }
-                        }
 
-                        // OD 2004-04-05 #i26791# - direct drawing object
-                        // positioning for group members
-                        pNew->NbcSetAnchorPos( aGrpAnchor );
-                        pNew->SetSnapRect( aSnapRect );
+                            // OD 2004-04-05 #i26791# - direct drawing object
+                            // positioning for group members
+                            pNew->NbcSetAnchorPos( aGrpAnchor );
+                            pNew->SetSnapRect( aSnapRect );
 
-                        bInsWithFmt = false;
+                            bInsWithFmt = false;
+                        }
                     }
-                }
 
-                if( bInsWithFmt  )
-                {
-                    SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
-                    if ((FLY_AT_PARA == aAnchor.GetAnchorId()) ||
-                        (FLY_AT_CHAR == aAnchor.GetAnchorId()) ||
-                        (FLY_AS_CHAR == aAnchor.GetAnchorId()))
+                    if( bInsWithFmt  )
                     {
-                        SwPosition* pPos = PCURCRSR->GetPoint();
-                        // allow shapes (no controls) in header/footer
-                        if( RES_DRAWFRMFMT == rCpyFmt.Which() &&
-                            GetDoc()->IsInHeaderFooter( pPos->nNode ) )
+                        SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
+                        if ((FLY_AT_PARA == aAnchor.GetAnchorId()) ||
+                            (FLY_AT_CHAR == aAnchor.GetAnchorId()) ||
+                            (FLY_AS_CHAR == aAnchor.GetAnchorId()))
                         {
-                            const SdrObject *pCpyObj = rCpyFmt.FindSdrObject();
-                            if (pCpyObj && CheckControlLayer(pCpyObj))
-                                continue;
-                        }
+                            SwPosition* pPos = rPaM.GetPoint();
+                            // allow shapes (no controls) in header/footer
+                            if( RES_DRAWFRMFMT == rCpyFmt.Which() &&
+                                GetDoc()->IsInHeaderFooter( pPos->nNode ) )
+                            {
+                                const SdrObject *pCpyObj = rCpyFmt.FindSdrObject();
+                                if (pCpyObj && CheckControlLayer(pCpyObj))
+                                    continue;
+                            }
 
-                        // Ignore TextBoxes, they are already handled in sw::DocumentLayoutManager::CopyLayoutFmt().
-                        if (aTextBoxes.find(&rCpyFmt) != aTextBoxes.end())
-                            continue;
+                            // Ignore TextBoxes, they are already handled in sw::DocumentLayoutManager::CopyLayoutFmt().
+                            if (aTextBoxes.find(&rCpyFmt) != aTextBoxes.end())
+                                continue;
 
-                        aAnchor.SetAnchor( pPos );
-                    }
-                    else if ( FLY_AT_PAGE == aAnchor.GetAnchorId() )
-                    {
-                        aAnchor.SetPageNum( GetPhyPageNum() );
-                    }
-                    else if( FLY_AT_FLY == aAnchor.GetAnchorId() )
-                    {
-                        Point aPt;
-                        (void)lcl_SetAnchor( *PCURCRSR->GetPoint(), PCURCRSR->GetNode(),
+                            aAnchor.SetAnchor( pPos );
+                        }
+                        else if ( FLY_AT_PAGE == aAnchor.GetAnchorId() )
+                        {
+                            aAnchor.SetPageNum( GetPhyPageNum() );
+                        }
+                        else if( FLY_AT_FLY == aAnchor.GetAnchorId() )
+                        {
+                            Point aPt;
+                            (void)lcl_SetAnchor( *rPaM.GetPoint(), rPaM.GetNode(),
                                         0, aPt, *this, aAnchor, aPt, false );
-                    }
+                        }
 
-                    SwFrmFmt * pNew = GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
+                        SwFrmFmt * pNew = GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
 
-                    if( pNew )
-                    {
-                        if( RES_FLYFRMFMT == pNew->Which() )
-                        {
-                            const Point aPt( GetCrsrDocPos() );
-                            SwFlyFrm* pFlyFrm = static_cast<SwFlyFrmFmt*>(pNew)->
-                                                        GetFrm( &aPt, false );
-                            if( pFlyFrm )
-                                SelectFlyFrm( *pFlyFrm, true );
-                            // always pick the first FlyFrame only; the others
-                            // were copied to the clipboard via Fly in Fly
-                            break;
-                        }
-                        else
+                        if( pNew )
                         {
-                            OSL_ENSURE( RES_DRAWFRMFMT == pNew->Which(), "Neues Format.");
-                            // #i52780# - drawing object has
-                            // to be made visible on paste.
+                            if( RES_FLYFRMFMT == pNew->Which() )
                             {
-                                SwDrawContact* pContact =
-                                    static_cast<SwDrawContact*>(pNew->FindContactObj());
-                                pContact->MoveObjToVisibleLayer( pContact->GetMaster() );
+                                const Point aPt( GetCrsrDocPos() );
+                                SwFlyFrm* pFlyFrm = static_cast<SwFlyFrmFmt*>(pNew)->
+                                                        GetFrm( &aPt, false );
+                                if( pFlyFrm )
+                                    SelectFlyFrm( *pFlyFrm, true );
+                                // always pick the first FlyFrame only; the others
+                                // were copied to the clipboard via Fly in Fly
+                                break;
                             }
-                            SdrObject *pObj = pNew->FindSdrObject();
-                            SwDrawView  *pDV = Imp()->GetDrawView();
-                            pDV->MarkObj( pObj, pDV->GetSdrPageView() );
-                            // #i47455# - notify draw frame format
-                            // that position attributes are already set.
-                            if ( pNew->ISA(SwDrawFrmFmt) )
+                            else
                             {
-                                static_cast<SwDrawFrmFmt*>(pNew)->PosAttrSet();
+                                OSL_ENSURE( RES_DRAWFRMFMT == pNew->Which(), "Neues Format.");
+                                // #i52780# - drawing object has
+                                // to be made visible on paste.
+                                {
+                                    SwDrawContact* pContact =
+                                        static_cast<SwDrawContact*>(pNew->FindContactObj());
+                                    pContact->MoveObjToVisibleLayer( pContact->GetMaster() );
+                                }
+                                SdrObject *pObj = pNew->FindSdrObject();
+                                SwDrawView  *pDV = Imp()->GetDrawView();
+                                pDV->MarkObj( pObj, pDV->GetSdrPageView() );
+                                // #i47455# - notify draw frame format
+                                // that position attributes are already set.
+                                if ( pNew->ISA(SwDrawFrmFmt) )
+                                {
+                                    static_cast<SwDrawFrmFmt*>(pNew)->PosAttrSet();
+                                }
                             }
                         }
                     }
                 }
             }
-        }
-        else
-        {
-            if( bDelTbl && IsTableMode() )
+            else
             {
-                SwEditShell::Delete();
-                bDelTbl = false;
-            }
+                if( bDelTbl && IsTableMode() )
+                {
+                    SwEditShell::Delete();
+                    bDelTbl = false;
+                }
 
-            SwPosition& rInsPos = *PCURCRSR->GetPoint();
-            const SwStartNode* pBoxNd = rInsPos.nNode.GetNode().
+                SwPosition& rInsPos = *rPaM.GetPoint();
+                const SwStartNode* pBoxNd = rInsPos.nNode.GetNode().
                                                     FindTableBoxStartNode();
-            if( pBoxNd && 2 == pBoxNd->EndOfSectionIndex() -
+                if( pBoxNd && 2 == pBoxNd->EndOfSectionIndex() -
                                 pBoxNd->GetIndex() &&
-                aCpyPam.GetPoint()->nNode != aCpyPam.GetMark()->nNode )
-            {
-                // Copy more than 1 node in the current box. But
-                // then the BoxAttribute should be removed
-                GetDoc()->ClearBoxNumAttrs( rInsPos.nNode );
-            }
+                    aCpyPam.GetPoint()->nNode != aCpyPam.GetMark()->nNode )
+                {
+                    // Copy more than 1 node in the current box. But
+                    // then the BoxAttribute should be removed
+                    GetDoc()->ClearBoxNumAttrs( rInsPos.nNode );
+                }
 
-            // **
-            // ** Update SwDoc::Append, if you change the following code **
-            // **
+                // **
+                // ** Update SwDoc::Append, if you change the following code **
+                // **
 
-            // find out if the clipboard document starts with a table
-            bool bStartWithTable = 0 != aCpyPam.Start()->nNode.GetNode().FindTableNode();
-            SwPosition aInsertPosition( rInsPos );
+                // find out if the clipboard document starts with a table
+                bool bStartWithTable = 0 != aCpyPam.Start()->nNode.GetNode().FindTableNode();
+                SwPosition aInsertPosition( rInsPos );
 
-            {
-                SwNodeIndex aIndexBefore(rInsPos.nNode);
+                {
+                    SwNodeIndex aIndexBefore(rInsPos.nNode);
 
-                aIndexBefore--;
+                    aIndexBefore--;
 
-                pClpDoc->getIDocumentContentOperations().CopyRange( aCpyPam, rInsPos, false );
-                // Note: aCpyPam is invalid now
+                    pClpDoc->getIDocumentContentOperations().CopyRange( aCpyPam, rInsPos, false );
+                    // Note: aCpyPam is invalid now
 
-                ++aIndexBefore;
-                SwPaM aPaM(SwPosition(aIndexBefore),
+                    ++aIndexBefore;
+                    SwPaM aPaM(SwPosition(aIndexBefore),
                            SwPosition(rInsPos.nNode));
 
-                aPaM.GetDoc()->MakeUniqueNumRules(aPaM);
+                    aPaM.GetDoc()->MakeUniqueNumRules(aPaM);
 
-                // Update the rsid of each pasted text node.
-                SwNodes &rDestNodes = GetDoc()->GetNodes();
-                sal_uLong const nEndIdx = aPaM.End()->nNode.GetIndex();
+                    // Update the rsid of each pasted text node.
+                    SwNodes &rDestNodes = GetDoc()->GetNodes();
+                    sal_uLong const nEndIdx = aPaM.End()->nNode.GetIndex();
 
-                for (sal_uLong nIdx = aPaM.Start()->nNode.GetIndex();
+                    for (sal_uLong nIdx = aPaM.Start()->nNode.GetIndex();
                         nIdx <= nEndIdx; ++nIdx)
-                {
-                    SwTxtNode *const pTxtNode = rDestNodes[nIdx]->GetTxtNode();
-                    if ( pTxtNode )
                     {
-                        GetDoc()->UpdateParRsid( pTxtNode );
+                        SwTxtNode *const pTxtNode = rDestNodes[nIdx]->GetTxtNode();
+                        if ( pTxtNode )
+                        {
+                            GetDoc()->UpdateParRsid( pTxtNode );
+                        }
                     }
                 }
-            }
 
-            SaveTblBoxCntnt( &rInsPos );
-            if(bIncludingPageFrames && bStartWithTable)
-            {
-                //remove the paragraph in front of the table
-                SwPaM aPara(aInsertPosition);
-                GetDoc()->getIDocumentContentOperations().DelFullPara(aPara);
-            }
-            //additionally copy page bound frames
-            if( bIncludingPageFrames && pClpDoc->GetSpzFrmFmts()->size() )
-            {
-                // create a draw view if necessary
-                if( !Imp()->GetDrawView() )
-                    MakeDrawView();
-
-                for ( sal_uInt16 i = 0; i < pClpDoc->GetSpzFrmFmts()->size(); ++i )
+                SaveTblBoxCntnt( &rInsPos );
+                if(bIncludingPageFrames && bStartWithTable)
                 {
-                    const SwFrmFmt& rCpyFmt = *(*pClpDoc->GetSpzFrmFmts())[i];
-                    SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
-                    if ( FLY_AT_PAGE != aAnchor.GetAnchorId() )
-                        continue;
-                    aAnchor.SetPageNum( aAnchor.GetPageNum() + nStartPageNumber - 1 );
-                    GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
+                    //remove the paragraph in front of the table
+                    SwPaM aPara(aInsertPosition);
+                    GetDoc()->getIDocumentContentOperations().DelFullPara(aPara);
+                }
+                //additionally copy page bound frames
+                if( bIncludingPageFrames && pClpDoc->GetSpzFrmFmts()->size() )
+                {
+                    // create a draw view if necessary
+                    if( !Imp()->GetDrawView() )
+                        MakeDrawView();
+
+                    for ( sal_uInt16 i = 0; i < pClpDoc->GetSpzFrmFmts()->size(); ++i )
+                    {
+                        const SwFrmFmt& rCpyFmt = *(*pClpDoc->GetSpzFrmFmts())[i];
+                        SwFmtAnchor aAnchor( rCpyFmt.GetAnchor() );
+                        if ( FLY_AT_PAGE != aAnchor.GetAnchorId() )
+                            continue;
+                        aAnchor.SetPageNum( aAnchor.GetPageNum() + nStartPageNumber - 1 );
+                        GetDoc()->getIDocumentLayoutAccess().CopyLayoutFmt( rCpyFmt, aAnchor, true, true );
+                    }
                 }
             }
         }
-
-        FOREACHPAM_END()
     }
 
     GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL );
diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx
index 353d5b4..f4fee9a 100644
--- a/sw/source/core/frmedt/fedesc.cxx
+++ b/sw/source/core/frmedt/fedesc.cxx
@@ -188,16 +188,17 @@ const SwPageDesc* SwFEShell::GetSelectedPageDescs() const
     const SwPageDesc* pFnd, *pRetDesc = reinterpret_cast<SwPageDesc*>(0xffffffff);
     const Point aNulPt;
 
-    FOREACHPAM_START(GetCrsr())
+    for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+    {
 
-        if( 0 != (pCNd = PCURCRSR->GetCntntNode() ) &&
+        if( 0 != (pCNd = rPaM.GetCntntNode() ) &&
             0 != ( pPtFrm = pCNd->getLayoutFrm( GetLayout(), &aNulPt, 0, false )) )
             pPtFrm = pPtFrm->FindPageFrm();
         else
             pPtFrm = 0;
 
-        if( PCURCRSR->HasMark() &&
-            0 != (pCNd = PCURCRSR->GetCntntNode( false ) ) &&
+        if( rPaM.HasMark() &&
+            0 != (pCNd = rPaM.GetCntntNode( false ) ) &&
             0 != ( pMkFrm = pCNd->getLayoutFrm( GetLayout(), &aNulPt, 0, false )) )
             pMkFrm = pMkFrm->FindPageFrm();
         else
@@ -234,7 +235,7 @@ const SwPageDesc* SwFEShell::GetSelectedPageDescs() const
             break;
         }
 
-    FOREACHPAM_END()
+    }
 
     return pRetDesc;
 }
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 812d485..e2c7f9a 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -834,12 +834,13 @@ SwFlyFrmFmt* SwFEShell::InsertObject( const svt::EmbeddedObjectRef&  xObj,
     SwFlyFrmFmt* pFmt = 0;
     SET_CURR_SHELL( this );
     StartAllAction();
-        FOREACHPAM_START(GetCrsr())
-            pFmt = GetDoc()->getIDocumentContentOperations().Insert(*PCURCRSR, xObj,
+        for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+        {
+            pFmt = GetDoc()->getIDocumentContentOperations().Insert(rPaM, xObj,
                                     pFlyAttrSet, pGrfAttrSet, pFrmFmt );
             OSL_ENSURE( pFmt, "Doc->getIDocumentContentOperations().Insert(notxt) failed." );
 
-        FOREACHPAM_END()
+        }
     EndAllAction();
 
     if( pFmt )


More information about the Libreoffice-commits mailing list