View | Details | Raw Unified | Return to issue 120554
Collapse All | Expand All

(-)filter/inc/filter/msfilter/escherex.hxx (-2 / +3 lines)
Lines 1222-1230 Link Here
1222
		static sal_uInt32 GetGradientColor( const ::com::sun::star::awt::Gradient* pGradient, sal_uInt32 nStartColor );
1222
		static sal_uInt32 GetGradientColor( const ::com::sun::star::awt::Gradient* pGradient, sal_uInt32 nStartColor );
1223
1223
1224
        void        CreateGradientProperties( const ::com::sun::star::awt::Gradient & rGradient );
1224
        void        CreateGradientProperties( const ::com::sun::star::awt::Gradient & rGradient );
1225
		void		CreateGradientProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & );
1225
		void		CreateGradientProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & , sal_Bool bTransparentGradient = sal_False );
1226
		void		CreateLineProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge );
1226
		void		CreateLineProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge );
1227
		void		CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge );
1227
		void		CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge , sal_Bool bTransparentGradient = sal_False );
1228
		void		CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge ,  const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape );
1228
		void		CreateTextProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_uInt32 nText,
1229
		void		CreateTextProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_uInt32 nText,
1229
						const sal_Bool bIsCustomShape = sal_False, const sal_Bool bIsTextFrame = sal_True );
1230
						const sal_Bool bIsCustomShape = sal_False, const sal_Bool bIsTextFrame = sal_True );
1230
1231
(-)filter/inc/filter/msfilter/msdffimp.hxx (+2 lines)
Lines 80-85 Link Here
80
public:
80
public:
81
81
82
	sal_Int32					mnFix16Angle;
82
	sal_Int32					mnFix16Angle;
83
	sal_Bool					mbRotateGranientFillWithAngle;
83
84
84
	DffPropertyReader( const SvxMSDffManager& rManager );
85
	DffPropertyReader( const SvxMSDffManager& rManager );
85
	~DffPropertyReader();
86
	~DffPropertyReader();
Lines 94-99 Link Here
94
	void		SetDefaultPropSet( SvStream& rIn, sal_uInt32 nOffDgg ) const;
95
	void		SetDefaultPropSet( SvStream& rIn, sal_uInt32 nOffDgg ) const;
95
	void		ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const;
96
	void		ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const;
96
	void		ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const;
97
	void		ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const;
98
	void		ImportGradientColor( SfxItemSet& aSet, MSO_FillType eMSO_FillType, double dTrans = 1.0 , double dBackTrans = 1.0 ) const;
97
};
99
};
98
100
99
101
(-)filter/source/msfilter/escherex.cxx (-25 / +168 lines)
Lines 24-29 Link Here
24
// MARKER(update_precomp.py): autogen include statement, do not remove
24
// MARKER(update_precomp.py): autogen include statement, do not remove
25
#include "precompiled_filter.hxx"
25
#include "precompiled_filter.hxx"
26
#include "eschesdo.hxx"
26
#include "eschesdo.hxx"
27
#include <svx/xflftrit.hxx>
27
#include <filter/msfilter/escherex.hxx>
28
#include <filter/msfilter/escherex.hxx>
28
#include <svx/unoapi.hxx>
29
#include <svx/unoapi.hxx>
29
#include <svx/svdobj.hxx>
30
#include <svx/svdobj.hxx>
Lines 438-458 Link Here
438
}
439
}
439
440
440
void EscherPropertyContainer::CreateGradientProperties(
441
void EscherPropertyContainer::CreateGradientProperties(
441
    const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet )
442
	const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet , sal_Bool bTransparentGradient)
442
{
443
{
443
    ::com::sun::star::uno::Any aAny;
444
	::com::sun::star::uno::Any			aAny;
444
    ::com::sun::star::awt::Gradient aGradient;
445
	::com::sun::star::awt::Gradient*	pGradient = NULL;
445
    if ( EscherPropertyValueHelper::GetPropertyValue(
446
            aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ) ), sal_False ) )
447
    {
448
        aGradient = *static_cast< const ::com::sun::star::awt::Gradient* >( aAny.getValue() );
449
    }
450
    CreateGradientProperties( aGradient );
451
};
452
446
447
	sal_uInt32  nFillType = ESCHER_FillShadeScale;
448
	sal_Int32  nAngle = 0;
449
	sal_uInt32  nFillFocus = 0;
450
	sal_uInt32  nFillLR = 0;
451
	sal_uInt32  nFillTB = 0;
452
	sal_uInt32	nFirstColor = 0;//like the control var nChgColors in import logic
453
	bool        bWriteFillTo = false;
454
455
	//Transparency gradient: Means the third setting in transparency page is set
