diff options
-rw-r--r-- | include/oox/drawingml/effectpropertiescontext.hxx | 3 | ||||
-rw-r--r-- | oox/source/drawingml/effectpropertiescontext.cxx | 65 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 8 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx | bin | 17276 -> 18687 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 17 |
5 files changed, 64 insertions, 29 deletions
diff --git a/include/oox/drawingml/effectpropertiescontext.hxx b/include/oox/drawingml/effectpropertiescontext.hxx index 060604b61d50..f81396d15483 100644 --- a/include/oox/drawingml/effectpropertiescontext.hxx +++ b/include/oox/drawingml/effectpropertiescontext.hxx @@ -31,6 +31,9 @@ public: protected: EffectProperties& mrEffectProperties; + +private: + void saveUnsupportedAttribs( const AttributeList& rAttribs ); }; } } diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx index 705adb046d18..458ee596fd4f 100644 --- a/oox/source/drawingml/effectpropertiescontext.cxx +++ b/oox/source/drawingml/effectpropertiescontext.cxx @@ -33,6 +33,37 @@ EffectPropertiesContext::~EffectPropertiesContext() { } +void EffectPropertiesContext::saveUnsupportedAttribs( const AttributeList& rAttribs ) +{ + if( rAttribs.hasAttribute( XML_algn ) ) + mrEffectProperties.appendUnsupportedEffectAttrib( "algn", + makeAny( rAttribs.getString( XML_algn, "" ) ) ); + if( rAttribs.hasAttribute( XML_blurRad ) ) + mrEffectProperties.appendUnsupportedEffectAttrib( "blurRad", + makeAny( rAttribs.getInteger( XML_blurRad, 0 ) ) ); + if( rAttribs.hasAttribute( XML_dir ) ) + mrEffectProperties.appendUnsupportedEffectAttrib( "dir", + makeAny( rAttribs.getInteger( XML_dir, 0 ) ) ); + if( rAttribs.hasAttribute( XML_dist ) ) + mrEffectProperties.appendUnsupportedEffectAttrib( "dist", + makeAny( rAttribs.getInteger( XML_dist, 0 ) ) ); + if( rAttribs.hasAttribute( XML_kx ) ) + mrEffectProperties.appendUnsupportedEffectAttrib( "kx", + makeAny( rAttribs.getInteger( XML_kx, 0 ) ) ); + if( rAttribs.hasAttribute( XML_ky ) ) + mrEffectProperties.appendUnsupportedEffectAttrib( "ky", + makeAny( rAttribs.getInteger( XML_ky, 0 ) ) ); + if( rAttribs.hasAttribute( XML_rotWithShape ) ) + mrEffectProperties.appendUnsupportedEffectAttrib( "rotWithShape", + makeAny( rAttribs.getInteger( XML_rotWithShape, 0 ) ) ); + if( rAttribs.hasAttribute( XML_sx ) ) + mrEffectProperties.appendUnsupportedEffectAttrib( "sx", + makeAny( rAttribs.getInteger( XML_sx, 0 ) ) ); + if( rAttribs.hasAttribute( XML_sy ) ) + mrEffectProperties.appendUnsupportedEffectAttrib( "sy", + makeAny( rAttribs.getInteger( XML_sy, 0 ) ) ); +} + ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { switch( nElement ) @@ -40,39 +71,19 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, case A_TOKEN( outerShdw ): { mrEffectProperties.msUnsupportedEffectName = "outerShdw"; - if( rAttribs.hasAttribute( XML_algn ) ) - mrEffectProperties.appendUnsupportedEffectAttrib( "algn", - makeAny( rAttribs.getString( XML_algn, "" ) ) ); - if( rAttribs.hasAttribute( XML_blurRad ) ) - mrEffectProperties.appendUnsupportedEffectAttrib( "blurRad", - makeAny( rAttribs.getInteger( XML_blurRad, 0 ) ) ); - if( rAttribs.hasAttribute( XML_dir ) ) - mrEffectProperties.appendUnsupportedEffectAttrib( "dir", - makeAny( rAttribs.getInteger( XML_dir, 0 ) ) ); - if( rAttribs.hasAttribute( XML_dist ) ) - mrEffectProperties.appendUnsupportedEffectAttrib( "dist", - makeAny( rAttribs.getInteger( XML_dist, 0 ) ) ); - if( rAttribs.hasAttribute( XML_kx ) ) - mrEffectProperties.appendUnsupportedEffectAttrib( "kx", - makeAny( rAttribs.getInteger( XML_kx, 0 ) ) ); - if( rAttribs.hasAttribute( XML_ky ) ) - mrEffectProperties.appendUnsupportedEffectAttrib( "ky", - makeAny( rAttribs.getInteger( XML_ky, 0 ) ) ); - if( rAttribs.hasAttribute( XML_rotWithShape ) ) - mrEffectProperties.appendUnsupportedEffectAttrib( "rotWithShape", - makeAny( rAttribs.getInteger( XML_rotWithShape, 0 ) ) ); - if( rAttribs.hasAttribute( XML_sx ) ) - mrEffectProperties.appendUnsupportedEffectAttrib( "sx", - makeAny( rAttribs.getInteger( XML_sx, 0 ) ) ); - if( rAttribs.hasAttribute( XML_sy ) ) - mrEffectProperties.appendUnsupportedEffectAttrib( "sy", - makeAny( rAttribs.getInteger( XML_sy, 0 ) ) ); + saveUnsupportedAttribs( rAttribs ); mrEffectProperties.maShadow.moShadowDist = rAttribs.getInteger( XML_dist, 0 ); mrEffectProperties.maShadow.moShadowDir = rAttribs.getInteger( XML_dir, 0 ); return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor ); } break; + case A_TOKEN( innerShdw ): + { + mrEffectProperties.msUnsupportedEffectName = "innerShdw"; + saveUnsupportedAttribs( rAttribs ); + } + break; } return 0; diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index a14cf72bc32d..b66bfc0db2d5 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2093,13 +2093,17 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet ) OUString sSchemeClr; sal_uInt32 nRgbClr = 0; + sal_Int32 nEffectToken = 0; sal_Int32 nAlpha = MAX_PERCENT; Sequence< PropertyValue > aTransformations; sax_fastparser::FastAttributeList *aOuterShdwAttrList = mpFS->createAttrList(); for( sal_Int32 i=0; i < aEffectProps.getLength(); ++i ) { - if(aEffectProps[i].Name == "outerShdw") + if( aEffectProps[i].Name == "outerShdw" || aEffectProps[i].Name == "innerShdw" ) { + nEffectToken = ( aEffectProps[i].Name == "outerShdw") ? + FSNS( XML_a, XML_outerShdw ) : + FSNS( XML_a, XML_innerShdw ); uno::Sequence< beans::PropertyValue > aOuterShdwProps; aEffectProps[0].Value >>= aOuterShdwProps; for( sal_Int32 j=0; j < aOuterShdwProps.getLength(); ++j ) @@ -2183,7 +2187,7 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet ) mpFS->startElementNS(XML_a, XML_effectLst, FSEND); sax_fastparser::XFastAttributeListRef xAttrList( aOuterShdwAttrList ); - mpFS->startElementNS( XML_a, XML_outerShdw, xAttrList ); + mpFS->startElement( nEffectToken, xAttrList ); if( sSchemeClr.isEmpty() ) WriteColor( nRgbClr, nAlpha ); diff --git a/sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx b/sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx Binary files differindex aecbd59826d9..97787eb529df 100644 --- a/sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx +++ b/sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx index a6fdc9eb98b4..bfadcecc5925 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx @@ -1086,6 +1086,23 @@ DECLARE_OOXMLEXPORT_TEST(testShapeEffectPreservation, "shape-effect-preservation assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:schemeClr/a:alpha", "val", "40000"); + + // second shape with inner shadow, rgb color + assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" + "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw", + "blurRad", "63500"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" + "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw", + "dir", "16200000"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" + "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw", + "dist", "50800"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" + "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw/a:srgbClr", + "val", "FFFF00"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/" + "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw/a:srgbClr/a:alpha", + "val", "50000"); } #endif |