[Libreoffice-commits] core.git: sw/qa writerfilter/source

Gabor Kelemen (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 19 11:30:47 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf108505.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx        |   12 ++++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   13 +++++++++----
 3 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit 833dd75c6956f5a0d395468575aa416a6853a1f9
Author:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
AuthorDate: Sun Mar 22 22:59:05 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Jun 19 13:29:57 2020 +0200

    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 at numbertext.org>
    Reviewed-by: László Németh <nemeth at 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 000000000000..50ebc3770895
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf108505.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 99e1d29c93d8..781dfa872081 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1136,6 +1136,18 @@ DECLARE_OOXMLEXPORT_TEST(testLineWidthRounding, "tdf126363_LineWidthRounding.doc
     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 8cc1f7c02358..95b8e5e46647 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4887,7 +4887,7 @@ void DomainMapper_Impl::CloseFieldCommand()
             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 @@ void DomainMapper_Impl::CloseFieldCommand()
                     {
                         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);
                     }
                 }
             }


More information about the Libreoffice-commits mailing list