summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-12-21 13:52:56 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-12-22 17:05:27 +0100
commit2165f174f131933ad4abe530d79ca87728439824 (patch)
treedbcd9ecc7649f70512be0dbcd4e3449c9ab14993 /sw/source
parent0e4f4b9ea8cf5223b90af47bea3c20e4541fc532 (diff)
sw: simplify SwNodes::FindPrvNxtFrameNode(), pEnd is always passed
Change-Id: I6bd606e8c70704cb716b1eb474934dedb54d81da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127270 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit e0f13ce0f9e2dac836c42141bb848d2bf4fbda75) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127250
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/docnode/nodes.cxx25
1 files changed, 8 insertions, 17 deletions
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 1b16c73b46eb..9ee61dd93d50 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2027,8 +2027,7 @@ SwContentNode* SwNodes::GoPrevSection( SwNodeIndex * pIdx,
/** find the next/previous ContentNode or table node that should have layout
* frames that are siblings to the ones of the node at rFrameIdx.
*
- * If no pEnd is given, search is started with FrameIndex; otherwise
- * search is started backward with the one before rFrameIdx and
+ * Search is started backward with the one before rFrameIdx and
* forward after pEnd.
*
* @param rFrameIdx in: node with frames to search in; out: found node
@@ -2038,6 +2037,8 @@ SwContentNode* SwNodes::GoPrevSection( SwNodeIndex * pIdx,
SwNode* SwNodes::FindPrvNxtFrameNode( SwNodeIndex& rFrameIdx,
const SwNode* pEnd ) const
{
+ assert(pEnd != nullptr); // every caller currently
+
SwNode* pFrameNd = nullptr;
// no layout -> skip
@@ -2057,12 +2058,8 @@ SwNode* SwNodes::FindPrvNxtFrameNode( SwNodeIndex& rFrameIdx,
? pSttNd->StartOfSectionNode()->FindTableNode()
: pSttNd->FindTableNode();
SwNodeIndex aIdx( rFrameIdx );
- SwNode* pNd;
- if( pEnd )
- {
- --aIdx;
- }
- pNd = &aIdx.GetNode();
+ --aIdx;
+ SwNode *const pNd = &aIdx.GetNode();
if( ( pFrameNd = pNd )->IsContentNode() )
rFrameIdx = aIdx;
@@ -2083,13 +2080,10 @@ SwNode* SwNodes::FindPrvNxtFrameNode( SwNodeIndex& rFrameIdx,
}
else
{
- if( pEnd )
- aIdx = pEnd->GetIndex() + 1;
- else
- aIdx = rFrameIdx;
+ aIdx = pEnd->GetIndex() + 1;
// NEVER leave the section when doing this!
- if( ( pEnd && ( pFrameNd = &aIdx.GetNode())->IsContentNode() ) ||
+ if( ( ( pFrameNd = &aIdx.GetNode())->IsContentNode() ) ||
( nullptr != ( pFrameNd = GoNextSection( &aIdx, true, false )) &&
::CheckNodesRange( aIdx, rFrameIdx, true ) &&
( pFrameNd->FindTableNode() == pTableNd &&
@@ -2122,10 +2116,7 @@ SwNode* SwNodes::FindPrvNxtFrameNode( SwNodeIndex& rFrameIdx,
}
else
{
- if( pEnd )
- aIdx = pEnd->GetIndex() + 1;
- else
- aIdx = rFrameIdx.GetIndex() + 1;
+ aIdx = pEnd->GetIndex() + 1;
if( (pFrameNd = &aIdx.GetNode())->IsTableNode() )
rFrameIdx = aIdx;