Kaydet (Commit) 67a08894 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#108416 RTF import: fix unexpected bold list numbering

Some paragraph-level run properties affect the current list style since
commit 2123ede0 (n#758883 dmapper:
paragraph-level run props should affect numberings as well, 2012-06-19).
This was extended for any run properties in case of RTF since commit
c1f8437d (fdo#83465 RTF import: handle
font of numbering, 2014-09-25), as RTF doesn't really separate the
paragraph-level and the other run properties.

However, field formatting clearly should affect only the field itself,
so disable this mechanism in that context.

Change-Id: I6df7488e99e44f3ba7e17bf09ce590c88151e043
Reviewed-on: https://gerrit.libreoffice.org/38980Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 80759b58
{\rtf1\adeflang1025
{\*\listtable
{\list\listtemplateid492320832\listhybrid
{\listlevel\levelnfc0\levelnfcn0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\leveltext\leveltemplateid510954734\'03(\'00);}{\levelnumbers\'02;}\rtlch\fcs1\af0}
{\listname ;}\listid1847935044}
}
{\*\listoverridetable
{\listoverride\listid1847935044\listoverridecount0\ls3}
}
\pard\plain asdf asdf asdf asdf asdf asdf asdf asdf\par
\pard \ls3
{before field }
{\field
{\*\fldinst {\b MERGEFIELD "ZADDFIELDCON_BEGDADE" }}
{\fldrslt {\b 01.08.2017}}
}
{ after\par }
}
......@@ -2430,6 +2430,14 @@ DECLARE_RTFIMPORT_TEST(testTdf86814, "tdf86814.rtf")
CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(getParagraph(1), 1), "CharWeight"));
}
DECLARE_RTFIMPORT_TEST(testTdf108416, "tdf108416.rtf")
{
uno::Reference<container::XNameAccess> xCharacterStyles(getStyles("CharacterStyles"));
uno::Reference<beans::XPropertySet> xListLabel(xCharacterStyles->getByName("ListLabel 1"), uno::UNO_QUERY);
// This was awt::FontWeight::BOLD, list numbering got an unexpected bold formatting.
CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(xListLabel, "CharWeight"));
}
DECLARE_RTFIMPORT_TEST(testTdf90315, "tdf90315.rtf")
{
uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
......
......@@ -5268,11 +5268,13 @@ uno::Reference<beans::XPropertySet> DomainMapper_Impl::GetCurrentNumberingCharSt
if (!xLevels.is())
{
PropertyMapPtr pContext = m_pTopContext;
if (IsRTFImport())
if (IsRTFImport() && !IsOpenField())
{
// Looking up the paragraph context explicitly (and not just taking
// the top context) is necessary for RTF, where formatting of a run
// and of the paragraph mark is not separated.
// We know that the formatting inside a field won't affect the
// paragraph marker formatting, though.
pContext = GetTopContextOfType(CONTEXT_PARAGRAPH);
if (!pContext)
return xRet;
......
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