summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-05-08 11:47:42 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-05-08 14:37:51 +0200
commitc94d7b8a9aafc51ce33e74c6102c9b54a07a6b16 (patch)
tree8c67756ffa309e15473d709a02e87026f673a210
parent7aedeab27cbef89fd3f831b4a1ef2c06f24c9790 (diff)
tdf#132201: use proper sequence order of effects per spec
See CT_EffectList in ECMA-376 Change-Id: Ib0605f1e4a0795d2bfdbb6b7451a902c67ea504d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93717 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--oox/source/export/drawingml.cxx18
-rw-r--r--sd/qa/unit/data/pptx/effectOrder.pptxbin0 -> 30482 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx21
3 files changed, 37 insertions, 2 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index aebd6901c864..e2149b648f84 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3742,6 +3742,9 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
}
}
+ // tdf#132201: the order of effects is important. Effects order (CT_EffectList in ECMA-376):
+ // blur -> fillOverlay -> glow -> innerShdw -> outerShdw -> prstShdw -> reflection -> softEdge
+
if( !aEffects.hasElements() )
{
bool bHasShadow = false;
@@ -3755,6 +3758,7 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
if( bHasShadow || bHasGlow )
{
mpFS->startElementNS(XML_a, XML_effectLst);
+ WriteGlowEffect(rXPropSet);
if( bHasShadow )
{
Sequence< PropertyValue > aShadowGrabBag( 3 );
@@ -3778,7 +3782,6 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
WriteShapeEffect( "outerShdw", aShadowGrabBag );
}
- WriteGlowEffect(rXPropSet);
mpFS->endElementNS(XML_a, XML_effectLst);
}
}
@@ -3820,8 +3823,18 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
}
mpFS->startElementNS(XML_a, XML_effectLst);
+ bool bGlowWritten = false;
for( const auto& rEffect : std::as_const(aEffects) )
{
+ if (!bGlowWritten
+ && (rEffect.Name == "innerShdw" || rEffect.Name == "outerShdw"
+ || rEffect.Name == "prstShdw" || rEffect.Name == "reflection"
+ || rEffect.Name == "softEdge"))
+ {
+ WriteGlowEffect(rXPropSet);
+ bGlowWritten = true;
+ }
+
if( rEffect.Name == "outerShdw" )
{
WriteShapeEffect( rEffect.Name, aOuterShdwProps );
@@ -3833,7 +3846,8 @@ void DrawingML::WriteShapeEffects( const Reference< XPropertySet >& rXPropSet )
WriteShapeEffect( rEffect.Name, aEffectProps );
}
}
- WriteGlowEffect(rXPropSet);
+ if (!bGlowWritten)
+ WriteGlowEffect(rXPropSet);
mpFS->endElementNS(XML_a, XML_effectLst);
}
diff --git a/sd/qa/unit/data/pptx/effectOrder.pptx b/sd/qa/unit/data/pptx/effectOrder.pptx
new file mode 100644
index 000000000000..7f913b3726f8
--- /dev/null
+++ b/sd/qa/unit/data/pptx/effectOrder.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 6bb672641d56..645c3cb4f388 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -195,6 +195,7 @@ public:
void testTdf119087();
void testTdf131554();
void testTdf132282();
+ void testTdf132201EffectOrder();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -307,6 +308,7 @@ public:
CPPUNIT_TEST(testTdf119087);
CPPUNIT_TEST(testTdf131554);
CPPUNIT_TEST(testTdf132282);
+ CPPUNIT_TEST(testTdf132201EffectOrder);
CPPUNIT_TEST_SUITE_END();
@@ -2894,6 +2896,25 @@ void SdOOXMLExportTest2::testTdf132282()
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2604), xShape->getSize().Height);
}
+void SdOOXMLExportTest2::testTdf132201EffectOrder()
+{
+ auto xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/effectOrder.pptx"),
+ PPTX);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+ xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+ assertXPathChildren(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:effectLst", 2);
+ // The relative order of effects is important: glow must be before shadow
+ CPPUNIT_ASSERT_EQUAL(0, getXPathPosition(pXmlDocContent,
+ "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:effectLst",
+ "glow"));
+ CPPUNIT_ASSERT_EQUAL(1, getXPathPosition(pXmlDocContent,
+ "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:effectLst",
+ "outerShdw"));
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();