summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-10-11 18:53:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-10-12 12:39:15 +0200
commit7aa0d01818e6934d1bbb361b750a91204251b465 (patch)
treecf45372f16333b52750a51b675e355a434cc09af /sw/source/filter
parent950b2712e78e4c5015aff3762d78558be8a642bd (diff)
rearrange node logic here
so we don't have to touch SwPosition.nContent. Part of the process of hiding the internals of SwPosition Change-Id: I797eec2b4ccb01360602f2f19ae4a7a51fe712fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141235 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/html/swhtml.cxx6
-rw-r--r--sw/source/filter/xml/xmlimp.cxx15
2 files changed, 14 insertions, 7 deletions
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 364fa0a096c1..438f19829935 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -842,9 +842,11 @@ void SwHTMLParser::Continue( HtmlTokenId nToken )
}
else if (pCurrentNd->GetText().isEmpty())
{
- pPos->nContent.Assign( nullptr, 0 );
m_pPam->SetMark(); m_pPam->DeleteMark();
- m_xDoc->GetNodes().Delete( pPos->GetNode() );
+ SwNode& rDelNode = pPos->GetNode();
+ // move so we don't have a dangling SwContentIndex to the deleted node
+ m_pPam->GetPoint()->Adjust(SwNodeOffset(+1));
+ m_xDoc->GetNodes().Delete( rDelNode );
m_pPam->Move( fnMoveBackward );
}
}
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index f2bd52292b01..62263ce2737f 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -731,9 +731,12 @@ void SwXMLImport::endDocument()
if( pCNd && pCNd->StartOfSectionIndex()+2 <
pCNd->EndOfSectionIndex() )
{
- pPaM->GetBound().nContent.Assign( nullptr, 0 );
- pPaM->GetBound(false).nContent.Assign( nullptr, 0 );
- pDoc->GetNodes().Delete( pPaM->GetPoint()->GetNode() );
+ SwNode& rDelNode = pPaM->GetPoint()->GetNode();
+ // move so we don't have a dangling SwContentIndex to the deleted node
+ pPaM->GetPoint()->Adjust(SwNodeOffset(+1));
+ if (pPaM->HasMark())
+ pPaM->GetMark()->Adjust(SwNodeOffset(+1));
+ pDoc->GetNodes().Delete( rDelNode );
}
}
}
@@ -768,9 +771,11 @@ void SwXMLImport::endDocument()
}
else if (pCurrNd->GetText().isEmpty())
{
- pPos->nContent.Assign( nullptr, 0 );
pPaM->SetMark(); pPaM->DeleteMark();
- pDoc->GetNodes().Delete( pPos->GetNode() );
+ SwNode& rDelNode = pPos->GetNode();
+ // move so we don't have a dangling SwContentIndex to the deleted node
+ pPaM->GetPoint()->Adjust(SwNodeOffset(+1));
+ pDoc->GetNodes().Delete( rDelNode );
pPaM->Move( fnMoveBackward );
}
}