Export image shadow effects to docx.

Change-Id: Ic8be107eeaeed286359869fd7e6712c3f740fba5
Reviewed-on: https://gerrit.libreoffice.org/709
Reviewed-by: Noel Power <noel.power@suse.com>
Tested-by: Noel Power <noel.power@suse.com>
This commit is contained in:
Eilidh McAdam 2012-09-27 12:39:59 +01:00 committed by Noel Power
parent dca431cfea
commit 57633e42ff

View File

@ -2176,6 +2176,38 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode& rGrfNode, const Size
m_pSerializer->singleElementNS( XML_a, XML_tailEnd,
FSEND );
m_pSerializer->endElementNS( XML_a, XML_ln );
// Output effects
SvxShadowItem aShadowItem = rGrfNode.GetFlyFmt()->GetShadow();
if ( aShadowItem.GetLocation() != SVX_SHADOW_NONE )
{
// Distance is measured diagonally from corner
double nShadowDist = sqrt((aShadowItem.GetWidth()*aShadowItem.GetWidth())*2);
OString aShadowDist( OString::valueOf( TwipsToEMU( nShadowDist ) ) );
OString aShadowColor = impl_ConvertColor( aShadowItem.GetColor() );
sal_uInt32 nShadowDir = 0;
switch ( aShadowItem.GetLocation() )
{
case SVX_SHADOW_TOPLEFT: nShadowDir = 13500000; break;
case SVX_SHADOW_TOPRIGHT: nShadowDir = 18900000; break;
case SVX_SHADOW_BOTTOMLEFT: nShadowDir = 8100000; break;
case SVX_SHADOW_BOTTOMRIGHT: nShadowDir = 2700000; break;
case SVX_SHADOW_NONE:
case SVX_SHADOW_END:
break;
}
OString aShadowDir( OString::valueOf( long(nShadowDir) ) );
m_pSerializer->startElementNS( XML_a, XML_effectLst, FSEND );
m_pSerializer->startElementNS( XML_a, XML_outerShdw,
XML_dist, aShadowDist.getStr(),
XML_dir, aShadowDir.getStr(), FSEND );
m_pSerializer->singleElementNS( XML_a, XML_srgbClr,
XML_val, aShadowColor.getStr(), FSEND );
m_pSerializer->endElementNS( XML_a, XML_outerShdw );
m_pSerializer->endElementNS( XML_a, XML_effectLst );
}
m_pSerializer->endElementNS( XML_pic, XML_spPr );
m_pSerializer->endElementNS( XML_pic, XML_pic );