diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-11-07 09:02:11 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-11-07 21:47:44 +0100 |
commit | 54c1066d3f98ac15b51b57645ddca767247e622b (patch) | |
tree | c31a035cc4d2a9021346960be39aff50d93d3f06 | |
parent | 4e5e00dad2593d677be74f96d72477a8531afcdb (diff) |
tdf#113550 RTF import: fix incorrect text indent
Left indent was set to non-zero in the style, but direct formatting set
it back to zero. Teach deduplication to remove the
NS_ooxml::LN_CT_PPrBase_ind SPRM itself in case the last attribute was
removed.
(cherry picked from commit 5f4a3e7bd77c3294ef85eebec17ed2d624dc3a2d)
Change-Id: I01b202f0241b02816b2b392326737b1150caffc2
Reviewed-on: https://gerrit.libreoffice.org/44395
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf113550.rtf | 17 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsprm.cxx | 3 |
3 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf113550.rtf b/sw/qa/extras/rtfexport/data/tdf113550.rtf new file mode 100644 index 000000000000..ef89c9af5df6 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf113550.rtf @@ -0,0 +1,17 @@ +{\rtf1\adeflang1037\ansi\ansicpg1252\uc1\adeff1\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0 +{\fonttbl +{\f0\fbidi \froman\fcharset238\fprq2 Times New Roman;} +} +{\stylesheet +{\ql \li0\ri0 Normal;} +{\s22\ql \li0\ri0 S22;} +{\s442\ql \li1418\ri0 \sbasedon22 S442;} +} +\paperw12240\paperh15840\margl1134\margr1134\margt1134\margb1410 +\trowd \cellx10008 +\pard\plain \ltrpar\s442\ql \li0\ri0\intbl +hello\par +\pard\cell\row +} +\pard\plain\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 12fb3dcf8708..ebc700c194f4 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -1206,6 +1206,16 @@ DECLARE_RTFEXPORT_TEST(testTdf104085, "tdf104085.rtf") CPPUNIT_FAIL("no BulletChar property"); } +DECLARE_RTFEXPORT_TEST(testTdf113550, "tdf113550.rtf") +{ + uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xCell->getText()); + // This was 2501, 0 as direct formatting was ignored on the paragraph (and + // the style had this larger value). + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin")); +} + DECLARE_RTFEXPORT_TEST(testLeveljcCenter, "leveljc-center.rtf") { // Tests that \leveljc1 is mapped to Adjust=Center for a numbering rule. diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx index f6301243de1a..4f2b4b02194f 100644 --- a/writerfilter/source/rtftok/rtfsprm.cxx +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -187,6 +187,9 @@ static bool isSPRMChildrenExpected(Id nId) SAL_FALLTHROUGH; case NS_ooxml::LN_CT_PrBase_shd: // Expected children are NS_ooxml::LN_CT_Shd_*. + SAL_FALLTHROUGH; + case NS_ooxml::LN_CT_PPrBase_ind: + // Expected children are NS_ooxml::LN_CT_Ind_*. return true; default: |