456
	if (bTransparentGradient &&  EscherPropertyValueHelper::GetPropertyValue(
457
		aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillTransparenceGradient" ) ), sal_False ) )
458
	{
459
		pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
460
				
461
		::com::sun::star::uno::Any			aAnyTemp;
462
		const rtl::OUString aPropName( String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) );
463
		if ( EscherPropertyValueHelper::GetPropertyValue(
464
			aAnyTemp, rXPropSet, aPropName, sal_False ) )
465
		{
466
			::com::sun::star::drawing::FillStyle eFS;
467
			if ( ! ( aAnyTemp >>= eFS ) )
468
				eFS = ::com::sun::star::drawing::FillStyle_SOLID;
469
			//solid and transparency
470
			if ( eFS == ::com::sun::star::drawing::FillStyle_SOLID)
471
			{
472
				if ( EscherPropertyValueHelper::GetPropertyValue(
473
					aAnyTemp, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ), sal_False ) )
474
				{
475
					pGradient->StartColor = ImplGetColor( *((sal_uInt32*)aAnyTemp.getValue()), sal_False );
476
					pGradient->EndColor = ImplGetColor( *((sal_uInt32*)aAnyTemp.getValue()), sal_False );
477
				}
478
			}
479
			//gradient and transparency.
480
			else if( eFS == ::com::sun::star::drawing::FillStyle_GRADIENT )
481
			{
482
				if ( EscherPropertyValueHelper::GetPropertyValue(
483
					aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ) ), sal_False ) )
484
					pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
485
			}
486
		}
487
		
488
	}
489
	//Not transparency gradient
490
	else if ( EscherPropertyValueHelper::GetPropertyValue(
491
		aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ) ), sal_False ) )
492
	{
493
		pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
494
	}
495
	
496
	if ( pGradient )
497
	{
498
		switch ( pGradient->Style )
499
		{
500
		case ::com::sun::star::awt::GradientStyle_LINEAR :
501
		case ::com::sun::star::awt::GradientStyle_AXIAL :
502
			{
503
				nFillType = ESCHER_FillShadeScale;
504
				nAngle = pGradient->Angle;
505
				while ( nAngle > 0 ) nAngle -= 3600;
506
				while ( nAngle <= -3600 ) nAngle += 3600;
507
				//Value of the real number = Integral + (Fractional / 65536.0)
508
				nAngle = ( nAngle * 0x10000) / 10;
509
510
				nFillFocus = (pGradient->Style == GradientStyle_LINEAR) ? 
511
							( pGradient->XOffset + pGradient->YOffset )/2 : -50;
512
				if( !nFillFocus )
513
					nFirstColor=nFirstColor ^ 1;
514
				if ( !nAngle )
515
					nFirstColor=nFirstColor ^ 1;
516
			}
517
			break;
518
		case ::com::sun::star::awt::GradientStyle_RADIAL :
519
		case ::com::sun::star::awt::GradientStyle_ELLIPTICAL :
520
		case ::com::sun::star::awt::GradientStyle_SQUARE :
521
		case ::com::sun::star::awt::GradientStyle_RECT :
522
			{
523
				//according to the import logic and rect type fill** value
524
				nFillLR = (pGradient->XOffset * 0x10000) / 100;
525
				nFillTB = (pGradient->YOffset * 0x10000) / 100;
526
				if ( ((nFillLR > 0) && (nFillLR < 0x10000)) || ((nFillTB > 0) && (nFillTB < 0x10000)) )
527
					nFillType = ESCHER_FillShadeShape;
528
				else
529
					nFillType = ESCHER_FillShadeCenter;
530
				nFirstColor = 1;
531
				bWriteFillTo = true;
532
			}
533
			break;
534
		}
535
	}
536
	
537
	AddOpt( ESCHER_Prop_fillType, nFillType );
538
	AddOpt( ESCHER_Prop_fillAngle, nAngle );
539
	AddOpt( ESCHER_Prop_fillColor, GetGradientColor( pGradient, nFirstColor ) );
540
	AddOpt( ESCHER_Prop_fillBackColor, GetGradientColor( pGradient, nFirstColor ^ 1 ) );
541
	AddOpt( ESCHER_Prop_fillFocus, nFillFocus );
542
	if ( bWriteFillTo )
543
	{
544
		//according to rect type fillTo** value
545
		if(nFillLR)
546
		{
547
			AddOpt( ESCHER_Prop_fillToLeft, nFillLR );
548
			AddOpt( ESCHER_Prop_fillToRight, nFillLR );
549
		}
550
		if(nFillTB)
551
		{
552
			AddOpt( ESCHER_Prop_fillToTop, nFillTB );
553
			AddOpt( ESCHER_Prop_fillToBottom, nFillTB );
554
		}
555
	}
