sw/source/filter/basflt/fltshell.cxx | 8 ++++---- sw/source/filter/docx/swdocxreader.cxx | 3 +-- sw/source/filter/html/htmlctxt.cxx | 16 ++++++++-------- sw/source/filter/html/htmlsect.cxx | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-)
New commits: commit eb9a76c697b72cf0c31d1467a862c03d08760628 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Aug 29 14:47:34 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Aug 29 17:59:36 2022 +0200 use more SwPosition::Assign part of hiding the internals of SwPosition Change-Id: I9a0e393e755c8cb6a1b9857ecf0abbabf61a2840 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138996 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index 2c12e23c338d..75ef5d5c36b4 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -470,15 +470,15 @@ static bool MakeBookRegionOrPoint(const SwFltStackEntry& rEntry, SwDoc& rDoc, // out: start of valid range // rTmpEnd is an out parameter // Returns true for valid range -static bool IterateNumrulePiece( const SwNodeIndex& rEnd, +static bool IterateNumrulePiece( const SwPosition& rEnd, SwNodeIndex& rTmpStart, SwNodeIndex& rTmpEnd ) { - while( ( rTmpStart <= rEnd ) + while( ( rTmpStart <= rEnd.GetNode() ) && !( rTmpStart.GetNode().IsTextNode() ) ) // look for valid start ++rTmpStart; rTmpEnd = rTmpStart; - while( ( rTmpEnd <= rEnd ) + while( ( rTmpEnd <= rEnd.GetNode() ) && ( rTmpEnd.GetNode().IsTextNode() ) ) // look for valid end + 1 ++rTmpEnd; @@ -532,7 +532,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, { SwNodeIndex aTmpStart( aRegion.Start()->GetNode() ); SwNodeIndex aTmpEnd( aTmpStart ); - SwNodeIndex& rRegEndNd = aRegion.End()->nNode; + SwPosition& rRegEndNd = *aRegion.End(); while( IterateNumrulePiece( rRegEndNd, aTmpStart, aTmpEnd ) ) { diff --git a/sw/source/filter/docx/swdocxreader.cxx b/sw/source/filter/docx/swdocxreader.cxx index 1fc6b563ef9f..a813cf9eef74 100644 --- a/sw/source/filter/docx/swdocxreader.cxx +++ b/sw/source/filter/docx/swdocxreader.cxx @@ -167,8 +167,7 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks &rBlocks ) OUString aLNm; { SwPaM aPam( aStart ); - SwNodeIndex& rIdx = aPam.GetPoint()->nNode; - ++rIdx; + aPam.GetPoint()->Adjust(SwNodeOffset(1)); aLNm = aPam.GetPointNode().GetTextNode()->GetText(); // is AutoText? diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx index b4f7389b4044..70b26ad07e1e 100644 --- a/sw/source/filter/html/htmlctxt.cxx +++ b/sw/source/filter/html/htmlctxt.cxx @@ -179,13 +179,13 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos ) "Danger: there are non-final paragraph attributes"); m_aParaAttrs.clear(); - const SwNodeIndex* pOldEndPara = &m_pPam->GetPoint()->nNode; + const SwPosition* pOldEndPara = m_pPam->GetPoint(); #ifndef NDEBUG - auto const nOld(pOldEndPara->GetIndex()); + auto const nOld(pOldEndPara->GetNodeIndex()); #endif sal_Int32 nOldEndCnt = m_pPam->GetPoint()->GetContentIndex(); - const SwNodeIndex& rNewSttPara = rNewPos.nNode; + const SwPosition& rNewSttPara = rNewPos; sal_Int32 nNewSttCnt = rNewPos.GetContentIndex(); bool bMoveBack = false; @@ -202,7 +202,7 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos ) sal_uInt16 nWhich = pAttr->m_pItem->Which(); if( !nOldEndCnt && RES_PARATR_BEGIN <= nWhich && - pAttr->GetStartParagraphIdx() < pOldEndPara->GetIndex() ) + pAttr->GetStartParagraphIdx() < pOldEndPara->GetNodeIndex() ) { // The attribute needs to be closed one content position beforehand if( !bMoveBack ) @@ -219,8 +219,8 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos ) } if( (RES_PARATR_BEGIN <= nWhich && bMoveBack) || - pAttr->GetStartParagraphIdx() < pOldEndPara->GetIndex() || - (pAttr->GetStartParagraph() == *pOldEndPara && + pAttr->GetStartParagraphIdx() < pOldEndPara->GetNodeIndex() || + (pAttr->GetStartParagraph() == pOldEndPara->GetNode() && pAttr->GetStartContent() != nOldEndCnt) ) { // The attribute needs to be set. Because we still need the original, since @@ -254,8 +254,8 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos ) } // Set the start of the attribute - pAttr->m_nStartPara = rNewSttPara; - pAttr->m_nEndPara = rNewSttPara; + pAttr->m_nStartPara = rNewSttPara.GetNode(); + pAttr->m_nEndPara = rNewSttPara.GetNode(); pAttr->m_nStartContent = nNewSttCnt; pAttr->m_nEndContent = nNewSttCnt; pAttr->m_pPrev = nullptr; diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index ee1e6b55d39d..e503d0546af7 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -203,7 +203,7 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken ) const SwStartNode *pStNd = static_cast<const SwStartNode *>( &rContentStIdx.GetNode() ); - aDelPam.GetPoint()->nNode = pStNd->EndOfSectionIndex(); + aDelPam.GetPoint()->Assign( pStNd->EndOfSectionIndex() ); SwSectionData aSection(SectionType::Content, m_xDoc->GetUniqueSectionName()); if (SwSection* pOldContent = m_xDoc->InsertSwSection(aDelPam, aSection, nullptr, nullptr, false))