summaryrefslogtreecommitdiff
path: root/filter/source/msfilter
diff options
context:
space:
mode:
authorJianyuan Li <lijiany@apache.org>2012-08-16 01:13:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-05-20 15:56:19 +0100
commit0982b526bf0cd938af468f8c2d05830d6b6a8620 (patch)
tree25c23118168e2000609bd25e2bdb08e05b8454c5 /filter/source/msfilter
parentbbfc9999db281c02c4a79b49c86499ba52571002 (diff)
Resolves: #i120554# Shape Gradient MS2003 import/export Enhancement
Reported by: Jianyuan Li Patch by: Jianyuan Li Review by: SunYing (cherry picked from commit 09c33de80a0e5fa321979e53bf88c4d17271eba8) Conflicts: filter/inc/filter/msfilter/escherex.hxx filter/inc/filter/msfilter/msdffimp.hxx filter/source/msfilter/escherex.cxx filter/source/msfilter/msdffimp.cxx Change-Id: I80a60af4862eb99523ea59e4f788b685d6de1fbd WaE fixes: reorder initialization, handle all cases in switch, ... (cherry picked from commit 350f294badf378806348e77e6a8ed0b5f1d5b77d) Conflicts: filter/source/msfilter/msdffimp.cxx Change-Id: I4f1bde463921d48d1e014d0521427eaa9294663e Add default to switch statements to avoid compiler warnings. Patch by: Jianyuan Li (cherry picked from commit f1302af0d803ca969022e69bcf7deeb62459f789) Change-Id: I4e78e3b565d5922d452d2cfd1bf473af1587d29b
Diffstat (limited to 'filter/source/msfilter')
-rw-r--r--filter/source/msfilter/escherex.cxx198
-rw-r--r--filter/source/msfilter/msdffimp.cxx213
2 files changed, 322 insertions, 89 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 58766138bc1e..4c8fec021af0 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -18,6 +18,7 @@
*/
#include "eschesdo.hxx"
+#include <svx/xflftrit.hxx>
#include <filter/msfilter/escherex.hxx>
#include <svx/unoapi.hxx>
#include <svx/svdobj.hxx>
@@ -426,20 +427,159 @@ void EscherPropertyContainer::CreateGradientProperties(
}
void EscherPropertyContainer::CreateGradientProperties(
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet )
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet , sal_Bool bTransparentGradient)
{
- ::com::sun::star::uno::Any aAny;
- ::com::sun::star::awt::Gradient aGradient;
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "FillGradient" ), sal_False ) )
+ ::com::sun::star::uno::Any aAny;
+ ::com::sun::star::awt::Gradient* pGradient = NULL;
+
+ sal_uInt32 nFillType = ESCHER_FillShadeScale;
+ sal_Int32 nAngle = 0;
+ sal_uInt32 nFillFocus = 0;
+ sal_uInt32 nFillLR = 0;
+ sal_uInt32 nFillTB = 0;
+ sal_uInt32 nFirstColor = 0;//like the control var nChgColors in import logic
+ bool bWriteFillTo = false;
+
+ //Transparency gradient: Means the third setting in transparency page is set
+ if (bTransparentGradient && EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, OUString( "FillTransparenceGradient" ), sal_False ) )
+ {
+ pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
+
+ ::com::sun::star::uno::Any aAnyTemp;
+ const rtl::OUString aPropName( "FillStyle" );
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAnyTemp, rXPropSet, aPropName, sal_False ) )
+ {
+ ::com::sun::star::drawing::FillStyle eFS;
+ if ( ! ( aAnyTemp >>= eFS ) )
+ eFS = ::com::sun::star::drawing::FillStyle_SOLID;
+ //solid and transparency
+ if ( eFS == ::com::sun::star::drawing::FillStyle_SOLID)
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAnyTemp, rXPropSet, OUString( "FillColor" ), sal_False ) )
+ {
+ pGradient->StartColor = ImplGetColor( *((sal_uInt32*)aAnyTemp.getValue()), sal_False );
+ pGradient->EndColor = ImplGetColor( *((sal_uInt32*)aAnyTemp.getValue()), sal_False );
+ }
+ }
+ //gradient and transparency.
+ else if( eFS == ::com::sun::star::drawing::FillStyle_GRADIENT )
+ {
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, OUString( "FillGradient" ), sal_False ) )
+ pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
+ }
+ }
+
+ }
+ //Not transparency gradient
+ else if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, OUString( "FillGradient" ), sal_False ) )
{
- aGradient = *static_cast< const ::com::sun::star::awt::Gradient* >( aAny.getValue() );
+ pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
}
- CreateGradientProperties( aGradient );
-};
+
+ if ( pGradient )
+ {
+ switch ( pGradient->Style )
+ {
+ case ::com::sun::star::awt::GradientStyle_LINEAR :
+ case ::com::sun::star::awt::GradientStyle_AXIAL :
+ {
+ nFillType = ESCHER_FillShadeScale;
+ nAngle = pGradient->Angle;
+ while ( nAngle > 0 ) nAngle -= 3600;
+ while ( nAngle <= -3600 ) nAngle += 3600;
+ //Value of the real number = Integral + (Fractional / 65536.0)
+ nAngle = ( nAngle * 0x10000) / 10;
+
+ nFillFocus = (pGradient->Style == ::com::sun::star::awt::GradientStyle_LINEAR) ?
+ ( pGradient->XOffset + pGradient->YOffset )/2 : -50;
+ if( !nFillFocus )
+ nFirstColor=nFirstColor ^ 1;
+ if ( !nAngle )
+ nFirstColor=nFirstColor ^ 1;
+ }
+ break;
+ case ::com::sun::star::awt::GradientStyle_RADIAL :
+ case ::com::sun::star::awt::GradientStyle_ELLIPTICAL :
+ case ::com::sun::star::awt::GradientStyle_SQUARE :
+ case ::com::sun::star::awt::GradientStyle_RECT :
+ {
+ //according to the import logic and rect type fill** value
+ nFillLR = (pGradient->XOffset * 0x10000) / 100;
+ nFillTB = (pGradient->YOffset * 0x10000) / 100;
+ if ( ((nFillLR > 0) && (nFillLR < 0x10000)) || ((nFillTB > 0) && (nFillTB < 0x10000)) )
+ nFillType = ESCHER_FillShadeShape;
+ else
+ nFillType = ESCHER_FillShadeCenter;
+ nFirstColor = 1;
+ bWriteFillTo = true;
+ }
+ break;
+ default: break;
+ }
+ }
+
+ AddOpt( ESCHER_Prop_fillType, nFillType );
+ AddOpt( ESCHER_Prop_fillAngle, nAngle );
+ AddOpt( ESCHER_Prop_fillColor, GetGradientColor( pGradient, nFirstColor ) );
+ AddOpt( ESCHER_Prop_fillBackColor, GetGradientColor( pGradient, nFirstColor ^ 1 ) );
+ AddOpt( ESCHER_Prop_fillFocus, nFillFocus );
+ if ( bWriteFillTo )
+ {
+ //according to rect type fillTo** value
+ if(nFillLR)
+ {
+ AddOpt( ESCHER_Prop_fillToLeft, nFillLR );
+ AddOpt( ESCHER_Prop_fillToRight, nFillLR );
+ }
+ if(nFillTB)
+ {
+ AddOpt( ESCHER_Prop_fillToTop, nFillTB );
+ AddOpt( ESCHER_Prop_fillToBottom, nFillTB );
+ }
+ }
+
+ //Transparency gradient
+ if (bTransparentGradient && EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, OUString( "FillTransparenceGradient" ), sal_False ) )
+ {
+ pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
+ if ( pGradient )
+ {
+ sal_uInt32 nBlue = GetGradientColor( pGradient, nFirstColor ) >> 16;
+ AddOpt( ESCHER_Prop_fillOpacity,( ( 100 - ( nBlue * 100 / 255 ) ) << 16 ) / 100 );
+ nBlue = GetGradientColor( pGradient, nFirstColor ^ 1 ) >>16 ;
+ AddOpt( ESCHER_Prop_fillBackOpacity,( ( 100 - ( nBlue * 100 / 255 ) ) << 16 )/ 100 );
+ }
+ }
+}
+
+void EscherPropertyContainer::CreateFillProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ sal_Bool bEdge , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape )
+{
+ if ( rXShape.is() )
+ {
+ SdrObject* pObj = GetSdrObjectFromXShape( rXShape );
+ if ( pObj )
+ {
+ SfxItemSet aAttr( pObj->GetMergedItemSet() );
+ //tranparency with gradient. Means the third setting in transparency page is set
+ sal_Bool bTransparentGradient = ( aAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET ) &&
+ ( (const XFillFloatTransparenceItem&) aAttr.Get( XATTR_FILLFLOATTRANSPARENCE ) ).IsEnabled();
+ CreateFillProperties( rXPropSet, bEdge, bTransparentGradient );
+ }
+ }
+}
void EscherPropertyContainer::CreateFillProperties(
- const uno::Reference< beans::XPropertySet > & rXPropSet,
- sal_Bool bEdge )
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ sal_Bool bEdge , sal_Bool bTransparentGradient)
+
{
::com::sun::star::uno::Any aAny;
AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
@@ -457,7 +597,7 @@ void EscherPropertyContainer::CreateFillProperties(
{
case ::com::sun::star::drawing::FillStyle_GRADIENT :
{
- CreateGradientProperties( rXPropSet );
+ CreateGradientProperties( rXPropSet , bTransparentGradient );
AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
}
break;
@@ -477,19 +617,25 @@ void EscherPropertyContainer::CreateFillProperties(
case ::com::sun::star::drawing::FillStyle_SOLID :
default:
{
- ::com::sun::star::beans::PropertyState ePropState = EscherPropertyValueHelper::GetPropertyState(
- rXPropSet, aPropName );
- if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
- AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
-
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "FillColor" ), sal_False ) )
+ if ( bTransparentGradient )
+ CreateGradientProperties( rXPropSet , bTransparentGradient );
+ else
{
- sal_uInt32 nFillColor = ImplGetColor( *((sal_uInt32*)aAny.getValue()) );
- nFillBackColor = nFillColor ^ 0xffffff;
- AddOpt( ESCHER_Prop_fillColor, nFillColor );
+ ::com::sun::star::beans::PropertyState ePropState = EscherPropertyValueHelper::GetPropertyState(
+ rXPropSet, aPropName );
+ if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
+ AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
+
+ if ( EscherPropertyValueHelper::GetPropertyValue(
+ aAny, rXPropSet, OUString( "FillColor" ), sal_False ) )
+ {
+ sal_uInt32 nFillColor = ImplGetColor( *((sal_uInt32*)aAny.getValue()) );
+ nFillBackColor = nFillColor ^ 0xffffff;
+ AddOpt( ESCHER_Prop_fillColor, nFillColor );
+ }
+ AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100010 );
+ AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
}
- AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100010 );
- AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
break;
}
case ::com::sun::star::drawing::FillStyle_NONE :
@@ -1358,27 +1504,27 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
// #121074# transparency of graphic is not supported in MS formats, get and apply it
// in the GetTransformedGraphic call in GetBlibID
- if(EscherPropertyValueHelper::GetPropertyValue(aAny, rXPropSet, String(RTL_CONSTASCII_USTRINGPARAM("Transparency"))))
+ if(EscherPropertyValueHelper::GetPropertyValue(aAny, rXPropSet, OUString("Transparency")))
{
aAny >>= nTransparency;
}
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustRed" ) ) ) )
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString("AdjustRed") ) )
{
aAny >>= nRed;
}
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustGreen" ) ) ) )
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString("AdjustGreen" ) ) )
{
aAny >>= nGreen;
}
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "AdjustBlue" ) ) ) )
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString("AdjustBlue" ) ) )
{
aAny >>= nBlue;
}
- if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Gamma" ) ) ) )
+ if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, OUString( "Gamma" ) ) )
{
aAny >>= fGamma;
}
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index feac1c71b79d..069b8b3c4fc3 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -199,7 +199,8 @@ void Impl_OlePres::Write( SvStream & rStm )
DffPropertyReader::DffPropertyReader( const SvxMSDffManager& rMan ) :
rManager( rMan ),
- pDefaultPropSet( NULL )
+ pDefaultPropSet( NULL ),
+ mbRotateGranientFillWithAngle ( 0 )
{
InitializePropSet( DFF_msofbtOPT );
}
@@ -1267,6 +1268,9 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
break;
case mso_fillShadeCenter : // Shade from bounding rectangle to end point
{
+ //If it is imported as a bitmap, it will not work well with transparecy especially 100
+ //But the gradient look well comparing with imported as gradient. And rotate with shape
+ //also works better. So here just keep it.
if ( rObjData.aBoundRect.IsEmpty() )// size of object needed to be able
eXFill = XFILL_GRADIENT; // to create a bitmap substitution
else
@@ -1284,77 +1288,29 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
}
rSet.Put( XFillStyleItem( eXFill ) );
+ double dTrans = 1.0;
+ double dBackTrans = 1.0;
if (IsProperty(DFF_Prop_fillOpacity))
{
- double nTrans = GetPropertyValue(DFF_Prop_fillOpacity);
- nTrans = (nTrans * 100) / 65536;
- rSet.Put(XFillTransparenceItem(
- sal_uInt16(100 - ::rtl::math::round(nTrans))));
+ dTrans = GetPropertyValue(DFF_Prop_fillOpacity) / 65536.0;
+ if ( eXFill != XFILL_GRADIENT )
+ {
+ dTrans = dTrans * 100;
+ rSet.Put(XFillTransparenceItem(
+ sal_uInt16(100 - ::rtl::math::round(dTrans))));
+ }
}
+ if ( IsProperty(DFF_Prop_fillBackOpacity) )
+ dBackTrans = GetPropertyValue(DFF_Prop_fillBackOpacity) / 65536.0;
+
if ( ( eMSO_FillType == mso_fillShadeCenter ) && ( eXFill == XFILL_BITMAP ) )
{
ApplyRectangularGradientAsBitmap( rManager, rIn, rSet, aShadeColors, rObjData, mnFix16Angle );
}
else if ( eXFill == XFILL_GRADIENT )
{
- sal_Int32 nAngle = 3600 - ( ( Fix16ToAngle( GetPropertyValue( DFF_Prop_fillAngle, 0 ) ) + 5 ) / 10 );
-
- // force rotation angle to be within a certain range
- while ( nAngle >= 3600 )
- nAngle -= 3600;
- while ( nAngle < 0 )
- nAngle += 3600;
-
- sal_Int32 nFocus = GetPropertyValue( DFF_Prop_fillFocus, 0 );
- XGradientStyle eGrad = XGRAD_LINEAR;
- sal_Int32 nChgColors = 0;
-
- if ( nFocus < 0 ) // If the focus is negative the colors need to be swapped
- {
- nFocus = -nFocus;
- nChgColors ^= 1;
- }
- if( nFocus > 40 && nFocus < 60 )
- {
- eGrad = XGRAD_AXIAL; // Unfortunately there's no better solution
- }
-
- sal_uInt16 nFocusX = (sal_uInt16)nFocus;
- sal_uInt16 nFocusY = (sal_uInt16)nFocus;
-
- switch( eMSO_FillType )
- {
- case mso_fillShadeShape :
- {
- eGrad = XGRAD_RECT;
- nFocusY = nFocusX = 50;
- nChgColors ^= 1;
- }
- break;
- case mso_fillShadeCenter :
- {
- eGrad = XGRAD_RECT;
- nFocusX = ( IsProperty( DFF_Prop_fillToRight ) ) ? 100 : 0;
- nFocusY = ( IsProperty( DFF_Prop_fillToBottom ) ) ? 100 : 0;
- nChgColors ^= 1;
- }
- break;
- default: break;
- }
- Color aCol1( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor, COL_WHITE ), DFF_Prop_fillColor ) );
- Color aCol2( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor, COL_WHITE ), DFF_Prop_fillBackColor ) );
-
- if ( nChgColors )
- {
- Color aZwi( aCol1 );
- aCol1 = aCol2;
- aCol2 = aZwi;
- }
- XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY );
- aGrad.SetStartIntens( 100 );
- aGrad.SetEndIntens( 100 );
- rSet.Put( XFillGradientItem( OUString(), aGrad ) );
+ ImportGradientColor ( rSet, eMSO_FillType, dTrans , dBackTrans );
}
else if ( eXFill == XFILL_BITMAP )
{
@@ -2579,7 +2535,7 @@ void DffPropertyReader::ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObj
if ( nFontAttributes & 0x08 )
rSet.Put( SvxUnderlineItem( nFontAttributes & 0x08 ? UNDERLINE_SINGLE : UNDERLINE_NONE, EE_CHAR_UNDERLINE ) );
if ( nFontAttributes & 0x40 )
- rSet.Put( SvxShadowedItem( ( nFontAttributes & 0x40 ) != 0, EE_CHAR_SHADOW ) );
+ rSet.Put( SvxShadowedItem( (nFontAttributes & 0x40) != 0, EE_CHAR_SHADOW ) );
// if ( nFontAttributes & 0x02 )
// rSet.Put( SvxCaseMapItem( nFontAttributes & 0x02 ? SVX_CASEMAP_KAPITAELCHEN : SVX_CASEMAP_NOT_MAPPED ) );
if ( nFontAttributes & 0x01 )
@@ -2771,6 +2727,114 @@ void DffPropertyReader::CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItem
}
}
+
+void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet,MSO_FillType eMSO_FillType, double dTrans , double dBackTrans) const
+{
+ //MS Focus prop will impact the start and end color position. And AOO does not
+ //support this prop. So need some swap for the two color to keep fidelity with AOO and MS shape.
+ //So below var is defined.
+ sal_Int32 nChgColors = 0;
+ sal_Int32 nAngle = GetPropertyValue( DFF_Prop_fillAngle, 0 );
+ sal_Int32 nRotateAngle = 0;
+ if(nAngle >= 0)
+ nChgColors ^= 1;
+
+ //Translate a MS clockwise(+) or count clockwise angle(-) into a AOO count clock wise angle
+ nAngle=3600 - ( ( Fix16ToAngle(nAngle) + 5 ) / 10 );
+ //Make sure this angle belongs to 0~3600
+ while ( nAngle >= 3600 ) nAngle -= 3600;
+ while ( nAngle < 0 ) nAngle += 3600;
+
+ //Rotate angle
+ if ( mbRotateGranientFillWithAngle )
+ {
+ nRotateAngle = GetPropertyValue( DFF_Prop_Rotation, 0 );
+ if(nRotateAngle)//fixed point number
+ nRotateAngle = ( (sal_Int16)( nRotateAngle >> 16) * 100L ) + ( ( ( nRotateAngle & 0x0000ffff) * 100L ) >> 16 );
+ nRotateAngle = ( nRotateAngle + 5 ) / 10 ;//round up
+ //nAngle is a clockwise angle. If nRotateAngle is a clockwise angle, then gradient need be rotated a little less
+ //Or it need be rotated a little more
+ nAngle -= nRotateAngle;
+ }
+ while ( nAngle >= 3600 ) nAngle -= 3600;
+ while ( nAngle < 0 ) nAngle += 3600;
+
+ XGradientStyle eGrad = XGRAD_LINEAR;
+
+ sal_Int32 nFocus = GetPropertyValue( DFF_Prop_fillFocus, 0 );
+ if ( !nFocus )
+ nChgColors ^= 1;
+ else if ( nFocus < 0 )//If it is a negative focus, the color will be swapped
+ {
+ nFocus =- nFocus;
+ nChgColors ^= 1;
+ }
+
+ if( nFocus > 40 && nFocus < 60 )
+ {
+ eGrad = XGRAD_AXIAL;//A axial gradient other than linear
+ nChgColors ^= 1;
+ }
+ //if the type is linear or axial, just save focus to nFocusX and nFocusY for export
+ //Core function does no need them. They serves for rect gradient(CenterXY).
+ sal_uInt16 nFocusX = (sal_uInt16)nFocus;
+ sal_uInt16 nFocusY = (sal_uInt16)nFocus;
+
+ switch( eMSO_FillType )
+ {
+ case mso_fillShadeShape :
+ {
+ eGrad = XGRAD_RECT;
+ nFocusY = nFocusX = 50;
+ nChgColors ^= 1;
+ }
+ break;
+ case mso_fillShadeCenter :
+ {
+ eGrad = XGRAD_RECT;
+ //A MS fillTo prop specifies the relative position of the left boundary
+ //of the center rectangle in a concentric shaded fill. Use 100 or 0 to keep fidelity
+ nFocusX=(GetPropertyValue( DFF_Prop_fillToRight, 0 )==0x10000) ? 100 : 0;
+ nFocusY=(GetPropertyValue( DFF_Prop_fillToBottom,0 )==0x10000) ? 100 : 0;
+ nChgColors ^= 1;
+ }
+ break;
+ default: break;
+ }
+
+ Color aCol1( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor, COL_WHITE ), DFF_Prop_fillColor ) );
+ Color aCol2( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor, COL_WHITE ), DFF_Prop_fillBackColor ) );
+ if ( nChgColors )
+ {
+ //Swap start and end color
+ Color aZwi( aCol1 );
+ aCol1 = aCol2;
+ aCol2 = aZwi;
+ //Swap two colors' transparency
+ double dTemp = dTrans;
+ dTrans = dBackTrans;
+ dBackTrans = dTemp;
+ }
+
+ //Construct gradient item
+ XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY );
+ //Intensity has been merged into color. So here just set is as 100
+ aGrad.SetStartIntens( 100 );
+ aGrad.SetEndIntens( 100 );
+ aSet.Put( XFillGradientItem( String(), aGrad ) );
+ //Construct tranparency item. This item can coodinate with both solid and gradient.
+ if ( dTrans < 1.0 || dBackTrans < 1.0 )
+ {
+ sal_uInt8 nStartCol = (sal_uInt8)( (1 - dTrans )* 255 );
+ sal_uInt8 nEndCol = (sal_uInt8)( ( 1- dBackTrans ) * 255 );
+ aCol1 = Color(nStartCol, nStartCol, nStartCol);
+ aCol2 = Color(nEndCol, nEndCol, nEndCol);
+
+ XGradient aGrad2( aCol2 , aCol1 , eGrad, nAngle, nFocusX, nFocusY );
+ aSet.Put( XFillFloatTransparenceItem( String(), aGrad2 ) );
+ }
+}
+
//---------------------------------------------------------------------------
//- Record Manager ----------------------------------------------------------
//---------------------------------------------------------------------------
@@ -4018,6 +4082,29 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
DffObjData aObjData( rHd, rClientRect, nCalledByGroup );
aObjData.bRotateTextWithShape = ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_EXCEL ) == 0;
maShapeRecords.Consume( rSt, sal_False );
+ if( maShapeRecords.SeekToContent( rSt,
+ DFF_msofbtUDefProp,
+ SEEK_FROM_BEGINNING ) )
+ {
+ sal_uInt32 nBytesLeft = maShapeRecords.Current()->nRecLen;
+ sal_uInt32 nUDData;
+ sal_uInt16 nPID;
+ while( 5 < nBytesLeft )
+ {
+ rSt >> nPID;
+ if ( rSt.GetError() != 0 )
+ break;
+ rSt >> nUDData;
+ if ( rSt.GetError() != 0 )
+ break;
+ if ( nPID == 447 ) //
+ {
+ mbRotateGranientFillWithAngle = nUDData & 0x20;
+ break;
+ }
+ nBytesLeft -= 6;
+ }
+ }
aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp, SEEK_FROM_BEGINNING );
if ( aObjData.bShapeType )
{