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 dfe794ee03cab7906136c39ab2aa468c983af4cd
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 23:24:01 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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152243

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 69596ded0303..cd4410e3cb2e 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>
 
@@ -54,6 +55,24 @@ DECLARE_WW8EXPORT_TEST(testTdf117994_CRnumformatting, 
"tdf117994_CRnumformatting
     CPPUNIT_ASSERT_EQUAL(OUString("160"), 
parseDump("//body/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::Number']",
 "font-height"));
 }
 
+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 4a9779591d87..ff3d057d3042 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4988,7 +4988,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