Author: orw Date: Mon Sep 24 14:37:39 2012 New Revision: 1389406 URL: http://svn.apache.org/viewvc?rev=1389406&view=rev Log: #119634# shape import (Microsoft Office documents) - apply default shadow color, if none is given; apply default shadow distance, if shadow type is not supported.
Patch by: Jianyuan Li Review by: Oliver Modified: incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.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=1389406&r1=1389405&r2=1389406&view=diff ============================================================================== --- incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx (original) +++ incubator/ooo/trunk/main/filter/source/msfilter/msdffimp.cxx Mon Sep 24 14:37:39 2012 @@ -2660,17 +2660,13 @@ void DffPropertyReader::ApplyAttributes( rSet.Put( SvxCrossedOutItem( nFontAttributes & 0x01 ? STRIKEOUT_SINGLE : STRIKEOUT_NONE, EE_CHAR_STRIKEOUT ) ); if ( IsProperty( DFF_Prop_fillColor ) ) rSet.Put( XFillColorItem( String(), rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor ), DFF_Prop_fillColor ) ) ); - if ( IsProperty( DFF_Prop_shadowType ) ) - { - MSO_ShadowType eShadowType = static_cast< MSO_ShadowType >( GetPropertyValue( DFF_Prop_shadowType ) ); - if( eShadowType != mso_shadowOffset ) - { - rSet.Put( SdrShadowXDistItem( 35 ) ); // 0,35 mm Schattendistanz - rSet.Put( SdrShadowYDistItem( 35 ) ); - } - } if ( IsProperty( DFF_Prop_shadowColor ) ) rSet.Put( SdrShadowColorItem( String(), rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_shadowColor ), DFF_Prop_shadowColor ) ) ); + else + { + //The default value for this property is 0x00808080 + rSet.Put( SdrShadowColorItem( String(), rManager.MSO_CLR_ToColor( 0x00808080, DFF_Prop_shadowColor ) ) ); + } if ( IsProperty( DFF_Prop_shadowOpacity ) ) rSet.Put( SdrShadowTransparenceItem( (sal_uInt16)( ( 0x10000 - GetPropertyValue( DFF_Prop_shadowOpacity ) ) / 655 ) ) ); if ( IsProperty( DFF_Prop_shadowOffsetX ) ) @@ -2696,6 +2692,17 @@ void DffPropertyReader::ApplyAttributes( rSet.Put( SdrShadowYDistItem( 35 ) ); } } + if ( IsProperty( DFF_Prop_shadowType ) ) + { + MSO_ShadowType eShadowType = static_cast< MSO_ShadowType >( GetPropertyValue( DFF_Prop_shadowType ) ); + if( eShadowType != mso_shadowOffset ) + { + //0.12'' == 173 twip == 302 100mm + sal_uInt32 nDist = rManager.pSdrModel->GetScaleUnit() == MAP_TWIP ? 173: 302; + rSet.Put( SdrShadowXDistItem( nDist ) ); + rSet.Put( SdrShadowYDistItem( nDist ) ); + } + } if ( bHasShadow ) { // #160376# sj: activating shadow only if fill and or linestyle is used