diff options
-rw-r--r-- | oox/source/export/drawingml.cxx | 23 | ||||
-rw-r--r-- | sd/qa/unit/data/odp/tdf134969_TransparencyOnColorGradient.odp | bin | 0 -> 17107 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml1.cxx | 18 |
3 files changed, 38 insertions, 3 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 517d9801bba6..155c33796f70 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -540,10 +540,27 @@ void DrawingML::WriteGradientFill( const Reference< XPropertySet >& rXPropSet ) else { mpFS->startElementNS(XML_a, XML_gradFill, XML_rotWithShape, "0"); - if( GetProperty(rXPropSet, "FillTransparenceGradient") ) - aTransparenceGradient = *o3tl::doAccess<awt::Gradient>(mAny); + OUString sFillTransparenceGradientName; + if (GetProperty(rXPropSet, "FillTransparenceGradientName") + && (mAny >>= sFillTransparenceGradientName) + && !sFillTransparenceGradientName.isEmpty()) + { + if (GetProperty(rXPropSet, "FillTransparenceGradient")) + aTransparenceGradient = *o3tl::doAccess<awt::Gradient>(mAny); + } + else if (GetProperty(rXPropSet, "FillTransparence")) + { + // currently only StartColor and EndColor are evaluated in WriteGradientFill() + sal_Int32 nTransparency = 0; + mAny >>= nTransparency; + // convert percent to gray color + nTransparency = nTransparency * 255/100; + const sal_Int32 aGrayColor = static_cast<sal_Int32>( nTransparency | nTransparency << 8 | nTransparency << 16 ); + aTransparenceGradient.StartColor = aGrayColor; + aTransparenceGradient.EndColor = aGrayColor; + } WriteGradientFill(aGradient, aTransparenceGradient); - mpFS->endElementNS( XML_a, XML_gradFill ); + mpFS->endElementNS(XML_a, XML_gradFill); } } diff --git a/sd/qa/unit/data/odp/tdf134969_TransparencyOnColorGradient.odp b/sd/qa/unit/data/odp/tdf134969_TransparencyOnColorGradient.odp Binary files differnew file mode 100644 index 000000000000..bb0d7bbc5709 --- /dev/null +++ b/sd/qa/unit/data/odp/tdf134969_TransparencyOnColorGradient.odp diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 5cde7f0c8b91..f8f471f08b9a 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -97,6 +97,7 @@ public: void testTdf128345GradientLinear(); void testTdf128345GradientRadial(); void testTdf128345GradientAxial(); + void testTdf134969TransparencyOnColorGradient(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); @@ -143,6 +144,7 @@ public: CPPUNIT_TEST(testTdf128345GradientLinear); CPPUNIT_TEST(testTdf128345GradientRadial); CPPUNIT_TEST(testTdf128345GradientAxial); + CPPUNIT_TEST(testTdf134969TransparencyOnColorGradient); CPPUNIT_TEST_SUITE_END(); @@ -1212,6 +1214,22 @@ void SdOOXMLExportTest1::testTdf128345GradientAxial() xDocShRef->DoClose(); } +void SdOOXMLExportTest1::testTdf134969TransparencyOnColorGradient() +{ + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf134969_TransparencyOnColorGradient.odp"), ODP); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + xDocShRef->DoClose(); + + // Make sure the shape has a transparency in gradient stops. + xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); + const OString sPathStart("//p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:gradFill"); + assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs",2); + assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[1]/a:srgbClr/a:alpha", "val", "60000"); + assertXPath(pXmlDoc, sPathStart + "/a:gsLst/a:gs[2]/a:srgbClr/a:alpha", "val", "60000"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1); CPPUNIT_PLUGIN_IMPLEMENT(); |