sw/source/core/docnode/ndnum.cxx | 2 ++ sw/source/core/docnode/nodes.cxx | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-)
New commits: commit d405d73c60d9a86631f592ba4b4cc97ee43fec38 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Mon Nov 15 17:29:59 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Nov 15 21:15:48 2021 +0100 tdf#121546 sw: don't use undo array's m_pOutlineNodes It's pointless. Change-Id: I304c123bffc16e6133d2953bc9a4f7a3afad14ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124999 Tested-by: Jenkins Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx index e27755f9ed33..89a7acb098b7 100644 --- a/sw/source/core/docnode/ndnum.cxx +++ b/sw/source/core/docnode/ndnum.cxx @@ -38,6 +38,8 @@ bool SwOutlineNodes::Seek_Entry(SwNode* rP, size_type* pnPos) const void SwNodes::UpdateOutlineNode(SwNode & rNd) { + assert(IsDocNodes()); // no point in m_pOutlineNodes for undo nodes + SwTextNode * pTextNd = rNd.GetTextNode(); if (!pTextNd || !pTextNd->IsOutlineStateChanged()) diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 5942ddb65569..aa9dd63f4bfd 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -110,6 +110,16 @@ SwNodes::~SwNodes() m_pEndOfContent.reset(); } +static bool IsInsertOutline(SwNodes const& rNodes, SwNodeOffset const nIndex) +{ + if (!rNodes.IsDocNodes()) + { + return false; + } + return nIndex < rNodes.GetEndOfRedlines().StartOfSectionNode()->GetIndex() + || rNodes.GetEndOfRedlines().GetIndex() < nIndex; +} + void SwNodes::ChgNode( SwNodeIndex const & rDelPos, SwNodeOffset nSz, SwNodeIndex& rInsPos, bool bNewFrames ) { @@ -125,9 +135,7 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, SwNodeOffset nSz, // NEVER include nodes from the RedLineArea SwNodeOffset nNd = rInsPos.GetIndex(); - bool bInsOutlineIdx = ( - rNds.GetEndOfRedlines().StartOfSectionNode()->GetIndex() >= nNd || - nNd >= rNds.GetEndOfRedlines().GetIndex() ); + bool const bInsOutlineIdx = IsInsertOutline(rNds, nNd); if( &rNds == this ) // if in the same node array -> move { @@ -484,9 +492,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // NEVER include nodes from the RedLineArea SwNodeOffset nNd = aIdx.GetIndex(); - bool bInsOutlineIdx = ( rNodes.GetEndOfRedlines(). - StartOfSectionNode()->GetIndex() >= nNd || - nNd >= rNodes.GetEndOfRedlines().GetIndex() ); + bool const bInsOutlineIdx = IsInsertOutline(rNodes, nNd); if( bNewFrames ) // delete all frames