[ooo-build-commit] patches/dev300

Thorsten Behrens thorsten at kemper.freedesktop.org
Mon Nov 16 06:49:12 PST 2009


 patches/dev300/apply                            |    2 
 patches/dev300/ppt-customshape-shading-fix.diff |  399 ------------------------
 2 files changed, 13 insertions(+), 388 deletions(-)

New commits:
commit eca8d6784f70cf44b529d5a0ef4a25741c92f2fb
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Mon Nov 16 13:36:24 2009 +0100

    Add missing patch to upstreamed shape gradient fix
    
    * patches/dev300/apply: added patch back
    * patches/dev300/ppt-customshape-shading-fix.diff: missing fixes

diff --git a/patches/dev300/apply b/patches/dev300/apply
index bfd6dc7..18f6c4e 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3382,6 +3382,8 @@ sw-ww8-import-list-fix.diff, Fong, n#547308
 sw-changes-format-fix.diff, Fong, n#545815
 # short/ushort mixup
 sw-doc-image-export-size.diff, bnc#554549, i#59648, tml
+# add missing patch to upstreamed ppt gradient fix
+ppt-customshape-shading-fix.diff, i#102797, thorsten
 
 [ NLPSolverBits ]
 # build NLPSolver extension when enabled (fate#304653)
diff --git a/patches/dev300/ppt-customshape-shading-fix.diff b/patches/dev300/ppt-customshape-shading-fix.diff
index 80c8b88..3fa4afb 100644
--- a/patches/dev300/ppt-customshape-shading-fix.diff
+++ b/patches/dev300/ppt-customshape-shading-fix.diff
@@ -1,415 +1,38 @@
-Fix the custom shape gradient behaviour, plus shaded fill colors
+Fill subgeometry of customshapes properly
 
 From: Thorsten Behrens <thb at openoffice.org>
 
 
 ---
 
- svx/source/customshapes/EnhancedCustomShape2d.cxx |  252 +++++++++++++--------
- svx/source/customshapes/EnhancedCustomShape2d.hxx |    5 
- svx/source/msfilter/msdffimp.cxx                  |    9 -
- 3 files changed, 164 insertions(+), 102 deletions(-)
+ svx/source/customshapes/EnhancedCustomShape2d.cxx |   16 ++++++++++++++++
+ 1 files changed, 16 insertions(+), 0 deletions(-)
 
 
 diff --git svx/source/customshapes/EnhancedCustomShape2d.cxx svx/source/customshapes/EnhancedCustomShape2d.cxx
-index 0361511..daf4454 100644
+index ed0b16b..15f69b3 100644
 --- svx/source/customshapes/EnhancedCustomShape2d.cxx
 +++ svx/source/customshapes/EnhancedCustomShape2d.cxx
-@@ -55,6 +55,12 @@
- #include <svx/xlnedwit.hxx>
- #include <svx/xlnstcit.hxx>
- #include <svx/xlnedcit.hxx>
-+#include <svx/xflgrit.hxx>
-+#include <svx/xflhtit.hxx>
-+#include <svx/xbtmpit.hxx>
-+#include <svx/xgrad.hxx>
-+#include <svx/xbitmap.hxx>
-+#include <svx/xhatch.hxx>
- #include <com/sun/star/awt/Size.hpp>
- #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
- #ifndef __COM_SUN_STAR_DRAWING_ENHANCEDCUSTOMSHAPESEGMENTCOMMAND_HPP__
-@@ -64,6 +70,7 @@
- #include <boost/shared_ptr.hpp>
- #endif
- #include <basegfx/numeric/ftools.hxx>
-+#include <basegfx/color/bcolortools.hxx>
- #include <basegfx/polygon/b2dpolygon.hxx>
+@@ -1710,6 +1710,22 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm
  
