sw/inc/ndarr.hxx | 2 +- sw/source/core/doc/docglbl.cxx | 4 ++-- sw/source/core/doc/doctxm.cxx | 10 +++++----- sw/source/core/docnode/ndsect.cxx | 18 +++++++++--------- sw/source/core/undo/unsect.cxx | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-)
New commits: commit 740d45184fc7d05f8a37186dd619f07f527fa465 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Wed Aug 10 20:18:40 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sat Aug 13 12:02:41 2022 +0200 pass SwNode instead of SwNodeIndex to SwNodes::InsertTextSection part of the process of hiding the internals of SwPosition Change-Id: Iddf8af8c7c9242bd3d9a48a59059b1cc8321be16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138223 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 d2f87e36d834..5321bc62ca1f 100644 --- a/sw/inc/ndarr.hxx +++ b/sw/inc/ndarr.hxx @@ -297,7 +297,7 @@ public: sal_uInt16 nMode = 0 ); /// Insert a new SwSection. - SwSectionNode* InsertTextSection(SwNodeIndex const& rNdIdx, + SwSectionNode* InsertTextSection(SwNode& rNd, SwSectionFormat& rSectionFormat, SwSectionData const&, SwTOXBase const*const pTOXBase, diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 282d98f14316..b1e85e546872 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -462,12 +462,12 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, if (aEndIdx >= aStartIdx) { - pSectNd = GetNodes().InsertTextSection(aStartIdx, + pSectNd = GetNodes().InsertTextSection(aStartIdx.GetNode(), *pFormat, aSectData, nullptr, &aEndIdx, false); } else { - pSectNd = GetNodes().InsertTextSection(aEndIdx, + pSectNd = GetNodes().InsertTextSection(aEndIdx.GetNode(), *pFormat, aSectData, nullptr, &aStartIdx, false); } // <- #i26762# diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 8ad0ddc79c0e..e5afaa5bd362 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -394,10 +394,10 @@ SwTOXBaseSection* SwDoc::InsertTableOf( const SwPaM& aPam, SwSectionData headerData( SectionType::ToxHeader, pNewSection->GetTOXName()+"_Head" ); - SwNodeIndex aStt( *pHeadNd ); --aIdx; + --aIdx; SwSectionFormat* pSectFormat = MakeSectionFormat(); GetNodes().InsertTextSection( - aStt, *pSectFormat, headerData, nullptr, &aIdx, true, false); + *pHeadNd, *pSectFormat, headerData, nullptr, &aIdx, true, false); } } @@ -431,7 +431,7 @@ void SwDoc::InsertTableOf( SwNodeOffset nSttNd, SwNodeOffset nEndNd, pFormat->SetFormatAttr(*pSet); SwSectionNode *const pNewSectionNode = - GetNodes().InsertTextSection(aStt, *pFormat, aSectionData, &rTOX, &aEnd); + GetNodes().InsertTextSection(aStt.GetNode(), *pFormat, aSectionData, &rTOX, &aEnd); if (!pNewSectionNode) { DelSectionFormat( pFormat ); @@ -1047,10 +1047,10 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, SwSectionData headerData( SectionType::ToxHeader, GetTOXName()+"_Head" ); - SwNodeIndex aStt( *pHeadNd ); --aIdx; + --aIdx; SwSectionFormat* pSectFormat = rDoc.MakeSectionFormat(); rDoc.GetNodes().InsertTextSection( - aStt, *pSectFormat, headerData, nullptr, &aIdx, true, false); + *pHeadNd, *pSectFormat, headerData, nullptr, &aIdx, true, false); if (pUndo) { diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index ac731e549823..3e85ec3e500a 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -222,7 +222,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, --aEnd; // End is inclusive in the InsertSection pNewSectNode = GetNodes().InsertTextSection( - aStt, *pFormat, rNewData, pTOXBase, & aEnd); + aStt.GetNode(), *pFormat, rNewData, pTOXBase, & aEnd); } else { @@ -291,7 +291,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, } } pNewSectNode = GetNodes().InsertTextSection( - pSttPos->nNode, *pFormat, rNewData, pTOXBase, &pEndPos->nNode); + pSttPos->GetNode(), *pFormat, rNewData, pTOXBase, &pEndPos->nNode); } } else @@ -301,12 +301,12 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, if( !pPos->GetContentIndex() ) { pNewSectNode = GetNodes().InsertTextSection( - pPos->nNode, *pFormat, rNewData, pTOXBase, nullptr); + pPos->GetNode(), *pFormat, rNewData, pTOXBase, nullptr); } else if( pPos->GetContentIndex() == pCNd->Len() ) { pNewSectNode = GetNodes().InsertTextSection( - pPos->nNode, *pFormat, rNewData, pTOXBase, nullptr, false); + pPos->GetNode(), *pFormat, rNewData, pTOXBase, nullptr, false); } else { @@ -316,7 +316,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, } getIDocumentContentOperations().SplitNode( *pPos, false ); pNewSectNode = GetNodes().InsertTextSection( - pPos->nNode, *pFormat, rNewData, pTOXBase, nullptr); + pPos->GetNode(), *pFormat, rNewData, pTOXBase, nullptr); } } @@ -779,18 +779,18 @@ static bool lcl_IsTOXSection(SwSectionData const& rSectionData) || (SectionType::ToxHeader == rSectionData.GetType()); } -SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, +SwSectionNode* SwNodes::InsertTextSection(SwNode& rNd, SwSectionFormat& rSectionFormat, SwSectionData const& rSectionData, SwTOXBase const*const pTOXBase, SwNodeIndex const*const pEnd, bool const bInsAtStart, bool const bCreateFrames) { - SwNodeIndex aInsPos( rNdIdx ); + SwNodeIndex aInsPos( rNd ); if( !pEnd ) // No Area, thus create a new Section before/after it { // #i26762# - OSL_ENSURE(!pEnd || rNdIdx <= *pEnd, + OSL_ENSURE(!pEnd || rNd.GetIndex() <= pEnd->GetIndex(), "Section start and end in wrong order!"); if( bInsAtStart ) @@ -877,7 +877,7 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex const& rNdIdx, } else { - SwTextNode* pCpyTNd = rNdIdx.GetNode().GetTextNode(); + SwTextNode* pCpyTNd = rNd.GetTextNode(); if( pCpyTNd ) { SwTextNode* pTNd = new SwTextNode( aInsPos, pCpyTNd->GetTextColl() ); diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index da774cbe8561..83b32f23058e 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -380,7 +380,7 @@ void SwUndoDelSection::UndoImpl(::sw::UndoRedoContext & rContext) /// OD 04.10.2002 #102894# /// remember inserted section node for further calculations SwSectionNode* pInsertedSectNd = rDoc.GetNodes().InsertTextSection( - aStt, *pFormat, *m_pSectionData, nullptr, & aEnd); + aStt.GetNode(), *pFormat, *m_pSectionData, nullptr, & aEnd); if( SfxItemState::SET == pFormat->GetItemState( RES_FTN_AT_TXTEND ) || SfxItemState::SET == pFormat->GetItemState( RES_END_AT_TXTEND ))