Kaydet (Commit) 2310af23 authored tarafından Jacobo Aragunde Pérez's avatar Jacobo Aragunde Pérez

ooxml: Preserve blur effect on shapes.

Reused the code for other effects just adding the new attribute
"grow".

I didn't add a unit test for this effect because I found no way to
apply it to an object in Word, but it's technically part of the
standard.

Change-Id: I391aff17f59d49d6bf339a71481dcdb51c537c9e
üst f519bfde
...@@ -80,6 +80,9 @@ void EffectPropertiesContext::saveUnsupportedAttribs( const AttributeList& rAttr ...@@ -80,6 +80,9 @@ void EffectPropertiesContext::saveUnsupportedAttribs( const AttributeList& rAttr
if( rAttribs.hasAttribute( XML_stPos ) ) if( rAttribs.hasAttribute( XML_stPos ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "stPos", mrEffectProperties.appendUnsupportedEffectAttrib( "stPos",
makeAny( rAttribs.getInteger( XML_stPos, 0 ) ) ); makeAny( rAttribs.getInteger( XML_stPos, 0 ) ) );
if( rAttribs.hasAttribute( XML_grow ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "grow",
makeAny( rAttribs.getInteger( XML_grow, 0 ) ) );
} }
ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
...@@ -109,6 +112,7 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, ...@@ -109,6 +112,7 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
case A_TOKEN( glow ): case A_TOKEN( glow ):
case A_TOKEN( softEdge ): case A_TOKEN( softEdge ):
case A_TOKEN( reflection ): case A_TOKEN( reflection ):
case A_TOKEN( blur ):
{ {
if( nElement == A_TOKEN( glow ) ) if( nElement == A_TOKEN( glow ) )
mrEffectProperties.msUnsupportedEffectName = "glow"; mrEffectProperties.msUnsupportedEffectName = "glow";
...@@ -116,6 +120,8 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, ...@@ -116,6 +120,8 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
mrEffectProperties.msUnsupportedEffectName = "softEdge"; mrEffectProperties.msUnsupportedEffectName = "softEdge";
else if( nElement == A_TOKEN( reflection ) ) else if( nElement == A_TOKEN( reflection ) )
mrEffectProperties.msUnsupportedEffectName = "reflection"; mrEffectProperties.msUnsupportedEffectName = "reflection";
else if( nElement == A_TOKEN( blur ) )
mrEffectProperties.msUnsupportedEffectName = "blur";
saveUnsupportedAttribs( rAttribs ); saveUnsupportedAttribs( rAttribs );
return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor ); return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor );
} }
......
...@@ -2102,7 +2102,7 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet ) ...@@ -2102,7 +2102,7 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
{ {
if( aEffectProps[i].Name == "outerShdw" || aEffectProps[i].Name == "innerShdw" if( aEffectProps[i].Name == "outerShdw" || aEffectProps[i].Name == "innerShdw"
|| aEffectProps[i].Name == "glow" || aEffectProps[i].Name == "softEdge" || aEffectProps[i].Name == "glow" || aEffectProps[i].Name == "softEdge"
|| aEffectProps[i].Name == "reflection" ) || aEffectProps[i].Name == "reflection" || aEffectProps[i].Name == "blur" )
{ {
// assign the proper tag and enable bContainsColor if necessary // assign the proper tag and enable bContainsColor if necessary
if( aEffectProps[i].Name == "outerShdw" ) if( aEffectProps[i].Name == "outerShdw" )
...@@ -2124,6 +2124,8 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet ) ...@@ -2124,6 +2124,8 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
nEffectToken = FSNS( XML_a, XML_softEdge ); nEffectToken = FSNS( XML_a, XML_softEdge );
else if( aEffectProps[i].Name == "reflection" ) else if( aEffectProps[i].Name == "reflection" )
nEffectToken = FSNS( XML_a, XML_reflection ); nEffectToken = FSNS( XML_a, XML_reflection );
else if( aEffectProps[i].Name == "blur" )
nEffectToken = FSNS( XML_a, XML_blur );
// read tag attributes // read tag attributes
uno::Sequence< beans::PropertyValue > aOuterShdwProps; uno::Sequence< beans::PropertyValue > aOuterShdwProps;
...@@ -2220,6 +2222,12 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet ) ...@@ -2220,6 +2222,12 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
aOuterShdwProps[j].Value >>= nVal; aOuterShdwProps[j].Value >>= nVal;
aOuterShdwAttrList->add( XML_stPos, OString::number( nVal ).getStr() ); aOuterShdwAttrList->add( XML_stPos, OString::number( nVal ).getStr() );
} }
else if( aOuterShdwProps[j].Name == "grow" )
{
sal_Int32 nVal = 0;
aOuterShdwProps[j].Value >>= nVal;
aOuterShdwAttrList->add( XML_grow, OString::number( nVal ).getStr() );
}
} }
} }
else if(aEffectProps[i].Name == "ShadowRgbClr") else if(aEffectProps[i].Name == "ShadowRgbClr")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment