summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-08-23 09:04:43 +0200
committerMichael Stahl <mstahl@redhat.com>2017-08-24 11:56:19 +0200
commite6426cc1bf174a67828f3e18ab1ea70eccc44b07 (patch)
treef065a970f6c21b05c5c61f6982d35a2696dbae1b
parent93e79bc7b14c82ec4a2ff5eddddb2c18ac36d9b2 (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. (cherry picked from commit 57d535302596a62be914bee49d7b1df1fc622a65) Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx Change-Id: I7b98ae3d82bbd2c4ad41d0d7f4ad50525c4d0f9a Reviewed-on: https://gerrit.libreoffice.org/41457 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/qa/extras/rtfimport/data/tdf108943.rtf24
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx19
-rw-r--r--writerfilter/source/rtftok/rtfdispatchvalue.cxx5
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 bf8188db99d6..f7f2e89d70a3 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -235,6 +235,25 @@ DECLARE_RTFIMPORT_TEST(testFdo45187, "fdo45187.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xTextRangeCompare->compareRegionStarts(xAnchor0, xAnchor1));
}
+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;