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

Regényi Balázs (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 29 14:21:16 UTC 2020


 oox/source/drawingml/textcharacterpropertiescontext.cxx                  |    7 +++++
 sw/qa/extras/ooxmlexport/data/tdf132491_UnderlineColorGroupedShapes.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx                                |   14 ++++++++++
 3 files changed, 21 insertions(+)

New commits:
commit d0124728059088cd72cb173e33df89d785ae2ab5
Author:     Regényi Balázs <regenyi.balazs+gerrit at gmail.com>
AuthorDate: Tue Apr 28 09:18:24 2020 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Apr 29 16:20:37 2020 +0200

    tdf#132491 DOCX DrawingML shape import: fix missing underline color
    
    The import of underline color was unhandled.
    Co-Author: Szabolcs Toth
    
    Change-Id: I47dce90966c7130ca67941ee47b0e4b2ba7eb972
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93108
    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/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index 8c6eb4aee22a..8fecb8bd2735 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -201,6 +201,13 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
                 mrTextCharacterProperties.moUnderline = XML_dash;
             else if (attrib == "none")
                 mrTextCharacterProperties.moUnderline = XML_none;
+            auto colorAttrib = rAttribs.getIntegerHex(W_TOKEN(color));
+            if (colorAttrib.has())
+            {
+                oox::drawingml::Color theColor;
+                theColor.setSrgbClr(colorAttrib.get());
+                mrTextCharacterProperties.maUnderlineColor = theColor;
+            }
             break;
         }
         case W_TOKEN( spacing ):
diff --git a/sw/qa/extras/ooxmlexport/data/tdf132491_UnderlineColorGroupedShapes.docx b/sw/qa/extras/ooxmlexport/data/tdf132491_UnderlineColorGroupedShapes.docx
new file mode 100644
index 000000000000..aa5528b31093
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf132491_UnderlineColorGroupedShapes.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index e73e7dcfddab..a6352c767335 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1198,6 +1198,20 @@ DECLARE_OOXMLEXPORT_TEST(testUnderlineGroupShapeText, "tdf123351_UnderlineGroupS
         "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "val", "single");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testUnderlineColorGroupedShapes, "tdf132491_UnderlineColorGroupedShapes.docx")
+{
+    // tdf#132491 : Check if correct color is used for underline.
+    xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+    if (!pXmlDocument)
+        return;
+    assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
+        "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "color", "FF0000");
+    assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
+        "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[2]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "color", "00B050");
+    assertXPathNoAttribute(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
+        "/a:graphic/a:graphicData/wpg:wgp/wps:wsp[3]/wps:txbx/w:txbxContent/w:p/w:r/w:rPr/w:u", "color");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list