556
557
	//Transparency gradient
558
	if (bTransparentGradient &&  EscherPropertyValueHelper::GetPropertyValue(
559
		aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillTransparenceGradient" ) ), sal_False ) )
560
	{
561
		pGradient = (::com::sun::star::awt::Gradient*)aAny.getValue();
562
		if ( pGradient )
563
		{
564
			sal_uInt32	nBlue =	 GetGradientColor( pGradient, nFirstColor ) >> 16;
565
			AddOpt( ESCHER_Prop_fillOpacity,( ( 100 - ( nBlue * 100 / 255 ) ) << 16 ) / 100 );
566
			nBlue =	 GetGradientColor( pGradient, nFirstColor ^ 1 ) >>16 ;
567
			AddOpt( ESCHER_Prop_fillBackOpacity,( ( 100 - ( nBlue * 100 / 255 ) ) << 16 )/ 100 );
568
		}
569
	}
570
}
571
572
void	EscherPropertyContainer::CreateFillProperties( 
573
	const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
574
	sal_Bool bEdge ,  const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape )
575
{
576
	if ( rXShape.is() )
577
	{
578
		SdrObject* pObj = GetSdrObjectFromXShape( rXShape );
579
		if ( pObj )
580
		{
581
			SfxItemSet aAttr( pObj->GetMergedItemSet() );
582
			//tranparency with gradient. Means the third setting in transparency page is set
583
			sal_Bool bTransparentGradient =  ( aAttr.GetItemState( XATTR_FILLFLOATTRANSPARENCE ) == SFX_ITEM_SET ) &&
584
				( (const XFillFloatTransparenceItem&) aAttr.Get( XATTR_FILLFLOATTRANSPARENCE ) ).IsEnabled();
585
			CreateFillProperties(  rXPropSet, bEdge, bTransparentGradient );
586
		}
587
	}
588
}
589
453
void EscherPropertyContainer::CreateFillProperties(
590
void EscherPropertyContainer::CreateFillProperties(
454
	const uno::Reference< beans::XPropertySet > & rXPropSet,
591
	const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
455
		sal_Bool bEdge )
592
	sal_Bool bEdge , sal_Bool bTransparentGradient)
593
456
{
594
{
457
	::com::sun::star::uno::Any aAny;
595
	::com::sun::star::uno::Any aAny;
458
    AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
596
    AddOpt( ESCHER_Prop_WrapText, ESCHER_WrapNone );
Lines 471-477 Link Here
471
        {
609
        {
472
            case ::com::sun::star::drawing::FillStyle_GRADIENT :
610
            case ::com::sun::star::drawing::FillStyle_GRADIENT :
473
            {
611
            {
474
				CreateGradientProperties( rXPropSet );
612
				CreateGradientProperties( rXPropSet , bTransparentGradient );
475
                AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
613
                AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
476
            }
614
            }
477
            break;
615
            break;
Lines 491-510 Link Here
491
            case ::com::sun::star::drawing::FillStyle_SOLID :
629
            case ::com::sun::star::drawing::FillStyle_SOLID :
492
            default:
630
            default:
493
            {
631
            {
494
				::com::sun::star::beans::PropertyState ePropState = EscherPropertyValueHelper::GetPropertyState(
632
				if ( bTransparentGradient )
495
					rXPropSet, aPropName );
633
					CreateGradientProperties( rXPropSet , bTransparentGradient );
496
				if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
634
				else
497
	                AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
635
				{
636
					::com::sun::star::beans::PropertyState ePropState = EscherPropertyValueHelper::GetPropertyState(
637
						rXPropSet, aPropName );
638
					if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE )
639
						AddOpt( ESCHER_Prop_fillType, ESCHER_FillSolid );
498
640
499
				if ( EscherPropertyValueHelper::GetPropertyValue(
641
					if ( EscherPropertyValueHelper::GetPropertyValue(
500
						aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ), sal_False ) )
642
							aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ), sal_False ) )
501
				{
643
					{
502
                    sal_uInt32 nFillColor = ImplGetColor( *((sal_uInt32*)aAny.getValue()) );
644
						sal_uInt32 nFillColor = ImplGetColor( *((sal_uInt32*)aAny.getValue()) );
503
                    nFillBackColor = nFillColor ^ 0xffffff;
645
						nFillBackColor = nFillColor ^ 0xffffff;
504
                    AddOpt( ESCHER_Prop_fillColor, nFillColor );
646
						AddOpt( ESCHER_Prop_fillColor, nFillColor );
647
					}
648
					AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100010 );
649
					AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
505
				}
650
				}
506
                AddOpt( ESCHER_Prop_fNoFillHitTest, 0x100010 );
507
                AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor );
508
                break;
651
                break;
509
            }
652
            }
