[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sw/qa writerfilter/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 3 15:40:38 UTC 2021


 sw/qa/extras/ooxmlexport/data/tdf138899.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport12.cxx        |    7 +++++++
 writerfilter/source/dmapper/DomainMapper.cxx      |    3 ++-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    8 ++++----
 4 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 88e874bf063d19d7d1cd1ad37639ac829e74b58f
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Fri Jan 22 10:10:39 2021 +0100
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Wed Mar 3 16:40:02 2021 +0100

    tdf#138899 DOCX import: fix removing last para of section
    
    Fix regression from commit 39090afac268f9ae985832c2f08863b41e6c06f2
    (tdf#120336 DOCX import: fix page break after tracked deletion),
    limiting the condition only for *empty* section starting
    paragraphs with tracked deletion.
    
    Change-Id: I020c8b0edf5d4a37a9150cccec8c25fce50327d3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109779
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit b7ca9576c26ed258537134c0cf2944cfcfc65f2e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109799
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit 6de15a8d094b7eca68eab5341d5a55744154114e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111890
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf138899.docx b/sw/qa/extras/ooxmlexport/data/tdf138899.docx
new file mode 100644
index 000000000000..3e346ac0e4d9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf138899.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index 1ae45cb04183..691c709b8894 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -925,6 +925,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf99631, "tdf99631.docx")
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:object[1]", "dyaOrig", "768");
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf138899, "tdf138899.docx")
+{
+    xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
+    // This was 6, not removed empty temporary paragraph at the end of the section
+    assertXPath(pXmlDocument, "/w:document/w:body/w:p", 5);
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf122563, "tdf122563.docx")
 {
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 7535f2774b9c..909f055da826 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3468,7 +3468,8 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
         if (bNewLine)
         {
             const bool bSingleParagraph = m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->GetIsLastParagraphInSection();
-            const bool bSingleParagraphAfterRedline = m_pImpl->GetIsFirstParagraphInSection(true) && m_pImpl->GetIsLastParagraphInSection();
+            const bool bSingleParagraphAfterRedline = m_pImpl->GetIsFirstParagraphInSection(/*bAfterRedline=*/true) &&
+                    m_pImpl->GetIsLastParagraphInSection();
             PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
             if (!m_pImpl->GetFootnoteContext())
             {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 48b5bd6fea53..5986266f4de4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2028,20 +2028,20 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
     else
         SetIsPreviousParagraphFramed(false);
 
-    m_bParaChanged = false;
     m_bRemoveThisParagraph = false;
     if( !IsInHeaderFooter() && !IsInShape() && (!pParaContext || !pParaContext->IsFrameMode()) )
     { // If the paragraph is in a frame, shape or header/footer, it's not a paragraph of the section itself.
         SetIsFirstParagraphInSection(false);
-        // count first not deleted paragraph as first paragraph in section to avoid of
-        // its deletion later, resulting loss of the associated page break
-        if (!m_previousRedline)
+        // don't count an empty deleted paragraph as first paragraph in section to avoid of
+        // the deletion of the next empty paragraph later, resulting loss of the associated page break
+        if (!m_previousRedline || m_bParaChanged)
         {
             SetIsFirstParagraphInSectionAfterRedline(false);
             SetIsLastParagraphInSection(false);
         }
     }
     m_previousRedline.clear();
+    m_bParaChanged = false;
 
     if (m_bIsFirstParaInShape)
         m_bIsFirstParaInShape = false;


More information about the Libreoffice-commits mailing list