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>
This commit is contained in:
Justin Luth
2023-05-24 08:52:20 -04:00
parent 2cdb48eee9
commit 446f9d77af
3 changed files with 20 additions and 1 deletions

View File

@@ -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: */

View File

@@ -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;