510
            case ::com::sun::star::drawing::FillStyle_NONE :
653
            case ::com::sun::star::drawing::FillStyle_NONE :
(-)filter/source/msfilter/msdffimp.cxx (-64 / +150 lines)
Lines 218-223 Link Here
218
218
219
DffPropertyReader::DffPropertyReader( const SvxMSDffManager& rMan ) :
219
DffPropertyReader::DffPropertyReader( const SvxMSDffManager& rMan ) :
220
	rManager( rMan ),
220
	rManager( rMan ),
221
	mbRotateGranientFillWithAngle ( 0 ),
221
	pDefaultPropSet( NULL )
222
	pDefaultPropSet( NULL )
222
{
223
{
223
	InitializePropSet( DFF_msofbtOPT );
224
	InitializePropSet( DFF_msofbtOPT );
Lines 1350-1355 Link Here
1350
			break;
1351
			break;
1351
			case mso_fillShadeCenter :		// Shade from bounding rectangle to end point
1352
			case mso_fillShadeCenter :		// Shade from bounding rectangle to end point
1352
			{
1353
			{
1354
				//If it is imported as a bitmap, it will not work well with transparecy especially 100
1355
				//But the gradient look well comparing with imported as gradient. And rotate with shape
1356
				//also works better. So here just keep it.
1353
				if ( rObjData.aBoundRect.IsEmpty() )// size of object needed to be able
1357
				if ( rObjData.aBoundRect.IsEmpty() )// size of object needed to be able
1354
					eXFill = XFILL_GRADIENT;		// to create a bitmap substitution
1358
					eXFill = XFILL_GRADIENT;		// to create a bitmap substitution
1355
				else
1359
				else
Lines 1367-1443 Link Here
1367
		}
1371
		}
1368
		rSet.Put( XFillStyleItem( eXFill ) );
1372
		rSet.Put( XFillStyleItem( eXFill ) );
1369
1373
1370
        if (IsProperty(DFF_Prop_fillOpacity))
1374
		double dTrans  = 1.0;
1371
        {
1375
		double dBackTrans = 1.0;
1372
			double nTrans = GetPropertyValue(DFF_Prop_fillOpacity);
1376
		if (IsProperty(DFF_Prop_fillOpacity))
1373
            nTrans = (nTrans * 100) / 65536;
1377
		{
1374
			rSet.Put(XFillTransparenceItem(
1378
			dTrans = GetPropertyValue(DFF_Prop_fillOpacity) / 65536.0;			
1375
                sal_uInt16(100 - ::rtl::math::round(nTrans))));
1379
			if ( eXFill != XFILL_GRADIENT )
1376
        }
1380
			{
1381
				dTrans = dTrans * 100;
1382
				rSet.Put(XFillTransparenceItem(
1383
					sal_uInt16(100 - ::rtl::math::round(dTrans))));
1384
			}
1385
		}
1377
1386
1387
		if ( IsProperty(DFF_Prop_fillBackOpacity) )
1388
			dBackTrans = GetPropertyValue(DFF_Prop_fillBackOpacity) / 65536.0;
1389
1378
		if ( ( eMSO_FillType == mso_fillShadeCenter ) && ( eXFill == XFILL_BITMAP ) )
1390
		if ( ( eMSO_FillType == mso_fillShadeCenter ) && ( eXFill == XFILL_BITMAP ) )
1379
		{
1391
		{
1380
			ApplyRectangularGradientAsBitmap( rManager, rIn, rSet, aShadeColors, rObjData, mnFix16Angle );
1392
			ApplyRectangularGradientAsBitmap( rManager, rIn, rSet, aShadeColors, rObjData, mnFix16Angle );
1381
		}
1393
		}
1382
		else if ( eXFill == XFILL_GRADIENT )
1394
		else if ( eXFill == XFILL_GRADIENT )
1383
		{
1395
		{
1384
			sal_Int32 nAngle = 3600 - ( ( Fix16ToAngle( GetPropertyValue( DFF_Prop_fillAngle, 0 ) ) + 5 ) / 10 );
1396
			ImportGradientColor ( rSet, eMSO_FillType, dTrans , dBackTrans );
1385
1386
			// Rotationswinkel in Bereich zwingen
1387
			while ( nAngle >= 3600 )
1388
				nAngle -= 3600;
1389
			while ( nAngle < 0 )
1390
				nAngle += 3600;
1391
1392
			sal_Int32 nFocus = GetPropertyValue( DFF_Prop_fillFocus, 0 );
1393
			XGradientStyle eGrad = XGRAD_LINEAR;
1394
			sal_Int32 nChgColors = 0;
1395
1396
			if ( nFocus < 0 )		// Bei negativem Focus sind die Farben zu tauschen
1397
			{
1398
				nFocus =- nFocus;
1399
				nChgColors ^= 1;
1400
			}
1401
			if( nFocus > 40 && nFocus < 60 )
1402
			{
1403
				eGrad = XGRAD_AXIAL;	// Besser gehts leider nicht
1404
			}
1405
1406
			sal_uInt16 nFocusX = (sal_uInt16)nFocus;
1407
			sal_uInt16 nFocusY = (sal_uInt16)nFocus;
1408
1409
			switch( eMSO_FillType )
1410
			{
1411
				case mso_fillShadeShape :
1412
				{
1413
					eGrad = XGRAD_RECT;
1414
					nFocusY = nFocusX = 50;
1415
					nChgColors ^= 1;
1416
				}
1417
				break;
1418
				case mso_fillShadeCenter :
1419
				{
1420
					eGrad = XGRAD_RECT;
1421
					nFocusX = ( IsProperty( DFF_Prop_fillToRight ) ) ? 100 : 0;
1422
					nFocusY = ( IsProperty( DFF_Prop_fillToBottom ) ) ? 100 : 0;
1423
					nChgColors ^= 1;
1424
				}
1425
				break;
1426
				default: break;
1427
			}
1428
			Color aCol1( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor, COL_WHITE ), DFF_Prop_fillColor ) );
1429
			Color aCol2( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor, COL_WHITE ), DFF_Prop_fillBackColor ) );
