Kaydet (Commit) 58c30a35 authored tarafından Miklos Vajna's avatar Miklos Vajna

fdo#59638 handle RTF_F inside RTF_LISTLEVEL

Word typically uses the Symbol font to describe bullet characters
instead of using a sane Unicode value, the previous can only be handled
if we parse the custom font set for the list.

Change-Id: I1491f07c40953949e381a035c1596c207cdc4c35
üst 2f82a08d
{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0
{\fonttbl
{\f0\fbidi \froman\fcharset238\fprq2
Times New Roman;}
{\f2\fbidi \fmodern\fcharset238\fprq1
Courier New;}
{\f3\fbidi \froman\fcharset2\fprq2
Symbol;}
}
{\*\listtable
{\list\listtemplateid-1784933330\listsimple
{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat0\levelspace0\levelindent0
{\leveltext\'01*;}
{\levelnumbers;}
\hres0\chhres0 }
{\listname ;}
\listid-2}
}
{\*\listoverridetable
{\listoverride\listid-2\listoverridecount1
{\lfolevel\listoverrideformat
{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat0\levelold\levelspace0
\levelindent0
{\leveltext\'01\u-3913 ?;}
{\levelnumbers;}
\f3\fbias0 }
}
\ls1}
}
\pard\plain \ltrpar\ql \fi-360\li720\ri0\nowidctlpar\wrapdefault
\faauto\ls1\rin0\lin720\itap0\pararsid7241016 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \fs22\lang1031\langfe1031\loch\af31506\hich\af31506\dbch\af31505\cgrid\langnp1031\langfenp1031
{\rtlch\fcs1 \af37 \ltrch\fcs0
\f37\insrsid15285686 \hich\af37\dbch\af31505\loch\f37 3
\par }
}
......@@ -143,6 +143,7 @@ public:
void testFdo59419();
void testFdo58076_2();
void testFdo59953();
void testFdo59638();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
......@@ -258,6 +259,7 @@ void Test::run()
{"fdo59419.rtf", &Test::testFdo59419},
{"fdo58076-2.rtf", &Test::testFdo58076_2},
{"fdo59953.rtf", &Test::testFdo59953},
{"fdo59638.rtf", &Test::testFdo59638},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
......@@ -1120,6 +1122,29 @@ void Test::testFdo59953()
CPPUNIT_ASSERT_EQUAL(sal_Int16(7650), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
}
void Test::testFdo59638()
{
// The problem was that w:lvlOverride inside w:num was ignores by dmapper.
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
for (int i = 0; i < aProps.getLength(); ++i)
{
const beans::PropertyValue& rProp = aProps[i];
if (rProp.Name == "BulletChar")
{
// Was '*', should be 'o'.
CPPUNIT_ASSERT_EQUAL(OUString("\xEF\x82\xB7", 3, RTL_TEXTENCODING_UTF8), rProp.Value.get<OUString>());
return;
}
}
CPPUNIT_FAIL("no BulletChar property");
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -2721,6 +2721,14 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
m_aFontIndexes.push_back(nParam);
m_nCurrentFontIndex = getFontIndex(nParam);
}
else if (m_aStates.top().nDestinationState == DESTINATION_LISTLEVEL)
{
RTFSprms aFontSprms;
aFontSprms.set(NS_sprm::LN_CRgFtc0, RTFValue::Pointer_t(new RTFValue(getFontIndex(nParam))));
RTFSprms aRunPropsSprms;
aRunPropsSprms.set(NS_ooxml::LN_EG_RPrBase_rFonts, RTFValue::Pointer_t(new RTFValue(RTFSprms(), aFontSprms)));
m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_rPr, RTFValue::Pointer_t(new RTFValue(RTFSprms(), aRunPropsSprms)));
}
else
{
int nFontIndex = getFontIndex(nParam);
......
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