sw/source/filter/xml/xmlimp.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
New commits: commit f5ac56c9f7f54bb6603f6f1e8dba06da20f7e0a4 Author: Georgy Litvinov <g...@litvinovg.pro> AuthorDate: Sat May 15 10:57:38 2021 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue May 18 13:36:04 2021 +0200 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.st...@allotropia.de> Reviewed-by: Michael Stahl <michael.st...@allotropia.de> 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits