From c94d7b8a9aafc51ce33e74c6102c9b54a07a6b16 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 8 May 2020 11:47:42 +0300 Subject: 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 --- oox/source/export/drawingml.cxx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'oox') 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); } -- cgit