[ooo-build-commit] patches/dev300
Thorsten Behrens
thorsten at kemper.freedesktop.org
Fri Jun 12 14:13:33 PDT 2009
patches/dev300/ppt-customshape-shading-fix.diff | 159 ++++++++++++++++--------
1 file changed, 106 insertions(+), 53 deletions(-)
New commits:
commit e4f1844510779150ef32ffb9560f589ed0d9d0a0
Author: Thorsten Behrens <tbehrens at novell.com>
Date: Fri Jun 12 23:11:50 2009 +0200
Improved custom shape coloring fix, added bitmaps & hatchs
* patches/dev300/ppt-customshape-shading-fix.diff: added color
modifications also for bitmap and hatch fills
diff --git a/patches/dev300/ppt-customshape-shading-fix.diff b/patches/dev300/ppt-customshape-shading-fix.diff
index 2f79937..71bc91b 100644
--- a/patches/dev300/ppt-customshape-shading-fix.diff
+++ b/patches/dev300/ppt-customshape-shading-fix.diff
@@ -5,26 +5,30 @@ From: Thorsten Behrens <thb at openoffice.org>
---
- svx/source/customshapes/EnhancedCustomShape2d.cxx | 195 ++++++++++++---------
- svx/source/customshapes/EnhancedCustomShape2d.hxx | 2
+ svx/source/customshapes/EnhancedCustomShape2d.cxx | 248 +++++++++++++--------
+ svx/source/customshapes/EnhancedCustomShape2d.hxx | 5
svx/source/msfilter/msdffimp.cxx | 9 -
- 3 files changed, 114 insertions(+), 92 deletions(-)
+ 3 files changed, 160 insertions(+), 102 deletions(-)
diff --git svx/source/customshapes/EnhancedCustomShape2d.cxx svx/source/customshapes/EnhancedCustomShape2d.cxx
-index 0361511..a235e8c 100644
+index 0361511..796cd40 100644
--- svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ svx/source/customshapes/EnhancedCustomShape2d.cxx
-@@ -55,6 +55,8 @@
+@@ -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 +66,7 @@
+@@ -64,6 +70,7 @@
#include <boost/shared_ptr.hpp>
#endif
#include <basegfx/numeric/ftools.hxx>
@@ -32,7 +36,7 @@ index 0361511..a235e8c 100644
#include <basegfx/polygon/b2dpolygon.hxx>
// #i76201#
-@@ -724,23 +727,23 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
+@@ -724,23 +731,23 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
/*const sal_Int32* pDefData =*/ ApplyShapeAttributes( rGeometryItem );
switch( eSpType )
{
@@ -73,7 +77,7 @@ index 0361511..a235e8c 100644
case mso_sptNil :
{
if( sShapeType.getLength() > 4 &&
-@@ -775,7 +778,7 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
+@@ -775,7 +782,7 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
}
break;
case mso_sptCurvedDownArrow : nFlags |= DFF_CUSTOMSHAPE_EXCH; break;
@@ -82,7 +86,7 @@ index 0361511..a235e8c 100644
case mso_sptRibbon :
{
if ( ( seqAdjustmentValues.getLength() > 1 ) && ( seqAdjustmentValues[ 1 ].State == com::sun::star::beans::PropertyState_DIRECT_VALUE ) )
-@@ -786,10 +789,10 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
+@@ -786,10 +793,10 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
seqAdjustmentValues[ 1 ].Value <<= fValue;
}
nFlags |= DFF_CUSTOMSHAPE_FLIP_V;
@@ -95,7 +99,7 @@ index 0361511..a235e8c 100644
case mso_sptEllipseRibbon : // !!!!!!!!!!
{
if ( ( seqAdjustmentValues.getLength() > 1 ) && ( seqAdjustmentValues[ 1 ].State == com::sun::star::beans::PropertyState_DIRECT_VALUE ) )
-@@ -800,11 +803,11 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
+@@ -800,11 +807,11 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) :
seqAdjustmentValues[ 1 ].Value <<= fValue;
}
nFlags |= DFF_CUSTOMSHAPE_FLIP_V;
@@ -110,23 +114,32 @@ index 0361511..a235e8c 100644
default:
break;
}
-@@ -1069,35 +1072,38 @@ Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 n
+@@ -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;
+- Color aRetColor;
++ const sal_uInt32 nCount = nColorData >> 28;
++ if ( !nCount )
++ return 0;
- sal_uInt32 i, nColor, nTmp, nCount = nColorData >> 28;
--
-+ const sal_uInt32 nCount = nColorData >> 28;
- if ( nCount )
- {
- if ( nIndex >= nCount )
- nIndex = nCount - 1;
++ 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 nLumDat = nColorData << ( ( 1 + nIndex ) << 2 );
- sal_Int32 nLuminance = ( nLumDat >> 28 ) * 12;
-
- nTmp = nFillColor;
@@ -144,35 +157,45 @@ index 0361511..a235e8c 100644
- nColor |= nC << 16;
- }
- aRetColor = Color( (sal_uInt8)nColor, (sal_uInt8)( nColor >> 8 ), (sal_uInt8)( nColor >> 16 ) );
-+ sal_Int32 nLuminance = ( nLumDat >> 28 ) * 10;
+- }
+- return aRetColor;
++ const sal_Int32 nLumDat = nColorData << ( ( 1 + nIndex ) << 2 );
++ return ( nLumDat >> 28 ) * 10;
++}
+
-+ 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());
-+ }
++Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 nIndex ) const
++{
++ const sal_Int32 nLuminance = GetLuminanceChange(nIndex);
++ if( !nLuminance )
++ return rFillColor;
+
-+ aHSVColor = basegfx::tools::hsv2rgb(aHSVColor);
-+ aRetColor = 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 ) );
- }
- return aRetColor;
++ 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 ) );
}
-@@ -1713,6 +1719,16 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm
+
+ Rectangle EnhancedCustomShape2d::GetTextRect() const
+@@ -1713,6 +1727,16 @@ void EnhancedCustomShape2d::CreateSubPath( sal_uInt16& rSrcPt, sal_uInt16& rSegm
if(aNewB2DPolyPolygon.count())
{
@@ -189,7 +212,7 @@ index 0361511..a235e8c 100644
// #i37011#
bool bForceCreateTwoObjects(false);
-@@ -1882,6 +1898,51 @@ void CorrectCalloutArrows( MSO_SPT eSpType, sal_uInt32 nLineObjectCount, std::ve
+@@ -1882,6 +1906,78 @@ void CorrectCalloutArrows( MSO_SPT eSpType, sal_uInt32 nLineObjectCount, std::ve
}
}
@@ -232,6 +255,33 @@ index 0361511..a235e8c 100644
+ 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 )
@@ -241,7 +291,7 @@ index 0361511..a235e8c 100644
SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnly )
{
-@@ -1906,18 +1967,10 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
+@@ -1906,18 +2002,10 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
if ( vObjectList.size() )
{
const SfxItemSet& rCustomShapeSet = pCustomShapeObj->GetMergedItemSet();
@@ -260,7 +310,7 @@ index 0361511..a235e8c 100644
// #i37011# remove invisible objects
if(vObjectList.size())
{
-@@ -1927,7 +1980,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
+@@ -1927,7 +2015,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
{
SdrPathObj* pObj(vObjectList[i]);
const XLineStyle eLineStyle = ((const XLineStyleItem&)pObj->GetMergedItem(XATTR_LINESTYLE)).GetValue();
@@ -269,7 +319,7 @@ index 0361511..a235e8c 100644
//SJ: #i40600# if bLineGeometryNeededOnly is set linystyle does not matter
if( !bLineGeometryNeededOnly && ( XLINE_NONE == eLineStyle ) && ( XFILL_NONE == eFillStyle ) )
-@@ -1942,26 +1995,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
+@@ -1942,26 +2030,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
if(1L == vObjectList.size())
{
// a single object, correct some values
@@ -297,7 +347,7 @@ index 0361511..a235e8c 100644
}
else
{
-@@ -1980,16 +2014,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
+@@ -1980,16 +2049,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl
else
{
nAreaObjectCount++;
@@ -316,13 +366,16 @@ index 0361511..a235e8c 100644
}
diff --git svx/source/customshapes/EnhancedCustomShape2d.hxx svx/source/customshapes/EnhancedCustomShape2d.hxx
-index 9d0f04b..077bce0 100644
+index 9d0f04b..fc28b3d 100644
--- svx/source/customshapes/EnhancedCustomShape2d.hxx
+++ svx/source/customshapes/EnhancedCustomShape2d.hxx
-@@ -121,6 +121,8 @@ class EnhancedCustomShape2d : public SfxItemSet
+@@ -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 );
+- 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&,
More information about the ooo-build-commit
mailing list