summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEilidh McAdam <eilidh@lanedo.com>2013-01-11 18:16:45 +0100
committerNoel Power <noel.power@suse.com>2013-01-14 12:24:17 +0000
commit18be0ce63bbff4132c198e29a34cf3e5a27369d5 (patch)
treea78c9e1324cf1412d6469611b6212428e2855096
parent1a5b3d8e4d88aa27647cc7b99623dd6f6e706bbc (diff)
Fixes image drop shadow export to DOCX.
Word has problems if the effect extent element is omitted. This gets the minimum required extent using the shadow position. Change-Id: I69d0d7a694c34f50289253e5cb7c4265198deaa8 Reviewed-on: https://gerrit.libreoffice.org/1655 Reviewed-by: Noel Power <noel.power@suse.com> Tested-by: Noel Power <noel.power@suse.com>
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx31
1 files changed, 28 insertions, 3 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b97b3683f92c..2669b5fee0b1 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2141,9 +2141,35 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
XML_cx, aWidth.getStr(),
XML_cy, aHeight.getStr(),
FSEND );
- // TODO - the right effectExtent, extent including the effect
+
+ // effectExtent, extent including the effect (shadow only for now)
+ SvxShadowItem aShadowItem = pFrmFmt->GetShadow();
+ OString aLeftExt("0"), aRightExt("0"), aTopExt("0"), aBottomExt("0");
+ if ( aShadowItem.GetLocation() != SVX_SHADOW_NONE )
+ {
+ OString aShadowWidth( OString::valueOf( TwipsToEMU( aShadowItem.GetWidth() ) ) );
+ switch ( aShadowItem.GetLocation() )
+ {
+ case SVX_SHADOW_TOPLEFT:
+ aTopExt = aLeftExt = aShadowWidth;
+ break;
+ case SVX_SHADOW_TOPRIGHT:
+ aTopExt = aRightExt = aShadowWidth;
+ break;
+ case SVX_SHADOW_BOTTOMLEFT:
+ aBottomExt = aLeftExt = aShadowWidth;
+ break;
+ case SVX_SHADOW_BOTTOMRIGHT:
+ aBottomExt = aRightExt = aShadowWidth;
+ break;
+ case SVX_SHADOW_NONE:
+ case SVX_SHADOW_END:
+ break;
+ }
+ }
+
m_pSerializer->singleElementNS( XML_wp, XML_effectExtent,
- XML_l, "0", XML_t, "0", XML_r, "0", XML_b, "0",
+ XML_l, aLeftExt, XML_t, aTopExt, XML_r, aRightExt, XML_b, aBottomExt,
FSEND );
if( isAnchor )
@@ -2275,7 +2301,6 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
m_pSerializer->endElementNS( XML_a, XML_ln );
// Output effects
- SvxShadowItem aShadowItem = pFrmFmt->GetShadow();
if ( aShadowItem.GetLocation() != SVX_SHADOW_NONE )
{
// Distance is measured diagonally from corner