tdf#77236 DOCX shape export: fix missing solidFill
(resulting for example, invisible shapes).
Co-authored-by: Szabolcs Tóth
Change-Id: I328514022f4a594c374d5a97db39d1cf3a954e02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102195
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 06bbfea..605e85f 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -926,14 +926,17 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet, Referenc
// the line had a scheme color and the user didn't change it
WriteSolidFill( sColorFillScheme, aTransformations );
}
else if( aStyleProperties.hasElements() )
{
if( nColor != nStyleColor )
// the line style defines some color but it wasn't being used
WriteSolidFill( nColor );
// in case the shape used the style color and the user didn't change it,
// we must not write a <a: solidFill> tag.
}
// tdf#77236: I do not understand why this condition is required.
// The original docx document of bug tdf#77236 includes the native colors in both places,
// so, I think, we can export this color too (not only schema ones).
//else if( aStyleProperties.hasElements() )
//{
// if( nColor != nStyleColor )
// // the line style defines some color but it wasn't being used
// WriteSolidFill( nColor );
// // in case the shape used the style color and the user didn't change it,
// // we must not write a <a: solidFill> tag.
//}
else
{
WriteSolidFill( nColor, nColorAlpha );
diff --git a/sw/qa/extras/ooxmlexport/data/tdf77236_MissingSolidFill.docx b/sw/qa/extras/ooxmlexport/data/tdf77236_MissingSolidFill.docx
new file mode 100644
index 0000000..2bb2c09
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf77236_MissingSolidFill.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index da998b0..4f77681d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -1338,6 +1338,15 @@ DECLARE_OOXMLEXPORT_TEST( testTdf107359, "tdf107359-char-pitch.docx" )
CPPUNIT_ASSERT_EQUAL( sal_Int32(convertTwipToMm100(24 * 20)), nBaseWidth );
}
DECLARE_OOXMLEXPORT_TEST(testTdf77236_MissingSolidFill, "tdf77236_MissingSolidFill.docx")
{
// tdf#77236: solidFill of VML shape was not exported if the colors of line and style were the same
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "//mc:Choice/w:drawing/wp:inline/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill", 1);
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index d1091c9..eafdf88 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -783,7 +783,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testShapeThemePreservation, "shape-theme-pre
0);
assertXPath(pXmlDocument,
"/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:solidFill",
0);
1);
// check direct theme assignments have been preserved
assertXPath(pXmlDocument,