sw/inc/ndarr.hxx | 4 ++-- sw/source/core/doc/docnew.cxx | 4 ++-- sw/source/core/docnode/ndnum.cxx | 14 +++++++------- sw/source/core/docnode/nodes.cxx | 28 ++++++++++++++-------------- 4 files changed, 25 insertions(+), 25 deletions(-)
New commits: commit 1c4675580855a638877c90e70489bfae88143f4f Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Aug 9 19:18:14 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Aug 13 08:36:48 2022 +0200 flatten SwNodes a little SwOutlineNodes does not need to be allocated separately. Change-Id: I134d3293b9b9c489c327b8c283b324875705541f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138215 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx index cce94857bc3f..e95d5bf7e7dc 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -107,7 +107,7 @@ class SW_DLLPUBLIC SwNodes final *m_pEndOfAutotext, *m_pEndOfRedlines; std::unique_ptr<SwNode> m_pEndOfContent; - mutable std::unique_ptr<SwOutlineNodes> m_pOutlineNodes; ///< Array of all outline nodes. + mutable SwOutlineNodes m_aOutlineNodes; ///< Array of all outline nodes. bool m_bInNodesDel : 1; /**< In Case of recursive calling. Do not update Num/Outline. */ @@ -234,7 +234,7 @@ public: SwAttrSet const * pAutoAttr ); ///< in ndole.cxx /// Array of all OutlineNodes. - const SwOutlineNodes& GetOutLineNds() const { return *m_pOutlineNodes;} + const SwOutlineNodes& GetOutLineNds() const { return m_aOutlineNodes;} /// Update all Nodes - Rule/Format-Change. void UpdateOutlineNode(SwNode & rNd); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 67c284df1f9b..2cc77c788c20 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -448,9 +448,9 @@ SwDoc::~SwDoc() // The ChapterNumbers/Numbers need to be deleted before the styles // or we update all the time! - m_pNodes->m_pOutlineNodes->clear(); + m_pNodes->m_aOutlineNodes.clear(); SwNodes & rUndoNodes( GetUndoManager().GetUndoNodes() ); - rUndoNodes.m_pOutlineNodes->clear(); + rUndoNodes.m_aOutlineNodes.clear(); mpFootnoteIdxs->clear(); diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx index 89a7acb098b7..af17a2a68e15 100644 --- a/sw/source/core/docnode/ndnum.cxx +++ b/sw/source/core/docnode/ndnum.cxx @@ -45,7 +45,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd) if (!pTextNd || !pTextNd->IsOutlineStateChanged()) return; - bool bFound = m_pOutlineNodes->find(pTextNd) != m_pOutlineNodes->end(); + bool bFound = m_aOutlineNodes.find(pTextNd) != m_aOutlineNodes.end(); if (pTextNd->IsOutline()) { @@ -54,7 +54,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd) // assure that text is in the correct nodes array if ( &(pTextNd->GetNodes()) == this ) { - m_pOutlineNodes->insert(pTextNd); + m_aOutlineNodes.insert(pTextNd); } else { @@ -65,7 +65,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd) else { if (bFound) - m_pOutlineNodes->erase(pTextNd); + m_aOutlineNodes.erase(pTextNd); } pTextNd->UpdateOutlineState(); @@ -76,22 +76,22 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd) void SwNodes::UpdateOutlineIdx( const SwNode& rNd ) { - if( m_pOutlineNodes->empty() ) // no OutlineNodes present ? + if( m_aOutlineNodes.empty() ) // no OutlineNodes present ? return; SwNode* const pSrch = const_cast<SwNode*>(&rNd); SwOutlineNodes::size_type nPos; - if (!m_pOutlineNodes->Seek_Entry(pSrch, &nPos)) + if (!m_aOutlineNodes.Seek_Entry(pSrch, &nPos)) return; - if( nPos == m_pOutlineNodes->size() ) // none present for updating ? + if( nPos == m_aOutlineNodes.size() ) // none present for updating ? return; if( nPos ) --nPos; if( !GetDoc().IsInDtor() && IsDocNodes() ) - UpdateOutlineNode( *(*m_pOutlineNodes)[ nPos ]); + UpdateOutlineNode( *m_aOutlineNodes[ nPos ]); } diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index f1d29db3802e..0336ec48d9e1 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -81,7 +81,7 @@ SwNodes::SwNodes( SwDoc& rDocument ) pTmp->m_pStartOfSection = pSttNd; m_pEndOfContent.reset(new SwEndNode( *this, nPos++, *pTmp )); - m_pOutlineNodes.reset(new SwOutlineNodes); + m_aOutlineNodes.clear(); } /** Destructor @@ -92,7 +92,7 @@ SwNodes::SwNodes( SwDoc& rDocument ) */ SwNodes::~SwNodes() { - m_pOutlineNodes.reset(); + m_aOutlineNodes.clear(); { SwNodeIndex aNdIdx( *this ); @@ -162,7 +162,7 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, SwNodeOffset nSz, if (pTextNode->IsOutline()) { SwNode* pSrch = &rNd; - m_pOutlineNodes->erase( pSrch ); + m_aOutlineNodes.erase( pSrch ); } } @@ -177,7 +177,7 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, SwNodeOffset nSz, if (bInsOutlineIdx && rTextNd.IsOutline()) { SwNode* pSrch = &rNd; - m_pOutlineNodes->insert( pSrch ); + m_aOutlineNodes.insert( pSrch ); } rTextNd.InvalidateNumRule(); @@ -219,7 +219,7 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, SwNodeOffset nSz, // remove outline index from old nodes array if (pTextNd->IsOutline()) { - m_pOutlineNodes->erase( pNd ); + m_aOutlineNodes.erase( pNd ); } // copy rules if needed @@ -261,7 +261,7 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, SwNodeOffset nSz, // OutlineNodes set the new nodes in the array if (bInsOutlineIdx && pTextNd->IsOutline()) { - rNds.m_pOutlineNodes->insert( pTextNd ); + rNds.m_aOutlineNodes.insert( pTextNd ); } pTextNd->AddToList(); @@ -517,7 +517,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // remove outline index from old nodes array if (pCNd->IsTextNode() && pCNd->GetTextNode()->IsOutline()) { - m_pOutlineNodes->erase( pCNd ); + m_aOutlineNodes.erase( pCNd ); } else pCNd = nullptr; @@ -526,7 +526,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, BigPtrArray::Move( sal_Int32(aMvIdx.GetIndex()), sal_Int32(aIdx.GetIndex()) ); if( bInsOutlineIdx && pCNd ) - m_pOutlineNodes->insert( pCNd ); + m_aOutlineNodes.insert( pCNd ); if( pTmpNd->IsTextNode() ) static_cast<SwTextNode*>(pTmpNd)->AddToList(); } @@ -550,7 +550,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, const bool bOutlNd = pNd->IsTextNode() && pNd->GetTextNode()->IsOutline(); // delete outline indices from old node array if( bOutlNd ) - m_pOutlineNodes->erase( pNd ); + m_aOutlineNodes.erase( pNd ); RemoveNode( aMvIdx.GetIndex(), SwNodeOffset(1), false ); pNd->m_pStartOfSection = pSttNode; @@ -559,7 +559,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes, // set correct indices in Start/EndNodes if( bInsOutlineIdx && bOutlNd ) // and put them into the new node array - rNodes.m_pOutlineNodes->insert( pNd ); + rNodes.m_aOutlineNodes.insert( pNd ); else if( pNd->IsStartNode() ) pSttNode = static_cast<SwStartNode*>(pNd); else if( pNd->IsEndNode() ) @@ -1141,10 +1141,10 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, SwNodeOffset nNodes) { SwTextNode *const pTextNode(pNd->GetTextNode()); if (pTextNode->IsOutline() && - m_pOutlineNodes->Seek_Entry( pNd, &nIdxPos )) + m_aOutlineNodes.Seek_Entry( pNd, &nIdxPos )) { // remove outline indices - m_pOutlineNodes->erase_at(nIdxPos); + m_aOutlineNodes.erase_at(nIdxPos); bUpdateOutline = true; } pTextNode->InvalidateNumRule(); @@ -1207,7 +1207,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, SwNodeOffset nNodes) if( pTextNd->IsOutline()) { // delete outline indices - m_pOutlineNodes->erase( pTextNd ); + m_aOutlineNodes.erase( pTextNd ); bUpdateOutline = true; } if (sw::HasNumberingWhichNeedsLayoutUpdate(*pTextNd)) @@ -1406,7 +1406,7 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, SwNodeOffset nCnt ) if (pNd->IsTextNode() && pNd->GetTextNode()->IsOutline()) { // remove the outline indices - if (m_pOutlineNodes->erase(pNd)) + if (m_aOutlineNodes.erase(pNd)) bUpdateNum = 1; } if( pNd->IsContentNode() )