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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Sep 3 05:43:39 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf104354_firstParaInSection.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx                      |   10 ++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx                    |    6 ++----
 writerfilter/source/dmapper/DomainMapper_Impl.cxx               |    5 ++++-
 4 files changed, 16 insertions(+), 5 deletions(-)

New commits:
commit dff829e863fd05bedd5bcb713cd80c10fa582932
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Fri Aug 31 11:57:31 2018 +0300
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Mon Sep 3 07:43:18 2018 +0200

    tdf#104354 writerfilter: not FirstParaInSection if InFootOrEndnote
    
    or InComment. The first footnote does not get special treatment in
    autospacing either, so no exception needs to be made for it like in
    autospacing, unlike many other "firsts".
    
    The unit test is simply preventative. I'm a bit surprised,
    but the section isn't even marked as "IsFirstSection" until after
    the comment and footnote paragraphs are finished. That seems a bit
    odd to me, since they are in the FirstSection after all.
    
    Change-Id: Ib0107c969bf624e44f0c78b936bf9531fd25bfc2
    Reviewed-on: https://gerrit.libreoffice.org/59858
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf104354_firstParaInSection.docx b/sw/qa/extras/ooxmlexport/data/tdf104354_firstParaInSection.docx
new file mode 100644
index 000000000000..79ff44f256f8
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf104354_firstParaInSection.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 6012d8039e91..e5ef60d164b6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -390,6 +390,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104354, "tdf104354.docx")
                          getProperty<sal_Int32>(xShape->getEnd(), "ParaTopMargin"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf104354_firstParaInSection, "tdf104354_firstParaInSection.docx")
+{
+    uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
+    uno::Reference<text::XText> xText(xFootnotes->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(494),
+                         getProperty<sal_Int32>(getParagraphOfText(1, xText), "ParaTopMargin"));
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf107035, "tdf107035.docx")
 {
     // Select the second run containing the page number field
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index a85590baf5e7..d88a4f701ac6 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2855,10 +2855,8 @@ void DomainMapper::lcl_endSectionGroup()
     {
         m_pImpl->CheckUnregisteredFrameConversion();
         m_pImpl->ExecuteFrameConversion();
-        // First paragraph in a footnote doesn't count: that would create
-        // additional paragraphs before and after the real footnote content.
-        // Also, when pasting, it's fine to not have any paragraph inside the document at all.
-        if (m_pImpl->GetIsFirstParagraphInSection() && !m_pImpl->IsInFootOrEndnote() && m_pImpl->IsNewDoc())
+        // When pasting, it's fine to not have any paragraph inside the document at all.
+        if (m_pImpl->GetIsFirstParagraphInSection() && m_pImpl->IsNewDoc())
         {
             // This section has no paragraph at all (e.g. they are all actually in a frame).
             // If this section has a page break, there would be nothing to apply to the page
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 12bd911f5e59..9caf6e3c8fd8 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -480,7 +480,10 @@ bool DomainMapper_Impl::GetIsFirstParagraphInSection()
 {
     // Anchored objects may include multiple paragraphs,
     // and none of them should be considered the first para in section.
-    return m_bIsFirstParaInSection && !IsInShape();
+    return m_bIsFirstParaInSection
+                && !IsInShape()
+                && !m_bIsInComments
+                && !m_bInFootOrEndnote;
 }
 
 void DomainMapper_Impl::SetIsFirstParagraphInShape(bool bIsFirst)


More information about the Libreoffice-commits mailing list