summaryrefslogtreecommitdiff
path: root/sw/source/core/docnode/ndsect.cxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-02-15 20:00:16 +0600
committerMike Kaganski <mike.kaganski@collabora.com>2024-02-16 08:37:33 +0100
commit9bb7d239258133020dea5fb8cd8c3b18f706d4e2 (patch)
tree5ea1c219803bc20f80e29e56a41ea92fd5f4bfc0 /sw/source/core/docnode/ndsect.cxx
parent63562694beb42b86d0f00dd3c18ac47bb094c9fe (diff)
Deduplicate and unify SwNodes::Go(Next|Prev)(Section)
The "Next" methods are made static, just as "Prev" ones. Overloads taking SwNodeIndex and SwPosition are implemented using a common implementation function, to avoid code duplication. Change-Id: I4035188b5c29d19824cd6d031e05d668d5cf1e86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163443 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source/core/docnode/ndsect.cxx')
-rw-r--r--sw/source/core/docnode/ndsect.cxx27
1 files changed, 12 insertions, 15 deletions
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 1da9ecb43ed6..856447d4d8d2 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -63,9 +63,7 @@
// #i21457# - new implementation of local method <lcl_IsInSameTableBox(..)>.
// Method now determines the previous/next on its own. Thus, it can be controlled,
// for which previous/next is checked, if it's visible.
-static bool lcl_IsInSameTableBox( SwNodes const & _rNds,
- const SwNode& _rNd,
- const bool _bPrev )
+static bool lcl_IsInSameTableBox(const SwNode& _rNd, const bool _bPrev)
{
const SwTableNode* pTableNd = _rNd.FindTableNode();
if ( !pTableNd )
@@ -84,7 +82,7 @@ static bool lcl_IsInSameTableBox( SwNodes const & _rNds,
{
if ( _bPrev
? !SwNodes::GoPrevSection( &aChkIdx, false, false )
- : !_rNds.GoNextSection( &aChkIdx, false, false ) )
+ : !SwNodes::GoNextSection( &aChkIdx, false, false ) )
{
OSL_FAIL( "<lcl_IsInSameTableBox(..)> - no previous/next!" );
return false;
@@ -124,20 +122,20 @@ static bool lcl_IsInSameTableBox( SwNodes const & _rNds,
return true;
}
-static void lcl_CheckEmptyLayFrame( SwNodes const & rNds, SwSectionData& rSectionData,
+static void lcl_CheckEmptyLayFrame( SwSectionData& rSectionData,
const SwNode& rStt, const SwNode& rEnd )
{
SwNodeIndex aIdx( rStt );
if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
!CheckNodesRange( rStt, aIdx.GetNode(), true ) ||
// #i21457#
- !lcl_IsInSameTableBox( rNds, rStt, true ))
+ !lcl_IsInSameTableBox( rStt, true ))
{
aIdx = rEnd;
- if( !rNds.GoNextSection( &aIdx, true, false ) ||
+ if( !SwNodes::GoNextSection( &aIdx, true, false ) ||
!CheckNodesRange( rEnd, aIdx.GetNode(), true ) ||
// #i21457#
- !lcl_IsInSameTableBox( rNds, rEnd, false ))
+ !lcl_IsInSameTableBox( rEnd, false ))
{
rSectionData.SetHidden( false );
}
@@ -171,7 +169,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
pEnd->GetNode().GetContentNode()->Len() ==
pEnd->GetContentIndex() )
{
- ::lcl_CheckEmptyLayFrame( GetNodes(),
+ ::lcl_CheckEmptyLayFrame(
rNewData,
pStt->GetNode(),
pEnd->GetNode() );
@@ -650,7 +648,7 @@ void SwDoc::UpdateSection( size_t const nPos, SwSectionData & rNewData,
pIdx->GetNode().GetSectionNode();
if (pSectNd)
{
- ::lcl_CheckEmptyLayFrame( GetNodes(), rNewData,
+ ::lcl_CheckEmptyLayFrame( rNewData,
*pSectNd, *pSectNd->EndOfSectionNode() );
}
}
@@ -1040,7 +1038,7 @@ void SwSectionNode::MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx)
if (GetSection().IsHiddenFlag() || IsContentHidden())
{
SwNodeIndex aIdx( *EndOfSectionNode() );
- SwContentNode* pCNd = rNds.GoNextSection( &aIdx, true, false );
+ SwContentNode* pCNd = SwNodes::GoNextSection(&aIdx, true, false);
if( !pCNd )
{
aIdx = *this;
@@ -1180,7 +1178,6 @@ void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/, bool const
return ;
}
- SwNodes& rNds = GetNodes();
m_pSection->GetFormat()->DelFrames();
// Update our Flag
@@ -1196,13 +1193,13 @@ void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/, bool const
if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
!CheckNodesRange( *this, aIdx.GetNode(), true ) ||
// #i21457#
- !lcl_IsInSameTableBox( rNds, *this, true ))
+ !lcl_IsInSameTableBox( *this, true ))
{
aIdx = *EndOfSectionNode();
- if( !rNds.GoNextSection( &aIdx, true, false ) ||
+ if( !SwNodes::GoNextSection( &aIdx, true, false ) ||
!CheckNodesRange( *EndOfSectionNode(), aIdx.GetNode(), true ) ||
// #i21457#
- !lcl_IsInSameTableBox( rNds, *EndOfSectionNode(), false ))
+ !lcl_IsInSameTableBox( *EndOfSectionNode(), false ))
{
m_pSection->m_Data.SetHiddenFlag(false);
}