diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-23 22:09:23 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-24 11:13:45 +0200 |
commit | 810364653b8e5ef8578ae7c9fc2e3b9196e7cdc4 (patch) | |
tree | 58202df3d202947269281e474e4de0558636f63f | |
parent | 46581021108cc1f634ffc69c2776584d1f2847d1 (diff) |
tdf#116841 RTF import: fix default value of left para margin from numbering
The left mragin value is usually spelled out in RTF and DOCX, but this
bugdoc used the WW6 RTF markup to declare the numbering rules and there
the margin value was missing.
This also allows me to partially revert the changes to testTdf106953
from commit 56a695fddb915bcba13b088b5b2b4e0841d4acbc (tdf#112211 RTF
import: fix unwanted direct formatting for left indents, 2017-09-26).
Change-Id: I9902f2f9ada4080cb4d873624ae9824342c6ee77
Reviewed-on: https://gerrit.libreoffice.org/53364
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf116841.rtf | 16 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport2.cxx | 3 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport3.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/dmapper/NumberingManager.cxx | 5 |
4 files changed, 31 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf116841.rtf b/sw/qa/extras/rtfexport/data/tdf116841.rtf new file mode 100644 index 000000000000..75ff4878d7ab --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf116841.rtf @@ -0,0 +1,16 @@ +{\rtf1\ansi\ansicpg1252\deff0\deflang1034 +{\fonttbl +{\f0\fnil\fcharset0\fprq0\fttruetype Times New Roman;} +{\f1\fnil\fcharset0\fprq0\fttruetype Arial;} +{\f2\fnil\fcharset0\fprq0\fttruetype Courier New;} +} +\kerning0\cf0\viewkind1\paperw11905\paperh16837\margl1440\margr1440\widowctl +\sectd\sbknone\colsx360\headery0\footery0 +\pard +{\*\pn\pnql\pnstart0\pnlvlblt +{\pntxtb\bullet} +} +\fi-431\li720 +{\f0\fs24\lang1033 +This is item one} +\par\pard} diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx index 4e3299c6243d..64de79280e25 100644 --- a/sw/qa/extras/rtfexport/rtfexport2.cxx +++ b/sw/qa/extras/rtfexport/rtfexport2.cxx @@ -1068,10 +1068,11 @@ DECLARE_RTFEXPORT_TEST(testN825305, "n825305.rtf") DECLARE_RTFEXPORT_TEST(testTdf106953, "tdf106953.rtf") { + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), + getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); auto xRules = getProperty<uno::Reference<container::XIndexAccess>>( getStyles("NumberingStyles")->getByName("WWNum1"), "NumberingRules"); comphelper::SequenceAsHashMap aRule(xRules->getByIndex(0)); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), aRule["IndentAt"].get<sal_Int32>()); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), aRule["FirstLineIndent"].get<sal_Int32>()); } diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index be67a57dec2d..d07740cc2879 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -101,6 +101,14 @@ DECLARE_RTFEXPORT_TEST(testTdf115180, "tdf115180.docx") CPPUNIT_ASSERT_EQUAL_MESSAGE("First cell width", sal_Int32(218), cell2Width); } +DECLARE_RTFEXPORT_TEST(testTdf116841, "tdf116841.rtf") +{ + // This was 0, left margin was ignored as we assumed the default is already + // fine for us. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), + getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index 71e839ec32e7..02f49c62c67e 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -305,6 +305,11 @@ uno::Sequence<beans::PropertyValue> ListLevel::GetLevelProperties(bool bDefaults else if (rReadId == PROP_FIRST_LINE_INDENT && bDefaults) // Writer default is -360 twips, Word default seems to be 0. aNumberingProperties.emplace_back("FirstLineIndent", 0, uno::makeAny(static_cast<sal_Int32>(0)), beans::PropertyState_DIRECT_VALUE); + else if (rReadId == PROP_INDENT_AT && bDefaults) + // Writer default is 720 twips, Word default seems to be 0. + aNumberingProperties.emplace_back("IndentAt", 0, + uno::makeAny(static_cast<sal_Int32>(0)), + beans::PropertyState_DIRECT_VALUE); } boost::optional<PropertyMap::Property> aPropFont = getProperty(PROP_CHAR_FONT_NAME); |