Author: leidb
Date: Mon Aug 20 01:48:42 2012
New Revision: 1374894

URL: http://svn.apache.org/viewvc?rev=1374894&view=rev
Log:
#120158# fix picture shadow lost after saved as doc in some case.
Reported by: Yan Ji
Patch by: Chen Zuo Jun
Review by: Lei De Bin 

Modified:
    incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx
    incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8esh.cxx

Modified: incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx?rev=1374894&r1=1374893&r2=1374894&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx Mon Aug 20 
01:48:42 2012
@@ -2731,7 +2731,7 @@ void DffPropertyReader::ApplyAttributes(
                                break;
                        }
                }
-               if ( ( ( nLineFlags & 0x08 ) == 0 ) && ( ( nFillFlags & 0x10 ) 
== 0 ) ) // if there is no fillstyle and linestyle
+               if ( ( ( nLineFlags & 0x08 ) == 0 ) && ( ( nFillFlags & 0x10 ) 
== 0 ) && ( rObjData.eShapeType != mso_sptPictureFrame ))        // if there is 
no fillstyle and linestyle
                        bHasShadow = sal_False;                                 
                                                        // we are turning 
shadow off.
 
                if ( bHasShadow )
@@ -4482,7 +4482,7 @@ SdrObject* SvxMSDffManager::ImportShape(
                             aSet.Put( SvxWeightItem( ( GetPropertyValue( 
DFF_Prop_gtextFStrikethrough, 0 ) & 0x0020 ) != 0 ? WEIGHT_BOLD : 
WEIGHT_NORMAL, EE_CHAR_WEIGHT ) );
 
                                                // SJ TODO: Vertical Writing is 
not correct, instead this should be
-                                               // replaced through 
"CharacterRotation" by 90°, therefore a new Item has to be
+                                               // replaced through 
"CharacterRotation" by 90? therefore a new Item has to be
                                                // supported by svx core, api 
and xml file format
                                                
((SdrObjCustomShape*)pRet)->SetVerticalWriting( ( GetPropertyValue( 
DFF_Prop_gtextFStrikethrough, 0 ) & 0x2000 ) != 0 );
 

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8esh.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8esh.cxx?rev=1374894&r1=1374893&r2=1374894&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8esh.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8esh.cxx Mon Aug 20 
01:48:42 2012
@@ -102,6 +102,7 @@
 #include <ndtxt.hxx>
 // <--
 #include "WW8FFData.hxx"
+#include <editeng/shaditem.hxx>
 
 using namespace com::sun::star;
 using namespace sw::util;
@@ -1726,7 +1727,61 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrame
         rPropOpt.AddOpt( ESCHER_Prop_dxTextLeft, 0 );
         rPropOpt.AddOpt( ESCHER_Prop_dxTextRight, 0 );
     }
+    const SwAttrSet& rAttrSet = rFmt.GetAttrSet();
+    if (SFX_ITEM_ON == rAttrSet.GetItemState(RES_BOX, false, &pItem))
+    {
+        const SvxBoxItem* pBox = (const SvxBoxItem*)pItem;
+        if( pBox )
+        {
+            const SfxPoolItem* pShadItem;
+            if (SFX_ITEM_ON
+                == rAttrSet.GetItemState(RES_SHADOW, true, &pShadItem))
+            {
+                const SvxShadowItem* pSI = (const SvxShadowItem*)pShadItem;
+
+                const sal_uInt16 nCstScale = 635;        // unit scale between 
SODC and MS Word
+                const sal_uInt32 nShadowType = 131074;    // shadow type of ms 
word. need to set the default value.
+
+                sal_uInt32  nColor = (sal_uInt32)(pSI->GetColor().GetColor()) ;
+                sal_uInt32  nOffX = pSI->GetWidth() * nCstScale;
+                sal_uInt32  nOffY = pSI->GetWidth() * nCstScale;
+                sal_uInt32  nShadow = nShadowType;
+
+                SvxShadowLocation eLocation = pSI->GetLocation();
+                if( (eLocation!=SVX_SHADOW_NONE) && (pSI->GetWidth()!=0) )
+                {
+                    switch( eLocation )
+                    {
+                    case SVX_SHADOW_TOPLEFT:
+                        {
+                            nOffX = -nOffX;
+                            nOffY = -nOffY;
+                        }
+                        break;
+                    case SVX_SHADOW_TOPRIGHT:
+                        {
+                            nOffY = -nOffY;
+                        }
+                        break;
+                    case SVX_SHADOW_BOTTOMLEFT:
+                        {
+                            nOffX = -nOffX;
+                        }
+                        break;
+                    case SVX_SHADOW_BOTTOMRIGHT:
+                        break;
+                    default:
+                        break;
+                    }
 
+                    rPropOpt.AddOpt( DFF_Prop_shadowColor,    
wwUtility::RGBToBGR((nColor)));
+                    rPropOpt.AddOpt( DFF_Prop_shadowOffsetX,    nOffX );
+                    rPropOpt.AddOpt( DFF_Prop_shadowOffsetY,    nOffY );
+                    rPropOpt.AddOpt( DFF_Prop_fshadowObscured,  nShadow );
+                }
+            }
+       }
+    }
     SvxBrushItem aBrush(rWrt.TrueFrameBgBrush(rFmt));
     WriteBrushAttr(aBrush, rPropOpt);
 


Reply via email to