1430
1431
			if ( nChgColors )
1432
			{
1433
				Color aZwi( aCol1 );
1434
				aCol1 = aCol2;
1435
				aCol2 = aZwi;
1436
			}
1437
			XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY );
1438
			aGrad.SetStartIntens( 100 );
1439
			aGrad.SetEndIntens( 100 );
1440
			rSet.Put( XFillGradientItem( String(), aGrad ) );
1441
		}
1397
		}
1442
		else if ( eXFill == XFILL_BITMAP )
1398
		else if ( eXFill == XFILL_BITMAP )
1443
		{
1399
		{
Lines 2889-2894 Link Here
2889
	}
2845
	}
2890
}
2846
}
2891
2847
2848
2849
void DffPropertyReader::ImportGradientColor( SfxItemSet& aSet,MSO_FillType eMSO_FillType, double dTrans , double dBackTrans) const
2850
{
2851
	//MS Focus prop will impact the start and end color position. And AOO does not
2852
	//support this prop. So need some swap for the two color to keep fidelity with AOO and MS shape.
2853
	//So below var is defined.
2854
	sal_Int32 nChgColors = 0;
2855
	sal_Int32 nAngle = GetPropertyValue( DFF_Prop_fillAngle, 0 );
2856
	sal_Int32 nRotateAngle = 0;
2857
	if(nAngle >= 0)
2858
		nChgColors ^= 1;
2859
2860
	//Translate a MS clockwise(+) or count clockwise angle(-) into a AOO count clock wise angle
2861
	nAngle=3600 - ( ( Fix16ToAngle(nAngle) + 5 ) / 10 );
2862
	//Make sure this angle belongs to 0~3600
2863
	while ( nAngle >= 3600 ) nAngle -= 3600;
2864
	while ( nAngle < 0 ) nAngle += 3600;
2865
2866
	//Rotate angle
2867
	if ( mbRotateGranientFillWithAngle )
2868
	{
2869
		nRotateAngle = GetPropertyValue( DFF_Prop_Rotation, 0 );
2870
		if(nRotateAngle)//fixed point number
2871
			nRotateAngle = ( (sal_Int16)( nRotateAngle >> 16) * 100L ) + ( ( ( nRotateAngle & 0x0000ffff) * 100L ) >> 16 );
2872
		nRotateAngle = ( nRotateAngle + 5 ) / 10 ;//round up
2873
		//nAngle is a clockwise angle. If nRotateAngle is a clockwise angle, then gradient need be rotated a little less
2874
		//Or it need be rotated a little more
2875
		nAngle -=  nRotateAngle;
2876
	}
2877
	while ( nAngle >= 3600 ) nAngle -= 3600;
2878
	while ( nAngle < 0 ) nAngle += 3600;
2879
2880
	XGradientStyle eGrad = XGRAD_LINEAR;
2881
	
2882
	sal_Int32 nFocus = GetPropertyValue( DFF_Prop_fillFocus, 0 );	
2883
	if ( !nFocus )
2884
		nChgColors ^= 1;
2885
	else if ( nFocus < 0 )//If it is a negative focus, the color will be swapped
2886
	{
2887
		nFocus =- nFocus;
2888
		nChgColors ^= 1;
2889
	}
2890
	
2891
	if( nFocus > 40 && nFocus < 60 )
2892
	{
2893
		eGrad = XGRAD_AXIAL;//A axial gradient other than linear
2894
		nChgColors ^= 1;
2895
	}
2896
	//if the type is linear or axial, just save focus to nFocusX and nFocusY for export
2897
	//Core function does no need them. They serves for rect gradient(CenterXY).
2898
	sal_uInt16 nFocusX = (sal_uInt16)nFocus;
2899
	sal_uInt16 nFocusY = (sal_uInt16)nFocus;
2900
	
2901
	switch( eMSO_FillType )
2902
	{
2903
	case mso_fillShadeShape :
2904
		{
2905
			eGrad = XGRAD_RECT;
2906
			nFocusY = nFocusX = 50;
2907
			nChgColors ^= 1;
2908
		}
2909
		break;
2910
	case mso_fillShadeCenter :
2911
		{
2912
			eGrad = XGRAD_RECT;
2913
			//A MS fillTo prop specifies the relative position of the left boundary 
2914
			//of the center rectangle in a concentric shaded fill. Use 100 or 0 to keep fidelity
2915
			nFocusX=(GetPropertyValue( DFF_Prop_fillToRight, 0 )==0x10000) ? 100 : 0;
2916
			nFocusY=(GetPropertyValue( DFF_Prop_fillToBottom,0 )==0x10000) ? 100 : 0;			
2917
			nChgColors ^= 1;
2918
		}
2919
		break;
2920
	}
2921
2922
	Color aCol1( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillColor, COL_WHITE ), DFF_Prop_fillColor ) );
