summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2014-04-23 17:26:38 +0200
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2014-04-23 17:42:20 +0200
commit211637d575d717de8b9e9ed9bf6c4c29f8e8f772 (patch)
tree8c98d79945a12d759b4961e87ce209e8b3128702 /oox
parent14873da8c264cb3ca70d945f67c8d2e25add36ff (diff)
ooxml: Preserve inner shadow effect on shapes.
Reused most of the code of outerShdw effect. Modified an existing unit test to add a check for innerShdw. Change-Id: Ifdd77850bfd3b5fa250594469455b1b66c338611
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/effectpropertiescontext.cxx65
-rw-r--r--oox/source/export/drawingml.cxx8
2 files changed, 44 insertions, 29 deletions
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 );