summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docredln.cxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2014-04-28 18:03:49 +0200
committerLuboš Luňák <l.lunak@collabora.com>2014-04-28 19:20:21 +0200
commit160e93607f6c2c3981823b30ee981ca23d4e1a0d (patch)
treeb717f91011ba9bc9aca7e8a56080989e9ed06b79 /sw/source/core/doc/docredln.cxx
parentf60d4c758ab94bfb55990ca0975de91e22f8265b (diff)
move function searching for a readline directly to SwRedlineTbl
It's more fun to roll one's own lcl_ function hidden somewhere, huh? Change-Id: I8cad6ff7e829a58c68098bff23bd48343c3e5b6a
Diffstat (limited to 'sw/source/core/doc/docredln.cxx')
-rw-r--r--sw/source/core/doc/docredln.cxx66
1 files changed, 33 insertions, 33 deletions
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 8dcf9ee64300..5b4583837245 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -2115,35 +2115,6 @@ static sal_Bool lcl_RejectRedline( SwRedlineTbl& rArr, sal_uInt16& rPos,
return bRet;
}
-static const SwRangeRedline* lcl_FindCurrRedline( const SwPosition& rSttPos,
- sal_uInt16& rPos,
- bool bNext = true )
-{
- const SwRangeRedline* pFnd = 0;
- const SwRedlineTbl& rArr = rSttPos.nNode.GetNode().GetDoc()->GetRedlineTbl();
- for( ; rPos < rArr.size() ; ++rPos )
- {
- const SwRangeRedline* pTmp = rArr[ rPos ];
- if( pTmp->HasMark() && pTmp->IsVisible() )
- {
- const SwPosition* pRStt = pTmp->Start(),
- * pREnd = pRStt == pTmp->GetPoint() ? pTmp->GetMark()
- : pTmp->GetPoint();
- if( bNext ? *pRStt <= rSttPos : *pRStt < rSttPos )
- {
- if( bNext ? *pREnd > rSttPos : *pREnd >= rSttPos )
- {
- pFnd = pTmp;
- break;
- }
- }
- else
- break;
- }
- }
- return pFnd;
-}
-
static int lcl_AcceptRejectRedl( Fn_AcceptReject fn_AcceptReject,
SwRedlineTbl& rArr, sal_Bool bCallDelete,
const SwPaM& rPam)
@@ -2154,7 +2125,7 @@ static int lcl_AcceptRejectRedl( Fn_AcceptReject fn_AcceptReject,
const SwPosition* pStt = rPam.Start(),
* pEnd = pStt == rPam.GetPoint() ? rPam.GetMark()
: rPam.GetPoint();
- const SwRangeRedline* pFnd = lcl_FindCurrRedline( *pStt, n, true );
+ const SwRangeRedline* pFnd = rArr.FindAtPosition( *pStt, n, true );
if( pFnd && // Is new a part of it?
( *pFnd->Start() != *pStt || *pFnd->End() > *pEnd ))
{
@@ -2466,7 +2437,7 @@ const SwRangeRedline* SwDoc::SelNextRedline( SwPaM& rPam ) const
// If the starting position points to the last valid ContentNode,
// we take the next Redline in any case.
sal_uInt16 n = 0;
- const SwRangeRedline* pFnd = lcl_FindCurrRedline( rSttPos, n, true );
+ const SwRangeRedline* pFnd = GetRedlineTbl().FindAtPosition( rSttPos, n, true );
if( pFnd )
{
const SwPosition* pEnd = pFnd->End();
@@ -2585,7 +2556,7 @@ const SwRangeRedline* SwDoc::SelPrevRedline( SwPaM& rPam ) const
// If the starting position points to the last valid ContentNode,
// we take the previous Redline in any case.
sal_uInt16 n = 0;
- const SwRangeRedline* pFnd = lcl_FindCurrRedline( rSttPos, n, false );
+ const SwRangeRedline* pFnd = GetRedlineTbl().FindAtPosition( rSttPos, n, false );
if( pFnd )
{
const SwPosition* pStt = pFnd->Start();
@@ -2702,7 +2673,7 @@ bool SwDoc::SetRedlineComment( const SwPaM& rPaM, const OUString& rS )
* pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark()
: rPaM.GetPoint();
sal_uInt16 n = 0;
- if( lcl_FindCurrRedline( *pStt, n, true ) )
+ if( GetRedlineTbl().FindAtPosition( *pStt, n, true ) )
{
for( ; n < mpRedlineTbl->size(); ++n )
{
@@ -3042,6 +3013,35 @@ sal_uInt16 SwRedlineTbl::FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos,
return nRet;
}
+const SwRangeRedline* SwRedlineTbl::FindAtPosition( const SwPosition& rSttPos,
+ sal_uInt16& rPos,
+ bool bNext ) const
+{
+ const SwRangeRedline* pFnd = 0;
+ for( ; rPos < size() ; ++rPos )
+ {
+ const SwRangeRedline* pTmp = (*this)[ rPos ];
+ if( pTmp->HasMark() && pTmp->IsVisible() )
+ {
+ const SwPosition* pRStt = pTmp->Start(),
+ * pREnd = pRStt == pTmp->GetPoint() ? pTmp->GetMark()
+ : pTmp->GetPoint();
+ if( bNext ? *pRStt <= rSttPos : *pRStt < rSttPos )
+ {
+ if( bNext ? *pREnd > rSttPos : *pREnd >= rSttPos )
+ {
+ pFnd = pTmp;
+ break;
+ }
+ }
+ else
+ break;
+ }
+ }
+ return pFnd;
+}
+
+
SwRedlineExtraData::~SwRedlineExtraData()
{
}