2923
	Color aCol2( rManager.MSO_CLR_ToColor( GetPropertyValue( DFF_Prop_fillBackColor, COL_WHITE ), DFF_Prop_fillBackColor ) );	
2924
	if ( nChgColors )
2925
	{
2926
		//Swap start and end color
2927
		Color aZwi( aCol1 );
2928
		aCol1 = aCol2;
2929
		aCol2 = aZwi;
2930
		//Swap two colors' transparency
2931
		double dTemp = dTrans;
2932
		dTrans = dBackTrans;
2933
		dBackTrans = dTemp;
2934
	}
2935
	
2936
	//Construct gradient item
2937
	XGradient aGrad( aCol2, aCol1, eGrad, nAngle, nFocusX, nFocusY );
2938
	//Intensity has been merged into color. So here just set is as 100
2939
	aGrad.SetStartIntens( 100 );
2940
	aGrad.SetEndIntens( 100 );
2941
	aSet.Put( XFillGradientItem( String(), aGrad ) );
2942
	//Construct tranparency item. This item can coodinate with both solid and gradient.
2943
	if ( dTrans < 1.0 || dBackTrans < 1.0 )
2944
	{
2945
		sal_uInt8 nStartCol = (sal_uInt8)( (1 - dTrans )* 255 );
2946
		sal_uInt8 nEndCol = (sal_uInt8)( ( 1- dBackTrans ) * 255 );
2947
		aCol1 = Color(nStartCol, nStartCol, nStartCol);
2948
		aCol2 = Color(nEndCol, nEndCol, nEndCol);
2949
		
2950
		XGradient aGrad2( aCol2 ,  aCol1 , eGrad, nAngle, nFocusX, nFocusY );
2951
		aSet.Put( XFillFloatTransparenceItem( String(), aGrad2 ) );
2952
	}
2953
}
2954
2892
//---------------------------------------------------------------------------
2955
//---------------------------------------------------------------------------
2893
//- Record Manager ----------------------------------------------------------
2956
//- Record Manager ----------------------------------------------------------
2894
//---------------------------------------------------------------------------
2957
//---------------------------------------------------------------------------
Lines 4213-4218 Link Here
4213
	DffObjData aObjData( rHd, rClientRect, nCalledByGroup );
4276
	DffObjData aObjData( rHd, rClientRect, nCalledByGroup );
4214
	aObjData.bRotateTextWithShape = ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_EXCEL ) == 0;
4277
	aObjData.bRotateTextWithShape = ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_EXCEL ) == 0;
4215
	maShapeRecords.Consume( rSt, sal_False );
4278
	maShapeRecords.Consume( rSt, sal_False );
4279
	if( maShapeRecords.SeekToContent( rSt,
4280
		DFF_msofbtUDefProp,
4281
		SEEK_FROM_BEGINNING ) )
