Kaydet (Commit) 57d53530 authored tarafından Miklos Vajna's avatar Miklos Vajna

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/41442Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst ac3a4fe3
{\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
}
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment