sw/source/filter/ww8/docxattributeoutput.cxx |   31 ++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

New commits:
commit 18be0ce63bbff4132c198e29a34cf3e5a27369d5
Author: Eilidh McAdam <eil...@lanedo.com>
Date:   Fri Jan 11 18:16:45 2013 +0100

    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.po...@suse.com>
    Tested-by: Noel Power <noel.po...@suse.com>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index b97b368..2669b5f 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
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to