From 446f9d77af4fe0cedf50e9cbd792cf1aee105675 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Wed, 24 May 2023 08:52:20 -0400 Subject: [PATCH] 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 --- .../data/tdf155465_paraAdjustDistribute.doc | Bin 0 -> 9728 bytes sw/qa/extras/ww8export/ww8export4.cxx | 19 ++++++++++++++++++ sw/source/filter/ww8/ww8atr.cxx | 2 +- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/ww8export/data/tdf155465_paraAdjustDistribute.doc 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 0000000000000000000000000000000000000000..5a661cd837ef0c9532304e3ab5f180728e25b903 GIT binary patch literal 9728 zcmeI2O>9(E6vywIPCo_eH229nKSvnd*6Nc zo^$TG=YG${Kc)w zwV|IzECy=xQcwm0U;=msl!J+25||8BW=b}EimF^tHOB(mOp@P#37K`Kk1%CU)1uy~ z8js0gcV`^P$02vT$d}LSw}Sj(3wW_vuKnHddo2B5bAkGQ5LALH@GPhXQ$Y=Q4om~n z!3^*`cmd1=AutO__H4p1crp7vm#_}J1m=PHU;$VNB481Sf_l&Z8o^?)1S|#1KoeLF zUIr_`O7IF;1y+M*&;nY)8n70u18rbE*Z?+y7}x|}1?^xn*aAAhRcP3_m7IG9SNlZOUE zyOOD{g=>??PV{#74cK!+`*x+RO&+vY1&T*_vA;)}%=P6z9CsMyds@yiB43ug--3AD z1Xdw?>>0_)nqrx9HREF}(_FTh@hxR~v2+jb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U0w#Rvji~P-^sGa^?pU0=6>suu$v>23w#$~)#jRM9n;2=* vjRrcw^G4IgQ2#lwcF)a<@00v+_GlV|{C&v(##{9~<#Jlyd3q_3d;k9*8)^QN literal 0 HcmV?d00001 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 #include #include +#include #include #include #include @@ -101,6 +102,24 @@ DECLARE_WW8EXPORT_TEST(testTdf90408B, "tdf90408B.doc") CPPUNIT_ASSERT_EQUAL_MESSAGE("text is 10pt", 10.f, getProperty(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(getParagraph(1), "ParaAdjust"); + CPPUNIT_ASSERT_EQUAL(eBlock, static_cast(nAdjust)); + + nAdjust = getProperty(getParagraph(1), "ParaLastLineAdjust"); + CPPUNIT_ASSERT_EQUAL(eBlock, static_cast(nAdjust)); + + nAdjust = getProperty(getParagraph(2), "ParaAdjust"); + CPPUNIT_ASSERT_EQUAL(eBlock, static_cast(nAdjust)); + + nAdjust = getProperty(getParagraph(2), "ParaLastLineAdjust"); + CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_LEFT, static_cast(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;