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

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 24 12:45:36 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf121045.docx      |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx        |   21 +++++++++++++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   19 +++++++++++++++++++
 3 files changed, 40 insertions(+)

New commits:
commit 22ad4d69d771708f28a2d9e137cfd43ac846cf3a
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Mon Feb 24 10:55:38 2020 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Mon Feb 24 13:44:58 2020 +0100

    tdf#121045 DOCX import: fix checkbox size in table
    
    in cell starting position.
    
    Change-Id: Ib99726c03ff3f83177a015721e562ebc5bc516d3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89338
    Tested-by: Jenkins
    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/tdf121045.docx b/sw/qa/extras/ooxmlexport/data/tdf121045.docx
new file mode 100644
index 000000000000..271aca1ec0a6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf121045.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 7c02ef57d4fc..537e5ad77dea 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -145,6 +145,27 @@ DECLARE_OOXMLEXPORT_TEST(testTdf130610, "tdf130610_bold_in_2_styles.ott")
     }
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121045, "tdf121045.docx")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:pPr/w:rPr/w:sz", "val", "20");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:pPr/w:rPr/w:szCs", "val", "20");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[1]/w:fldChar", "fldCharType", "begin");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[2]/w:instrText", 1);
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[3]/w:fldChar", "fldCharType", "separate");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[5]/w:fldChar", "fldCharType", "end");
+    // form control keeps its direct formatted font size
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[2]/w:rPr/w:sz", "val", "20");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[2]/w:rPr/w:szCs", "val", "20");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[3]/w:rPr/w:sz", "val", "20");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[3]/w:rPr/w:szCs", "val", "20");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[4]/w:rPr/w:sz", "val", "20");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[4]/w:rPr/w:szCs", "val", "20");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[5]/w:rPr/w:sz", "val", "20");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:p/w:r[5]/w:rPr/w:szCs", "val", "20");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf120315, "tdf120315.docx")
 {
     // tdf#120315 cells of the second column weren't vertically merged
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 4c7b50c72cf8..cae7e40a215d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4728,6 +4728,25 @@ void DomainMapper_Impl::CloseFieldCommand()
             (void)vSwitches;
             OUString const sFirstParam(vArguments.empty() ? OUString() : vArguments.front());
 
+            // apply font size to the form control in tables
+            if ( m_nTableDepth > 0 && m_pLastCharacterContext.get() && m_pLastCharacterContext->isSet(PROP_CHAR_HEIGHT) )
+            {
+                uno::Reference< text::XTextAppend >  xTextAppend = m_aTextAppendStack.top().xTextAppend;
+                if (xTextAppend.is())
+                {
+                    uno::Reference< text::XTextCursor > xCrsr = xTextAppend->getText()->createTextCursor();
+                    uno::Reference< text::XText > xText = xTextAppend->getText();
+                    if(xCrsr.is() && xText.is())
+                    {
+                        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);
+                    }
+                }
+            }
+
             FieldConversionMap_t::const_iterator const aIt = aFieldConversionMap.find(sType);
             if (aIt != aFieldConversionMap.end()
                 && (!m_bForceGenericFields


More information about the Libreoffice-commits mailing list