summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Litvinov <git@litvinovg.pro>2021-05-15 10:57:38 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2021-05-18 13:36:04 +0200
commitf5ac56c9f7f54bb6603f6f1e8dba06da20f7e0a4 (patch)
tree07d7f7478cfd5785963a3650e2532a43babba2f0
parentac5b355f7afae4eaddb9e11ead95dfad63fe2b97 (diff)
Don't remove section at the end of inserted text tdf#142157
Change-Id: Ie52721a480e0bbc76d00f0cc5c9182be6476d939 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115643 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/source/filter/xml/xmlimp.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 28e7e3ff9db3..5951a8e36724 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -755,12 +755,12 @@ void SwXMLImport::endDocument()
if( pCurrNd->CanJoinNext( &pPos->nNode ))
{
SwTextNode* pNextNd = pPos->nNode.GetNode().GetTextNode();
-
+ bool endNodeFound = pDoc->GetNodes()[nNodeIdx-1]->IsEndNode();
SwNode *pLastPar = pDoc->GetNodes()[nNodeIdx -2];
if ( !pLastPar->IsTextNode() ) {
pLastPar = pDoc->GetNodes()[nNodeIdx -1];
}
- if ( pLastPar->IsTextNode() )
+ if ( !endNodeFound && pLastPar->IsTextNode() )
{
pNextNd->ChgFormatColl(pLastPar->GetTextNode()->GetTextColl());
}
@@ -768,10 +768,11 @@ void SwXMLImport::endDocument()
pPos->nContent.Assign( pNextNd, 0 );
pPaM->SetMark(); pPaM->DeleteMark();
pNextNd->JoinPrev();
-
+
// Remove line break that has been inserted by the import,
- // but only if one has been inserted!
- if( pNextNd->CanJoinPrev(/* &pPos->nNode*/ ) &&
+ // but only if one has been inserted and
+ // no endNode found to avoid removing section
+ if( pNextNd->CanJoinPrev(/* &pPos->nNode*/ ) && !endNodeFound &&
*m_pSttNdIdx != pPos->nNode )
{
pNextNd->JoinPrev();