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

ooxml: Preserve shape effects when there's more than one

Transformed the preservation process of shape effects to be able to
store more than one effect. For that we:

* Created the Effect struct and added a vector member to the
  EffectProperties struct.
* Changed the shadow effect to use the new Effect struct,
  EffectShadowProperties struct is preserved because the direction
  field still has some use but we should remove it.
* Changed the structure of the grab bag to store more than one effect.
* Modified an existing unit test to check shapes with several effects.

Change-Id: I0dd908fa1d9578827c02ef6272fc9e2b914391be
üst a5835285
......@@ -30,13 +30,23 @@ struct EffectShadowProperties
struct Effect
{
OUString msName;
std::map< OUString, css::uno::Any > maAttribs;
Color moColor;
css::beans::PropertyValue getEffect();
};
struct OOX_DLLPUBLIC EffectProperties
{
EffectShadowProperties maShadow;
/** Store unsupported effect type name and its attributes */
OptValue< OUString > msUnsupportedEffectName;
std::vector< css::beans::PropertyValue > maUnsupportedEffectAttribs;
/** Stores all effect properties, including those not supported by core yet */
std::vector< Effect* > maEffects;
/** Overwrites all members that are explicitly set in rSourceProps. */
void assignUsed( const EffectProperties& rSourceProps );
......@@ -45,9 +55,6 @@ struct OOX_DLLPUBLIC EffectProperties
void pushToPropMap(
PropertyMap& rPropMap,
const GraphicHelper& rGraphicHelper ) const;
void appendUnsupportedEffectAttrib( const OUString& aKey, const css::uno::Any& aValue );
css::beans::PropertyValue getUnsupportedEffect();
};
......
......@@ -12,6 +12,7 @@
#include <oox/core/contexthandler2.hxx>
#include <oox/dllapi.h>
#include <oox/drawingml/effectproperties.hxx>
namespace oox { namespace drawingml {
......@@ -33,7 +34,7 @@ protected:
EffectProperties& mrEffectProperties;
private:
void saveUnsupportedAttribs( const AttributeList& rAttribs );
void saveUnsupportedAttribs( Effect& rEffect, const AttributeList& rAttribs );
};
} }
......
......@@ -174,6 +174,7 @@ public:
void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
void WriteShapeStyle( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
void WriteShapeEffects( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
void WriteShapeEffect( const OUString& sName, const css::uno::Sequence< css::beans::PropertyValue >& aEffectProps );
void WriteShape3DEffects( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
static void ResetCounters();
......
......@@ -30,54 +30,57 @@ void EffectShadowProperties::assignUsed(const EffectShadowProperties& rSourcePro
void EffectProperties::assignUsed( const EffectProperties& rSourceProps )
{
maShadow.assignUsed(rSourceProps.maShadow);
msUnsupportedEffectName.assignIfUsed( rSourceProps.msUnsupportedEffectName );
maUnsupportedEffectAttribs = rSourceProps.maUnsupportedEffectAttribs;
if( rSourceProps.maEffects.size() > 0 )
maEffects = rSourceProps.maEffects;
}
void EffectProperties::pushToPropMap( PropertyMap& rPropMap,
const GraphicHelper& rGraphicHelper ) const
{
if (maShadow.moShadowDist.has())
{
// Negative X or Y dist indicates left or up, respectively
double nAngle = (maShadow.moShadowDir.get(0) / PER_DEGREE) * F_PI180;
sal_Int32 nDist = convertEmuToHmm(maShadow.moShadowDist.get(0));
sal_Int32 nXDist = cos(nAngle) * nDist;
sal_Int32 nYDist = sin(nAngle) * nDist;
rPropMap.setProperty( PROP_Shadow, true );
rPropMap.setProperty( PROP_ShadowXDistance, nXDist);
rPropMap.setProperty( PROP_ShadowYDistance, nYDist);
rPropMap.setProperty( PROP_ShadowColor, maShadow.moShadowColor.getColor(rGraphicHelper, -1 ) );
rPropMap.setProperty( PROP_ShadowTransparence, maShadow.moShadowColor.getTransparency());
}
}
void EffectProperties::appendUnsupportedEffectAttrib( const OUString& aKey, const css::uno::Any& aValue )
{
css::beans::PropertyValue aProperty;
aProperty.Name = aKey;
aProperty.Value = aValue;
maUnsupportedEffectAttribs.push_back(aProperty);
for( std::vector< Effect* >::const_iterator it = maEffects.begin(); it != maEffects.end(); ++it )
if( (*it)->msName == "outerShdw" )
{
sal_Int32 nAttrDir = 0, nAttrDist = 0;
std::map< OUString, css::uno::Any >::iterator attribIt = (*it)->maAttribs.find( "dir" );
if( attribIt != (*it)->maAttribs.end() )
attribIt->second >>= nAttrDir;
attribIt = (*it)->maAttribs.find( "dist" );
if( attribIt != (*it)->maAttribs.end() )
attribIt->second >>= nAttrDist;
// Negative X or Y dist indicates left or up, respectively
double nAngle = ( nAttrDir / PER_DEGREE ) * F_PI180;
sal_Int32 nDist = convertEmuToHmm( nAttrDist );
sal_Int32 nXDist = cos(nAngle) * nDist;
sal_Int32 nYDist = sin(nAngle) * nDist;
rPropMap.setProperty( PROP_Shadow, true );
rPropMap.setProperty( PROP_ShadowXDistance, nXDist);
rPropMap.setProperty( PROP_ShadowYDistance, nYDist);
rPropMap.setProperty( PROP_ShadowColor, (*it)->moColor.getColor(rGraphicHelper, -1 ) );
rPropMap.setProperty( PROP_ShadowTransparence, (*it)->moColor.getTransparency());
}
}
css::beans::PropertyValue EffectProperties::getUnsupportedEffect()
css::beans::PropertyValue Effect::getEffect()
{
css::beans::PropertyValue pRet;
if(!msUnsupportedEffectName.has())
if( msName.isEmpty() )
return pRet;
css::uno::Sequence<css::beans::PropertyValue> aSeq(maUnsupportedEffectAttribs.size());
css::beans::PropertyValue* pSeq = aSeq.getArray();
for (std::vector<css::beans::PropertyValue>::iterator i = maUnsupportedEffectAttribs.begin(); i != maUnsupportedEffectAttribs.end(); ++i)
*pSeq++ = *i;
css::uno::Sequence< css::beans::PropertyValue > aSeq( maAttribs.size() );
sal_uInt32 i = 0;
for( std::map< OUString, css::uno::Any >::iterator it = maAttribs.begin(); it != maAttribs.end(); ++it )
{
aSeq[i].Name = it->first;
aSeq[i].Value = it->second;
i++;
}
pRet.Name = msUnsupportedEffectName.use();
pRet.Name = msName;
pRet.Value = css::uno::Any( aSeq );
msUnsupportedEffectName.reset();
maUnsupportedEffectAttribs.clear();
return pRet;
}
......
......@@ -33,80 +33,66 @@ EffectPropertiesContext::~EffectPropertiesContext()
{
}
void EffectPropertiesContext::saveUnsupportedAttribs( const AttributeList& rAttribs )
void EffectPropertiesContext::saveUnsupportedAttribs( Effect& rEffect, const AttributeList& rAttribs )
{
if( rAttribs.hasAttribute( XML_algn ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "algn",
makeAny( rAttribs.getString( XML_algn, "" ) ) );
rEffect.maAttribs["algn"] = makeAny( rAttribs.getString( XML_algn, "" ) );
if( rAttribs.hasAttribute( XML_blurRad ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "blurRad",
makeAny( rAttribs.getInteger( XML_blurRad, 0 ) ) );
rEffect.maAttribs["blurRad"] = makeAny( rAttribs.getInteger( XML_blurRad, 0 ) );
if( rAttribs.hasAttribute( XML_dir ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "dir",
makeAny( rAttribs.getInteger( XML_dir, 0 ) ) );
rEffect.maAttribs["dir"] = makeAny( rAttribs.getInteger( XML_dir, 0 ) );
if( rAttribs.hasAttribute( XML_dist ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "dist",
makeAny( rAttribs.getInteger( XML_dist, 0 ) ) );
rEffect.maAttribs["dist"] = makeAny( rAttribs.getInteger( XML_dist, 0 ) );
if( rAttribs.hasAttribute( XML_kx ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "kx",
makeAny( rAttribs.getInteger( XML_kx, 0 ) ) );
rEffect.maAttribs["kx"] = makeAny( rAttribs.getInteger( XML_kx, 0 ) );
if( rAttribs.hasAttribute( XML_ky ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "ky",
makeAny( rAttribs.getInteger( XML_ky, 0 ) ) );
rEffect.maAttribs["ky"] = makeAny( rAttribs.getInteger( XML_ky, 0 ) );
if( rAttribs.hasAttribute( XML_rotWithShape ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "rotWithShape",
makeAny( rAttribs.getInteger( XML_rotWithShape, 0 ) ) );
rEffect.maAttribs["rotWithShape"] = makeAny( rAttribs.getInteger( XML_rotWithShape, 0 ) );
if( rAttribs.hasAttribute( XML_sx ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "sx",
makeAny( rAttribs.getInteger( XML_sx, 0 ) ) );
rEffect.maAttribs["sx"] = makeAny( rAttribs.getInteger( XML_sx, 0 ) );
if( rAttribs.hasAttribute( XML_sy ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "sy",
makeAny( rAttribs.getInteger( XML_sy, 0 ) ) );
rEffect.maAttribs["sy"] = makeAny( rAttribs.getInteger( XML_sy, 0 ) );
if( rAttribs.hasAttribute( XML_rad ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "rad",
makeAny( rAttribs.getInteger( XML_rad, 0 ) ) );
rEffect.maAttribs["rad"] = makeAny( rAttribs.getInteger( XML_rad, 0 ) );
if( rAttribs.hasAttribute( XML_endA ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "endA",
makeAny( rAttribs.getInteger( XML_endA, 0 ) ) );
rEffect.maAttribs["endA"] = makeAny( rAttribs.getInteger( XML_endA, 0 ) );
if( rAttribs.hasAttribute( XML_endPos ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "endPos",
makeAny( rAttribs.getInteger( XML_endPos, 0 ) ) );
rEffect.maAttribs["endPos"] = makeAny( rAttribs.getInteger( XML_endPos, 0 ) );
if( rAttribs.hasAttribute( XML_fadeDir ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "fadeDir",
makeAny( rAttribs.getInteger( XML_fadeDir, 0 ) ) );
rEffect.maAttribs["fadeDir"] = makeAny( rAttribs.getInteger( XML_fadeDir, 0 ) );
if( rAttribs.hasAttribute( XML_stA ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "stA",
makeAny( rAttribs.getInteger( XML_stA, 0 ) ) );
rEffect.maAttribs["stA"] = makeAny( rAttribs.getInteger( XML_stA, 0 ) );
if( rAttribs.hasAttribute( XML_stPos ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "stPos",
makeAny( rAttribs.getInteger( XML_stPos, 0 ) ) );
rEffect.maAttribs["stPos"] = makeAny( rAttribs.getInteger( XML_stPos, 0 ) );
if( rAttribs.hasAttribute( XML_grow ) )
mrEffectProperties.appendUnsupportedEffectAttrib( "grow",
makeAny( rAttribs.getInteger( XML_grow, 0 ) ) );
rEffect.maAttribs["grow"] = makeAny( rAttribs.getInteger( XML_grow, 0 ) );
}
ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
sal_Int32 nPos = mrEffectProperties.maEffects.size();
mrEffectProperties.maEffects.push_back( new Effect() );
switch( nElement )
{
case A_TOKEN( outerShdw ):
{
mrEffectProperties.msUnsupportedEffectName = "outerShdw";
saveUnsupportedAttribs( rAttribs );
mrEffectProperties.maEffects[nPos]->msName = "outerShdw";
saveUnsupportedAttribs( *mrEffectProperties.maEffects[nPos], rAttribs );
mrEffectProperties.maShadow.moShadowDist = rAttribs.getInteger( XML_dist, 0 );
mrEffectProperties.maShadow.moShadowDir = rAttribs.getInteger( XML_dir, 0 );
return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor );
return new ColorContext( *this, mrEffectProperties.maEffects[nPos]->moColor );
}
break;
case A_TOKEN( innerShdw ):
{
mrEffectProperties.msUnsupportedEffectName = "innerShdw";
saveUnsupportedAttribs( rAttribs );
mrEffectProperties.maEffects[nPos]->msName = "innerShdw";
saveUnsupportedAttribs( *mrEffectProperties.maEffects[nPos], rAttribs );
mrEffectProperties.maShadow.moShadowDist = rAttribs.getInteger( XML_dist, 0 );
mrEffectProperties.maShadow.moShadowDir = rAttribs.getInteger( XML_dir, 0 );
return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor );
return new ColorContext( *this, mrEffectProperties.maEffects[nPos]->moColor );
}
break;
case A_TOKEN( glow ):
......@@ -115,19 +101,20 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
case A_TOKEN( blur ):
{
if( nElement == A_TOKEN( glow ) )
mrEffectProperties.msUnsupportedEffectName = "glow";
mrEffectProperties.maEffects[nPos]->msName = "glow";
else if( nElement == A_TOKEN( softEdge ) )
mrEffectProperties.msUnsupportedEffectName = "softEdge";
mrEffectProperties.maEffects[nPos]->msName = "softEdge";
else if( nElement == A_TOKEN( reflection ) )
mrEffectProperties.msUnsupportedEffectName = "reflection";
mrEffectProperties.maEffects[nPos]->msName = "reflection";
else if( nElement == A_TOKEN( blur ) )
mrEffectProperties.msUnsupportedEffectName = "blur";
saveUnsupportedAttribs( rAttribs );
return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor );
mrEffectProperties.maEffects[nPos]->msName = "blur";
saveUnsupportedAttribs( *mrEffectProperties.maEffects[nPos], rAttribs );
return new ColorContext( *this, mrEffectProperties.maEffects[nPos]->moColor );
}
break;
}
mrEffectProperties.maEffects.pop_back();
return 0;
}
......
......@@ -911,30 +911,41 @@ Reference< XShape > Shape::createAndInsert(
}
// store unsupported effect attributes in the grab bag
PropertyValue aEffect = aEffectProperties.getUnsupportedEffect();
if( aEffect.Name != "" )
if( aEffectProperties.maEffects.size() > 0 )
{
Sequence< PropertyValue > aEffectsGrabBag( 3 );
PUT_PROP( aEffectsGrabBag, 0, aEffect.Name, aEffect.Value );
OUString sColorScheme = aEffectProperties.maShadow.moShadowColor.getSchemeName();
if( sColorScheme.isEmpty() )
{
// RGB color and transparency value
PUT_PROP( aEffectsGrabBag, 1, "ShadowRgbClr",
aEffectProperties.maShadow.moShadowColor.getColor( rGraphicHelper, nFillPhClr ) );
PUT_PROP( aEffectsGrabBag, 2, "ShadowRgbClrTransparency",
aEffectProperties.maShadow.moShadowColor.getTransparency() );
}
else
Sequence< PropertyValue > aEffects( aEffectProperties.maEffects.size() );
sal_uInt32 i = 0;
for( std::vector< Effect* >::iterator it = aEffectProperties.maEffects.begin();
it != aEffectProperties.maEffects.end(); ++it )
{
// scheme color with name and transformations
PUT_PROP( aEffectsGrabBag, 1, "ShadowColorSchemeClr", sColorScheme );
PUT_PROP( aEffectsGrabBag, 2, "ShadowColorTransformations",
aEffectProperties.maShadow.moShadowColor.getTransformations() );
}
PropertyValue aEffect = (*it)->getEffect();
if( !aEffect.Name.isEmpty() )
{
Sequence< PropertyValue > aEffectsGrabBag( 3 );
PUT_PROP( aEffectsGrabBag, 0, "Attribs", aEffect.Value );
putPropertyToGrabBag( "EffectProperties", Any( aEffectsGrabBag ) );
Color& aColor( (*it)->moColor );
OUString sColorScheme = aColor.getSchemeName();
if( sColorScheme.isEmpty() )
{
// RGB color and transparency value
PUT_PROP( aEffectsGrabBag, 1, "RgbClr",
aColor.getColor( rGraphicHelper, nFillPhClr ) );
PUT_PROP( aEffectsGrabBag, 2, "RgbClrTransparency",
aColor.getTransparency() );
}
else
{
// scheme color with name and transformations
PUT_PROP( aEffectsGrabBag, 1, "SchemeClr", sColorScheme );
PUT_PROP( aEffectsGrabBag, 2, "SchemeClrTransformations",
aColor.getTransformations() );
}
PUT_PROP( aEffects, i, aEffect.Name, aEffectsGrabBag );
++i;
}
}
putPropertyToGrabBag( "EffectProperties", Any( aEffects ) );
}
// add 3D effects if any
......
......@@ -2076,57 +2076,45 @@ void DrawingML::WriteShapeStyle( Reference< XPropertySet > xPropSet )
mpFS->singleElementNS( XML_a, XML_fontRef, XML_idx, "minor", FSEND );
}
void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
void DrawingML::WriteShapeEffect( const OUString& sName, const Sequence< PropertyValue >& aEffectProps )
{
if( !GetProperty( rXPropSet, "InteropGrabBag" ) )
if( aEffectProps.getLength() == 0 )
return;
Sequence< PropertyValue > aGrabBag, aEffectProps;
mAny >>= aGrabBag;
for( sal_Int32 i=0; i < aGrabBag.getLength(); ++i )
// assign the proper tag and enable bContainsColor if necessary
sal_Int32 nEffectToken = 0;
bool bContainsColor = false;
if( sName == "outerShdw" )
{
if( aGrabBag[i].Name == "EffectProperties" )
aGrabBag[i].Value >>= aEffectProps;
nEffectToken = FSNS( XML_a, XML_outerShdw );
bContainsColor = true;
}
if( aEffectProps.getLength() == 0 )
return;
else if( sName == "innerShdw" )
{
nEffectToken = FSNS( XML_a, XML_innerShdw );
bContainsColor = true;
}
else if( sName == "glow" )
{
nEffectToken = FSNS( XML_a, XML_glow );
bContainsColor = true;
}
else if( sName == "softEdge" )
nEffectToken = FSNS( XML_a, XML_softEdge );
else if( sName == "reflection" )
nEffectToken = FSNS( XML_a, XML_reflection );
else if( sName == "blur" )
nEffectToken = FSNS( XML_a, XML_blur );
OUString sSchemeClr;
bool bContainsColor = false;
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" || aEffectProps[i].Name == "innerShdw"
|| aEffectProps[i].Name == "glow" || aEffectProps[i].Name == "softEdge"
|| aEffectProps[i].Name == "reflection" || aEffectProps[i].Name == "blur" )
if( aEffectProps[i].Name == "Attribs" )
{
// assign the proper tag and enable bContainsColor if necessary
if( aEffectProps[i].Name == "outerShdw" )
{
nEffectToken = FSNS( XML_a, XML_outerShdw );
bContainsColor = true;
}
else if( aEffectProps[i].Name == "innerShdw" )
{
nEffectToken = FSNS( XML_a, XML_innerShdw );
bContainsColor = true;
}
else if( aEffectProps[i].Name == "glow" )
{
nEffectToken = FSNS( XML_a, XML_glow );
bContainsColor = true;
}
else if( aEffectProps[i].Name == "softEdge" )
nEffectToken = FSNS( XML_a, XML_softEdge );
else if( aEffectProps[i].Name == "reflection" )
nEffectToken = FSNS( XML_a, XML_reflection );
else if( aEffectProps[i].Name == "blur" )
nEffectToken = FSNS( XML_a, XML_blur );
// read tag attributes
uno::Sequence< beans::PropertyValue > aOuterShdwProps;
aEffectProps[i].Value >>= aOuterShdwProps;
......@@ -2230,22 +2218,22 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
}
}
}
else if(aEffectProps[i].Name == "ShadowRgbClr")
else if(aEffectProps[i].Name == "RgbClr")
{
aEffectProps[i].Value >>= nRgbClr;
}
else if(aEffectProps[i].Name == "ShadowRgbClrTransparency")
else if(aEffectProps[i].Name == "RgbClrTransparency")
{
sal_Int32 nTransparency;
aEffectProps[i].Value >>= nTransparency;
// Calculate alpha value (see oox/source/drawingml/color.cxx : getTransparency())
nAlpha = MAX_PERCENT - ( PER_PERCENT * nTransparency );
}
else if(aEffectProps[i].Name == "ShadowColorSchemeClr")
else if(aEffectProps[i].Name == "SchemeClr")
{
aEffectProps[i].Value >>= sSchemeClr;
}
else if(aEffectProps[i].Name == "ShadowColorTransformations")
else if(aEffectProps[i].Name == "SchemeClrTransformations")
{
aEffectProps[i].Value >>= aTransformations;
}
......@@ -2253,7 +2241,6 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
if( nEffectToken > 0 )
{
mpFS->startElementNS(XML_a, XML_effectLst, FSEND);
sax_fastparser::XFastAttributeListRef xAttrList( aOuterShdwAttrList );
mpFS->startElement( nEffectToken, xAttrList );
......@@ -2266,10 +2253,39 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
}
mpFS->endElement( nEffectToken );
mpFS->endElementNS(XML_a, XML_effectLst);
}
}
void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
{
if( !GetProperty( rXPropSet, "InteropGrabBag" ) )
return;
Sequence< PropertyValue > aGrabBag, aEffects;
mAny >>= aGrabBag;
for( sal_Int32 i=0; i < aGrabBag.getLength(); ++i )
{
if( aGrabBag[i].Name == "EffectProperties" )
{
aGrabBag[i].Value >>= aEffects;
break;
}
}
if( aEffects.getLength() == 0 )
return;
mpFS->startElementNS(XML_a, XML_effectLst, FSEND);
for( sal_Int32 i=0; i < aEffects.getLength(); ++i )
{
Sequence< PropertyValue > aEffectProps;
aEffects[i].Value >>= aEffectProps;
WriteShapeEffect( aEffects[i].Name, aEffectProps );
}
mpFS->endElementNS(XML_a, XML_effectLst);
}
void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet )
{
// check existence of the grab bag
......
......@@ -1143,6 +1143,35 @@ DECLARE_OOXMLEXPORT_TEST(testShapeEffectPreservation, "shape-effect-preservation
assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection/*",
0 ); // should not be present
// 7th shape with several effects: glow, inner shadow and reflection
assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow",
"rad", "63500");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr",
"val", "accent2");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr/*",
2);
assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/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[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
"dir", "2700000");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/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", "000000");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/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");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
"blurRad", "6350");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[8]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
"wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
"stA", "52000");
}
DECLARE_OOXMLEXPORT_TEST(testShape3DEffectPreservation, "shape-3d-effect-preservation.docx")
......
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