From 2ef83c8782ed947b47f9292a12355fc3bb078078 Mon Sep 17 00:00:00 2001 From: Tünde Tóth Date: Wed, 19 Apr 2023 14:48:33 +0200 Subject: tdf#91332 XLSX export: fix missing solidFill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Background color of shape inherited from theme lost after export. Regression from commit bc0a9076aa43a0782bcf81e55d3f84f6af0f68e8 "ooxml: Preserve shape theme attribute for solid fill". Change-Id: I2d8298ac17332ba3ad6a627ce8b07c23087ac7b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150674 Tested-by: Jenkins Tested-by: László Németh Reviewed-by: László Németh --- oox/source/export/drawingml.cxx | 3 ++- sc/qa/unit/data/xlsx/tdf91332.xlsx | Bin 0 -> 11375 bytes sc/qa/unit/subsequent_export_test2.cxx | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 sc/qa/unit/data/xlsx/tdf91332.xlsx diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 60a5cdd62d7e..77c4c1b02186 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -530,7 +530,8 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet ) WriteSolidFill(::Color(ColorTransparency, nFillColor & 0xffffff), nAlpha); } } - else if ( !sColorFillScheme.isEmpty() ) + // tdf#91332 LO doesn't export the actual theme.xml in XLSX. + else if ( !sColorFillScheme.isEmpty() && GetDocumentType() != DOCUMENT_XLSX ) { // the shape had a scheme color and the user didn't change it WriteSolidFill( sColorFillScheme, aTransformations, nAlpha ); diff --git a/sc/qa/unit/data/xlsx/tdf91332.xlsx b/sc/qa/unit/data/xlsx/tdf91332.xlsx new file mode 100644 index 000000000000..5f1d119e8ee7 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf91332.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index 7a9579f3dfa0..403bffc3112f 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -1224,6 +1224,25 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX) assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship", "TargetMode", "External"); } +CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91332) +{ + createScDoc("xlsx/tdf91332.xlsx"); + saveAndReload("Calc Office Open XML"); + + uno::Reference xDoc(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference xPage(xDoc->getDrawPages()->getByIndex(0), + uno::UNO_QUERY_THROW); + uno::Reference xShapeProps(xPage->getByIndex(0), uno::UNO_QUERY_THROW); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: rgba[90cf47ff] + // - Actual : rgba[ffffffff] + // i.e. fill color inherited from theme lost after export. + Color nColor; + xShapeProps->getPropertyValue("FillColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(Color(0x90cf47), nColor); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit