summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2014-12-15 23:31:51 +0100
committerNoel Grandin <noelgrandin@gmail.com>2014-12-18 06:39:46 +0000
commit2a44e785da22fe08da295208c2819af813e63447 (patch)
tree5abf0a49dd70f4ec37d40cc425264b5e8afc5ac2 /sw
parenta23f6eb3ae49dfc326c6e57a8ab95a840c0661d2 (diff)
Related fdo#86929: Kill FOREACHPAM_START for good (final part)
Change-Id: I74c6e8633ee5ac477d2f7ac8ee468204076bc886 Reviewed-on: https://gerrit.libreoffice.org/13488 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/edimp.hxx9
-rw-r--r--sw/source/core/doc/CntntIdxStore.cxx21
-rw-r--r--sw/source/core/doc/doccorr.cxx35
-rw-r--r--sw/source/core/edit/edattr.cxx14
4 files changed, 39 insertions, 40 deletions
diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx
index a62f0d2fa58e..44d53e8785f1 100644
--- a/sw/inc/edimp.hxx
+++ b/sw/inc/edimp.hxx
@@ -27,15 +27,6 @@
class SwPaM;
class SwNodeIndex;
-// Macros to iterate over all ranges.
-#define PCURCRSR (static_cast<SwPaM *>(&__r))
-
-#define FOREACHPAM_START(pCURSH) \
- for(SwPaM& __r : (pCURSH)->GetRingContainer()) \
- {
-
-#define FOREACHPAM_END() }
-
struct SwPamRange
{
sal_uLong nStart, nEnd;
diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx
index 353f6f7f8984..3ce5b12164bf 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ b/sw/source/core/doc/CntntIdxStore.cxx
@@ -382,15 +382,17 @@ void CntntIdxStoreImpl::SaveUnoCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 nCn
{
BOOST_FOREACH(const SwUnoCrsr* pUnoCrsr, pDoc->GetUnoCrsrTbl())
{
- FOREACHPAM_START( const_cast<SwUnoCrsr*>(pUnoCrsr) )
- lcl_ChkPaMBoth( m_aUnoCrsrEntries, nNode, nCntnt, *PCURCRSR );
- FOREACHPAM_END()
+ for(SwPaM& rPaM : (const_cast<SwUnoCrsr*>(pUnoCrsr))->GetRingContainer())
+ {
+ lcl_ChkPaMBoth( m_aUnoCrsrEntries, nNode, nCntnt, rPaM);
+ }
const SwUnoTableCrsr* pUnoTblCrsr = dynamic_cast<const SwUnoTableCrsr*>(pUnoCrsr);
if( pUnoTblCrsr )
{
- FOREACHPAM_START( &(const_cast<SwUnoTableCrsr*>(pUnoTblCrsr))->GetSelRing() )
- lcl_ChkPaMBoth( m_aUnoCrsrEntries, nNode, nCntnt, *PCURCRSR );
- FOREACHPAM_END()
+ for(SwPaM& rPaM : (&(const_cast<SwUnoTableCrsr*>(pUnoTblCrsr))->GetSelRing())->GetRingContainer())
+ {
+ lcl_ChkPaMBoth( m_aUnoCrsrEntries, nNode, nCntnt, rPaM);
+ }
}
}
}
@@ -419,9 +421,10 @@ void CntntIdxStoreImpl::SaveShellCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 n
} while ( (_pStkCrsr != 0 ) &&
((_pStkCrsr = _pStkCrsr->GetNext()) != static_cast<SwCrsrShell*>(&rCurShell)->GetStkCrsr()) );
- FOREACHPAM_START( static_cast<SwCrsrShell*>(&rCurShell)->_GetCrsr() )
- lcl_ChkPaMBoth( m_aShellCrsrEntries, nNode, nCntnt, *PCURCRSR);
- FOREACHPAM_END()
+ for(SwPaM& rPaM : (static_cast<SwCrsrShell*>(&rCurShell)->_GetCrsr())->GetRingContainer())
+ {
+ lcl_ChkPaMBoth( m_aShellCrsrEntries, nNode, nCntnt, rPaM);
+ }
}
}
}
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index b012731b0815..7cf46303a17e 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -111,9 +111,10 @@ void PaMCorrAbs( const SwPaM& rRange,
} while ( (_pStkCrsr != 0 ) &&
((_pStkCrsr = static_cast<SwPaM *>(_pStkCrsr->GetNext())) != pCrsrShell->GetStkCrsr()) );
- FOREACHPAM_START( const_cast<SwShellCrsr*>(pCrsrShell->_GetCrsr()) )
- lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos );
- FOREACHPAM_END()
+ for(SwPaM& rPaM : const_cast<SwShellCrsr*>(pCrsrShell->_GetCrsr())->GetRingContainer())
+ {
+ lcl_PaMCorrAbs( rPaM, aStart, aEnd, aNewPos );
+ }
if( pCrsrShell->IsTableMode() )
lcl_PaMCorrAbs( const_cast<SwPaM &>(*pCrsrShell->GetTblCrs()), aStart, aEnd, aNewPos );
@@ -136,18 +137,20 @@ void PaMCorrAbs( const SwPaM& rRange,
lcl_FindUnoCrsrSection(
pUnoCursor->GetPoint()->nNode.GetNode() ) );
- FOREACHPAM_START( pUnoCursor )
- bChange |= lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos );
- FOREACHPAM_END()
+ for(SwPaM& rPaM : pUnoCursor->GetRingContainer())
+ {
+ bChange |= lcl_PaMCorrAbs( rPaM, aStart, aEnd, aNewPos );
+ }
SwUnoTableCrsr *const pUnoTblCrsr =
dynamic_cast<SwUnoTableCrsr *>(*it);
if( pUnoTblCrsr )
{
- FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
+ for(SwPaM& rPaM : (&pUnoTblCrsr->GetSelRing())->GetRingContainer())
+ {
bChange |=
- lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos );
- FOREACHPAM_END()
+ lcl_PaMCorrAbs( rPaM, aStart, aEnd, aNewPos );
+ }
}
// if a UNO cursor leaves its designated section, we must inform
@@ -275,17 +278,19 @@ void PaMCorrRel( const SwNodeIndex &rOldNode,
SwUnoCrsrTbl& rTbl = (SwUnoCrsrTbl&)pDoc->GetUnoCrsrTbl();
for( SwUnoCrsrTbl::iterator it = rTbl.begin(); it != rTbl.end(); ++it )
{
- FOREACHPAM_START( *it )
- lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx );
- FOREACHPAM_END()
+ for(SwPaM& rPaM : (*it)->GetRingContainer())
+ {
+ lcl_PaMCorrRel1( &rPaM, pOldNode, aNewPos, nCntIdx );
+ }
SwUnoTableCrsr* pUnoTblCrsr =
dynamic_cast<SwUnoTableCrsr*>(*it);
if( pUnoTblCrsr )
{
- FOREACHPAM_START( &pUnoTblCrsr->GetSelRing() )
- lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx );
- FOREACHPAM_END()
+ for(SwPaM& rPaM : (&pUnoTblCrsr->GetSelRing())->GetRingContainer())
+ {
+ lcl_PaMCorrRel1( &rPaM, pOldNode, aNewPos, nCntIdx );
+ }
}
}
}
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index ffa6d633f3bc..248fa1f8ff82 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -638,12 +638,12 @@ sal_uInt16 SwEditShell::GetScriptType() const
sal_uInt16 nRet = 0;
{
- FOREACHPAM_START(GetCrsr())
-
- const SwPosition *pStt = PCURCRSR->Start(),
- *pEnd = pStt == PCURCRSR->GetMark()
- ? PCURCRSR->GetPoint()
- : PCURCRSR->GetMark();
+ for(SwPaM& rPaM : GetCrsr()->GetRingContainer())
+ {
+ const SwPosition *pStt = rPaM.Start(),
+ *pEnd = pStt == rPaM.GetMark()
+ ? rPaM.GetPoint()
+ : rPaM.GetMark();
if( pStt == pEnd || *pStt == *pEnd )
{
const SwTxtNode* pTNd = pStt->nNode.GetNode().GetTxtNode();
@@ -739,7 +739,7 @@ sal_uInt16 SwEditShell::GetScriptType() const
SCRIPTTYPE_COMPLEX) == nRet )
break;
- FOREACHPAM_END()
+ }
}
if( !nRet )
nRet = SvtLanguageOptions::GetScriptTypeOfLanguage( LANGUAGE_SYSTEM );