[Libreoffice-commits] core.git: sw/source
Julien Nabet
serval2412 at yahoo.fr
Mon Dec 15 13:05:56 PST 2014
sw/source/core/edit/edatmisc.cxx | 24 ++++++++--------
sw/source/core/edit/edattr.cxx | 10 +++---
sw/source/core/edit/eddel.cxx | 44 +++++++++++++++--------------
sw/source/core/edit/edfcol.cxx | 9 +++---
sw/source/core/edit/edfld.cxx | 18 ++++++------
sw/source/core/edit/edglss.cxx | 55 ++++++++++++++++++------------------
sw/source/core/edit/editsh.cxx | 58 ++++++++++++++++++++-------------------
sw/source/core/edit/edredln.cxx | 7 ++--
sw/source/core/edit/edsect.cxx | 26 +++++++++--------
sw/source/core/edit/edtab.cxx | 20 +++++++------
sw/source/core/edit/edtox.cxx | 12 ++++----
11 files changed, 149 insertions(+), 134 deletions(-)
New commits:
commit bbf59cb82eabee984926fb11dc5281dc84e62fb6
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Sat Dec 13 19:30:48 2014 +0100
Related fdo#86929: Kill FOREACHPAM_START for good (part2)
Change-Id: Ia6e166a4158d28f1a4145e51040f2f5637827197
Reviewed-on: https://gerrit.libreoffice.org/13466
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/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index 56a1a33..4b08a62 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -54,11 +54,12 @@ void SwEditShell::ResetAttr( const std::set<sal_uInt16> &attrs, SwPaM* pPaM )
void SwEditShell::GCAttr()
{
- FOREACHPAM_START(GetCrsr())
- if ( !PCURCRSR->HasMark() )
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ if ( !rPaM.HasMark() )
{
SwTxtNode *const pTxtNode =
- PCURCRSR->GetPoint()->nNode.GetNode().GetTxtNode();
+ rPaM.GetPoint()->nNode.GetNode().GetTxtNode();
if (pTxtNode)
{
pTxtNode->GCAttr();
@@ -66,8 +67,8 @@ void SwEditShell::GCAttr()
}
else
{
- const SwNodeIndex& rEnd = PCURCRSR->End()->nNode;
- SwNodeIndex aIdx( PCURCRSR->Start()->nNode );
+ const SwNodeIndex& rEnd = rPaM.End()->nNode;
+ SwNodeIndex aIdx( rPaM.Start()->nNode );
SwNode* pNd = &aIdx.GetNode();
do {
if( pNd->IsTxtNode() )
@@ -76,7 +77,7 @@ void SwEditShell::GCAttr()
while( 0 != ( pNd = GetDoc()->GetNodes().GoNext( &aIdx )) &&
aIdx <= rEnd );
}
- FOREACHPAM_END()
+ }
}
/// Set the attribute as new default attribute in the document.
@@ -104,13 +105,14 @@ void SwEditShell::SetAttrItem( const SfxPoolItem& rHint, sal_uInt16 nFlags )
bool bIsTblMode = IsTableMode();
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
- FOREACHPAM_START(GetCrsr())
- if( PCURCRSR->HasMark() && ( bIsTblMode ||
- *PCURCRSR->GetPoint() != *PCURCRSR->GetMark() ))
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ if( rPaM.HasMark() && ( bIsTblMode ||
+ *rPaM.GetPoint() != *rPaM.GetMark() ))
{
- GetDoc()->getIDocumentContentOperations().InsertPoolItem(*PCURCRSR, rHint, nFlags );
+ GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, rHint, nFlags );
}
- FOREACHPAM_END()
+ }
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL);
}
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 3d8a190..ffa6d63 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -481,10 +481,10 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
if( !nDefDist )
return false;
- FOREACHPAM_START(GetCrsr())
-
- sal_uLong nSttNd = PCURCRSR->GetMark()->nNode.GetIndex(),
- nEndNd = PCURCRSR->GetPoint()->nNode.GetIndex();
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ sal_uLong nSttNd = rPaM.GetMark()->nNode.GetIndex(),
+ nEndNd = rPaM.GetPoint()->nNode.GetIndex();
if( nSttNd > nEndNd )
std::swap(nSttNd, nEndNd);
@@ -516,7 +516,7 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const
if( !bRet )
break;
- FOREACHPAM_END()
+ }
return bRet;
}
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 7cc0973..a700116 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -121,9 +121,10 @@ long SwEditShell::Delete()
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_DELETE, &aRewriter);
}
- FOREACHPAM_START(GetCrsr())
- DeleteSel( *PCURCRSR, &bUndo );
- FOREACHPAM_END()
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ DeleteSel( rPaM, &bUndo );
+ }
// If undo container then close here
if( bUndo )
@@ -151,15 +152,15 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
SwPosition * pPos = 0;
boost::shared_ptr<SwPosition> pInsertPos;
sal_uInt16 nMove = 0;
- FOREACHPAM_START(GetCrsr())
-
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
if( !pPos )
{
if( pDestShell == this )
{
// First cursor represents the target position!!
- PCURCRSR->DeleteMark();
- pPos = (SwPosition*)PCURCRSR->GetPoint();
+ rPaM.DeleteMark();
+ pPos = (SwPosition*)rPaM.GetPoint();
continue;
}
else
@@ -184,9 +185,9 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
SwPosition *pTmp = IsBlockMode() ? pInsertPos.get() : pPos;
// Check if a selection would be copied into itself
if( pDestShell->GetDoc() == GetDoc() &&
- *PCURCRSR->Start() <= *pTmp && *pTmp < *PCURCRSR->End() )
+ *rPaM.Start() <= *pTmp && *pTmp < *rPaM.End() )
return sal_False;
- FOREACHPAM_END()
+ }
}
pDestShell->StartAllAction();
@@ -199,15 +200,15 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
std::list< boost::shared_ptr<SwPosition> >::iterator pNextInsert = aInsertList.begin();
pDestShell->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
- FOREACHPAM_START(GetCrsr())
-
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
if( !pPos )
{
if( pDestShell == this )
{
// First cursor represents the target position!!
- PCURCRSR->DeleteMark();
- pPos = (SwPosition*)PCURCRSR->GetPoint();
+ rPaM.DeleteMark();
+ pPos = (SwPosition*)rPaM.GetPoint();
continue;
}
else
@@ -225,7 +226,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
}
// Only for a selection (non-text nodes have selection but Point/GetMark are equal)
- if( !PCURCRSR->HasMark() || *PCURCRSR->GetPoint() == *PCURCRSR->GetMark() )
+ if( !rPaM.HasMark() || *rPaM.GetPoint() == *rPaM.GetMark() )
continue;
if( bFirstMove )
@@ -236,7 +237,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
bFirstMove = false;
}
- const bool bSuccess( GetDoc()->getIDocumentContentOperations().CopyRange( *PCURCRSR, *pPos, false ) );
+ const bool bSuccess( GetDoc()->getIDocumentContentOperations().CopyRange( rPaM, *pPos, false ) );
if (!bSuccess)
continue;
@@ -244,7 +245,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
pDestShell->GetDoc()->MakeUniqueNumRules(aInsertPaM);
bRet = true;
- FOREACHPAM_END()
+ }
// Maybe nothing has been moved?
if( !bFirstMove )
@@ -302,14 +303,15 @@ bool SwEditShell::Replace( const OUString& rNewStr, bool bRegExpRplc )
StartAllAction();
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
- FOREACHPAM_START(GetCrsr())
- if( PCURCRSR->HasMark() && *PCURCRSR->GetMark() != *PCURCRSR->GetPoint() )
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ if( rPaM.HasMark() && *rPaM.GetMark() != *rPaM.GetPoint() )
{
- bRet = GetDoc()->getIDocumentContentOperations().ReplaceRange( *PCURCRSR, rNewStr, bRegExpRplc )
+ bRet = GetDoc()->getIDocumentContentOperations().ReplaceRange( rPaM, rNewStr, bRegExpRplc )
|| bRet;
- SaveTblBoxCntnt( PCURCRSR->GetPoint() );
+ SaveTblBoxCntnt( rPaM.GetPoint() );
}
- FOREACHPAM_END()
+ }
// close Undo container here
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 4d7c107..72b90b3 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -58,14 +58,15 @@ void SwEditShell::SetTxtFmtColl(SwTxtFmtColl *pFmt,
aRewriter.AddRule(UndoArg1, pLocal->GetName());
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_SETFMTCOLL, &aRewriter);
- FOREACHPAM_START(GetCrsr())
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
- if ( !PCURCRSR->HasReadonlySel( GetViewOptions()->IsFormView() ) )
+ if ( !rPaM.HasReadonlySel( GetViewOptions()->IsFormView() ) )
{
- GetDoc()->SetTxtFmtColl( *PCURCRSR, pLocal, true, bResetListAttrs );
+ GetDoc()->SetTxtFmtColl( rPaM, pLocal, true, bResetListAttrs );
}
- FOREACHPAM_END()
+ }
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, &aRewriter);
EndAllAction();
}
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 5ab5ea0..3540ab7 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -204,11 +204,12 @@ void SwEditShell::Insert2(SwField& rFld, const bool bForceExpandHints)
? nsSetAttrMode::SETATTR_FORCEHINTEXPAND
: nsSetAttrMode::SETATTR_DEFAULT;
- FOREACHPAM_START(GetCrsr()) // for each PaM
- const bool bSuccess(GetDoc()->getIDocumentContentOperations().InsertPoolItem(*PCURCRSR, aFld, nInsertFlags));
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer()) // for each PaM
+ {
+ const bool bSuccess(GetDoc()->getIDocumentContentOperations().InsertPoolItem(rPaM, aFld, nInsertFlags));
OSL_ENSURE( bSuccess, "Doc->Insert(Field) failed");
(void) bSuccess;
- FOREACHPAM_END()
+ }
EndAllAction();
}
@@ -284,12 +285,13 @@ void SwEditShell::UpdateFlds( SwField &rFld )
SwMsgPoolItem aFldHint( RES_TXTATR_FIELD ); // Search-Hint
SwMsgPoolItem aAnnotationFldHint( RES_TXTATR_ANNOTATION );
SwMsgPoolItem aInputFldHint( RES_TXTATR_INPUTFIELD );
- FOREACHPAM_START(GetCrsr()) // for each PaM
- if( PCURCRSR->HasMark() && bOkay ) // ... with selection
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer()) // for each PaM
+ {
+ if( rPaM.HasMark() && bOkay ) // ... with selection
{
// copy of the PaM
- SwPaM aCurPam( *PCURCRSR->GetMark(), *PCURCRSR->GetPoint() );
- SwPaM aPam( *PCURCRSR->GetPoint() );
+ SwPaM aCurPam( *rPaM.GetMark(), *rPaM.GetPoint() );
+ SwPaM aPam( *rPaM.GetPoint() );
SwPosition *pCurStt = aCurPam.Start(), *pCurEnd =
aCurPam.End();
@@ -331,7 +333,7 @@ void SwEditShell::UpdateFlds( SwField &rFld )
if( bTblSelBreak ) // If table section and table formula are updated -> finish
break;
- FOREACHPAM_END()
+ }
}
GetDoc()->getIDocumentState().SetModified();
EndAllAction();
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index bf7c347..9df9e66 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -216,37 +216,38 @@ bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
pInsDoc->SetColumnSelection( true );
bool bSelectAll = StartsWithTable() && ExtendedSelectedAll(/*bFootnotes =*/ false);
{
- FOREACHPAM_START(GetCrsr())
-
- if( !PCURCRSR->HasMark() )
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
{
- SwCntntNode *const pNd = PCURCRSR->GetCntntNode();
- if (0 != pNd &&
- ( bColSel || !pNd->GetTxtNode() ) )
+ if( !rPaM.HasMark() )
{
- PCURCRSR->SetMark();
- PCURCRSR->Move( fnMoveForward, fnGoCntnt );
- bRet = GetDoc()->getIDocumentContentOperations().CopyRange( *PCURCRSR, aPos, false )
- || bRet;
- PCURCRSR->Exchange();
- PCURCRSR->DeleteMark();
+ SwCntntNode *const pNd = rPaM.GetCntntNode();
+ if (0 != pNd &&
+ ( bColSel || !pNd->GetTxtNode() ) )
+ {
+ rPaM.SetMark();
+ rPaM.Move( fnMoveForward, fnGoCntnt );
+ bRet = GetDoc()->getIDocumentContentOperations().CopyRange( rPaM, aPos, false )
+ || bRet;
+ rPaM.Exchange();
+ rPaM.DeleteMark();
+ }
+ }
+ else
+ {
+ // Make a copy, so that in case we need to adjust the selection
+ // for the purpose of copying, our shell cursor is not touched.
+ // (Otherwise we would have to restore it.)
+ SwPaM aPaM(rPaM);
+ if (bSelectAll)
+ {
+ // Selection starts at the first para of the first cell,
+ // but we want to copy the table and the start node before
+ // the first cell as well.
+ aPaM.Start()->nNode = aPaM.Start()->nNode.GetNode().FindTableNode()->GetIndex();
+ }
+ bRet = GetDoc()->getIDocumentContentOperations().CopyRange( aPaM, aPos, false ) || bRet;
}
}
- else
- {
- // Make a copy, so that in case we need to adjust the selection
- // for the purpose of copying, our shell cursor is not touched.
- // (Otherwise we would have to restore it.)
- SwPaM aPaM(*PCURCRSR);
- if (bSelectAll)
- // Selection starts at the first para of the first cell,
- // but we want to copy the table and the start node before
- // the first cell as well.
- aPaM.Start()->nNode = aPaM.Start()->nNode.GetNode().FindTableNode()->GetIndex();
- bRet = GetDoc()->getIDocumentContentOperations().CopyRange( aPaM, aPos, false ) || bRet;
- }
-
- FOREACHPAM_END()
}
}
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 3d8afe0..ba3f731 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -68,17 +68,17 @@ using namespace com::sun::star;
void SwEditShell::Insert( sal_Unicode c, bool bOnlyCurrCrsr )
{
StartAllAction();
- FOREACHPAM_START(GetCrsr())
-
- const bool bSuccess = GetDoc()->getIDocumentContentOperations().InsertString(*PCURCRSR, OUString(c));
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ const bool bSuccess = GetDoc()->getIDocumentContentOperations().InsertString(rPaM, OUString(c));
OSL_ENSURE( bSuccess, "Doc->Insert() failed." );
(void) bSuccess;
- SaveTblBoxCntnt( PCURCRSR->GetPoint() );
+ SaveTblBoxCntnt( rPaM.GetPoint() );
if( bOnlyCurrCrsr )
break;
- FOREACHPAM_END()
+ }
EndAllAction();
}
@@ -167,13 +167,14 @@ void SwEditShell::Insert2(const OUString &rStr, const bool bForceExpandHints )
void SwEditShell::Overwrite(const OUString &rStr)
{
StartAllAction();
- FOREACHPAM_START(GetCrsr())
- if( !GetDoc()->getIDocumentContentOperations().Overwrite(*PCURCRSR, rStr ) )
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ if( !GetDoc()->getIDocumentContentOperations().Overwrite(rPaM, rStr ) )
{
OSL_FAIL( "Doc->getIDocumentContentOperations().Overwrite(Str) failed." );
}
- SaveTblBoxCntnt( PCURCRSR->GetPoint() );
- FOREACHPAM_END()
+ SaveTblBoxCntnt( rPaM.GetPoint() );
+ }
EndAllAction();
}
@@ -182,11 +183,12 @@ long SwEditShell::SplitNode( bool bAutoFormat, bool bCheckTableStart )
StartAllAction();
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
- FOREACHPAM_START(GetCrsr())
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
// Here, a table cell becomes a normal text cell.
- GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode );
- GetDoc()->getIDocumentContentOperations().SplitNode( *PCURCRSR->GetPoint(), bCheckTableStart );
- FOREACHPAM_END()
+ GetDoc()->ClearBoxNumAttrs( rPaM.GetPoint()->nNode );
+ GetDoc()->getIDocumentContentOperations().SplitNode( *rPaM.GetPoint(), bCheckTableStart );
+ }
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
@@ -205,10 +207,11 @@ bool SwEditShell::AppendTxtNode()
StartAllAction();
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
- FOREACHPAM_START(GetCrsr())
- GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode );
- bRet = GetDoc()->getIDocumentContentOperations().AppendTxtNode( *PCURCRSR->GetPoint()) || bRet;
- FOREACHPAM_END()
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ GetDoc()->ClearBoxNumAttrs( rPaM.GetPoint()->nNode );
+ bRet = GetDoc()->getIDocumentContentOperations().AppendTxtNode( *rPaM.GetPoint()) || bRet;
+ }
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
@@ -1026,12 +1029,11 @@ void SwEditShell::TransliterateText( sal_uInt32 nType )
if( pCrsr->GetNext() != pCrsr )
{
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
- FOREACHPAM_START(GetCrsr())
-
- if( PCURCRSR->HasMark() )
- GetDoc()->getIDocumentContentOperations().TransliterateText( *PCURCRSR, aTrans );
-
- FOREACHPAM_END()
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ if( rPaM.HasMark() )
+ GetDoc()->getIDocumentContentOperations().TransliterateText( rPaM, aTrans );
+ }
GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
}
else
@@ -1042,12 +1044,12 @@ void SwEditShell::TransliterateText( sal_uInt32 nType )
void SwEditShell::CountWords( SwDocStat& rStat ) const
{
- FOREACHPAM_START(GetCrsr())
-
- if( PCURCRSR->HasMark() )
- GetDoc()->CountWords( *PCURCRSR, rStat );
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ if( rPaM.HasMark() )
+ GetDoc()->CountWords( rPaM, rStat );
- FOREACHPAM_END()
+ }
}
void SwEditShell::ApplyViewOptions( const SwViewOption &rOpt )
diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx
index 2948ad2..c5bc2a4 100644
--- a/sw/source/core/edit/edredln.cxx
+++ b/sw/source/core/edit/edredln.cxx
@@ -110,9 +110,10 @@ bool SwEditShell::RejectRedlinesInSelection()
bool SwEditShell::SetRedlineComment( const OUString& rS )
{
bool bRet = false;
- FOREACHPAM_START(GetCrsr())
- bRet = bRet || GetDoc()->getIDocumentRedlineAccess().SetRedlineComment( *PCURCRSR, rS );
- FOREACHPAM_END()
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ bRet = bRet || GetDoc()->getIDocumentRedlineAccess().SetRedlineComment( rPaM, rS );
+ }
return bRet;
}
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index d874c56..6179924 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -41,12 +41,13 @@ SwEditShell::InsertSection(
StartAllAction();
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSSECTION, NULL );
- FOREACHPAM_START(GetCrsr())
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
SwSection const*const pNew =
- GetDoc()->InsertSwSection( *PCURCRSR, rNewData, 0, pAttr );
+ GetDoc()->InsertSwSection( rPaM, rNewData, 0, pAttr );
if( !pRet )
pRet = pNew;
- FOREACHPAM_END()
+ }
GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL );
EndAllAction();
@@ -183,10 +184,10 @@ void SwEditShell::SetSectionAttr( const SfxItemSet& rSet,
{
// for all section in the selection
- FOREACHPAM_START(GetCrsr())
-
- const SwPosition* pStt = PCURCRSR->Start(),
- * pEnd = PCURCRSR->End();
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ const SwPosition* pStt = rPaM.Start(),
+ * pEnd = rPaM.End();
const SwSectionNode* pSttSectNd = pStt->nNode.GetNode().FindSectionNode(),
* pEndSectNd = pEnd->nNode.GetNode().FindSectionNode();
@@ -224,7 +225,7 @@ void SwEditShell::SetSectionAttr( const SfxItemSet& rSet,
}
}
- FOREACHPAM_END()
+ }
}
}
@@ -253,10 +254,11 @@ void SwEditShell::_SetSectionAttr( SwSectionFmt& rSectFmt,
sal_uInt16 SwEditShell::GetFullSelectedSectionCount() const
{
sal_uInt16 nRet = 0;
- FOREACHPAM_START(GetCrsr())
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
- const SwPosition* pStt = PCURCRSR->Start(),
- * pEnd = PCURCRSR->End();
+ const SwPosition* pStt = rPaM.Start(),
+ * pEnd = rPaM.End();
const SwCntntNode* pCNd;
// check the selection, if Start at Node begin and End at Node end
if( pStt->nContent.GetIndex() ||
@@ -286,7 +288,7 @@ sal_uInt16 SwEditShell::GetFullSelectedSectionCount() const
if( &aSIdx.GetNode() != aEIdx.GetNode().StartOfSectionNode() )
++nRet;
- FOREACHPAM_END()
+ }
return nRet;
}
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index eb7fbbb..fd08d96 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -126,11 +126,12 @@ bool SwEditShell::TextToTable( const SwInsertTableOptions& rInsTblOpts,
SwWait aWait( *GetDoc()->GetDocShell(), true );
bool bRet = false;
StartAllAction();
- FOREACHPAM_START(GetCrsr())
- if( PCURCRSR->HasMark() )
- bRet |= 0 != GetDoc()->TextToTable( rInsTblOpts, *PCURCRSR, cCh,
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ if( rPaM.HasMark() )
+ bRet |= 0 != GetDoc()->TextToTable( rInsTblOpts, rPaM, cCh,
eAdj, pTAFmt );
- FOREACHPAM_END()
+ }
EndAllAction();
return bRet;
}
@@ -185,14 +186,15 @@ bool SwEditShell::TableToText( sal_Unicode cCh )
bool SwEditShell::IsTextToTableAvailable() const
{
bool bOnlyText = false;
- FOREACHPAM_START(GetCrsr())
- if( PCURCRSR->HasMark() && *PCURCRSR->GetPoint() != *PCURCRSR->GetMark() )
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ if( rPaM.HasMark() && *rPaM.GetPoint() != *rPaM.GetMark() )
{
bOnlyText = true;
// check if selection is in listing
- sal_uLong nStt = PCURCRSR->GetMark()->nNode.GetIndex(),
- nEnd = PCURCRSR->GetPoint()->nNode.GetIndex();
+ sal_uLong nStt = rPaM.GetMark()->nNode.GetIndex(),
+ nEnd = rPaM.GetPoint()->nNode.GetIndex();
if( nStt > nEnd ) { sal_uLong n = nStt; nStt = nEnd; nEnd = n; }
for( ; nStt <= nEnd; ++nStt )
@@ -205,7 +207,7 @@ bool SwEditShell::IsTextToTableAvailable() const
if( !bOnlyText )
break;
}
- FOREACHPAM_END()
+ }
return bOnlyText;
}
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index b9c3db1..591353b 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -60,10 +60,10 @@ void SwEditShell::Insert(const SwTOXMark& rMark)
{
bool bInsAtPos = rMark.IsAlternativeText();
StartAllAction();
- FOREACHPAM_START(GetCrsr())
-
- const SwPosition *pStt = PCURCRSR->Start(),
- *pEnd = PCURCRSR->End();
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ const SwPosition *pStt = rPaM.Start(),
+ *pEnd = rPaM.End();
if( bInsAtPos )
{
SwPaM aTmp( *pStt );
@@ -72,10 +72,10 @@ void SwEditShell::Insert(const SwTOXMark& rMark)
else if( *pEnd != *pStt )
{
GetDoc()->getIDocumentContentOperations().InsertPoolItem(
- *PCURCRSR, rMark, nsSetAttrMode::SETATTR_DONTEXPAND );
+ rPaM, rMark, nsSetAttrMode::SETATTR_DONTEXPAND );
}
- FOREACHPAM_END()
+ }
EndAllAction();
}
More information about the Libreoffice-commits
mailing list