[Libreoffice-commits] core.git: sw/qa writerfilter/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 9 15:38:21 UTC 2020


 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx        |   11 +++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 9b4bda5361f7ed06b07ab8dd59aeb77278c73195
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Fri Oct 9 13:05:55 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Oct 9 17:37:43 2020 +0200

    tdf#136955 DOCX import: fix shape paragraph margins
    
    based on bad style inheritance, in the case of not
    first paragraphs of shapes.
    
    Regression from commit dc0300eac3b755bc207cd1fe87217f4ebaeb9f58
    (tdf#118521 DOCX import: fix paragraph margin from paragraph style),
    revealing the problematic m_sCurrentParaStyleName, see also
    commit 8920d865ee148518bf71f71ce1866b24cc17c07e for more information.
    
    Follow-up of commit c04ee66c7cfeb725d637b0f9ec3e3b1f8776bfe9
    (tdf#134784 DOCX import: fix shape paragraph margins).
    
    Change-Id: I4feab19fc58653d829d7a1ae8da3e3ce4fb3e2c3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104116
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index e45d99c6d2d7..6e4560493d87 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -813,6 +813,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf134784, "tdf134784.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xParagraph, "ParaTopMargin"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf136955, "tdf134784.docx")
+{
+    uno::Reference<text::XText> textbox(getShape(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(3, getParagraphs(textbox));
+    uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(2, textbox);
+
+    // These weren't zero (values inherited from style of the previous paragraph in the main text)
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xParagraph, "ParaBottomMargin"));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xParagraph, "ParaTopMargin"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf104348_contextMargin, "tdf104348_contextMargin.docx")
 {
     // tdf#104348 shows that ContextMargin belongs with Top/Bottom handling
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f16d5fa794d5..f6ede7c143b4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -785,7 +785,7 @@ OUString DomainMapper_Impl::GetCurrentParaStyleName()
     // use saved currParaStyleName as a fallback, in case no particular para style name applied.
     // tdf#134784 except in the case of first paragraph of shapes to avoid bad fallback.
     // TODO fix this "highly inaccurate" m_sCurrentParaStyleName
-    if ( !m_bIsFirstParaInShape )
+    if ( !IsInShape() )
         sName = m_sCurrentParaStyleName;
 
     PropertyMapPtr pParaContext = GetTopContextOfType(CONTEXT_PARAGRAPH);


More information about the Libreoffice-commits mailing list