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@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
Regényi Balázs
2020-04-29 16:20:37 +02:00
committed by László Németh
parent 40613706f7
commit d012472805
3 changed files with 21 additions and 0 deletions
@@ -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 ):
+14
View File
@@ -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: */