oox/source/export/drawingml.cxx | 29 ++++++++++++++++++++++++++++ sw/qa/extras/ooxmlexport/data/bnc637947.odt |binary sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 12 +++++++++++ 3 files changed, 41 insertions(+)
New commits: commit b848e32dfd5fc6ed4e487e68460d49643fd5e3c1 Author: Andras Timar <andras.ti...@collabora.com> Date: Tue Feb 24 21:34:12 2015 +0100 bnc#637947 export shape shadow to DrawingML Change-Id: I6e0b093d99dba731ff5723d6575f887346463908 Reviewed-on: https://gerrit.libreoffice.org/14605 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 214652d..5737730 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2503,7 +2503,36 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet ) } } if( aEffects.getLength() == 0 ) + { + bool bHasShadow = false; + rXPropSet->getPropertyValue( "Shadow" ) >>= bHasShadow; + if( bHasShadow ) + { + Sequence< PropertyValue > aShadowGrabBag( 3 ); + Sequence< PropertyValue > aShadowAttribsGrabBag( 2 ); + + double dX, dY; + rXPropSet->getPropertyValue( "ShadowXDistance" ) >>= dX; + rXPropSet->getPropertyValue( "ShadowYDistance" ) >>= dY; + + aShadowAttribsGrabBag[0].Name = "dist"; + aShadowAttribsGrabBag[0].Value = Any(static_cast< sal_Int32 >(sqrt(dX*dX + dY*dY) * 360)); + aShadowAttribsGrabBag[1].Name = "dir"; + aShadowAttribsGrabBag[1].Value = Any(static_cast< sal_Int32 >(atan2(dY,dX) * 180 * 60000 / M_PI)); + + aShadowGrabBag[0].Name = "Attribs"; + aShadowGrabBag[0].Value = Any(aShadowAttribsGrabBag); + aShadowGrabBag[1].Name = "RgbClr"; + aShadowGrabBag[1].Value = rXPropSet->getPropertyValue( "ShadowColor" ); + aShadowGrabBag[2].Name = "RgbClrTransparency"; + aShadowGrabBag[2].Value = rXPropSet->getPropertyValue( "ShadowTransparence" ); + + mpFS->startElementNS(XML_a, XML_effectLst, FSEND); + WriteShapeEffect( "outerShdw", aShadowGrabBag ); + mpFS->endElementNS(XML_a, XML_effectLst); + } return; + } mpFS->startElementNS(XML_a, XML_effectLst, FSEND); diff --git a/sw/qa/extras/ooxmlexport/data/bnc637947.odt b/sw/qa/extras/ooxmlexport/data/bnc637947.odt new file mode 100644 index 0000000..db5c878 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/bnc637947.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx index d778685..d81140c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx @@ -1810,6 +1810,18 @@ DECLARE_OOXMLEXPORT_TEST(testPictureWrapPolygon, "picture-wrap-polygon.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(11), aSeq.getLength()); } +DECLARE_OOXMLEXPORT_TEST(testExportShadow, "bnc637947.odt") +{ + // The problem was that shadows of shapes from non-OOXML origin were not exported to DrawingML + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + + assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw", "dist" , "109865"); + assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw", "dir" , "634411"); + assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw/a:srgbClr", "val" , "000000"); + assertXPath(pXmlDoc,"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wpg:wgp/wps:wsp[1]/wps:spPr/a:effectLst/a:outerShdw/a:srgbClr/a:alpha", "val" , "38000"); +} #endif CPPUNIT_PLUGIN_IMPLEMENT(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits