sw/qa/extras/ww8export/data/tdf155465_paraAdjustDistribute.doc |binary
 sw/qa/extras/ww8export/ww8export4.cxx                          |   19 
++++++++++
 sw/source/filter/ww8/ww8atr.cxx                                |    2 -
 3 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 446f9d77af4fe0cedf50e9cbd792cf1aee105675
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Wed May 24 08:52:20 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed May 24 19:52:14 2023 +0200

    tdf#155465 doc export: handle para last line - justify
    
    This was already OK for import in OOo 3.3,
    but never exported. DOCX export landed in 2019 (no bug report).
    
    No existing unit tests matched for DOC.
    
    make CppunitTest_sw_ww8export4 \
        CPPUNIT_TEST_NAME=testTdf155465_paraAdjustDistribute
    
    Change-Id: Iaea149c21259fe2a9002c8ce7c023327bbd13746
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152199
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/qa/extras/ww8export/data/tdf155465_paraAdjustDistribute.doc 
b/sw/qa/extras/ww8export/data/tdf155465_paraAdjustDistribute.doc
new file mode 100644
index 000000000000..5a661cd837ef
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf155465_paraAdjustDistribute.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index 414d183ed6b0..9e4551fe872f 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -13,6 +13,7 @@
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
 #include <com/sun/star/text/XTextTable.hpp>
@@ -101,6 +102,24 @@ DECLARE_WW8EXPORT_TEST(testTdf90408B, "tdf90408B.doc")
     CPPUNIT_ASSERT_EQUAL_MESSAGE("text is 10pt", 10.f, 
getProperty<float>(xRun, "CharHeight"));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf155465_paraAdjustDistribute, 
"tdf155465_paraAdjustDistribute.doc")
+{
+    // Without the accompanying fix in place, this test would have failed with
+    // 'Expected: 2; Actual  : 0', i.e. the first paragraph's ParaAdjust was 
left, not block.
+    const style::ParagraphAdjust eBlock = style::ParagraphAdjust_BLOCK;
+    auto nAdjust = getProperty<sal_Int16>(getParagraph(1), "ParaAdjust");
+    CPPUNIT_ASSERT_EQUAL(eBlock, static_cast<style::ParagraphAdjust>(nAdjust));
+
+    nAdjust = getProperty<sal_Int16>(getParagraph(1), "ParaLastLineAdjust");
+    CPPUNIT_ASSERT_EQUAL(eBlock, static_cast<style::ParagraphAdjust>(nAdjust));
+
+    nAdjust = getProperty<sal_Int16>(getParagraph(2), "ParaAdjust");
+    CPPUNIT_ASSERT_EQUAL(eBlock, static_cast<style::ParagraphAdjust>(nAdjust));
+
+    nAdjust = getProperty<sal_Int16>(getParagraph(2), "ParaLastLineAdjust");
+    CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_LEFT, 
static_cast<style::ParagraphAdjust>(nAdjust));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 8d7603f2d9a7..041abc5c65c5 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -5087,7 +5087,7 @@ void WW8AttributeOutput::ParaAdjust( const SvxAdjustItem& 
rAdjust )
             break;
         case SvxAdjust::BlockLine:
         case SvxAdjust::Block:
-            nAdj = nAdjBiDi = 3;
+            nAdj = nAdjBiDi = rAdjust.GetLastBlock() == SvxAdjust::Block ? 4 : 
3;
             break;
         case SvxAdjust::Center:
             nAdj = nAdjBiDi = 1;

Reply via email to