sw/qa/extras/ww8export/data/tdf166503_DoNotUseHTMLParagraphAutoSpacing.doc 
|binary
 sw/qa/extras/ww8export/ww8export4.cxx                                      |   
11 ++++++++++
 sw/source/core/layout/flowfrm.cxx                                          |   
 4 +++
 3 files changed, 15 insertions(+)

New commits:
commit 8be81fdaa7b7313d083457c64c8acddee2489991
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Mon May 12 18:07:00 2025 -0400
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri May 16 10:40:15 2025 +0200

    tdf#166503 sw mso-compat layout: don't consolidate if PAGE_SPACE_MAX
    
    For a few decades, Microsoft has been consolidating the top/bottom
    spacing of adjacent paragraphs. But there does exist a layout flag
    to not do that.
    
    In my recent 25.2.3 changes to attempt to match MS layout,
    that flag (which we already import) wasn't taken into account.
    
    make CppunitTest_sw_ww8export4 CPPUNIT_TEST_NAME=testTdf166503
    
    Change-Id: Ia7842398a4095a8c39753a594214b13ef724969d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185331
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    (cherry picked from commit e43929ce56843ffc91341d5897883e752e5b49ec)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185376
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git 
a/sw/qa/extras/ww8export/data/tdf166503_DoNotUseHTMLParagraphAutoSpacing.doc 
b/sw/qa/extras/ww8export/data/tdf166503_DoNotUseHTMLParagraphAutoSpacing.doc
new file mode 100644
index 000000000000..3c0a958898b2
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf166503_DoNotUseHTMLParagraphAutoSpacing.doc 
differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index 29338986e6d0..7bd30ab653c0 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -234,6 +234,17 @@ DECLARE_WW8EXPORT_TEST(testTdf162542, 
"tdf162542_notLayoutInCell_charLeft_wrapTh
     CPPUNIT_ASSERT(getProperty<bool>(getShape(1), 
u"IsFollowingTextFlow"_ustr)); // tdf#162551
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf166503, 
"tdf166503_DoNotUseHTMLParagraphAutoSpacing.doc")
+{
+    // forum-en-5864.doc: a file with m_xWDop->fDontUseHTMLAutoSpacing compat 
flag set.
+    xmlDocUniquePtr pDump = parseLayoutDump();
+    assertXPathContent(pDump, "//page[2]//section//txt[1]", u"First Heading");
+    sal_Int32 nTop = getXPath(pDump, 
"//page[2]//section//txt[1]//bounds","top").toInt32();
+    // The paragraph is to be laid out with a full 12pt before spacing (not 
reduced to 6pt).
+    // Without the fix, this was 17662
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(17782), nTop);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testEndnotesAtSectEndDOC)
 {
     // Given a document, endnotes at collected at section end:
diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index a2c83b864ae6..ead94615e359 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1551,6 +1551,10 @@ static void lcl_PartiallyCollapseUpper(const SwFrame& 
rFrame, SwTwips& rUpper)
     if (!bCompat15 && !bCompat14)
         return;
 
+    // are we even allowed to consolidate the below and above spacing between 
paragraphs?
+    if (rIDSA.get(DocumentSettingId::PARA_SPACE_MAX)) // DontUseHTMLAutoSpacing
+        return;
+
     const SwContentFrame* pPrevPara = pTextFrame->FindPrevCnt();
     while (pPrevPara && pPrevPara->IsHiddenNow())
         pPrevPara = pPrevPara->FindPrevCnt();

Reply via email to