diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-23 09:04:43 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-08-23 10:51:20 +0200 |
commit | 57d535302596a62be914bee49d7b1df1fc622a65 (patch) | |
tree | f094b7686bc20d3bed4006f7100a20a44c9b503f | |
parent | ac3a4fe35e873de17eefb46c3f5e792aded6b0a5 (diff) |
tdf#108943 RTF import: handle \tx inside a list level definition
\tx in the list level definition has a different meaning (we should map
it to the ListtabStopPosition UNO property), compared to when it's used
as a plain text property.
Change-Id: I7b98ae3d82bbd2c4ad41d0d7f4ad50525c4d0f9a
Reviewed-on: https://gerrit.libreoffice.org/41442
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r-- | sw/qa/extras/rtfimport/data/tdf108943.rtf | 24 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 19 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchvalue.cxx | 5 |
3 files changed, 47 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfimport/data/tdf108943.rtf b/sw/qa/extras/rtfimport/data/tdf108943.rtf new file mode 100644 index 000000000000..478d101f4167 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf108943.rtf @@ -0,0 +1,24 @@ +{\rtf1 +{\fonttbl +{\f0\fbidi \froman\fcharset238\fprq2 Times New Roman;} +} +\noqfpromote +{\stylesheet +{\s25 \fi-720\li720\ri0\ls1 ParaLevel1;} +} +{\*\listtable +{\list\listtemplateid-1762123600 +{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0 +\levelfollow0\levelstartat1\levelspace0\levelindent0 +{\leveltext\'02\'00.;} +{\levelnumbers\'01;} +\rtlch\fcs1 \af0 \ltrch\fcs0 \b0\i0\ulnone\fbias0 \s25\fi-720\li720\jclisttab\tx720\lin720 } +\listid1977027487} +} +{\*\listoverridetable +{\listoverride\listid1977027487\listoverridecount0\ls1} +} +\pard\plain \s25 \fi-720\li720\ri0\tqr\tx720\ls1 +hello +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 6a869b7a9113..a7fe074c478f 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -125,6 +125,25 @@ DECLARE_RTFIMPORT_TEST(testN695479, "n695479.rtf") CPPUNIT_ASSERT(bDrawFound); } +DECLARE_RTFIMPORT_TEST(testTdf108943, "tdf108943.rtf") +{ + uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aProps; + xLevels->getByIndex(0) >>= aProps; // 1st level + + sal_Int32 nListtabStopPosition = 0; + for (int i = 0; i < aProps.getLength(); ++i) + { + const beans::PropertyValue& rProp = aProps[i]; + + if (rProp.Name == "ListtabStopPosition") + nListtabStopPosition = rProp.Value.get<sal_Int32>(); + } + // This was 0, \tx was handled in paragraphs only (and not in list definitions). + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nListtabStopPosition); +} + DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf") { uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY); diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index 527d39da68db..f6a243e2fbc0 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -605,7 +605,10 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) { m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_pos, pIntValue); auto pValue = std::make_shared<RTFValue>(m_aStates.top().aTabAttributes); - putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue); + if (m_aStates.top().eDestination == Destination::LISTLEVEL) + putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue); + else + putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue); m_aStates.top().aTabAttributes.clear(); } break; |