diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-11-25 19:01:57 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2019-11-26 11:10:11 +0100 |
commit | 648758906e2d4a7a953d4eda27e95bc9478d336a (patch) | |
tree | 0166a588e25d44f7d31ce9e73f9be677a57f8c4a | |
parent | 7424588115568576c61005386242e3d7e9662dfd (diff) |
sw: remove SwNodes::CheckNodesRange()
Looks like it's the same as ::CheckNodesRange(..., false).
Change-Id: I1938892cdba9ff1d9758a0f1b6cb516e28f5d8bd
Reviewed-on: https://gerrit.libreoffice.org/83708
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r-- | sw/inc/ndarr.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/docnode/nodes.cxx | 43 |
2 files changed, 9 insertions, 36 deletions
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index 2f2958c977bc..da52d06377f6 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -181,8 +181,6 @@ public: void SectionUp( SwNodeRange *); void SectionDown( SwNodeRange *pRange, SwStartNodeType = SwNormalStartNode ); - bool CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd ) const; - static void GoStartOfSection(SwNodeIndex *); static void GoEndOfSection(SwNodeIndex *); diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index c1fdb7f87d95..b0a6055d782f 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -893,8 +893,10 @@ void SwNodes::SectionDown(SwNodeRange *pRange, SwStartNodeType eSttNdTyp ) { if( pRange->aStart >= pRange->aEnd || pRange->aEnd >= Count() || - !CheckNodesRange( pRange->aStart, pRange->aEnd )) + !::CheckNodesRange(pRange->aStart, pRange->aEnd, false)) + { return; + } // If the beginning of a range is before or at a start node position, so // delete it, otherwise empty S/E or E/S nodes would be created. @@ -945,9 +947,11 @@ void SwNodes::SectionUp(SwNodeRange *pRange) { if( pRange->aStart >= pRange->aEnd || pRange->aEnd >= Count() || - !CheckNodesRange( pRange->aStart, pRange->aEnd ) || + !::CheckNodesRange(pRange->aStart, pRange->aEnd, false) || ( HighestLevel( *this, *pRange ) <= 1 )) + { return; + } // If the beginning of a range is before or at a start node position, so // delete it, otherwise empty S/E or E/S nodes would be created. @@ -1073,8 +1077,10 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes) // check if [rIndex..rIndex + nCnt] is larger than the range if( ( !aRg.aStart.GetNode().StartOfSectionIndex() && !aRg.aStart.GetIndex() ) || - ! CheckNodesRange( aRg.aStart, aRg.aEnd ) ) + !::CheckNodesRange(aRg.aStart, aRg.aEnd, false)) + { return; + } // if aEnd is not on a ContentNode, search the previous one while( ( pCurrentNode = &aRg.aEnd.GetNode())->GetStartNode() || @@ -1302,37 +1308,6 @@ SwContentNode* SwNodes::GoPrevious(SwNodeIndex *pIdx) return static_cast<SwContentNode*>(pNd); } -static bool TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, sal_uLong nStt, sal_uLong nEnd ) -{ - return nStt < nSttIdx && nEnd >= nSttIdx && - nStt < nEndIdx && nEnd >= nEndIdx; -} - -/** Check if the given range is inside one of the defined top-level sections. - * - * The top-level sections are Content, AutoText, PostIts, Inserts, and Redlines. - * - * @param rStt start index of the range - * @param rEnd end index of the range - * @return <true> if valid range - */ -bool SwNodes::CheckNodesRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd ) const -{ - sal_uLong nStt = rStt.GetIndex(), nEnd = rEnd.GetIndex(); - if( TstIdx( nStt, nEnd, m_pEndOfContent->StartOfSectionIndex(), - m_pEndOfContent->GetIndex() )) return true; - if( TstIdx( nStt, nEnd, m_pEndOfAutotext->StartOfSectionIndex(), - m_pEndOfAutotext->GetIndex() )) return true; - if( TstIdx( nStt, nEnd, m_pEndOfPostIts->StartOfSectionIndex(), - m_pEndOfPostIts->GetIndex() )) return true; - if( TstIdx( nStt, nEnd, m_pEndOfInserts->StartOfSectionIndex(), - m_pEndOfInserts->GetIndex() )) return true; - if( TstIdx( nStt, nEnd, m_pEndOfRedlines->StartOfSectionIndex(), - m_pEndOfRedlines->GetIndex() )) return true; - - return false; // is somewhere in the middle, ERROR -} - /** Delete a number of nodes * * @param rStart starting position in this nodes array |