Kaydet (Commit) 8286e924 authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Björn Michaelsen

Related fdo#86929: Kill FOREACHPAM_START for good (part1)

Change-Id: Ifdb896108cf0db0a9be7ba419df785da536c0fab
Reviewed-on: https://gerrit.libreoffice.org/13465Reviewed-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: 's avatarBjörn Michaelsen <bjoern.michaelsen@canonical.com>
üst bbf59cb8
...@@ -812,15 +812,16 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) ...@@ -812,15 +812,16 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
} }
else else
{ {
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
if( pSrcNd && if( pSrcNd &&
0 != ( pDestNd = GetDoc()->IsIdxInTbl( PCURCRSR->GetPoint()->nNode ))) 0 != ( pDestNd = GetDoc()->IsIdxInTbl( rPaM.GetPoint()->nNode )))
{ {
SwPosition aDestPos( *PCURCRSR->GetPoint() ); SwPosition aDestPos( *rPaM.GetPoint() );
bool bParkTblCrsr = false; bool bParkTblCrsr = false;
const SwStartNode* pSttNd = PCURCRSR->GetNode().FindTableBoxStartNode(); const SwStartNode* pSttNd = rPaM.GetNode().FindTableBoxStartNode();
// TABLE IN TABLE: copy table in table // TABLE IN TABLE: copy table in table
// search boxes via the layout // search boxes via the layout
...@@ -831,7 +832,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) ...@@ -831,7 +832,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
ParkTblCrsr(); ParkTblCrsr();
bParkTblCrsr = true; bParkTblCrsr = true;
} }
else if( !PCURCRSR->HasMark() && PCURCRSR->GetNext() == PCURCRSR && else if( !rPaM.HasMark() && rPaM.GetNext() == &rPaM &&
( !pSrcNd->GetTable().IsTblComplex() || ( !pSrcNd->GetTable().IsTblComplex() ||
pDestNd->GetTable().IsNewModel() ) ) pDestNd->GetTable().IsNewModel() ) )
{ {
...@@ -866,7 +867,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) ...@@ -866,7 +867,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
SwCntntNode* pCNd = GetDoc()->GetNodes().GoNext( &aNdIdx ); SwCntntNode* pCNd = GetDoc()->GetNodes().GoNext( &aNdIdx );
SwPosition aPos( aNdIdx, SwIndex( pCNd, 0 )); SwPosition aPos( aNdIdx, SwIndex( pCNd, 0 ));
// #i59539: Don't remove all redline // #i59539: Don't remove all redline
SwNode & rNode(PCURCRSR->GetPoint()->nNode.GetNode()); SwNode & rNode(rPaM.GetPoint()->nNode.GetNode());
SwCntntNode *const pCntntNode( rNode.GetCntntNode() ); SwCntntNode *const pCntntNode( rNode.GetCntntNode() );
SwPaM const tmpPam(rNode, 0, SwPaM const tmpPam(rNode, 0,
rNode, (pCntntNode) ? pCntntNode->Len() : 0); rNode, (pCntntNode) ? pCntntNode->Len() : 0);
...@@ -942,7 +943,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) ...@@ -942,7 +943,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
(FLY_AT_CHAR == aAnchor.GetAnchorId()) || (FLY_AT_CHAR == aAnchor.GetAnchorId()) ||
(FLY_AS_CHAR == aAnchor.GetAnchorId())) (FLY_AS_CHAR == aAnchor.GetAnchorId()))
{ {
SwPosition* pPos = PCURCRSR->GetPoint(); SwPosition* pPos = rPaM.GetPoint();
// allow shapes (no controls) in header/footer // allow shapes (no controls) in header/footer
if( RES_DRAWFRMFMT == rCpyFmt.Which() && if( RES_DRAWFRMFMT == rCpyFmt.Which() &&
GetDoc()->IsInHeaderFooter( pPos->nNode ) ) GetDoc()->IsInHeaderFooter( pPos->nNode ) )
...@@ -965,7 +966,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) ...@@ -965,7 +966,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
else if( FLY_AT_FLY == aAnchor.GetAnchorId() ) else if( FLY_AT_FLY == aAnchor.GetAnchorId() )
{ {
Point aPt; Point aPt;
(void)lcl_SetAnchor( *PCURCRSR->GetPoint(), PCURCRSR->GetNode(), (void)lcl_SetAnchor( *rPaM.GetPoint(), rPaM.GetNode(),
0, aPt, *this, aAnchor, aPt, false ); 0, aPt, *this, aAnchor, aPt, false );
} }
...@@ -1016,7 +1017,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) ...@@ -1016,7 +1017,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
bDelTbl = false; bDelTbl = false;
} }
SwPosition& rInsPos = *PCURCRSR->GetPoint(); SwPosition& rInsPos = *rPaM.GetPoint();
const SwStartNode* pBoxNd = rInsPos.nNode.GetNode(). const SwStartNode* pBoxNd = rInsPos.nNode.GetNode().
FindTableBoxStartNode(); FindTableBoxStartNode();
if( pBoxNd && 2 == pBoxNd->EndOfSectionIndex() - if( pBoxNd && 2 == pBoxNd->EndOfSectionIndex() -
...@@ -1090,8 +1091,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames ) ...@@ -1090,8 +1091,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc, bool bIncludingPageFrames )
} }
} }
} }
}
FOREACHPAM_END()
} }
GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL ); GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL );
......
...@@ -188,16 +188,17 @@ const SwPageDesc* SwFEShell::GetSelectedPageDescs() const ...@@ -188,16 +188,17 @@ const SwPageDesc* SwFEShell::GetSelectedPageDescs() const
const SwPageDesc* pFnd, *pRetDesc = reinterpret_cast<SwPageDesc*>(0xffffffff); const SwPageDesc* pFnd, *pRetDesc = reinterpret_cast<SwPageDesc*>(0xffffffff);
const Point aNulPt; 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 )) ) 0 != ( pPtFrm = pCNd->getLayoutFrm( GetLayout(), &aNulPt, 0, false )) )
pPtFrm = pPtFrm->FindPageFrm(); pPtFrm = pPtFrm->FindPageFrm();
else else
pPtFrm = 0; pPtFrm = 0;
if( PCURCRSR->HasMark() && if( rPaM.HasMark() &&
0 != (pCNd = PCURCRSR->GetCntntNode( false ) ) && 0 != (pCNd = rPaM.GetCntntNode( false ) ) &&
0 != ( pMkFrm = pCNd->getLayoutFrm( GetLayout(), &aNulPt, 0, false )) ) 0 != ( pMkFrm = pCNd->getLayoutFrm( GetLayout(), &aNulPt, 0, false )) )
pMkFrm = pMkFrm->FindPageFrm(); pMkFrm = pMkFrm->FindPageFrm();
else else
...@@ -234,7 +235,7 @@ const SwPageDesc* SwFEShell::GetSelectedPageDescs() const ...@@ -234,7 +235,7 @@ const SwPageDesc* SwFEShell::GetSelectedPageDescs() const
break; break;
} }
FOREACHPAM_END() }
return pRetDesc; return pRetDesc;
} }
......
...@@ -834,12 +834,13 @@ SwFlyFrmFmt* SwFEShell::InsertObject( const svt::EmbeddedObjectRef& xObj, ...@@ -834,12 +834,13 @@ SwFlyFrmFmt* SwFEShell::InsertObject( const svt::EmbeddedObjectRef& xObj,
SwFlyFrmFmt* pFmt = 0; SwFlyFrmFmt* pFmt = 0;
SET_CURR_SHELL( this ); SET_CURR_SHELL( this );
StartAllAction(); StartAllAction();
FOREACHPAM_START(GetCrsr()) for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
pFmt = GetDoc()->getIDocumentContentOperations().Insert(*PCURCRSR, xObj, {
pFmt = GetDoc()->getIDocumentContentOperations().Insert(rPaM, xObj,
pFlyAttrSet, pGrfAttrSet, pFrmFmt ); pFlyAttrSet, pGrfAttrSet, pFrmFmt );
OSL_ENSURE( pFmt, "Doc->getIDocumentContentOperations().Insert(notxt) failed." ); OSL_ENSURE( pFmt, "Doc->getIDocumentContentOperations().Insert(notxt) failed." );
FOREACHPAM_END() }
EndAllAction(); EndAllAction();
if( pFmt ) if( pFmt )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment