summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2023-05-24 08:52:20 -0400
committerJustin Luth <jluth@mail.com>2023-05-24 19:52:14 +0200
commit446f9d77af4fe0cedf50e9cbd792cf1aee105675 (patch)
tree8ac110203a1e0c3be1bf0a9d40a6b4f96f5a667b
parent2cdb48eee93a3a93074184c5c8a82e571fb0bd04 (diff)
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 <jluth@mail.com>
-rw-r--r--sw/qa/extras/ww8export/data/tdf155465_paraAdjustDistribute.docbin0 -> 9728 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export4.cxx19
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx2
3 files changed, 20 insertions, 1 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf155465_paraAdjustDistribute.doc
Binary files 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;