- // #i76201#
-@@ -724,23 +731,23 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
- 	/*const sal_Int32* pDefData =*/ ApplyShapeAttributes( rGeometryItem );
- 	switch( eSpType )
- 	{
--		case mso_sptCan :						nColorData = 0x20200000; break;
--		case mso_sptCube :						nColorData = 0x302d0000; break;
--		case mso_sptActionButtonBlank :			nColorData = 0x502ad400; break;
--		case mso_sptActionButtonHome :			nColorData = 0x702ad4ad; break;
--		case mso_sptActionButtonHelp :			nColorData = 0x602ad4a0; break;
--		case mso_sptActionButtonInformation :	nColorData = 0x702ad4a5; break;
--		case mso_sptActionButtonBackPrevious :	nColorData = 0x602ad4a0; break;
--		case mso_sptActionButtonForwardNext :	nColorData = 0x602ad4a0; break;
--		case mso_sptActionButtonBeginning :		nColorData = 0x602ad4a0; break;
--		case mso_sptActionButtonEnd :			nColorData = 0x602ad4a0; break;
--		case mso_sptActionButtonReturn :		nColorData = 0x602ad4a0; break;
--		case mso_sptActionButtonDocument :		nColorData = 0x702ad4da; break;
--		case mso_sptActionButtonSound :			nColorData = 0x602ad4a0; break;
--		case mso_sptActionButtonMovie :			nColorData = 0x602ad4a0; break;
--		case mso_sptBevel :						nColorData = 0x502ad400; break;
--		case mso_sptFoldedCorner :				nColorData = 0x20d00000; break;
--		case mso_sptSmileyFace :				nColorData = 0x20d00000; break;
-+		case mso_sptCan :						nColorData = 0x20400000; break;
-+		case mso_sptCube :						nColorData = 0x302e0000; break;
-+		case mso_sptActionButtonBlank :			nColorData = 0x502ce400; break;
-+		case mso_sptActionButtonHome :			nColorData = 0x702ce4ce; break;
-+		case mso_sptActionButtonHelp :			nColorData = 0x602ce4c0; break;
-+		case mso_sptActionButtonInformation :	nColorData = 0x702ce4c5; break;
-+		case mso_sptActionButtonBackPrevious :	nColorData = 0x602ce4c0; break;
-+		case mso_sptActionButtonForwardNext :	nColorData = 0x602ce4c0; break;
-+		case mso_sptActionButtonBeginning :		nColorData = 0x602ce4c0; break;
-+		case mso_sptActionButtonEnd :			nColorData = 0x602ce4c0; break;
-+		case mso_sptActionButtonReturn :		nColorData = 0x602ce4c0; break;
-+		case mso_sptActionButtonDocument :		nColorData = 0x702ce4ec; break;
-+		case mso_sptActionButtonSound :			nColorData = 0x602ce4c0; break;
-+		case mso_sptActionButtonMovie :			nColorData = 0x602ce4c0; break;
-+		case mso_sptBevel :						nColorData = 0x502ce400; break;
-+		case mso_sptFoldedCorner :				nColorData = 0x20e00000; break;
-+		case mso_sptSmileyFace :				nColorData = 0x20e00000; break;
-         case mso_sptNil :
-         {
-             if( sShapeType.getLength() > 4 &&
-@@ -775,7 +782,7 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
- 		}
- 		break;
- 		case mso_sptCurvedDownArrow :			nFlags |= DFF_CUSTOMSHAPE_EXCH; break;
--		case mso_sptRibbon2 :					nColorData = 0x30dd0000; break;
-+		case mso_sptRibbon2 :					nColorData = 0x30ee0000; break;
- 		case mso_sptRibbon :
- 		{
- 			if ( ( seqAdjustmentValues.getLength() > 1 ) && ( seqAdjustmentValues[ 1 ].State == com::sun::star::beans::PropertyState_DIRECT_VALUE ) )
-@@ -786,10 +793,10 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
- 				seqAdjustmentValues[ 1 ].Value <<= fValue;
- 			}
- 			nFlags |= DFF_CUSTOMSHAPE_FLIP_V;
--			nColorData = 0x30dd0000;
-+			nColorData = 0x30ee0000;
- 		}
- 		break;
--		case mso_sptEllipseRibbon2 :			nColorData = 0x30dd0000; break;
-+		case mso_sptEllipseRibbon2 :			nColorData = 0x30ee0000; break;
- 		case mso_sptEllipseRibbon :				// !!!!!!!!!!
- 		{
- 			if ( ( seqAdjustmentValues.getLength() > 1 ) && ( seqAdjustmentValues[ 1 ].State == com::sun::star::beans::PropertyState_DIRECT_VALUE ) )
-@@ -800,11 +807,11 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
- 				seqAdjustmentValues[ 1 ].Value <<= fValue;
- 			}
- 			nFlags |= DFF_CUSTOMSHAPE_FLIP_V;
--			nColorData = 0x30dd0000;
-+			nColorData = 0x30ee0000;
- 		}
- 		break;
--		case mso_sptVerticalScroll :			nColorData = 0x30dd0000; break;
--		case mso_sptHorizontalScroll :			nColorData = 0x30dd0000; break;
-+		case mso_sptVerticalScroll :			nColorData = 0x30ee0000; break;
-+		case mso_sptHorizontalScroll :			nColorData = 0x30ee0000; break;
- 		default:
- 			break;
- 	}
-@@ -1065,41 +1072,48 @@ sal_Bool EnhancedCustomShape2d::GetParameter( double& rRetValue, const EnhancedC
- // nLumDat 27-24 = nLumDatEntry 0
- // nLumDat 23-20 = nLumDatEntry 1 ...
- // each 4bit entry is to be interpreted as a 10 percent signed luminance changing
--Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 nIndex )
-+sal_Int32 EnhancedCustomShape2d::GetLuminanceChange( sal_uInt32 nIndex ) const
- {
--	Color aRetColor;
-+	const sal_uInt32 nCount = nColorData >> 28;
-+	if ( !nCount )
-+        return 0;
- 
--	sal_uInt32 i, nColor, nTmp, nCount = nColorData >> 28;
-+    if ( nIndex >= nCount )
-+        nIndex = nCount - 1;
- 
--	if ( nCount )
--	{
--		if ( nIndex >= nCount )
--			nIndex = nCount - 1;
--
--		sal_uInt32 nFillColor = (sal_uInt32)rFillColor.GetRed() |
--									((sal_uInt32)rFillColor.GetGreen() << 8 ) |
--										((sal_uInt32)rFillColor.GetBlue() << 16 );
--
--		sal_Int32 nLumDat = nColorData << ( ( 1 + nIndex ) << 2 );
--		sal_Int32 nLuminance = ( nLumDat >> 28 ) * 12;
--
--		nTmp = nFillColor;
--		nColor = 0;
--		for ( i = 0; i < 3; i++ )
--		{
--			sal_Int32 nC = (sal_uInt8)nTmp;
--			nTmp >>= 8;
--			nC += ( ( nLuminance * nC ) >> 8 );
--			if ( nC < 0 )
--				nC = 0;
--			else if ( nC &~ 0xff )
--				nC = 0xff;
--			nColor >>= 8;
--			nColor |= nC << 16;
--		}
--		aRetColor = Color( (sal_uInt8)nColor, (sal_uInt8)( nColor >> 8 ), (sal_uInt8)( nColor >> 16 ) );
--	}
--	return aRetColor;
-+    const sal_Int32 nLumDat = nColorData << ( ( 1 + nIndex ) << 2 );
-+    return ( nLumDat >> 28 ) * 10;
-+}
-+
-+Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 nIndex ) const
-+{
-+    const sal_Int32 nLuminance = GetLuminanceChange(nIndex);
-+    if( !nLuminance )
-+        return rFillColor;
-+
-+    basegfx::BColor aHSVColor=
-+        basegfx::tools::rgb2hsv(
-+            basegfx::BColor(rFillColor.GetRed()/255.0,
-+                            rFillColor.GetGreen()/255.0,
-+                            rFillColor.GetBlue()/255.0));
-+    if( nLuminance > 0 )
-+    {
-+        aHSVColor.setGreen(
-+            aHSVColor.getGreen() * (1.0-nLuminance/100.0));
-+        aHSVColor.setBlue(
-+            nLuminance/100.0 + 
-+            (1.0-nLuminance/100.0)*aHSVColor.getBlue());
-+    }
-+    else if( nLuminance < 0 )
-+    {
-+        aHSVColor.setBlue(
-+            (1.0+nLuminance/100.0)*aHSVColor.getBlue());
-+    }
-+
-+    aHSVColor = basegfx::tools::hsv2rgb(aHSVColor);
-+    return Color( (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getRed(),0.0,1.0) * 255.0 + 0.5 ), 
-+                  (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getGreen(),0.0,1.0) * 255.0 + 0.5 ),
-+                  (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getBlue(),0.0,1.0) * 255.0 + 0.5 ) );
- }
- 
- Rectangle EnhancedCustomShape2d::GetTextRect() const
-@@ -1713,6 +1727,20 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm
- 
- 	if(aNewB2DPolyPolygon.count())
- 	{
+     if(aNewB2DPolyPolygon.count())
+     {
 +        if( !bLineGeometryNeededOnly )
 +        {
 +            // hack aNewB2DPolyPolygon to fill logic rect - this is
 +            // needed to produce gradient fills that look like mso
 +            aNewB2DPolygon.clear();
 +            aNewB2DPolygon.append(basegfx::B2DPoint(0,0));
++            aNewB2DPolygon.setClosed(true);
 +            aNewB2DPolyPolygon.append(aNewB2DPolygon);
 +
 +            aNewB2DPolygon.clear();
 +            aNewB2DPolygon.append(basegfx::B2DPoint(aLogicRect.GetWidth(),
 +                                                    aLogicRect.GetHeight()));
++            aNewB2DPolygon.setClosed(true);
 +            aNewB2DPolyPolygon.append(aNewB2DPolygon);
 +        }
 +
- 		// #i37011#
- 		bool bForceCreateTwoObjects(false);
- 
-@@ -1882,6 +1910,78 @@ void CorrectCalloutArrows( MSO_SPT eSpType, sal_uInt32 nLineObjectCount, std::ve
- 	}
- }
- 
-+void EnhancedCustomShape2d::AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rCustomShapeSet, 
-+                                          sal_uInt32& nColorIndex, sal_uInt32 nColorCount)
-+{
-+    if ( !rObj.IsLine() )
-+    {
-+        const XFillStyle eFillStyle = ((const XFillStyleItem&)rObj.GetMergedItem(XATTR_FILLSTYLE)).GetValue();
-+        switch( eFillStyle )
-+        {
-+            default:
-+            case XFILL_SOLID:
-+            {
-+                Color aFillColor;
-+                if ( nColorCount )
-+                {
-+                    aFillColor = GetColorData( 
-+                        ((XFillColorItem&)rCustomShapeSet.Get( XATTR_FILLCOLOR )).GetColorValue(), 
-+                        std::min(nColorIndex, nColorCount-1) );
-+                    rObj.SetMergedItem( XFillColorItem( String(), aFillColor ) );
-+                }
-+                break;
-+            }
-+            case XFILL_GRADIENT:
-+            {
-+                XGradient aXGradient(((const XFillGradientItem&)rObj.GetMergedItem(XATTR_FILLGRADIENT)).GetGradientValue());
-+                if ( nColorCount )
-+                {
-+                    aXGradient.SetStartColor(
-+                        GetColorData(
-+                            aXGradient.GetStartColor(), 
-+                            std::min(nColorIndex, nColorCount-1) ));
-+                    aXGradient.SetEndColor(
-+                        GetColorData(
-+                            aXGradient.GetEndColor(), 
-+                            std::min(nColorIndex, nColorCount-1) ));
-+                }
-+
-+                rObj.SetMergedItem( XFillGradientItem( String(), aXGradient ) );
-+                break;
-+            }
-+            case XFILL_HATCH:
-+            {
-+                XHatch aXHatch(((const XFillHatchItem&)rObj.GetMergedItem(XATTR_FILLHATCH)).GetHatchValue());
-+                if ( nColorCount )
-+                {
-+                    aXHatch.SetColor(
-+                        GetColorData(
-+                            aXHatch.GetColor(), 
-+                            std::min(nColorIndex, nColorCount-1) ));
-+                }
-+
-+                rObj.SetMergedItem( XFillHatchItem( String(), aXHatch ) );
-+                break;
-+            }
-+            case XFILL_BITMAP:
-+            {
-+                Bitmap aBitmap(((const XFillBitmapItem&)rObj.GetMergedItem(XATTR_FILLBITMAP)).GetBitmapValue().GetBitmap());
-+                if ( nColorCount )
-+                {
-+                    aBitmap.Adjust(
-+                        GetLuminanceChange(
-+                            std::min(nColorIndex, nColorCount-1)));
-+                }
-+
-+                rObj.SetMergedItem( XFillBitmapItem( String(), aBitmap ) );
-+                break;
-+            }
-+        }
-+
-+        if ( nColorIndex < nColorCount )
-+            nColorIndex++;
-+    }
-+}
- 
- SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnly )
- {
-@@ -1906,18 +2006,10 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
- 	if ( vObjectList.size() )
- 	{
- 		const SfxItemSet& rCustomShapeSet = pCustomShapeObj->GetMergedItemSet();
--		// For primitive rendering, shadow handling is done completely based on the geometry, so i removed it here
--		// const sal_Bool	bShadow(((SdrShadowItem&)rCustomShapeSet.Get( SDRATTR_SHADOW )).GetValue());
--		Color			aBasicColor( COL_WHITE );
- 		Color			aFillColor;
- 		sal_uInt32		nColorCount = nColorData >> 28;
- 		sal_uInt32		nColorIndex	= 0;
- 
--		if ( nColorCount )
--		{
--			aBasicColor = ((XFillColorItem&)rCustomShapeSet.Get( XATTR_FILLCOLOR )).GetColorValue();
--		}
--
- 		// #i37011# remove invisible objects
- 		if(vObjectList.size())
- 		{
-@@ -1927,7 +2019,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
- 			{
- 				SdrPathObj* pObj(vObjectList[i]);
- 				const XLineStyle eLineStyle = ((const XLineStyleItem&)pObj->GetMergedItem(XATTR_LINESTYLE)).GetValue();
--				const XFillStyle eFillStyle = ((const XFillStyleItem&)pObj->GetMergedItem(XATTR_FILLSTYLE)).GetValue();
-+                const XFillStyle eFillStyle = ((const XFillStyleItem&)pObj->GetMergedItem(XATTR_FILLSTYLE)).GetValue();
- 
- 				//SJ: #i40600# if bLineGeometryNeededOnly is set linystyle does not matter
- 				if( !bLineGeometryNeededOnly && ( XLINE_NONE == eLineStyle ) && ( XFILL_NONE == eFillStyle ) )
-@@ -1942,26 +2034,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
- 		if(1L == vObjectList.size())
- 		{
- 			// a single object, correct some values
--			SdrPathObj* pObj(vObjectList[0L]);
--
--// For primitive rendering, shadow handling is done completely based on the geometry, so i removed it here
--//			if(bShadow)
--//			{
--//				pObj->SetMergedItem(SdrShadowItem(sal_True));
--//			}
--
--			if(!pObj->IsLine())
--			{
--				if ( nColorIndex < nColorCount )
--				{
--					aFillColor = GetColorData( aBasicColor, nColorIndex++ );
--				}
--
--				if ( nColorCount )
--				{
--					pObj->SetMergedItem( XFillColorItem( String(), aFillColor ) );
--				}
--			}
-+            AdaptObjColor(*vObjectList[0L],rCustomShapeSet,nColorIndex,nColorCount);
- 		}
- 		else
- 		{
-@@ -1980,16 +2053,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
- 				else
- 				{
- 					nAreaObjectCount++;
--
--					if ( nColorIndex < nColorCount )
--					{
--						aFillColor = GetColorData( aBasicColor, nColorIndex++ );
--					}
--
--					if ( nColorCount )
--					{
--						pObj->SetMergedItem( XFillColorItem( String(), aFillColor ) );
--					}
-+                    AdaptObjColor(*pObj,rCustomShapeSet,nColorIndex,nColorCount);
- 				}
- 			}
- 
-diff --git svx/source/customshapes/EnhancedCustomShape2d.hxx svx/source/customshapes/EnhancedCustomShape2d.hxx
-index 9d0f04b..fc28b3d 100644
---- svx/source/customshapes/EnhancedCustomShape2d.hxx
-+++ svx/source/customshapes/EnhancedCustomShape2d.hxx
-@@ -120,7 +120,10 @@ class EnhancedCustomShape2d : public SfxItemSet
- 		sal_Int32					nRotateAngle;
- 
- 		sal_Bool					SetAdjustValueAsDouble( const double& rValue, const sal_Int32 nIndex );
--		Color						GetColorData( const Color& rFillColor, sal_uInt32 nIndex );
-+        sal_Int32                   GetLuminanceChange( sal_uInt32 nIndex ) const;
-+		Color						GetColorData( const Color& rFillColor, sal_uInt32 nIndex ) const;
-+        void                        AdaptObjColor(SdrPathObj& rObj, const SfxItemSet& rCustomShapeSet, 
-+                                                  sal_uInt32& nColorIndex, sal_uInt32 nColorCount);
- 		sal_Bool					GetParameter( double& rParameterReturnValue,  const com::sun::star::drawing::EnhancedCustomShapeParameter&,
- 													const sal_Bool bReplaceGeoWidth, const sal_Bool bReplaceGeoHeight ) const;
- 		Point						GetPoint( const com::sun::star::drawing::EnhancedCustomShapeParameterPair&,
-diff --git svx/source/msfilter/msdffimp.cxx svx/source/msfilter/msdffimp.cxx
-index 0ef0d6e..98b96cf 100644
---- svx/source/msfilter/msdffimp.cxx
-+++ svx/source/msfilter/msdffimp.cxx
-@@ -1668,12 +1668,7 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
- 			XGradientStyle eGrad = XGRAD_LINEAR;
- 			sal_Int32 nChgColors = 0;
- 
--			if ( !nAngle )
--				nChgColors ^= 1;
--
--			if ( !nFocus )
--				nChgColors ^= 1;
--			else if ( nFocus < 0 )		// Bei negativem Focus sind die Farben zu tauschen
-+			if ( nFocus < 0 )		// Bei negativem Focus sind die Farben zu tauschen
- 			{
- 				nFocus =- nFocus;
- 				nChgColors ^= 1;
-@@ -1681,8 +1676,8 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co
- 			if( nFocus > 40 && nFocus < 60 )
- 			{
- 				eGrad = XGRAD_AXIAL;	// Besser gehts leider nicht
--				nChgColors ^= 1;
- 			}
-+
- 			USHORT nFocusX = (USHORT)nFocus;
- 			USHORT nFocusY = (USHORT)nFocus;
+         // #i37011#
+         bool bForceCreateTwoObjects(false);
  


More information about the ooo-build-commit mailing list