diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-03 22:54:38 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-04-04 09:02:27 +0200 |
commit | 791fb3979df47a9fe21a1fbb9debbc955f3e035b (patch) | |
tree | 8906694489167d0f3eee4f393cf60658ca6154e1 /sw | |
parent | 6da4e626d17a9434d5d806bac6b7bbad23218df4 (diff) |
tdf#116265 RTF import: ignore \fi in para if it repeats invalid \fi from list
The 2nd paragraph of the bugdoc has a \fi set, but it has to be ignored.
The reason for this is that the \fi is a repeated property from the list
definition, but there \levelnumbers has invalid contents, which means
its \fi has to be ignored, including their repeated values in paragraph
direct formatting.
There was already code to insert implicit defaults as paragraph direct
formatting based on list properties, this does the opposite: remove
paragraph direct formatting based on the list state.
This requires tracking the ignored values in a separate structure, since
the normal list properties no longer contain the information we need to
be able to remove paragraph formatting. (At the moment this tracks only
\fi, but can be extended to other properties if it'll be necessary.)
Change-Id: Iff542cb76c66b7fc7ae4e07ade84701e24a74f1a
Reviewed-on: https://gerrit.libreoffice.org/52352
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfimport/data/tdf116265.rtf | 28 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 8 |
2 files changed, 36 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/tdf116265.rtf b/sw/qa/extras/rtfimport/data/tdf116265.rtf new file mode 100644 index 000000000000..c5ad557d289d --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf116265.rtf @@ -0,0 +1,28 @@ +{\rtf \ansi \ansicpg0 \deff0 \stshfdbch1 \stshfloch0 \stshfhich0 \deflang1033 \deflangfe1033 +{\fonttbl +{\f0 \froman \fcharset0 \fprq2 Times New Roman;} +} +{\stylesheet +{Normal;} +{\s19 \li720 \ri0 ListParagraph;} +} +{\*\listtable +{\list \listtemplateid700648999 \listhybrid +{\listlevel \levelnfc0 \levelnfcn0 \leveljc0 \leveljcn0 \levelstartat1 \levelfollow0 \levelspace0 \levelindent0 \levellegal0 \levelnorestart0 +{\leveltext +} +{\levelnumbers \'01 +{\uc1 \u59 ?} +} +\li720 \fi-360 } +{\listname ;} +\listid697112958 } +} +{\*\listoverridetable +{\listoverride \listid697112958 \listoverridecount0 \ls1 } +} +\paperw12240 \paperh15840 \margl1800 \margr1800 \margt1440 \margb1440 +\pard\plain We would add the following notes:\par +\pard \plain \s19 \fi-360 \li720 \ls1 +Strictly speaking, PDF is also a revisable format, but it is most often used to create documents for viewing.\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index e4af20ddc392..4211c88429e7 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -636,6 +636,14 @@ DECLARE_RTFIMPORT_TEST(testTdf116269, "tdf116269.rtf") getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin")); } +DECLARE_RTFIMPORT_TEST(testTdf116265, "tdf116265.rtf") +{ + // This was -635, \fi as direct formatting has to be ignored due to + // matching \fi in list definition (and with invalid level numbers). + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), + getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent")); +} + DECLARE_RTFIMPORT_TEST(testFdo66565, "fdo66565.rtf") { uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); |