4282
	{
4283
		sal_uInt32  nBytesLeft = maShapeRecords.Current()->nRecLen;
4284
		sal_uInt32	nUDData;
4285
		sal_uInt16  nPID;
4286
		while( 5 < nBytesLeft )
4287
		{
4288
			rSt >> nPID;
4289
			if ( rSt.GetError() != 0 )
4290
				break;
4291
			rSt >> nUDData;						
4292
			if ( rSt.GetError() != 0 )
4293
				break;
4294
			if ( nPID == 447 ) // 
4295
			{
4296
				mbRotateGranientFillWithAngle = nUDData & 0x20;
4297
				break;
4298
			}
4299
			nBytesLeft  -= 6;
4300
		}
4301
	}
4216
	aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp, SEEK_FROM_BEGINNING );
4302
	aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp, SEEK_FROM_BEGINNING );
4217
	if ( aObjData.bShapeType )
4303
	if ( aObjData.bShapeType )
4218
	{
4304
	{
(-)sd/source/filter/eppt/epptso.cxx (-12 / +12 lines)
Lines 4132-4138 Link Here
4132
		aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
4132
		aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
4133
		aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
4133
		aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
4134
		aPropOpt.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
4134
		aPropOpt.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
4135
		aPropOpt.CreateFillProperties( mXPropSet, sal_True );
4135
		aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
4136
		sal_uInt32 nLineFlags = 0x90001;
4136
		sal_uInt32 nLineFlags = 0x90001;
4137
		if ( aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
4137
		if ( aPropOpt.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
4138
			nLineFlags |= 0x10001;  // draw dashed line if no line
4138
			nLineFlags |= 0x10001;  // draw dashed line if no line
Lines 4191-4197 Link Here
4191
    mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
4191
    mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
4192
    ImplCreateShape( ESCHER_ShpInst_TextBox, 0xa00, rSolver );
4192
    ImplCreateShape( ESCHER_ShpInst_TextBox, 0xa00, rSolver );
4193
    if ( bFill )
4193
    if ( bFill )
4194
        rPropOpt.CreateFillProperties( mXPropSet, sal_True );
4194
        rPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
4195
	if ( ImplGetText() )
4195
	if ( ImplGetText() )
4196
		rPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
4196
		rPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
4197
}
4197
}
Lines 4353-4359 Link Here
4353
				{
4353
				{
4354
	                ImplCreateShape( eShapeType, nMirrorFlags | 0xa00, aSolverContainer );
4354
	                ImplCreateShape( eShapeType, nMirrorFlags | 0xa00, aSolverContainer );
4355
					aPropOpt.CreateCustomShapeProperties( eShapeType, mXShape );
4355
					aPropOpt.CreateCustomShapeProperties( eShapeType, mXShape );
4356
					aPropOpt.CreateFillProperties( mXPropSet, sal_True );
4356
					aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape);
4357
					if ( ImplGetText() )
4357
					if ( ImplGetText() )
4358
					{
4358
					{
4359
						if ( !aPropOpt.IsFontWork() )
4359
						if ( !aPropOpt.IsFontWork() )
Lines 4387-4393 Link Here
4387
                {
4387
                {
4388
                    ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, aSolverContainer );          // Flags: Connector | HasSpt
4388
                    ImplCreateShape( ESCHER_ShpInst_Rectangle, 0xa00, aSolverContainer );          // Flags: Connector | HasSpt
4389
                }
4389
                }
4390
                aPropOpt.CreateFillProperties( mXPropSet, sal_True );
4390
                aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
4391
				if ( ImplGetText() )
4391
				if ( ImplGetText() )
4392
					aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
4392
					aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
4393
            }
4393
            }
Lines 4425-4431 Link Here
4425
                {
4425
                {
4426
                    mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
4426
                    mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
4427
                    ImplCreateShape( ESCHER_ShpInst_Ellipse, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
4427
                    ImplCreateShape( ESCHER_ShpInst_Ellipse, 0xa00, aSolverContainer );            // Flags: Connector | HasSpt
4428
                    aPropOpt.CreateFillProperties( mXPropSet, sal_True );
4428
                    aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
4429
					if ( ImplGetText() )
4429
					if ( ImplGetText() )
4430
						aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
4430
						aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_False );
4431
				}
4431
				}
Lines 4477-4483 Link Here
4477
                        case POLY_CHORD :
4477
                        case POLY_CHORD :
4478
                        {
4478
                        {
4479
                            if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, &aPolygon ) )
4479
                            if ( aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, &aPolygon ) )
4480
                                aPropOpt.CreateFillProperties( mXPropSet, sal_True );
4480
                                aPropOpt.CreateFillProperties( mXPropSet, sal_True , mXShape );
4481
                        }
4481
                        }
4482
                        break;
4482
                        break;
4483
4483
Lines 4690-4696 Link Here
4690
                maRect = ImplMapRectangle( aNewRect );
4690
                maRect = ImplMapRectangle( aNewRect );
4691
                maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
4691
                maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
4692
                maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
4692
                maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
