summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/inc/ndarr.hxx2
-rw-r--r--sw/source/core/docnode/nodes.cxx43
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