oox/qa/unit/data/tdf163803_image_with_fill.pptx |binary oox/qa/unit/export.cxx | 16 ++++++++++++++++ oox/source/export/shapes.cxx | 1 + 3 files changed, 17 insertions(+)
New commits: commit dfd8caa6c49bd33f549a37d6c0244e4cce8f16d8 Author: Jaume Pujantell <jaume.pujant...@collabora.com> AuthorDate: Thu Nov 7 12:52:31 2024 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Nov 8 11:43:15 2024 +0100 tdf#163803 oox: export fill on graphic object The fill contents of a graphic object are lost when saving a pptx. Change-Id: I055d778d4a92de18dfec59bd27c63a20c08b99f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176208 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/oox/qa/unit/data/tdf163803_image_with_fill.pptx b/oox/qa/unit/data/tdf163803_image_with_fill.pptx new file mode 100644 index 000000000000..db45264fb304 Binary files /dev/null and b/oox/qa/unit/data/tdf163803_image_with_fill.pptx differ diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index bfee2e7ef8b3..8cf1ce0496bd 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -1420,6 +1420,22 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134401_ExportAutoGrowToTextWordWrap) assertXPathNoAttribute(pXmlDoc, "//p:sp[1]/p:txBody/a:bodyPr"_ostr, "wrap"_ostr); assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:bodyPr"_ostr, "wrap"_ostr, "none"); } + +CPPUNIT_TEST_FIXTURE(Test, testTdf163803_ImageFill) +{ + loadFromFile(u"tdf163803_image_with_fill.pptx"); + save("Impress Office Open XML"); + + xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml"); + // Check that the fill color is saved: + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 0 + // - In <>, XPath '//p:pic/p:spPr/a:solidFill' number of nodes is incorrect + // i.e. the <a:solidFill> element was not written. + assertXPath(pXmlDoc, "//p:pic/p:spPr/a:solidFill"_ostr); + assertXPath(pXmlDoc, "//p:pic/p:spPr/a:solidFill/a:srgbClr"_ostr, "val"_ostr, "000000"); +} } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 5997728e316b..c14b6e872f1a 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1469,6 +1469,7 @@ void ShapeExport::WriteGraphicObjectShapePart( const Reference< XShape >& xShape } WriteShapeTransformation( xShape, XML_a, bFlipH, false, false, false, true ); WritePresetShape( "rect"_ostr ); + WriteFill(xShapeProps); // graphic object can come with the frame (bnc#654525) WriteOutline( xShapeProps );