4693
                aPropOpt.CreateFillProperties( mXPropSet, sal_True );
4693
                aPropOpt.CreateFillProperties( mXPropSet, sal_True , mXShape );
4694
                mnAngle = 0;
4694
                mnAngle = 0;
4695
            }
4695
            }
4696
            else if ( bPolyLine )
4696
            else if ( bPolyLine )
Lines 4750-4756 Link Here
4750
                maRect = ImplMapRectangle( aNewRect );
4750
                maRect = ImplMapRectangle( aNewRect );
4751
                maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
4751
                maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() );
4752
                maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
4752
                maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() );
4753
                aPropOpt.CreateFillProperties( mXPropSet, sal_True );
4753
                aPropOpt.CreateFillProperties( mXPropSet, sal_True , mXShape );
4754
                mnAngle = 0;
4754
                mnAngle = 0;
4755
            }
4755
            }
4756
            else if ( ( mType == "drawing.GraphicObject" ) || ( mType == "presentation.GraphicObject" ) )
4756
            else if ( ( mType == "drawing.GraphicObject" ) || ( mType == "presentation.GraphicObject" ) )
Lines 4863-4869 Link Here
4863
								aPropertyOptions.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
4863
								aPropertyOptions.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x110001 );
4864
								aPropertyOptions.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
4864
								aPropertyOptions.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
4865
								aPropertyOptions.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
4865
								aPropertyOptions.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
4866
								aPropertyOptions.CreateFillProperties( mXPropSet, sal_True );
4866
								aPropertyOptions.CreateFillProperties( mXPropSet, sal_True, mXShape );
4867
								sal_uInt32 nLineFlags = 0x90001;
4867
								sal_uInt32 nLineFlags = 0x90001;
4868
								if ( aPropertyOptions.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
4868
								if ( aPropertyOptions.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
4869
									nLineFlags |= 0x10001;  // draw dashed line if no line
4869
									nLineFlags |= 0x10001;  // draw dashed line if no line
Lines 4908-4914 Link Here
4908
							nPlaceHolderAtom = rLayout.nTypeOfTitle;
4908
							nPlaceHolderAtom = rLayout.nTypeOfTitle;
4909
							ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer );          // Flags: HaveAnchor | HaveMaster
4909
							ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer );          // Flags: HaveAnchor | HaveMaster
4910
							aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterTitle );
4910
							aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterTitle );
4911
							aPropOpt.CreateFillProperties( mXPropSet, sal_True );
4911
							aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
4912
							aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
4912
							aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
4913
							ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
4913
							ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
4914
							if ( mbEmptyPresObj )
4914
							if ( mbEmptyPresObj )
Lines 4957-4963 Link Here
4957
								aPropOpt2.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
4957
								aPropOpt2.AddOpt( ESCHER_Prop_lineColor, 0x8000001 );
4958
								aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90001 );
4958
								aPropOpt2.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x90001 );
4959
								aPropOpt2.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
4959
								aPropOpt2.AddOpt( ESCHER_Prop_shadowColor, 0x8000002 );
4960
								aPropOpt2.CreateFillProperties( mXPropSet, sal_True );
4960
								aPropOpt2.CreateFillProperties( mXPropSet, sal_True, mXShape  );
4961
								sal_uInt32 nLineFlags = 0x90001;
4961
								sal_uInt32 nLineFlags = 0x90001;
4962
								if ( aPropOpt2.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
4962
								if ( aPropOpt2.GetOpt( ESCHER_Prop_fNoLineDrawDash, nLineFlags ) )
4963
									nLineFlags |= 0x10001;  // draw dashed line if no line
4963
									nLineFlags |= 0x10001;  // draw dashed line if no line
Lines 5006-5012 Link Here
5006
							mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
5006
							mpPptEscherEx->OpenContainer( ESCHER_SpContainer );
5007
							ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer );          // Flags: HaveAnchor | HaveMaster
5007
							ImplCreateShape( ESCHER_ShpInst_Rectangle, 0x220, aSolverContainer );          // Flags: HaveAnchor | HaveMaster
5008
							aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
5008
							aPropOpt.AddOpt( ESCHER_Prop_hspMaster, mnShapeMasterBody );
5009
							aPropOpt.CreateFillProperties( mXPropSet, sal_True );
5009
							aPropOpt.CreateFillProperties( mXPropSet, sal_True, mXShape );
5010
							aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
5010
							aPropOpt.CreateTextProperties( mXPropSet, mnTxId += 0x60, sal_False, sal_True );
5011
							ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
5011
							ImplAdjustFirstLineLineSpacing( aTextObj, aPropOpt );
5012
							if ( mbEmptyPresObj )
5012
							if ( mbEmptyPresObj )

Return to issue 120554