tdf#108505 DOCX: fix legacy dropdown fields direct font setting
if it is at the beginning of the paragraph.
See also commit 22ad4d69d771708f28a2d9e137cfd43ac846cf3a
(tdf#121045 DOCX import: fix checkbox size in table).
Change-Id: Ic4d4fc56cf031cc941c3f81930c6eba497090cba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91540
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf108505.docx b/sw/qa/extras/ooxmlexport/data/tdf108505.docx
new file mode 100644
index 0000000..50ebc37
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf108505.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 99e1d29..781dfa8 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1136,6 +1136,18 @@
assertXPath(pXml, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln", "w", "57150");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf108505, "tdf108505.docx")
{
uno::Reference<text::XTextRange> xParagraph = getParagraph(3);
uno::Reference<text::XTextRange> xText
= getRun(xParagraph, 1, "Wrong font when alone on the line");
// Without the fix in place this would have become Times New Roman
CPPUNIT_ASSERT_EQUAL(
OUString("Trebuchet MS"),
getProperty<OUString>(xText, "CharFontName"));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8cc1f7c..95b8e5e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4887,7 +4887,7 @@
OUString const sFirstParam(vArguments.empty() ? OUString() : vArguments.front());
// apply font size to the form control
if (!m_aTextAppendStack.empty() && m_pLastCharacterContext && m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT) )
if (!m_aTextAppendStack.empty() && m_pLastCharacterContext && ( m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT) || m_pLastCharacterContext->isSet(PROP_CHAR_FONT_NAME )))
{
uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
if (xTextAppend.is())
@@ -4897,9 +4897,14 @@
{
xCrsr->gotoEnd(false);
uno::Reference< beans::XPropertySet > xProp( xCrsr, uno::UNO_QUERY );
xProp->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT), m_pLastCharacterContext->getProperty(PROP_CHAR_HEIGHT)->second);
if ( m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT_COMPLEX) )
xProp->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT_COMPLEX), m_pLastCharacterContext->getProperty(PROP_CHAR_HEIGHT_COMPLEX)->second);
if (m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT))
{
xProp->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT), m_pLastCharacterContext->getProperty(PROP_CHAR_HEIGHT)->second);
if (m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT_COMPLEX))
xProp->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT_COMPLEX), m_pLastCharacterContext->getProperty(PROP_CHAR_HEIGHT_COMPLEX)->second);
}
if (m_pLastCharacterContext->isSet(PROP_CHAR_FONT_NAME))
xProp->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME), m_pLastCharacterContext->getProperty(PROP_CHAR_FONT_NAME)->second);
}
}
}