ooo-build r11205 - branches/sled-10-ooo-build-2-3/patches/emf+



Author: rodo
Date: Mon Jan  7 11:09:20 2008
New Revision: 11205
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11205&view=rev

Log:
emf+ patches I forgot in last commit


Added:
   branches/sled-10-ooo-build-2-3/patches/emf+/
   branches/sled-10-ooo-build-2-3/patches/emf+/Makefile.am
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-line-width.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-smooth-poly.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-vcl-clear.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-vcl-non-closed-polygons.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas-emfplus.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas-polyaction.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas-renderer.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-offapi-renderer.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-offapi.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-scp2-renderer.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-svtools.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-vcl-bitmap.diff
   branches/sled-10-ooo-build-2-3/patches/emf+/emf+-vcl-renderer.diff

Added: branches/sled-10-ooo-build-2-3/patches/emf+/Makefile.am
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/Makefile.am	Mon Jan  7 11:09:20 2008
@@ -0,0 +1 @@
+EXTRA_DIST = $(wildcard *.diff)

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-line-width.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-line-width.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,15 @@
+--- /home/rodo/svn/ooo-build-reference/build/oog680-m5/canvas/source/cairo/cairo_canvashelper.cxx	2007-10-31 17:29:51.000000000 +0100
++++ canvas/source/cairo/cairo_canvashelper.cxx	2007-11-01 13:32:40.000000000 +0100
+@@ -1080,7 +1080,11 @@
+ 
+ 	    useStates( viewState, renderState, true );
+ 
+-	    cairo_set_line_width( mpCairo, strokeAttributes.StrokeWidth );
++        Matrix aMatrix;
++        double w = strokeAttributes.StrokeWidth, h = 0;
++        cairo_get_matrix( mpCairo, &aMatrix );
++        cairo_matrix_transform_distance( &aMatrix, &w, &h );
++	    cairo_set_line_width( mpCairo, w );
+ 	    cairo_set_miter_limit( mpCairo, strokeAttributes.MiterLimit );
+ 
+ 	    // FIXME: cairo doesn't handle end cap so far (rodo)

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-smooth-poly.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-smooth-poly.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,37 @@
+diff -rup canvas-orig-1/source/cairo/cairo_canvashelper.cxx canvas/source/cairo/cairo_canvashelper.cxx
+--- canvas-orig-1/source/cairo/cairo_canvashelper.cxx	2007-11-15 11:23:44.000000000 +0100
++++ canvas/source/cairo/cairo_canvashelper.cxx	2007-11-15 12:10:57.000000000 +0100
+@@ -55,6 +55,7 @@
+ #include <basegfx/point/b2dpoint.hxx>
+ #include <basegfx/polygon/b2dpolygon.hxx>
+ #include <basegfx/polygon/b2dpolypolygon.hxx>
++#include <basegfx/polygon/b2dpolygontools.hxx>
+ #include <basegfx/tools/canvastools.hxx>
+ 
+ #include <comphelper/sequence.hxx>
+@@ -928,6 +929,7 @@ namespace cairocanvas
+ 
+ 	    if( nPointCount > 1) {
+ 		bool bIsBezier = aPolygon.areControlPointsUsed();
++        bool bIsRectangle = ::basegfx::tools::isRectangle( aPolygon );
+ 		::basegfx::B2DPoint aA, aB, aP;
+ 
+ 		aP = aPolygon.getB2DPoint( 0 );
+@@ -936,7 +938,7 @@ namespace cairocanvas
+ 
+ 		cairo_matrix_transform_point( &aOrigMatrix, &nX, &nY );
+ 
+-		if( ! bIsBezier ) {
++		if( ! bIsBezier && bIsRectangle ) {
+ 		    nX = ::rtl::math::round( nX );
+ 		    nY = ::rtl::math::round( nY );
+ 		}
+@@ -961,7 +963,7 @@ namespace cairocanvas
+ 		    nY = aP.getY();
+ 		    cairo_matrix_transform_point( &aOrigMatrix, &nX, &nY );
+ 
+-		    if( ! bIsBezier ) {
++		    if( ! bIsBezier && bIsRectangle ) {
+ 			nX = ::rtl::math::round( nX );
+ 			nY = ::rtl::math::round( nY );
+ 		    }

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-vcl-clear.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-vcl-clear.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,25 @@
+diff -rup canvas-orig/source/vcl/canvashelper.cxx canvas/source/vcl/canvashelper.cxx
+--- canvas-orig/source/vcl/canvashelper.cxx	2007-11-12 10:22:38.000000000 +0100
++++ canvas/source/vcl/canvashelper.cxx	2007-11-12 10:36:46.000000000 +0100
+@@ -162,8 +162,8 @@ namespace vclcanvas
+             OutputDevice& rOutDev( mpOutDev->getOutDev() );
+ 
+             rOutDev.EnableMapMode( FALSE );
+-            rOutDev.SetLineColor( COL_WHITE );
+-            rOutDev.SetFillColor( COL_WHITE );
++            rOutDev.SetLineColor( COL_TRANSPARENT );
++            rOutDev.SetFillColor( COL_TRANSPARENT );
+             rOutDev.DrawRect( Rectangle( Point(),
+                                          rOutDev.GetOutputSizePixel()) );
+ 
+@@ -173,8 +173,8 @@ namespace vclcanvas
+                 
+                 rOutDev2.SetDrawMode( DRAWMODE_DEFAULT );
+                 rOutDev2.EnableMapMode( FALSE );
+-                rOutDev2.SetLineColor( COL_WHITE );
+-                rOutDev2.SetFillColor( COL_WHITE );
++                rOutDev2.SetLineColor( COL_TRANSPARENT );
++                rOutDev2.SetFillColor( COL_TRANSPARENT );
+                 rOutDev2.DrawRect( Rectangle( Point(),
+                                               rOutDev2.GetOutputSizePixel()) );
+                 rOutDev2.SetDrawMode( DRAWMODE_BLACKLINE | DRAWMODE_BLACKFILL | DRAWMODE_BLACKTEXT |

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-vcl-non-closed-polygons.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas-vcl-non-closed-polygons.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,31 @@
+diff -rup ../oog680-m5.orig/canvas/source/vcl/canvashelper.cxx canvas/source/vcl/canvashelper.cxx
+--- ../oog680-m5.orig/canvas/source/vcl/canvashelper.cxx	2007-11-13 12:44:32.000000000 +0100
++++ canvas/source/vcl/canvashelper.cxx	2007-11-20 12:49:03.000000000 +0100
+@@ -415,10 +415,23 @@ namespace vclcanvas
+             
+             for( USHORT i=0; i<nSize; ++i )
+             {
+-                mpOutDev->getOutDev().DrawPolygon( aVCLPolyPoly[i] );
+-                
+-                if( mp2ndOutDev )
+-                    mp2ndOutDev->getOutDev().DrawPolygon( aVCLPolyPoly[i] );
++                if( aStrokedPolyPoly.getB2DPolygon( i ).isClosed() ) {
++                    mpOutDev->getOutDev().DrawPolygon( aVCLPolyPoly[i] );
++                    if( mp2ndOutDev )
++                        mp2ndOutDev->getOutDev().DrawPolygon( aVCLPolyPoly[i] );
++                } else {
++                    USHORT nPolySize = aVCLPolyPoly[i].GetSize();
++                    Point rPrevPoint = aVCLPolyPoly[i].GetPoint( 0 );
++                    Point rPoint;
++
++                    for( USHORT j=1; j<nPolySize; j++ ) {
++                        rPoint = aVCLPolyPoly[i].GetPoint( j );
++                        mpOutDev->getOutDev().DrawLine( rPrevPoint, rPoint );
++                        if( mp2ndOutDev )
++                            mp2ndOutDev->getOutDev().DrawLine( rPrevPoint, rPoint );
++                        rPrevPoint = rPoint;
++                    }
++                }
+             }
+         }
+ 

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-canvas.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,625 @@
+diff -rup canvas-orig/inc/canvas/base/graphicdevicebase.hxx canvas/inc/canvas/base/graphicdevicebase.hxx
+--- canvas-orig/inc/canvas/base/graphicdevicebase.hxx	2007-08-21 13:19:17.000000000 +0200
++++ canvas/inc/canvas/base/graphicdevicebase.hxx	2007-09-06 17:02:14.000000000 +0200
+@@ -357,41 +357,41 @@ namespace canvas
+ 
+         
+         // XParametricPolyPolygon2DFactory
+-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createLinearHorizontalGradient( const ::com::sun::star::uno::Sequence< double >& leftColor, const ::com::sun::star::uno::Sequence< double >& rightColor ) throw (::com::sun::star::lang::IllegalArgumentException, 
++        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createLinearHorizontalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops ) throw (::com::sun::star::lang::IllegalArgumentException, 
+                                                                                                                                                                                                                                                                                     ::com::sun::star::uno::RuntimeException)
+         {
+             return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( 
+                 ParametricPolyPolygon::createLinearHorizontalGradient( this, 
+-                                                                       leftColor, 
+-                                                                       rightColor ) );
++                                                                       colors, 
++                                                                       stops ) );
+         }
+ 
+-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createAxialHorizontalGradient( const ::com::sun::star::uno::Sequence< double >& middleColor, const ::com::sun::star::uno::Sequence< double >& endColor ) throw (::com::sun::star::lang::IllegalArgumentException, 
++        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createAxialHorizontalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops ) throw (::com::sun::star::lang::IllegalArgumentException, 
+                                                                                                                                                                                                                                                                                    ::com::sun::star::uno::RuntimeException)
+         {
+             return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( 
+                 ParametricPolyPolygon::createAxialHorizontalGradient( this,
+-                                                                      middleColor, 
+-                                                                      endColor ) );
++                                                                      colors,
++                                                                      stops ) );
+         }
+ 
+-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createEllipticalGradient( const ::com::sun::star::uno::Sequence< double >& centerColor, const ::com::sun::star::uno::Sequence< double >& endColor, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException, 
++        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createEllipticalGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException, 
+                                                                                                                                                                                                                                                                                                                                             ::com::sun::star::uno::RuntimeException)
+         {
+             return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( 
+                 ParametricPolyPolygon::createEllipticalGradient( this, 
+-                                                                 centerColor, 
+-                                                                 endColor,
++                                                                 colors,
++                                                                 stops,
+                                                                  boundRect ) );
+         }
+ 
+-        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createRectangularGradient( const ::com::sun::star::uno::Sequence< double >& centerColor, const ::com::sun::star::uno::Sequence< double >& endColor, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException, 
++        virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D > SAL_CALL createRectangularGradient( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors, const ::com::sun::star::uno::Sequence< double >& stops, const ::com::sun::star::geometry::RealRectangle2D& boundRect ) throw (::com::sun::star::lang::IllegalArgumentException, 
+                                                                                                                                                                                                                                                                                                                                              ::com::sun::star::uno::RuntimeException)
+         {
+             return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >( 
+                 ParametricPolyPolygon::createRectangularGradient( this,
+-                                                                  centerColor, 
+-                                                                  endColor, 
++                                                                  colors,
++                                                                  stops,
+                                                                   boundRect ) );
+         }
+ 
+diff -rup canvas-orig/inc/canvas/parametricpolypolygon.hxx canvas/inc/canvas/parametricpolypolygon.hxx
+--- canvas-orig/inc/canvas/parametricpolypolygon.hxx	2007-08-21 13:19:17.000000000 +0200
++++ canvas/inc/canvas/parametricpolypolygon.hxx	2007-09-06 16:24:13.000000000 +0200
+@@ -94,14 +94,14 @@ namespace canvas
+         struct Values
+         {
+             Values( const ::basegfx::B2DPolygon&                        rGradientPoly,
+-                    const ::com::sun::star::uno::Sequence< double >&	rColor1,
+-                    const ::com::sun::star::uno::Sequence< double >&	rColor2,
++                    const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >&	rColors,
++                    const ::com::sun::star::uno::Sequence< double >&	rStops,
+                     double                                              nAspectRatio,
+                     GradientType                                        eType ) :
+                 maGradientPoly( rGradientPoly ),
+                 mnAspectRatio( nAspectRatio ),
+-                maColor1( rColor1 ),
+-                maColor2( rColor2 ),
++                maColors( rColors ),
++                maStops( rStops ),
+                 meType( eType )
+             {
+             }
+@@ -112,11 +112,11 @@ namespace canvas
+             /// Aspect ratio of gradient, affects scaling of innermost gradient polygon
+             const double										mnAspectRatio;
+ 
+-            /// First gradient color 
+-            const ::com::sun::star::uno::Sequence< double >		maColor1;
++            /// Gradient colors
++            const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >		maColors;
+ 
+-            /// Second gradient color
+-            const ::com::sun::star::uno::Sequence< double >		maColor2;
++            /// Gradient color stops
++            const ::com::sun::star::uno::Sequence< double >		maStops;
+ 
+             /// Type of gradient to render (as e.g. linear grads are not represented by maGradientPoly)
+             const GradientType									meType;
+@@ -124,21 +124,21 @@ namespace canvas
+ 
+         static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference< 
+                                                                       	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
+-                                                                      const ::com::sun::star::uno::Sequence< double >& 	leftColor, 
+-                                                                      const ::com::sun::star::uno::Sequence< double >& 	rightColor );
++                                                                      const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors, 
++                                                                      const ::com::sun::star::uno::Sequence< double >& 	stops );
+         static ParametricPolyPolygon* createAxialHorizontalGradient( const ::com::sun::star::uno::Reference< 
+                                                                       	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
+-                                                                     const ::com::sun::star::uno::Sequence< double >& 	middleColor, 
+-                                                                     const ::com::sun::star::uno::Sequence< double >& 	endColor );
++                                                                      const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors, 
++                                                                      const ::com::sun::star::uno::Sequence< double >& 	stops );
+         static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference< 
+-                                                                      	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
+-                                                                const ::com::sun::star::uno::Sequence< double >& 		centerColor, 
+-                                                                const ::com::sun::star::uno::Sequence< double >& 		endColor,
++                                                                ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
++                                                                const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors, 
++                                                                const ::com::sun::star::uno::Sequence< double >& 	stops,
+                                                                 const ::com::sun::star::geometry::RealRectangle2D&		boundRect );
+         static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference< 
+-                                                                      	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
+-                                                                 const ::com::sun::star::uno::Sequence< double >& 		centerColor, 
+-                                                                 const ::com::sun::star::uno::Sequence< double >& 		endColor,
++                                                                 ::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
++                                                                 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors, 
++                                                                 const ::com::sun::star::uno::Sequence< double >& 	stops,
+                                                                  const ::com::sun::star::geometry::RealRectangle2D&		boundRect );
+ 
+         /// Dispose all internal references
+@@ -168,20 +168,20 @@ namespace canvas
+                                	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
+                                const ::basegfx::B2DPolygon& 					rGradientPoly,
+                                GradientType	  									eType,
+-                               const ::com::sun::star::uno::Sequence< double >&	rColor1,
+-                               const ::com::sun::star::uno::Sequence< double >&	rColor2 );
++                               const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors,
++                               const ::com::sun::star::uno::Sequence< double >& 	stops );
+         ParametricPolyPolygon( const ::com::sun::star::uno::Reference< 
+                                	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
+                                const ::basegfx::B2DPolygon& 					rGradientPoly,
+                                GradientType	  									eType,
+-                               const ::com::sun::star::uno::Sequence< double >&	rColor1,
+-                               const ::com::sun::star::uno::Sequence< double >&	rColor2,
++                               const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors,
++                               const ::com::sun::star::uno::Sequence< double >& 	stops,
+                                double											nAspectRatio );
+         ParametricPolyPolygon( const ::com::sun::star::uno::Reference< 
+-                               	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,  
++                               	::com::sun::star::rendering::XGraphicDevice >& 	rDevice,
+                                GradientType	  									eType,
+-                               const ::com::sun::star::uno::Sequence< double >&	rColor1,
+-                               const ::com::sun::star::uno::Sequence< double >&	rColor2 );
++                               const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& 	colors,
++                               const ::com::sun::star::uno::Sequence< double >& 	stops );
+ 
+     	::com::sun::star::uno::Reference< 
+ 	        ::com::sun::star::rendering::XGraphicDevice > 	 mxDevice;
+diff -rup canvas-orig/source/cairo/cairo_cairo.hxx canvas/source/cairo/cairo_cairo.hxx
+--- canvas-orig/source/cairo/cairo_cairo.hxx	2007-08-21 13:19:18.000000000 +0200
++++ canvas/source/cairo/cairo_cairo.hxx	2007-10-10 17:35:34.000000000 +0200
+@@ -67,6 +67,11 @@ namespace cairo {
+ 		{
+ 			return mpRenderFormat;
+ 		}
++
++        inline void doNotFreePixmap ()
++        {
++            mbFreePixmap = false;
++        }
+ #endif
+ 
+ 		// use only for surfaces made on X Drawables
+diff -rup canvas-orig/source/cairo/cairo_canvasbitmap.hxx canvas/source/cairo/cairo_canvasbitmap.hxx
+--- canvas-orig/source/cairo/cairo_canvasbitmap.hxx	2007-08-21 13:19:18.000000000 +0200
++++ canvas/source/cairo/cairo_canvasbitmap.hxx	2007-10-24 13:07:12.000000000 +0200
+@@ -36,11 +36,12 @@
+ #ifndef _CAIROCANVAS_CANVASBITMAP_HXX
+ #define _CAIROCANVAS_CANVASBITMAP_HXX
+ 
+-#include <cppuhelper/compbase3.hxx>
++#include <cppuhelper/compbase4.hxx>
+ 
+ #include <com/sun/star/lang/XServiceInfo.hpp>
+ #include <com/sun/star/rendering/XBitmapCanvas.hpp>
+ #include <com/sun/star/rendering/XIntegerBitmap.hpp>
++#include <com/sun/star/beans/XFastPropertySet.hpp>
+ 
+ #include <basegfx/vector/b2isize.hxx>
+ 
+@@ -58,9 +59,10 @@
+ 
+ namespace cairocanvas
+ {
+-    typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::rendering::XBitmapCanvas,
+-																		   ::com::sun::star::rendering::XIntegerBitmap,
+-																										::com::sun::star::lang::XServiceInfo >  	CanvasBitmapBase_Base;
++    typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XBitmapCanvas,
++											  ::com::sun::star::rendering::XIntegerBitmap,
++                                              ::com::sun::star::lang::XServiceInfo,
++                                              ::com::sun::star::beans::XFastPropertySet >  	CanvasBitmapBase_Base;
+     typedef ::canvas::IntegerBitmapBase< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >, 
+ 		CanvasHelper, 
+ 		::osl::MutexGuard,
+@@ -97,6 +99,19 @@ namespace cairocanvas
+                                                          const ::com::sun::star::rendering::ViewState& viewState,
+                                                          const ::com::sun::star::rendering::RenderState&       renderState );
+
++        // XFastPropertySet
++        // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
++        // handle values have these meanings:
++        // 0 ... get pointer to BitmapEx
++        // 1 ... get X pixmap handle to rgb content
++        // 2 ... get X pitmap handle to alpha mask
++        // returned any contains either BitmapEx pointer or array of three Any value
++        //     1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
++        //     2nd the pixmap handle
++        //     3rd the pixmap depth
++        virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle)  throw (::com::sun::star::uno::RuntimeException);
++        virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any&)  throw (::com::sun::star::uno::RuntimeException) {}
++
+     private:
+         /** MUST hold here, too, since CanvasHelper only contains a
+             raw pointer (without refcounting)
+diff -rup canvas-orig/source/cairo/cairo_canvashelper.cxx canvas/source/cairo/cairo_canvashelper.cxx
+--- canvas-orig/source/cairo/cairo_canvashelper.cxx     2007-08-21 13:19:18.000000000 +0200
++++ canvas/source/cairo/cairo_canvashelper.cxx  2007-10-24 13:30:52.000000000 +0200
+@@ -668,15 +673,28 @@ namespace cairocanvas
+ 		return pSurface;
+     }
+ 
+-    static void addColorStop( Pattern* pPattern, double nOffset, const uno::Sequence< double >& rColor )
++    static void addColorStops( Pattern* pPattern, const uno::Sequence< uno::Sequence< double > >& rColors, const uno::Sequence< double >& rStops, bool bReverseStops = false )
+     {
+-	if( rColor.getLength() == 3 )
+-	    cairo_pattern_add_color_stop_rgb( pPattern, nOffset, rColor[0], rColor[1], rColor[2] );
+-	else if( rColor.getLength() == 4 )
+-	    cairo_pattern_add_color_stop_rgba( pPattern, nOffset, rColor[0], rColor[1], rColor[2], rColor[3] );
++        float stop;
++        int i;
++
++        OSL_ASSERT( rColors.getLength() == rStops.getLength() );
++
++        for( i = 0; i < rColors.getLength(); i++ ) {
++            const uno::Sequence< double >& rColor( rColors[i] );
++            stop = bReverseStops ? 1 - rStops[i] : rStops[i];
++            if( rColor.getLength() == 3 )
++                cairo_pattern_add_color_stop_rgb( pPattern, stop, rColor[0], rColor[1], rColor[2] );
++            else if( rColor.getLength() == 4 ) {
++                double alpha = rColor[3];
++                // cairo expects premultiplied alpha
++                cairo_pattern_add_color_stop_rgba( pPattern, stop, rColor[0]*alpha, rColor[1]*alpha, rColor[2]*alpha, alpha );
++                //cairo_pattern_add_color_stop_rgba( pPattern, stop, rColor[0], rColor[1], rColor[2], alpha );
++            }
++        }
+     }
+ 
+-    static Pattern* patternFromParametricPolyPolygon( ::canvas::ParametricPolyPolygon& rPolygon, Matrix& rMatrix )
++    static Pattern* patternFromParametricPolyPolygon( ::canvas::ParametricPolyPolygon& rPolygon )
+     {
+ 	Pattern* pPattern = NULL;
+ 	const ::canvas::ParametricPolyPolygon::Values aValues = rPolygon.getValues();
+@@ -693,11 +711,8 @@ namespace cairocanvas
+ 	    y0 = 0;
+ 	    x1 = 1;
+ 	    y1 = 0;
+-	    cairo_matrix_transform_point( &rMatrix, &x0, &y0 );
+-	    cairo_matrix_transform_point( &rMatrix, &x1, &y1 );
+ 	    pPattern = cairo_pattern_create_linear( x0, y0, x1, y1 );
+-	    addColorStop( pPattern, 0, aValues.maColor1 );
+-	    addColorStop( pPattern, 1, aValues.maColor2 );
++	    addColorStops( pPattern, aValues.maColors, aValues.maStops );
+ 	    break;
+ 
+ 	// FIXME: NYI
+@@ -707,12 +722,8 @@ namespace cairocanvas
+ 	    y0 = 0;
+ 	    x1 = 1;
+ 	    y1 = 0;
+-	    cairo_matrix_transform_point( &rMatrix, &x0, &y0 );
+-	    cairo_matrix_transform_point( &rMatrix, &x1, &y1 );
+ 	    pPattern = cairo_pattern_create_linear( x0, y0, x1, y1 );
+-	    addColorStop( pPattern, 0, aValues.maColor1 );
+-	    addColorStop( pPattern, 0.5, aValues.maColor2 );
+-	    addColorStop( pPattern, 1, aValues.maColor1 );
++	    addColorStops( pPattern, aValues.maColors, aValues.maStops );
+ 	    break;
+ 
+ 	case ::canvas::ParametricPolyPolygon::GRADIENT_ELLIPTICAL:
+@@ -722,16 +733,21 @@ namespace cairocanvas
+ 	    r1 = 0.5;
+ 	    Matrix aScaleMatrix;
+ 
+-	    cairo_matrix_transform_point( &rMatrix, &cx, &cy );
+-	    cairo_matrix_transform_distance( &rMatrix, &r0, &r1 );
+ 	    pPattern = cairo_pattern_create_radial( cx, cy, r0, cx, cy, r1 );
+-	    addColorStop( pPattern, 0, aValues.maColor1 );
+-	    addColorStop( pPattern, 1, aValues.maColor2 );
++	    addColorStops( pPattern, aValues.maColors, aValues.maStops, true );
+ 
+-	    if( ! ::rtl::math::approxEqual( aValues.mnAspectRatio, 1 ) ) {
+-		cairo_matrix_init_scale( &aScaleMatrix, 1, aValues.mnAspectRatio );
+-		cairo_pattern_set_matrix( pPattern, &aScaleMatrix );
+-	    }
++        // looks like aspect ratio is already handled in the texture matrix
++// 	    if( ! ::rtl::math::approxEqual( aValues.mnAspectRatio, 1 ) ) {
++// 			OSL_TRACE( "elliptical gradient aspect ratio: %f", aValues.mnAspectRatio );
++//             cairo_matrix_init_translate ( &aScaleMatrix, -0.5, -0.5 );
++//             if (aValues.mnAspectRatio > 1)
++//                 cairo_matrix_scale( &aScaleMatrix, 1,
++//             1/aValues.mnAspectRatio ); else
++//                 cairo_matrix_scale( &aScaleMatrix, aValues.mnAspectRatio, 1 );
++//             cairo_matrix_translate ( &aScaleMatrix, 0.5, 0.5 );
++
++//             cairo_pattern_set_matrix( pPattern, &aScaleMatrix );
++// 	    }
+ 	    break;
+ 	}
+ 
+@@ -831,13 +847,14 @@ namespace cairocanvas
+ 			cairo_matrix_init( &aTextureMatrix,
+ 					   aTransform.m00, aTransform.m10, aTransform.m01,
+ 					   aTransform.m11, aTransform.m02, aTransform.m12);
+-			Pattern* pPattern = patternFromParametricPolyPolygon( *pPolyImpl, aTextureMatrix );
++			Pattern* pPattern = patternFromParametricPolyPolygon( *pPolyImpl );
+ 
+ 			if( pPattern ) {
+ 			    OSL_TRACE( "filling with pattern\n" );
+ 
+ 			    cairo_save( pCairo );
+ 
++                cairo_transform( pCairo, &aTextureMatrix );
+ 			    cairo_set_source( pCairo, pPattern );
+ 			    cairo_fill( pCairo );
+ 			    cairo_restore( pCairo );
+diff -rup canvas-orig/source/tools/parametricpolypolygon.cxx canvas/source/tools/parametricpolypolygon.cxx
+--- canvas-orig/source/tools/parametricpolypolygon.cxx	2007-08-21 13:19:19.000000000 +0200
++++ canvas/source/tools/parametricpolypolygon.cxx	2007-09-06 16:12:37.000000000 +0200
+@@ -60,22 +60,22 @@ namespace canvas
+ {
+     ParametricPolyPolygon* ParametricPolyPolygon::createLinearHorizontalGradient( 
+         const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
+-        const uno::Sequence< double >& 						leftColor, 
+-        const uno::Sequence< double >& 						rightColor )
++        const uno::Sequence< uno::Sequence< double > >&		colors, 
++        const uno::Sequence< double >& 						stops )
+     {
+         // TODO(P2): hold gradient brush statically, and only setup
+         // the colors
+-        return new ParametricPolyPolygon( rDevice, GRADIENT_LINEAR, leftColor, rightColor );
++        return new ParametricPolyPolygon( rDevice, GRADIENT_LINEAR, colors, stops );
+     }
+ 
+     ParametricPolyPolygon* ParametricPolyPolygon::createAxialHorizontalGradient( 
+         const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
+-        const uno::Sequence< double >& 						middleColor, 
+-        const uno::Sequence< double >& 						endColor )
++        const uno::Sequence< uno::Sequence< double > >&		colors, 
++        const uno::Sequence< double >& 						stops )
+     {
+         // TODO(P2): hold gradient brush statically, and only setup
+         // the colors
+-        return new ParametricPolyPolygon( rDevice, GRADIENT_AXIAL, endColor, middleColor );
++        return new ParametricPolyPolygon( rDevice, GRADIENT_AXIAL, colors, stops );
+     }
+ 
+     namespace
+@@ -91,8 +91,8 @@ namespace canvas
+ 
+     ParametricPolyPolygon* ParametricPolyPolygon::createEllipticalGradient( 
+         const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
+-        const uno::Sequence< double >& 						centerColor, 
+-        const uno::Sequence< double >& 						endColor,
++        const uno::Sequence< uno::Sequence< double > >&		colors, 
++        const uno::Sequence< double >& 						stops,
+         const geometry::RealRectangle2D&					boundRect )
+     {
+         // TODO(P2): hold gradient polygon statically, and only setup
+@@ -102,13 +102,13 @@ namespace canvas
+             ::basegfx::tools::createPolygonFromCircle( 
+                 ::basegfx::B2DPoint( 0.5, 0.5), 0.5 ),
+             GRADIENT_ELLIPTICAL,
+-            endColor, centerColor,
++            colors, stops,
+             calcAspectRatio( boundRect ) );
+     }
+ 
+     ParametricPolyPolygon* ParametricPolyPolygon::createRectangularGradient( const uno::Reference< rendering::XGraphicDevice >& rDevice,
+-                                                                             const uno::Sequence< double >& 					centerColor, 
+-                                                                             const uno::Sequence< double >& 					endColor,
++                                                                             const uno::Sequence< uno::Sequence< double > >&	colors, 
++                                                                             const uno::Sequence< double >& 					stops,
+                                                                              const geometry::RealRectangle2D&					boundRect )
+     {
+         // TODO(P2): hold gradient polygon statically, and only setup
+@@ -118,7 +118,7 @@ namespace canvas
+             ::basegfx::tools::createPolygonFromRect( 
+                 ::basegfx::B2DRectangle( 0.0, 0.0, 1.0, 1.0 ) ),
+             GRADIENT_RECTANGULAR,
+-            endColor, centerColor,
++            colors, stops,
+             calcAspectRatio( boundRect ) );
+     }
+ 
+@@ -188,13 +188,13 @@ namespace canvas
+     ParametricPolyPolygon::ParametricPolyPolygon( const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
+                                                   const ::basegfx::B2DPolygon&							rGradientPoly,
+                                                   GradientType                                          eType,
+-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor1,
+-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor2 ) :
++                                                  const uno::Sequence< uno::Sequence< double > >&		rColors, 
++                                                  const uno::Sequence< double >& 						rStops ) :
+         ParametricPolyPolygon_Base( m_aMutex ),
+         mxDevice( rDevice ),
+         maValues( rGradientPoly,
+-                  rColor1,
+-                  rColor2,
++                  rColors,
++                  rStops,
+                   1.0,
+                   eType )
+     {
+@@ -203,14 +203,14 @@ namespace canvas
+     ParametricPolyPolygon::ParametricPolyPolygon( const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
+                                                   const ::basegfx::B2DPolygon&							rGradientPoly,
+                                                   GradientType                                          eType,
+-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor1,
+-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor2,
++                                                  const uno::Sequence< uno::Sequence< double > >&		rColors, 
++                                                  const uno::Sequence< double >& 						rStops,
+                                                   double												nAspectRatio ) :
+         ParametricPolyPolygon_Base( m_aMutex ),        
+         mxDevice( rDevice ),
+         maValues( rGradientPoly,
+-                  rColor1,
+-                  rColor2,
++                  rColors,
++                  rStops,
+                   nAspectRatio,
+                   eType )
+     {
+@@ -218,13 +218,13 @@ namespace canvas
+ 
+     ParametricPolyPolygon::ParametricPolyPolygon( const uno::Reference< rendering::XGraphicDevice >& 	rDevice,
+                                                   GradientType	 										eType,
+-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor1,
+-                                                  const ::com::sun::star::uno::Sequence< double >&		rColor2 ) :
++                                                  const uno::Sequence< uno::Sequence< double > >&		rColors, 
++                                                  const uno::Sequence< double >& 						rStops ) :
+         ParametricPolyPolygon_Base( m_aMutex ),        
+         mxDevice( rDevice ),
+         maValues( ::basegfx::B2DPolygon(),
+-                  rColor1,
+-                  rColor2, 
++                  rColors,
++                  rStops, 
+                   1.0,
+                   eType )
+     {
+diff -rup canvas-orig/source/vcl/canvasbitmap.cxx canvas/source/vcl/canvasbitmap.cxx
+--- canvas-orig/source/vcl/canvasbitmap.cxx	2007-08-21 13:19:20.000000000 +0200
++++ canvas/source/vcl/canvasbitmap.cxx	2007-10-24 12:55:39.000000000 +0200
+@@ -145,4 +145,15 @@ namespace vclcanvas
+ 
+         return maCanvasHelper.repaint( rGrf, rPt, rSz, rAttr );
+     }
++
++    ::com::sun::star::uno::Any CanvasBitmap::getFastPropertyValue( sal_Int32 nHandle )  throw (::com::sun::star::uno::RuntimeException)
++    {
++        if( nHandle == 0 ) {
++            BitmapEx* pBitmapEx = new BitmapEx( getBitmap() );
++
++            return ::com::sun::star::uno::Any( reinterpret_cast<sal_Int64>( pBitmapEx ) );
++        }
++
++        return ::com::sun::star::uno::Any( sal_Int32( 0 ) );
++    }
+ }
+Only in canvas/source/vcl: canvasbitmap.cxx.~1.8.~
+diff -rup canvas-orig/source/vcl/canvasbitmap.hxx canvas/source/vcl/canvasbitmap.hxx
+--- canvas-orig/source/vcl/canvasbitmap.hxx	2007-08-21 13:19:20.000000000 +0200
++++ canvas/source/vcl/canvasbitmap.hxx	2007-10-24 13:07:32.000000000 +0200
+@@ -36,11 +36,12 @@
+ #ifndef _VCLCANVAS_CANVASBITMAP_HXX
+ #define _VCLCANVAS_CANVASBITMAP_HXX
+ 
+-#include <cppuhelper/compbase3.hxx>
++#include <cppuhelper/compbase4.hxx>
+ 
+ #include <com/sun/star/lang/XServiceInfo.hpp>
+ #include <com/sun/star/rendering/XBitmapCanvas.hpp>
+ #include <com/sun/star/rendering/XIntegerBitmap.hpp>
++#include <com/sun/star/beans/XFastPropertySet.hpp>
+ 
+ #include <vcl/virdev.hxx>
+ #include <vcl/bitmapex.hxx>
+@@ -59,9 +60,10 @@
+ 
+ namespace vclcanvas
+ {
+-    typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::rendering::XBitmapCanvas,
++    typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XBitmapCanvas,
+ 			                         		  ::com::sun::star::rendering::XIntegerBitmap,
+-                         			 		  ::com::sun::star::lang::XServiceInfo >  	CanvasBitmapBase_Base;
++                         			 		  ::com::sun::star::lang::XServiceInfo,
++                                              ::com::sun::star::beans::XFastPropertySet >  	CanvasBitmapBase_Base;
+     typedef ::canvas::IntegerBitmapBase< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >, 
+                                          CanvasBitmapHelper, 
+                                          tools::LocalGuard,
+@@ -107,6 +109,19 @@ namespace vclcanvas
+         /// Not threadsafe! Returned object is shared!
+         BitmapEx getBitmap() const;
+
++        // XFastPropertySet
++        // used to retrieve BitmapEx pointer or X Pixmap handles for this bitmap
++        // handle values have these meanings:
++        // 0 ... get pointer to BitmapEx
++        // 1 ... get X pixmap handle to rgb content
++        // 2 ... get X pitmap handle to alpha mask
++        // returned any contains either BitmapEx pointer or array of three Any value
++        //     1st a bool value: true - free the pixmap after used by XFreePixmap, false do nothing, the pixmap is used internally in the canvas
++        //     2nd the pixmap handle
++        //     3rd the pixmap depth
++        virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle)  throw (::com::sun::star::uno::RuntimeException);
++        virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any&)  throw (::com::sun::star::uno::RuntimeException) {}
++
+     private:
+         /** MUST hold here, too, since CanvasHelper only contains a
+             raw pointer (without refcounting)
+diff -rup canvas-orig/source/vcl/canvashelper_texturefill.cxx canvas/source/vcl/canvashelper_texturefill.cxx
+--- canvas-orig/source/vcl/canvashelper_texturefill.cxx	2007-08-21 13:19:20.000000000 +0200
++++ canvas/source/vcl/canvashelper_texturefill.cxx	2007-09-14 16:28:32.000000000 +0200
+@@ -832,12 +832,13 @@ namespace vclcanvas
+                     const ::canvas::ParametricPolyPolygon::Values& rValues(
+                         pGradient->getValues() );
+ 
++                    // TODO: use all the colors and place them on given positions/stops
+                     const ::Color aColor1( 
+                         ::vcl::unotools::sequenceToColor( mpDevice,
+-                                                          rValues.maColor1 ) );
++                                                          rValues.maColors [0] ) );
+                     const ::Color aColor2( 
+                         ::vcl::unotools::sequenceToColor( mpDevice,
+-                                                          rValues.maColor2 ) );
++                                                          rValues.maColors [rValues.maColors.getLength () - 1] ) );
+ 
+                     // TODO(E1): Return value
+                     // TODO(F1): FillRule
+--- canvas-bak/source/cairo/cairo_canvashelper.hxx      2007-10-29 20:07:45.000000000 +0100
++++ canvas/source/cairo/cairo_canvashelper.hxx  2007-10-30 10:12:33.000000000 +0100
+@@ -324,6 +324,7 @@
+                ::cairo::Cairo* mpCairo;
+                ::cairo::Surface* mpSurface;
+                SurfaceProvider* mpSurfaceProvider;
++    public:
+         ::basegfx::B2ISize maSize;
+     };
+
+--- canvas-orig/source/cairo/cairo_canvasbitmap.cxx	2007-08-21 13:19:18.000000000 +0200
++++ canvas/source/cairo/cairo_canvasbitmap.cxx	2007-11-01 13:57:20.000000000 +0100
+@@ -96,6 +96,67 @@
+ 		return maCanvasHelper.repaint( pSurface, viewState, renderState );
+     }
+ 
++    ::com::sun::star::uno::Any CanvasBitmap::getFastPropertyValue( sal_Int32 nHandle )  throw (::com::sun::star::uno::RuntimeException)
++    {
++        ::com::sun::star::uno::Any aRV( sal_Int32(0) );
++        // 0 ... get BitmapEx
++        // 1 ... get Pixbuf with bitmap RGB content
++        // 2 ... get Pixbuf with bitmap alpha mask
++        switch( nHandle ) {
++        case 0:
++            aRV = ::com::sun::star::uno::Any( reinterpret_cast<sal_Int64>( (BitmapEx*) NULL ) );
++            break;
++        case 1: {
++#ifdef CAIRO_HAS_XLIB_SURFACE
++        ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > args( 3 );
++        args[0] = ::com::sun::star::uno::Any( false );  // do not call XFreePixmap on it
++        args[1] = ::com::sun::star::uno::Any( mpBufferSurface->getPixmap () );
++        args[2] = ::com::sun::star::uno::Any( sal_Int32( mpBufferSurface->getDepth () ) );
++
++        aRV = ::com::sun::star::uno::Any( args );
++#endif
++        }
++        break;
++        case 2: {
++#ifdef CAIRO_HAS_XLIB_SURFACE
++        ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > args( 3 );
++        Surface* pSurface = mpDevice->getSurface( maCanvasHelper.maSize, CAIRO_CONTENT_COLOR_ALPHA );
++        Surface* pAlphaSurface = mpDevice->getSurface( maCanvasHelper.maSize, CAIRO_CONTENT_ALPHA );
++        Cairo* pCairo = pSurface->getCairo();
++        Cairo* pAlphaCairo = pAlphaSurface->getCairo();
++
++        // create RGB image (levels of gray) of alpha channel of original picture
++        cairo_set_source_surface( pAlphaCairo, mpBufferSurface->mpSurface, 0, 0 );
++        cairo_set_operator( pAlphaCairo, CAIRO_OPERATOR_SOURCE );
++        cairo_paint( pAlphaCairo );
++        cairo_destroy( pAlphaCairo );
++
++        cairo_set_source_rgba(pCairo, 1, 1, 1, 1 );
++        cairo_set_operator( pCairo, CAIRO_OPERATOR_SOURCE );
++        cairo_paint( pCairo );
++        cairo_set_source_surface( pCairo, pAlphaSurface->mpSurface, 0, 0 );
++        cairo_set_operator( pCairo, CAIRO_OPERATOR_OVER );
++        cairo_paint( pCairo );
++
++        delete pAlphaSurface;
++        cairo_destroy( pCairo );
++        pSurface->doNotFreePixmap();
++        args[0] = ::com::sun::star::uno::Any( true );
++        args[1] = ::com::sun::star::uno::Any( pSurface->getPixmap () );
++        args[2] = ::com::sun::star::uno::Any( sal_Int32( pSurface->getDepth () ) );
++        delete pSurface;
++
++        // return pixmap and alphachannel pixmap - it will be used in BitmapEx
++        aRV = ::com::sun::star::uno::Any( args );
++#endif
++        }
++        break;
++        }
++
++        return aRV;
++
++    }
++
+ #define IMPLEMENTATION_NAME "CairoCanvas.CanvasBitmap"
+ #define SERVICE_NAME "com.sun.star.rendering.CanvasBitmap"
+ 

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas-emfplus.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas-emfplus.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,1609 @@
+diff -rup cppcanvas-orig/source/inc/implrenderer.hxx cppcanvas/source/inc/implrenderer.hxx
+--- cppcanvas-orig/source/inc/implrenderer.hxx	2007-08-06 12:08:27.000000000 +0200
++++ cppcanvas/source/inc/implrenderer.hxx	2007-10-19 15:24:21.000000000 +0200
+@@ -62,6 +62,11 @@ class Gradient;
+ class BitmapEx;
+ class MapMode;
+ class Size;
++class Rectangle;
++class Font;
++class PolyPolygon;
++class Point;
++class MetaCommentAction;
+ 
+ namespace basegfx {
+     class B2DPolyPolygon;
+@@ -75,11 +80,110 @@ namespace cppcanvas
+     {
+         struct OutDevState;
+         struct ActionFactoryParameters;
++        struct EMFPObject;
++        struct XForm;
+ 
+         // state stack of OutputDevice, to correctly handle
+         // push/pop actions
+         typedef ::std::vector< OutDevState >	VectorOfOutDevStates;
+ 
++        // EMF+
++        // TODO: replace?
++        struct XForm
++        {
++            float	eM11;
++            float	eM12;
++            float	eM21;
++            float	eM22;
++            float	eDx;
++            float	eDy;
++            XForm()
++            {
++                SetIdentity ();
++            };
++
++            void SetIdentity ()
++            {
++                eM11 =  eM22 = 1.0f;
++                eDx = eDy = eM12 = eM21 = 0.0f;
++            }
++
++            void Set (float m11, float m12, float dx, float m21, float m22, float dy)
++            {
++                eM11 = m11;
++                eM12 = m12;
++                eDx  = dx;
++                eM21 = m21;
++                eM22 = m22;
++                eDy  = dy;
++            }
++
++            void Set (XForm f)
++            {
++                eM11 = f.eM11;
++                eM12 = f.eM12;
++                eM21 = f.eM21;
++                eM22 = f.eM22;
++                eDx  = f.eDx;
++                eDy  = f.eDy;
++            }
++
++            void Multiply (float m11, float m12, float dx, float m21, float m22, float dy)
++            {
++                eM11 = eM11*m11 + eM12*m21;
++                eM12 = eM11*m12 + eM12*m22;
++                eM21 = eM21*m11 + eM22*m21;
++                eM22 = eM21*m12 + eM22*m22;
++                eDx *= eDx*m11  + eDy*m21 + dx;
++                eDy *= eDx*m12  + eDy*m22 + dy;
++            }
++
++            void Multiply (XForm f)
++            {
++                eM11 = eM11*f.eM11 + eM12*f.eM21;
++                eM12 = eM11*f.eM12 + eM12*f.eM22;
++                eM21 = eM21*f.eM11 + eM22*f.eM21;
++                eM22 = eM21*f.eM12 + eM22*f.eM22;
++                eDx *= eDx*f.eM11  + eDy*f.eM21 + f.eDx;
++                eDy *= eDx*f.eM12  + eDy*f.eM22 + f.eDy;
++            }
++
++#ifdef OSL_BIGENDIAN
++// currently unused
++static float GetSwapFloat( SvStream& rSt )
++{
++        float   fTmp;
++        sal_Int8* pPtr = (sal_Int8*)&fTmp;
++        rSt >> pPtr[3] >> pPtr[2] >> pPtr[1] >> pPtr[0];        // Little Endian <-> Big Endian switch
++        return fTmp;
++}
++#endif
++
++            friend SvStream& operator>>( SvStream& rIn, XForm& rXForm )
++            {
++                if ( sizeof( float ) != 4 )
++                {
++                    DBG_ERROR( "EnhWMFReader::sizeof( float ) != 4" );
++                    rXForm = XForm();
++                }
++                else
++                {
++#ifdef OSL_BIGENDIAN
++                    rXForm.eM11 = GetSwapFloat( rIn );
++                    rXForm.eM12 = GetSwapFloat( rIn ); 
++                    rXForm.eM21 = GetSwapFloat( rIn );
++                    rXForm.eM22 = GetSwapFloat( rIn );
++                    rXForm.eDx = GetSwapFloat( rIn );
++                    rXForm.eDy = GetSwapFloat( rIn );
++#else
++                    rIn >> rXForm.eM11 >> rXForm.eM12 >> rXForm.eM21 >> rXForm.eM22
++                        >> rXForm.eDx >> rXForm.eDy;
++#endif
++                }
++                return rIn;
++            }
++        };
++
+         class ImplRenderer : public virtual Renderer, protected CanvasGraphicHelper
+         {
+         public:
+@@ -118,6 +211,14 @@ namespace cppcanvas
+             // (externally not visible)
+             typedef ::std::vector< MtfAction > 		ActionVector;
+ 
++            /* EMF+ */
++            void ReadRectangle (SvStream& s, float& x, float& y, float &width, float& height, sal_uInt32 flags = 0);
++            void ReadPoint (SvStream& s, float& x, float& y, sal_uInt32 flags = 0);
++            void MapToDevice (double &x, double &y);
++            ::basegfx::B2DPoint Map (::basegfx::B2DPoint& p);
++            ::basegfx::B2DPoint Map (double ix, double iy);
++            ::basegfx::B2DSize MapSize (double iwidth, double iheight);
++            ::basegfx::B2DRange MapRectangle (double ix, double iy, double iwidth, double iheight);
+ 
+         private:
+             // default: disabled copy/assignment
+@@ -170,8 +271,30 @@ namespace cppcanvas
+                                    ActionVector::const_iterator& o_rRangeBegin,
+                                    ActionVector::const_iterator& o_rRangeEnd ) const;
+ 
++            void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas );
++            void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor);
+ 
+             ActionVector maActions;
++
++            /* EMF+ */
++            XForm           aBaseTransform;
++            XForm           aWorldTransform;
++            EMFPObject*     aObjects [256];
++            float           fPageScale;
++            sal_Int32       nOriginX;
++            sal_Int32       nOriginY;
++            sal_Int32       nHDPI;
++            sal_Int32       nVDPI;
++            ::PolyPolygon   aClippingPolygon;
++            /* EMF+ emf header info */
++            sal_Int32       nFrameLeft;
++            sal_Int32       nFrameTop;
++            sal_Int32       nFrameRight;
++            sal_Int32       nFrameBottom;
++            sal_Int32       nPixX;
++            sal_Int32       nPixY;
++            sal_Int32       nMmX;
++            sal_Int32       nMmY;
+         };
+ 
+ 
+diff -rup cppcanvas-orig/util/makefile.mk cppcanvas/util/makefile.mk
+--- cppcanvas-orig/util/makefile.mk	2007-08-06 12:08:27.000000000 +0200
++++ cppcanvas/util/makefile.mk	2007-08-06 17:31:02.000000000 +0200
+@@ -54,7 +54,7 @@ LIB1FILES=\
+ 
+ SHL1TARGET= 	$(TARGET)$(UPD)$(DLLPOSTFIX)
+ SHL1IMPLIB= 	i$(TARGET)
+-SHL1STDLIBS=	$(TOOLSLIB) $(CPPULIB) $(SALLIB) $(VCLLIB) $(COMPHELPERLIB) $(CANVASTOOLSLIB) $(CPPUHELPERLIB) $(BASEGFXLIB)
++SHL1STDLIBS=	$(TOOLSLIB) $(CPPULIB) $(SALLIB) $(VCLLIB) $(COMPHELPERLIB) $(CANVASTOOLSLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(SVTOOLLIB)
+ 
+ SHL1LIBS=		$(SLB)$/$(TARGET).lib
+ 
+--- cppcanvas-orig/source/mtfrenderer/makefile.mk	2007-08-06 12:08:27.000000000 +0200
++++ cppcanvas/source/mtfrenderer/makefile.mk	2007-11-05 21:51:22.000000000 +0100
+@@ -52,6 +52,7 @@ CDEFS+= -DVERBOSE
+ 
+ SLOFILES =	$(SLO)$/cachedprimitivebase.obj \
+ 			$(SLO)$/bitmapaction.obj \
++			$(SLO)$/emfplus.obj \
+ 			$(SLO)$/implrenderer.obj \
+ 			$(SLO)$/lineaction.obj \
+ 			$(SLO)$/pointaction.obj \
+--- cppcanvas-orig/source/mtfrenderer/implrenderer.cxx	2007-08-06 12:08:27.000000000 +0200
++++ cppcanvas/source/mtfrenderer/implrenderer.cxx	2007-11-10 12:35:38.000000000 +0100
+@@ -107,6 +107,8 @@
+ #include "mtftools.hxx"
+ #include "outdevstate.hxx"
+ 
++#define EMFP_DEBUG(x)
++//#define EMFP_DEBUG(x) x
+ 
+ using namespace ::com::sun::star;
+ 
+@@ -1725,6 +1735,33 @@ namespace cppcanvas
+                                 }
+                             }
+                         }
++                        // Handle drawing layer fills
++                        else if( pAct->GetComment().Equals( "EMF_PLUS" ) ) {
++                            static int count = -1, limit = 0x7fffffff;
++                            if (count == -1) {
++                                count = 0;
++                                char *env;
++                                if (env = getenv ("EMF_PLUS_LIMIT")) {
++                                    limit = atoi (env);
++                                }
++                            }
++                            EMFP_DEBUG (printf ("EMF+ passed to canvas mtf renderer, size: %d\n", pAct->GetDataSize ()));
++                            if (count < limit)
++                            processEMFPlus( pAct, rFactoryParms, getState( rStates ), rCanvas );
++                            count ++;
++                        } else if( pAct->GetComment().Equals( "EMF_PLUS_HEADER_INFO" ) ) {
++                            EMFP_DEBUG (printf ("EMF+ passed to canvas mtf renderer - header info, size: %d\n", pAct->GetDataSize ()));
++
++                            SvMemoryStream rMF ((void*) pAct->GetData (), pAct->GetDataSize (), STREAM_READ);
++
++                            rMF >> nFrameLeft >> nFrameTop >> nFrameRight >> nFrameBottom;
++                            EMFP_DEBUG (printf ("EMF+ picture frame: %d,%d - %d,%d\n", nFrameLeft, nFrameTop, nFrameRight, nFrameBottom));
++                            rMF >> nPixX >> nPixY >> nMmX >> nMmY;
++                            EMFP_DEBUG (printf ("EMF+ ref device pixel size: %dx%d mm size: %dx%d\n", nPixX, nPixY, nMmX, nMmY));
++
++                            rMF >> aBaseTransform;
++                            //aWorldTransform.Set (aBaseTransform);
++                        }
+                     }
+                     break;
+ 
+@@ -2881,6 +2918,9 @@ namespace cppcanvas
+                                            aParms );
+             }
+ 
++            /* EMF+ */
++            memset (aObjects, 0, sizeof (aObjects));
++
+             createActions( const_cast<GDIMetaFile&>(rMtf), // HACK(Q2):
+ 								                           // we're
+                         		                           // changing
+--- /dev/null	2007-10-08 22:21:59.000000000 +0200
++++ cppcanvas/source/mtfrenderer/emfplus.cxx	2007-11-10 18:05:44.000000000 +0100
+@@ -0,0 +1,1357 @@
++#include <tools/stream.hxx>
++#include <vcl/metaact.hxx>
++#include <svtools/filter.hxx>
++#include <basegfx/tools/canvastools.hxx>
++#include <basegfx/tools/tools.hxx>
++#include <basegfx/numeric/ftools.hxx>
++#include <basegfx/point/b2dpoint.hxx>
++#include <basegfx/vector/b2dsize.hxx>
++#include <basegfx/range/b2drange.hxx>
++#include <basegfx/range/b2drectangle.hxx>
++#include <basegfx/polygon/b2dpolygon.hxx>
++#include <basegfx/polygon/b2dpolypolygon.hxx>
++#include <basegfx/polygon/b2dpolypolygontools.hxx>
++#include <vcl/canvastools.hxx>
++
++#include <com/sun/star/rendering/XCanvas.hpp>
++#include <com/sun/star/rendering/TexturingMode.hpp>
++#include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
++
++#include <bitmapaction.hxx>
++#include <implrenderer.hxx>
++#include <outdevstate.hxx>
++#include <polypolyaction.hxx>
++
++#define EmfPlusRecordTypeHeader 16385
++#define EmfPlusRecordTypeEndOfFile 16386
++#define EmfPlusRecordTypeGetDC 16388
++#define EmfPlusRecordTypeObject 16392
++#define EmfPlusRecordTypeFillRects 16394
++#define EmfPlusRecordTypeFillPolygon 16396
++#define EmfPlusRecordTypeDrawLines 16397
++#define EmfPlusRecordTypeFillPath 16404
++#define EmfPlusRecordTypeDrawPath 16405
++#define EmfPlusRecordTypeDrawImagePoints 16411
++#define EmfPlusRecordTypeDrawString 16412
++#define EmfPlusRecordTypeSetRenderingOrigin 16413
++#define EmfPlusRecordTypeSetAntiAliasMode 16414
++#define EmfPlusRecordTypeSetTextRenderingHint 16415
++#define EmfPlusRecordTypeSetInterpolationMode 16417
++#define EmfPlusRecordTypeSetPixelOffsetMode 16418
++#define EmfPlusRecordTypeSetCompositingQuality 16420
++#define EmfPlusRecordTypeSave 16421
++#define EmfPlusRecordTypeSetWorldTransform 16426
++#define EmfPlusRecordTypeResetWorldTransform 16427
++#define EmfPlusRecordTypeSetPageTransform 16432
++#define EmfPlusRecordTypeSetClipPath 16435
++#define EmfPlusRecordTypeSetClipRegion 16436
++#define EmfPlusRecordTypeDrawDriverString 16438
++
++#define EmfPlusObjectTypeBrush 0x100
++#define EmfPlusObjectTypePen 0x200
++#define EmfPlusObjectTypePath 0x300
++#define EmfPlusObjectTypeRegion 0x400
++#define EmfPlusObjectTypeImage 0x500
++#define EmfPlusObjectTypeFont 0x600
++#define EmfPlusObjectTypeStringFormat 0x700
++#define EmfPlusObjectTypeImageAttributes 0x800
++
++#define EmfPlusRegionInitialStateRectangle 0x10000000
++#define EmfPlusRegionInitialStatePath 0x10000001
++#define EmfPlusRegionInitialStateEmpty 0x10000002
++#define EmfPlusRegionInitialStateInfinite 0x10000003
++
++#define EMFP_DEBUG(x)
++//#define EMFP_DEBUG(x) x
++
++using namespace ::com::sun::star;
++
++namespace cppcanvas
++{
++    namespace internal
++    {
++
++        EMFP_DEBUG (void dumpWords (SvStream& s, int i)
++        {
++            sal_uInt32 pos = s.Tell ();
++            INT16 data;
++            for (; i > 0; i --) {
++                s >> data;
++                printf ("EMF+\tdata: %04hX\n", data);
++            }
++            s.Seek (pos);
++        });
++
++        struct EMFPObject
++        {
++        };
++
++        struct EMFPPath : public EMFPObject
++        {
++            ::basegfx::B2DPolyPolygon    aPolygon;
++            sal_Int32                    nPoints;
++            float*                       pPoints;
++            sal_uInt8*                   pPointTypes;
++
++        public:
++            EMFPPath (sal_Int32 _nPoints, bool bLines = false)
++            {
++                nPoints = _nPoints;
++                pPoints = new float [nPoints*2];
++                if (!bLines)
++                    pPointTypes = new sal_uInt8 [_nPoints];
++                else
++                    pPointTypes = NULL;
++            }
++
++            ~EMFPPath ()
++            {
++                delete [] pPoints;
++                delete [] pPointTypes;
++            }
++
++            // TODO: remove rR argument when debug code is not longer needed
++            void Read (SvStream& s, UINT32 pathFlags, ImplRenderer& rR)
++            {
++                for (int i = 0; i < nPoints; i ++) {
++                    if (pathFlags & 0x4000) {
++                        // points are stored in short 16bit integer format
++                        UINT16 x, y;
++
++                        s >> x >> y;
++                        EMFP_DEBUG (printf ("EMF+\tpoint [x,y]: %hd,%hd\n", x, y));
++                        pPoints [i*2] = x;
++                        pPoints [i*2 + 1] = y;
++                    } else {
++                        // points are stored in Single (float) format
++                        s >> pPoints [i*2] >> pPoints [i*2 + 1];
++                        EMFP_DEBUG (printf ("EMF+\tpoint [x,y]: %f,%f\n", pPoints [i*2], pPoints [i*2 + 1]));
++                    }
++                }
++
++                if (pPointTypes)
++                    for (int i = 0; i < nPoints; i ++) {
++                        UINT8 pathType;
++
++                        s >> pPointTypes [i];
++                        EMFP_DEBUG (printf ("EMF+\tpoint type: %x\n", pPointTypes [i]));
++                    }
++
++                aPolygon.clear ();
++
++                // debug code
++                const ::basegfx::B2DRectangle aBounds (::basegfx::tools::getRange (GetPolygon (rR)));
++                EMFP_DEBUG (printf ("EMF+\tpolygon bounding box: %f,%f %fx%f (mapped)\n", aBounds.getMinX (), aBounds.getMinY (), aBounds.getWidth (), aBounds.getHeight ()));
++            }
++
++            ::basegfx::B2DPolyPolygon& GetPolygon (ImplRenderer& rR, bool bMapIt = true)
++            {
++                ::basegfx::B2DPolygon polygon;
++                sal_Int32 points = nPoints;
++
++                aPolygon.clear ();
++
++                int last_normal = 0, p = 0;
++                ::basegfx::B2DPoint prev, mapped;
++                bool hasPrev = false;
++                for (int i = 0; i < nPoints; i ++) {
++                    if (p && pPointTypes && (pPointTypes [i] == 0)) {
++                        aPolygon.append (polygon);
++                        last_normal = i;
++                        p = 0;
++                        polygon.clear ();
++                    }
++
++                    if (bMapIt)
++                        mapped = rR.Map (pPoints [i*2], pPoints [i*2 + 1]);
++                    else
++                        mapped = ::basegfx::B2DPoint (pPoints [i*2], pPoints [i*2 + 1]);
++                    //EMFP_DEBUG (printf ("polygon point: %f,%f mapped: %f,%f\n", pPoints [i*2], pPoints [i*2 + 1], mapped.getX (), mapped.getY ()));
++                    if (pPointTypes) {
++                        if ((pPointTypes [i] & 0x07) == 3) {
++                            if (((i - last_normal )% 3) == 1) {
++                                polygon.setNextControlPoint (p - 1, mapped);
++                                continue;
++                            } else if (((i - last_normal) % 3) == 2) {
++                                prev = mapped;
++                                hasPrev = true;
++                                continue;
++                            }
++                        } else
++                            last_normal = i;
++                    }
++                    polygon.append (mapped);
++                    if (hasPrev) {
++                        polygon.setPrevControlPoint (p, prev);
++                        hasPrev = false;
++                    }
++                    p ++;
++                    if (pPointTypes && (pPointTypes [i] & 0x80)) { // closed polygon
++                        polygon.setClosed (true);
++                        aPolygon.append (polygon);
++                        last_normal = i + 1;
++                        p = 0;
++                        polygon.clear ();
++                    }
++                }
++
++                if (polygon.count ())
++                    aPolygon.append (polygon);
++
++                return aPolygon;
++            }
++        };
++
++        struct EMFPRegion : public EMFPObject
++        {
++            sal_Int32 parts;
++            sal_Int32 *combineMode;
++            sal_Int32 initialState;
++            EMFPPath *initialPath;
++            float ix, iy, iw, ih;
++
++            EMFPRegion ()
++            {
++                combineMode = NULL;
++                initialPath = NULL;
++            }
++
++            ~EMFPRegion ()
++            {
++                if (combineMode) {
++                    delete [] combineMode;
++                    combineMode = NULL;
++                }
++                if (initialPath) {
++                    delete initialPath;
++                    initialPath = NULL;
++                }
++            }
++
++            void Read (SvStream& s)
++            {
++                sal_uInt32 header;
++
++                s >> header >> parts;
++
++                EMFP_DEBUG (printf ("EMF+\tregion\n"));
++                EMFP_DEBUG (printf ("EMF+\theader: 0x%08x parts: %d\n", header, parts));
++
++                if (parts) {
++                    combineMode = new sal_Int32 [parts];
++
++                    for (int i = 0; i < parts; i ++) {
++                        s >> combineMode [i];
++                        EMFP_DEBUG (printf ("EMF+\tcombine mode [%d]: 0x%08x\n", i, combineMode [i]));
++                    }
++                }
++
++                s >> initialState;
++                EMFP_DEBUG (printf ("EMF+\tinitial state: 0x%08x\n", initialState));
++            }
++        };
++
++        struct EMFPBrush : public EMFPObject
++        {
++            ::Color solidColor;
++            sal_uInt32 type;
++            sal_uInt32 additionalFlags;
++
++            /* linear gradient */
++            sal_Int32 wrapMode;
++            float areaX, areaY, areaWidth, areaHeight;
++            ::Color secondColor; // first color is stored in solidColor;
++            XForm transformation;
++            bool hasTransformation;
++            sal_Int32 blendPoints;
++            float* blendPositions;
++            float* blendFactors;
++            sal_Int32 colorblendPoints;
++            float* colorblendPositions;
++            ::Color* colorblendColors;
++            sal_Int32 surroundColorsNumber;
++            ::Color* surroundColors;
++            EMFPPath *path;
++
++        public:
++            EMFPBrush ()
++            {
++                blendPositions = NULL;
++                colorblendPositions = NULL;
++                colorblendColors = NULL;
++                surroundColors = NULL;
++                path = NULL;
++                hasTransformation = false;
++            }
++
++            ~EMFPBrush ()
++            {
++                if (blendPositions != NULL) {
++                    delete[] blendPositions;
++                    blendPositions = NULL;
++                }
++                if (colorblendPositions != NULL) {
++                    delete[] colorblendPositions;
++                    colorblendPositions = NULL;
++                }
++                if (colorblendColors != NULL) {
++                    delete[] colorblendColors;
++                    colorblendColors = NULL;
++                }
++                if (surroundColors != NULL) {
++                    delete[] surroundColors;
++                    surroundColors = NULL;
++                }
++                if (path) {
++                    delete path;
++                    path = NULL;
++                }
++            }
++
++            UINT32 GetType () { return type; }
++            const ::Color& GetColor () { return solidColor; }
++
++            void Read (SvStream& s, ImplRenderer& rR)
++            {
++                UINT32 header;
++
++                s >> header >> type;
++
++                EMFP_DEBUG (printf ("EMF+\tbrush\nEMF+\theader: 0x%08x type: %d\n", header, type));
++
++                switch (type) {
++                case 0:
++                    {
++                        UINT32 color;
++
++                        s >> color;
++                        solidColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
++                        EMFP_DEBUG (printf ("EMF+\tsolid color: 0x%08x\n", color));
++
++                        break;
++                    }
++                // path gradient
++                case 3:
++                    {
++                        s >> additionalFlags >> wrapMode;
++
++                        EMFP_DEBUG (printf ("EMF+\tpath gradient, additional flags: 0x%02x\n", additionalFlags));
++
++                        UINT32 color;
++
++                        s >> color;
++                        solidColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
++                        EMFP_DEBUG (printf ("EMF+\tcenter color: 0x%08x\n", color));
++
++                        s >> areaX >> areaY;
++                        EMFP_DEBUG (printf ("EMF+\tcenter point: %f,%f\n", areaX, areaY));
++                        
++                        s >> surroundColorsNumber;
++                        EMFP_DEBUG (printf ("EMF+\tsurround colors: %d\n", surroundColorsNumber));
++
++                        surroundColors = new ::Color [surroundColorsNumber];
++                        for (int i = 0; i < surroundColorsNumber; i++) {
++                            s >> color;
++                            surroundColors[i] = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
++                            if (i == 0)
++                                secondColor = surroundColors [0];
++                            EMFP_DEBUG (printf ("EMF+\tsurround color[%d]: 0x%08x\n", i, color));
++                        }
++
++                        if (additionalFlags & 0x01) {
++                            sal_Int32 pathLength;
++
++                            s >> pathLength;
++                            EMFP_DEBUG (printf ("EMF+\tpath length: %d\n", pathLength));
++
++                            sal_uInt32 pos = s.Tell ();
++                            EMFP_DEBUG (dumpWords (s, 32));
++
++                            sal_uInt32 pathHeader;
++                            sal_Int32 pathPoints, pathFlags;
++                            s >> pathHeader >> pathPoints >> pathFlags;
++
++                            EMFP_DEBUG (printf ("EMF+\tpath (brush path gradient)\n"));
++                            EMFP_DEBUG (printf ("EMF+\theader: 0x%08x points: %d additional flags: 0x%08x\n", pathHeader, pathPoints, pathFlags));
++
++                            path = new EMFPPath (pathPoints);
++                            path->Read (s, pathFlags, rR);
++
++                            s.Seek (pos + pathLength);
++
++                            const ::basegfx::B2DRectangle aBounds (::basegfx::tools::getRange (path->GetPolygon (rR, false)));
++                            areaWidth = aBounds.getWidth ();
++                            areaHeight = aBounds.getHeight ();
++
++                            EMFP_DEBUG (printf ("EMF+\tpolygon bounding box: %f,%f %fx%f\n", aBounds.getMinX (), aBounds.getMinY (), aBounds.getWidth (), aBounds.getHeight ()));
++
++
++                        if (additionalFlags & 0x02) {
++                            EMFP_DEBUG (printf ("EMF+\tuse transformation\n", color));
++                            s >> transformation;
++                            hasTransformation = true;
++                            EMFP_DEBUG (printf ("EMF+\tm11: %f m12: %f\nEMF+\tm21: %f m22: %f\nEMF+\tdx: %f dy: %f\n",
++                                    transformation.eM11, transformation.eM12,
++                                    transformation.eM21, transformation.eM22,
++                                    transformation.eDx, transformation.eDy));
++                        }
++                        if (additionalFlags & 0x08) {
++                            s >> blendPoints;
++                            EMFP_DEBUG (printf ("EMF+\tuse blend, points: %d\n", blendPoints));
++                            blendPositions = new float [2*blendPoints];
++                            blendFactors = blendPositions + blendPoints;
++                            for (int i=0; i < blendPoints; i ++) {
++                                s >> blendPositions [i];
++                                EMFP_DEBUG (printf ("EMF+\tposition[%d]: %f\n", i, blendPositions [i]));
++                            }
++                            for (int i=0; i < blendPoints; i ++) {
++                                s >> blendFactors [i];
++                                EMFP_DEBUG (printf ("EMF+\tfactor[%d]: %f\n", i, blendFactors [i]));
++                            }
++                        }
++
++                        if (additionalFlags & 0x04) {
++                            s >> colorblendPoints;
++                            EMFP_DEBUG (printf ("EMF+\tuse color blend, points: %d\n", colorblendPoints));
++                            colorblendPositions = new float [colorblendPoints];
++                            colorblendColors = new ::Color [colorblendPoints];
++                            for (int i=0; i < colorblendPoints; i ++) {
++                                s >> colorblendPositions [i];
++                                EMFP_DEBUG (printf ("EMF+\tposition[%d]: %f\n", i, colorblendPositions [i]));
++                            }
++                            for (int i=0; i < colorblendPoints; i ++) {
++                                s >> color;
++                                colorblendColors [i] = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
++                                EMFP_DEBUG (printf ("EMF+\tcolor[%d]: 0x%08x\n", i, color));
++                            }
++                        }
++                        } else
++                            EMFP_DEBUG (dumpWords (s, 1024));
++
++                        break;
++                    }
++                // linear gradient
++                case 4:
++                    {
++                        s >> additionalFlags >> wrapMode;
++
++                        EMFP_DEBUG (printf ("EMF+\tlinear gradient, additional flags: 0x%02x\n", additionalFlags));
++
++                        s >> areaX >> areaY >> areaWidth >> areaHeight;
++
++                        EMFP_DEBUG (printf ("EMF+\tarea: %f,%f - %fx%f\n", areaX, areaY, areaWidth, areaHeight));
++                
++                        UINT32 color;
++
++                        s >> color;
++                        solidColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
++                        EMFP_DEBUG (printf ("EMF+\tfirst color: 0x%08x\n", color));
++
++                        s >> color;
++                        secondColor = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
++                        EMFP_DEBUG (printf ("EMF+\tsecond color: 0x%08x\n", color));
++
++                        // repeated colors, unknown meaning, see http://www.aces.uiuc.edu/~jhtodd/Metafile/MetafileRecords/ObjectBrush.html
++                        s >> color;
++                        s >> color;
++
++                        if (additionalFlags & 0x02) {
++                            EMFP_DEBUG (printf ("EMF+\tuse transformation\n", color));
++                            s >> transformation;
++                            hasTransformation = true;
++                            EMFP_DEBUG (printf ("EMF+\tm11: %f m12: %f\nEMF+\tm21: %f m22: %f\nEMF+\tdx: %f dy: %f\n",
++                                    transformation.eM11, transformation.eM12,
++                                    transformation.eM21, transformation.eM22,
++                                    transformation.eDx, transformation.eDy));
++                        }
++                        if (additionalFlags & 0x08) {
++                            s >> blendPoints;
++                            EMFP_DEBUG (printf ("EMF+\tuse blend, points: %d\n", blendPoints));
++                            blendPositions = new float [2*blendPoints];
++                            blendFactors = blendPositions + blendPoints;
++                            for (int i=0; i < blendPoints; i ++) {
++                                s >> blendPositions [i];
++                                EMFP_DEBUG (printf ("EMF+\tposition[%d]: %f\n", i, blendPositions [i]));
++                            }
++                            for (int i=0; i < blendPoints; i ++) {
++                                s >> blendFactors [i];
++                                EMFP_DEBUG (printf ("EMF+\tfactor[%d]: %f\n", i, blendFactors [i]));
++                            }
++                        }
++
++                        if (additionalFlags & 0x04) {
++                            s >> colorblendPoints;
++                            EMFP_DEBUG (printf ("EMF+\tuse color blend, points: %d\n", colorblendPoints));
++                            colorblendPositions = new float [colorblendPoints];
++                            colorblendColors = new ::Color [colorblendPoints];
++                            for (int i=0; i < colorblendPoints; i ++) {
++                                s >> colorblendPositions [i];
++                                EMFP_DEBUG (printf ("EMF+\tposition[%d]: %f\n", i, colorblendPositions [i]));
++                            }
++                            for (int i=0; i < colorblendPoints; i ++) {
++                                s >> color;
++                                colorblendColors [i] = ::Color (0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
++                                EMFP_DEBUG (printf ("EMF+\tcolor[%d]: 0x%08x\n", i, color));
++                            }
++                        }
++
++                        break;
++                    }
++                default:
++                    EMFP_DEBUG (printf ("EMF+\tunhandled brush type: %d\n", type));
++                }
++            }
++        };
++
++        struct EMFPPen : public EMFPBrush
++        {
++            XForm transformation;
++            float width;
++            sal_Int32 startCap;
++            sal_Int32 endCap;
++            sal_Int32 lineJoin;
++            float mitterLimit;
++            sal_Int32 dashStyle;
++            sal_Int32 dashCap;
++            float dashOffset;
++            sal_Int32 dashPatternLen;
++            float *dashPattern;
++            sal_Int32 alignment;
++            sal_Int32 compoundArrayLen;
++            float *compoundArray;
++            sal_Int32 customStartCapLen;
++            sal_uInt8 *customStartCap;
++            sal_Int32 customEndCapLen;
++            sal_uInt8 *customEndCap;
++
++        public:
++            EMFPPen () : EMFPBrush ()
++            {
++            }
++
++            void SetStrokeAttributes (rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState)
++            {
++                rStrokeAttributes.StrokeWidth = (rState.mapModeTransform * rR.MapSize (width, 0)).getX ();
++            }
++
++            void Read (SvStream& s, ImplRenderer& rR, sal_Int32 nHDPI, sal_Int32 nVDPI)
++            {
++                UINT32 header, unknown, penFlags, unknown2;
++                int i;
++
++                s >> header >> unknown >> penFlags >> unknown2 >> width;
++
++                EMFP_DEBUG (printf ("EMF+\tpen\nEMF+\theader: 0x%08x unknown: 0x%08x additional flags: 0x%08x unknown: 0x%08x width: %f\n", header, unknown, penFlags, unknown2, width));
++
++                if (penFlags & 1)
++                    s >> transformation;
++
++                if (penFlags & 2)
++                    s >> startCap;
++                else
++                    startCap = 0;
++
++                if (penFlags & 4)
++                    s >> endCap;
++                else
++                    endCap = 0;
++
++                if (penFlags & 8)
++                    s >> lineJoin;
++                else
++                    lineJoin = 0;
++
++                if (penFlags & 16)
++                    s >> mitterLimit;
++                else
++                    mitterLimit = 0;
++
++                if (penFlags & 32)
++                    s >> dashStyle;
++                else
++                    dashStyle = 0;
++
++                if (penFlags & 64)
++                    s >> dashCap;
++                else
++                    dashCap = 0;
++
++                if (penFlags & 128)
++                    s >> dashOffset;
++                else
++                    dashOffset = 0;
++
++                if (penFlags & 256) {
++                    s >> dashPatternLen;
++                    dashPattern = new float [dashPatternLen];
++                    for (i = 0; i < dashPatternLen; i++)
++                        s >> dashPattern [i];
++                } else
++                    dashPatternLen = 0;
++
++                if (penFlags & 512)
++                    s >> alignment;
++                else
++                    alignment = 0;
++
++                if (penFlags & 1024) {
++                    s >> compoundArrayLen;
++                    compoundArray = new float [compoundArrayLen];
++                    for (i = 0; i < compoundArrayLen; i++)
++                        s >> compoundArray [i];
++                } else
++                    compoundArrayLen = 0;
++
++                if (penFlags & 2048) {
++                    s >> customStartCapLen;
++                    customStartCap = new sal_uInt8 [customStartCapLen];
++                    for (i = 0; i < customStartCapLen; i++)
++                        s >> customStartCap [i];
++                } else
++                    customStartCapLen = 0;
++
++                if (penFlags & 4096) {
++                    s >> customEndCapLen;
++                    customEndCap = new sal_uInt8 [customEndCapLen];
++                    for (i = 0; i < customEndCapLen; i++)
++                        s >> customEndCap [i];
++                } else
++                    customEndCapLen = 0;
++
++                EMFPBrush::Read (s, rR);
++            }
++        };
++
++        struct EMFPImage : public EMFPObject
++        {
++            sal_uInt32 type;
++            sal_Int32 width;
++            sal_Int32 height;
++            sal_Int32 stride;
++            sal_Int32 pixelFormat;
++            Graphic graphic;
++    
++
++            void Read (SvStream &s)
++            {
++                sal_uInt32 header, unknown;
++
++                s >> header >> type;
++
++                EMFP_DEBUG (printf ("EMF+\timage\nEMF+\theader: 0x%08x type: 0x%08x\n", header, type));
++
++                if (type == 1) { // bitmap
++                    s >> width >> height >> stride >> pixelFormat >> unknown;
++                    EMFP_DEBUG (printf ("EMF+\tbitmap width: %d height: %d stride: %d pixelFormat: 0x%08x\n", width, height, stride, pixelFormat));
++                    if (width == 0) { // non native formats
++                        GraphicFilter filter;
++
++                        filter.ImportGraphic (graphic, String (), s);
++                        EMFP_DEBUG (printf ("EMF+\tbitmap width: %d height: %d\n", graphic.GetBitmap ().GetSizePixel ().Width (), graphic.GetBitmap ().GetSizePixel ().Height ()));
++                    }
++
++                }
++            }
++        };
++
++        void ImplRenderer::ReadRectangle (SvStream& s, float& x, float& y, float &width, float& height, sal_uInt32 flags)
++        {
++            if (flags & 0x4000) {
++                sal_Int16 ix, iy, iw, ih;
++
++                s >> ix >> iy >> iw >> ih;
++
++                x = ix;
++                y = iy;
++                width = iw;
++                height = ih;
++            } else
++                s >> x >> y >> width >> height;
++        }
++
++        void ImplRenderer::ReadPoint (SvStream& s, float& x, float& y, sal_uInt32 flags)
++        {
++            if (flags & 0x4000) {
++                sal_Int16 ix, iy;
++
++                s >> ix >> iy;
++
++                x = ix;
++                y = iy;
++            } else
++                s >> x >> y;
++        }
++
++        void ImplRenderer::MapToDevice (double& x, double& y)
++        {
++            // TODO: other untis
++            x = 100*nMmX*x/nPixX;
++            y = 100*nMmY*y/nPixY;
++        }
++
++        ::basegfx::B2DPoint ImplRenderer::Map (::basegfx::B2DPoint& p)
++        {
++            return Map (p.getX (), p.getY ());
++        }
++
++        ::basegfx::B2DPoint ImplRenderer::Map (double ix, double iy)
++        {
++            double x, y;
++
++            x = ix*aWorldTransform.eM11 + iy*aWorldTransform.eM21 + aWorldTransform.eDx;
++            y = ix*aWorldTransform.eM12 + iy*aWorldTransform.eM22 + aWorldTransform.eDy;
++
++            MapToDevice (x, y);
++
++            x -= nFrameLeft;
++            y -= nFrameTop;
++
++            x *= aBaseTransform.eM11;
++            y *= aBaseTransform.eM22;
++
++            return ::basegfx::B2DPoint (x, y);
++        }
++
++        ::basegfx::B2DSize ImplRenderer::MapSize (double iwidth, double iheight)
++        {
++            double w, h;
++
++            w = iwidth*aWorldTransform.eM11 + iheight*aWorldTransform.eM21;
++            h = iwidth*aWorldTransform.eM12 + iheight*aWorldTransform.eM22;
++
++            MapToDevice (w, h);
++
++            w *= aBaseTransform.eM11;
++            h *= aBaseTransform.eM22;
++
++            return ::basegfx::B2DSize (w, h);
++        }
++
++        ::basegfx::B2DRange ImplRenderer::MapRectangle (double ix, double iy, double iwidth, double iheight)
++        {
++            double x, y, w, h;
++
++            x = ix*aWorldTransform.eM11 + iy*aWorldTransform.eM21 + aWorldTransform.eDx;
++            y = ix*aWorldTransform.eM12 + iy*aWorldTransform.eM22 + aWorldTransform.eDy;
++            w = iwidth*aWorldTransform.eM11 + iheight*aWorldTransform.eM21;
++            h = iwidth*aWorldTransform.eM12 + iheight*aWorldTransform.eM22;
++
++            MapToDevice (x, y);
++            MapToDevice (w, h);
++
++            x -= nFrameLeft;
++            y -= nFrameTop;
++
++            x *= aBaseTransform.eM11;
++            y *= aBaseTransform.eM22;
++            w *= aBaseTransform.eM11;
++            h *= aBaseTransform.eM22;
++
++            return ::basegfx::B2DRange (x, y, x + w, y + h);
++        }
++
++        void ImplRenderer::EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms,
++                                                OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor)
++        {
++            sal_uInt8 transparency;
++            ::basegfx::B2DPolyPolygon localPolygon (polygon);
++
++            EMFP_DEBUG (printf ("EMF+\tfill polygon\n"));
++
++            localPolygon.transform( rState.mapModeTransform );
++
++            ActionSharedPtr pPolyAction;
++
++            if (isColor) {
++                EMFP_DEBUG (printf ("EMF+\t\tcolor fill\n"));
++
++                transparency = 0xff - (brushIndexOrColor >> 24);
++
++                rState.isFillColorSet = true;
++                rState.isLineColorSet = false;
++                rState.fillColor = ::vcl::unotools::colorToDoubleSequence( rCanvas->getUNOCanvas()->getDevice(),
++                                                                           ::Color (transparency,
++                                                                                    (brushIndexOrColor >> 16) & 0xff,
++                                                                                    (brushIndexOrColor >> 8) & 0xff,
++                                                                                    brushIndexOrColor & 0xff) );
++
++                pPolyAction = ActionSharedPtr ( internal::PolyPolyActionFactory::createPolyPolyAction( localPolygon, rParms.mrCanvas, rState ) );
++
++            } else {
++                rState.isFillColorSet = true;
++                // extract UseBrush
++                EMFPBrush* brush = (EMFPBrush*) aObjects [brushIndexOrColor];
++                EMFP_DEBUG (printf ("EMF+\tbrush fill slot: %d (type: %d)\n", brushIndexOrColor, brush->GetType ()));
++
++                rState.isFillColorSet = false;
++                rState.isLineColorSet = false;
++
++                if (brush->type == 3 || brush->type == 4) {
++
++                    if (brush->type == 3 && !(brush->additionalFlags & 0x1))
++                        return;  // we are unable to parse these brushes yet
++
++                ::basegfx::B2DHomMatrix aTextureTransformation;
++                ::basegfx::B2DHomMatrix aWorldTransformation;
++                ::basegfx::B2DHomMatrix aBaseTransformation;
++                rendering::Texture aTexture;
++                double nRotation( 0.0 );
++                const ::basegfx::B2DRectangle aBounds( ::basegfx::tools::getRange( localPolygon ) );
++                const double nScale( ::basegfx::pruneScaleValue( fabs( aBounds.getHeight()*sin(nRotation) ) + 
++                                                                 fabs( aBounds.getWidth()*cos(nRotation) )));
++
++                aWorldTransformation.set (0, 0, aWorldTransform.eM11);
++                aWorldTransformation.set (0, 1, aWorldTransform.eM21);
++                aWorldTransformation.set (0, 2, aWorldTransform.eDx);
++                aWorldTransformation.set (1, 0, aWorldTransform.eM12);
++                aWorldTransformation.set (1, 1, aWorldTransform.eM22);
++                aWorldTransformation.set (1, 2, aWorldTransform.eDy);
++
++                aBaseTransformation.set (0, 0, aBaseTransform.eM11);
++                aBaseTransformation.set (0, 1, aBaseTransform.eM21);
++                aBaseTransformation.set (0, 2, aBaseTransform.eDx);
++                aBaseTransformation.set (1, 0, aBaseTransform.eM12);
++                aBaseTransformation.set (1, 1, aBaseTransform.eM22);
++                aBaseTransformation.set (1, 2, aBaseTransform.eDy);
++
++                if (brush->type == 4) {
++                    aTextureTransformation.scale (brush->areaWidth, brush->areaHeight);
++                    aTextureTransformation.translate (brush->areaX, brush->areaY);
++                } else {
++                    aTextureTransformation.translate (-0.5, -0.5);
++                    aTextureTransformation.scale (brush->areaWidth, brush->areaHeight);
++                    aTextureTransformation.translate (brush->areaX,brush->areaY);
++                }
++
++                if (brush->hasTransformation) {
++                    ::basegfx::B2DHomMatrix aTransformation;
++
++                    aTransformation.set (0, 0, brush->transformation.eM11);
++                    aTransformation.set (0, 1, brush->transformation.eM21);
++                    aTransformation.set (0, 2, brush->transformation.eDx);
++                    aTransformation.set (1, 0, brush->transformation.eM12);
++                    aTransformation.set (1, 1, brush->transformation.eM22);
++                    aTransformation.set (1, 2, brush->transformation.eDy);
++
++                    aTextureTransformation *= aTransformation;
++                }
++
++                aTextureTransformation *= aWorldTransformation;
++                aTextureTransformation.scale (100.0*nMmX/nPixX, 100.0*nMmY/nPixY);
++                aTextureTransformation.translate (-nFrameLeft, -nFrameTop);
++                aTextureTransformation *= rState.mapModeTransform;
++                aTextureTransformation *= aBaseTransformation;
++
++                aTexture.RepeatModeX = rendering::TexturingMode::CLAMP;
++                aTexture.RepeatModeY = rendering::TexturingMode::CLAMP;
++                aTexture.Alpha = 1.0;
++
++                uno::Reference< rendering::XParametricPolyPolygon2DFactory > xFactory(
++                    rParms.mrCanvas->getUNOCanvas()->getDevice()->getParametricPolyPolygonFactory() );
++
++                if( xFactory.is() ) {
++                    const uno::Sequence< double > aStartColor(
++                        ::vcl::unotools::colorToDoubleSequence( rParms.mrCanvas->getUNOCanvas()->getDevice(),
++                                                                brush->solidColor ) );
++                    const uno::Sequence< double > aEndColor(
++                        ::vcl::unotools::colorToDoubleSequence( rParms.mrCanvas->getUNOCanvas()->getDevice(),
++                                                                brush->secondColor ) );
++                    uno::Sequence< uno::Sequence < double > > aColors (2);
++                    uno::Sequence< double > aStops (2);
++
++                    if (brush->blendPositions) {
++                        EMFP_DEBUG (printf ("EMF+\t\tuse blend\n"));
++                        aColors.realloc (brush->blendPoints);
++                        aStops.realloc (brush->blendPoints);
++                        int length = aStartColor.getLength ();
++                        uno::Sequence< double > aColor (length);
++
++                        OSL_ASSERT (length == aEndColor.getLength());
++
++                        for (int i = 0; i < brush->blendPoints; i++) {
++                            aStops[i] = brush->blendPositions [i];
++
++                            for (int j = 0; j < length; j++) {
++                                if (brush->type == 4) {
++//                                     // gamma correction
++//                                     if (brush->additionalFlags & 0x80)
++//                                         aColor [j] = pow (aStartColor [j]*(1 - brush->blendFactors[i]) + aEndColor [j]*brush->blendFactors[i], 1/2.2);
++//                                     else
++                                    aColor [j] = aStartColor [j]*(1 - brush->blendFactors[i]) + aEndColor [j]*brush->blendFactors[i];
++                                } else
++                                    aColor [j] = aStartColor [j]*brush->blendFactors[i] + aEndColor [j]*(1 - brush->blendFactors[i]);
++                            }
++
++                            aColors[i] = aColor;
++                        }
++                    } else if (brush->colorblendPositions) {
++                        EMFP_DEBUG (printf ("EMF+\t\tuse color blend\n"));
++                        aColors.realloc (brush->colorblendPoints);
++                        aStops.realloc (brush->colorblendPoints);
++
++                        for (int i = 0; i < brush->colorblendPoints; i++) {
++                            aStops[i] = brush->colorblendPositions [i];
++                            aColors[(brush->type == 4) ? i : brush->colorblendPoints - 1 - i] = ::vcl::unotools::colorToDoubleSequence( rParms.mrCanvas->getUNOCanvas()->getDevice(),
++                                                                                                                                        brush->colorblendColors [i] );
++                        }
++                    } else {
++                        aStops[0] = 0.0;
++                        aStops[1] = 1.0;
++
++                        if (brush->type == 4) {
++                            aColors[0] = aStartColor;
++                            aColors[1] = aEndColor;
++                        } else {
++                            aColors[1] = aStartColor;
++                            aColors[0] = aEndColor;
++                        }
++                    }
++
++                    EMFP_DEBUG (printf ("EMF+\t\tset gradient\n"));
++                    if (brush->type == 4)
++                        aTexture.Gradient = xFactory->createLinearHorizontalGradient( aColors,
++                                                                                      aStops );
++                    else {
++                        geometry::RealRectangle2D aBoundsRectangle (0, 0, 1, 1);
++                        aTexture.Gradient = xFactory->createEllipticalGradient( aColors,
++                                                                                aStops,
++                                                                                aBoundsRectangle);
++                    }
++                }
++
++                ::basegfx::unotools::affineMatrixFromHomMatrix( aTexture.AffineTransform, 
++                                                                aTextureTransformation );
++
++                pPolyAction =
++                    ActionSharedPtr ( internal::PolyPolyActionFactory::createPolyPolyAction( localPolygon,
++                                                                                             rParms.mrCanvas,
++                                                                                             rState,
++                                                                                             aTexture ) );
++                }
++            }
++
++            if( pPolyAction )
++            {
++                EMFP_DEBUG (printf ("EMF+\t\tadd poly action\n"));
++
++                maActions.push_back(
++                    MtfAction(
++                        pPolyAction,
++                        rParms.mrCurrActionIndex ) );
++                
++                rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
++            }
++        }
++
++        void ImplRenderer::processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms,
++                                           OutDevState& rState, const CanvasSharedPtr& rCanvas )
++        {
++            sal_uInt32 length = pAct->GetDataSize ();
++            SvMemoryStream rMF ((void*) pAct->GetData (), length, STREAM_READ);
++
++            length -= 4;
++
++            while (length > 0) {
++                UINT16 type, flags;
++                UINT32 size, dataSize;
++                sal_uInt32 next;
++
++                rMF >> type >> flags >> size >> dataSize;
++
++                next = rMF.Tell() + ( size - 12 );
++
++                EMFP_DEBUG (printf ("EMF+ record size: %d type: %04hx flags: %04hx data size: %d\n", size, type, flags, dataSize));
++
++                switch (type) {
++                case EmfPlusRecordTypeHeader:
++                    UINT32 header, version;
++
++                    rMF >> header >> version >> nHDPI >> nVDPI;
++ 
++                    EMFP_DEBUG (printf ("EMF+ Header\n"));
++                    EMFP_DEBUG (printf ("EMF+\theader: 0x%08x version: %d horizontal DPI: %d vertical DPI: %d dual: %d\n", header, version, nHDPI, nVDPI, flags & 1));
++
++                    break;
++                case EmfPlusRecordTypeEndOfFile:
++                    EMFP_DEBUG (printf ("EMF+ EndOfFile\n"));
++                    break;
++                case EmfPlusRecordTypeGetDC:
++                    EMFP_DEBUG (printf ("EMF+ GetDC\n"));
++                    EMFP_DEBUG (printf ("EMF+\talready used in svtools wmf/emf filter parser\n"));
++                    break;
++                case EmfPlusRecordTypeObject:
++                    {
++                        UINT32 objectLen;
++                        sal_uInt32 index;
++
++                        EMFP_DEBUG (printf ("EMF+ Object slot: %hd flags: %hx\n", flags & 0xff, flags & 0xff00));
++
++                        index = flags & 0xff;
++                        if (aObjects [index] != NULL) {
++                            delete aObjects [index];
++                            aObjects [index] = NULL;
++                        }
++
++                        switch (flags & 0xff00) {
++                        case EmfPlusObjectTypeBrush:
++                            {
++                                EMFPBrush *brush;
++                                aObjects [index] = brush = new EMFPBrush ();
++                                brush->Read (rMF, *this);
++
++                                break;
++                            }
++                        case EmfPlusObjectTypePen:
++                            {
++                                EMFPPen *pen;
++                                aObjects [index] = pen = new EMFPPen ();
++                                pen->Read (rMF, *this, nHDPI, nVDPI);
++
++                                break;
++                            }
++                        case EmfPlusObjectTypePath:
++                            sal_uInt32 header, pathFlags;
++                            sal_Int32 points;
++
++                            rMF >> header >> points >> pathFlags;
++
++                            EMFP_DEBUG (printf ("EMF+\tpath\n"));
++                            EMFP_DEBUG (printf ("EMF+\theader: 0x%08x points: %d additional flags: 0x%08x\n", header, points, pathFlags));
++
++                            EMFPPath *path;
++                            aObjects [index] = path = new EMFPPath (points);
++                            path->Read (rMF, pathFlags, *this);
++                    
++                            break;
++                        case EmfPlusObjectTypeRegion: {
++                            EMFPRegion *region;
++
++                            aObjects [index] = region = new EMFPRegion ();
++                            region->Read (rMF);
++                            
++                            break;
++                        }
++                        case EmfPlusObjectTypeImage:
++                            {
++                                EMFPImage *image;
++                                aObjects [index] = image = new EMFPImage ();
++                                image->Read (rMF);
++
++                                break;
++                            }
++                        default:
++                            EMFP_DEBUG (printf ("EMF+\tObject unhandled flags: 0x%04x\n", flags & 0xff00));
++                            break;
++                        }
++
++                        break;
++                    }
++                case EmfPlusRecordTypeFillPath:
++                    {
++                        sal_uInt32 index = flags & 0xff;
++                        sal_uInt32 brushIndexOrColor;
++
++                        rMF >> brushIndexOrColor;
++
++                        EMFP_DEBUG (printf ("EMF+ FillPath slot: %d\n", index));
++
++                        EMFPPlusFillPolygon (((EMFPPath*) aObjects [index])->GetPolygon (*this), rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor);
++                    }
++                    break;
++                case EmfPlusRecordTypeFillRects:
++                    {
++                        EMFP_DEBUG (printf ("EMF+ FillRects\n"));
++
++                        sal_uInt32 brushIndexOrColor;
++                        sal_Int32 rectangles;
++                        ::basegfx::B2DPolygon polygon;
++
++                        rMF >> brushIndexOrColor >> rectangles;
++
++                        EMFP_DEBUG (printf ("EMF+\t%s: 0x%08x\n", (flags & 0x8000) ? "color" : "brush index", brushIndexOrColor));
++
++                        for (int i=0; i < rectangles; i++) {
++                            if (flags & 0x4000) {
++                                /* 16bit integers */
++                                sal_Int16 x, y, width, height;
++
++                                rMF >> x >> y >> width >> height;
++
++                                polygon.append (Map (x, y));
++                                polygon.append (Map (x + width, y));
++                                polygon.append (Map (x + width, y + height));
++                                polygon.append (Map (x, y + height));
++
++                                EMFP_DEBUG (printf ("EMF+\trectangle: %d,%d %dx%d\n", x, y, width, height));
++                            } else {
++                                /* Single's */
++                                float x, y, width, height;
++
++                                rMF >> x >> y >> width >> height;
++
++                                polygon.append (Map (x, y));
++                                polygon.append (Map (x + width, y));
++                                polygon.append (Map (x + width, y + height));
++                                polygon.append (Map (x, y + height));
++
++                                EMFP_DEBUG (printf ("EMF+\trectangle: %f,%f %fx%f\n", x, y, width, height));
++                            }
++
++                            ::basegfx::B2DPolyPolygon polyPolygon (polygon);
++
++                            EMFPPlusFillPolygon (polyPolygon, rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor);
++                        }
++                        break;
++                    }
++                case EmfPlusRecordTypeFillPolygon:
++                    {
++                        sal_uInt8 index = flags & 0xff;
++                        sal_uInt32 brushIndexOrColor;
++                        sal_Int32 brushIndex;
++                        sal_Int32 points;
++                        UINT32 color;
++                        USHORT transparency = 0;
++
++                        rMF >> brushIndexOrColor;
++                        rMF >> points;
++
++                        EMFP_DEBUG (printf ("EMF+ FillPolygon in slot: %d points: %d\n", index, points));
++                        EMFP_DEBUG (printf ("EMF+\twith solid color (ARGB): 0x%08X\n", color));
++
++                        EMFPPath path (points, true);
++                        path.Read (rMF, flags, *this);
++
++
++                        EMFPPlusFillPolygon (path.GetPolygon (*this), rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor);
++
++                        break;
++                    }
++                case EmfPlusRecordTypeDrawLines:
++                    {
++                        sal_uInt32 index = flags & 0xff;
++                        sal_uInt32 points;
++
++                        rMF >> points;
++
++                        EMFP_DEBUG (printf ("EMF+ DrawLines in slot: %d points: %d\n", index, points));
++
++                        EMFPPath path (points, true);
++                        path.Read (rMF, flags, *this);
++
++                        EMFPPen* pen = (EMFPPen*) aObjects [index];
++
++                        rState.isFillColorSet = false;
++                        rState.isLineColorSet = true;
++                        rState.lineColor = ::vcl::unotools::colorToDoubleSequence (rCanvas->getUNOCanvas ()->getDevice(),
++                                                                                   pen->GetColor ());
++                        ::basegfx::B2DPolyPolygon& polygon (path.GetPolygon (*this));
++
++                        polygon.transform( rState.mapModeTransform );
++
++                        rendering::StrokeAttributes aStrokeAttributes;
++
++                        pen->SetStrokeAttributes (aStrokeAttributes, *this, rState);
++
++            ActionSharedPtr pPolyAction( 
++                internal::PolyPolyActionFactory::createPolyPolyAction(
++                    polygon, rFactoryParms.mrCanvas, rState, aStrokeAttributes ) );
++
++            if( pPolyAction )
++            {
++                maActions.push_back(
++                    MtfAction(
++                        pPolyAction,
++                        rFactoryParms.mrCurrActionIndex ) );
++                
++                rFactoryParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
++            }
++
++                        break;
++                    }
++                case EmfPlusRecordTypeDrawPath:
++                    {
++                        UINT32 penIndex;
++
++                        rMF >> penIndex;
++
++                        EMFP_DEBUG (printf ("EMF+ DrawPath\n"));
++                        EMFP_DEBUG (printf ("EMF+\tpen: %d\n", penIndex));
++
++                        EMFPPath* path = (EMFPPath*) aObjects [flags & 0xff];
++                        EMFPPen* pen = (EMFPPen*) aObjects [penIndex];
++
++                        rState.isFillColorSet = false;
++                        rState.isLineColorSet = true;
++                        rState.lineColor = ::vcl::unotools::colorToDoubleSequence (rCanvas->getUNOCanvas ()->getDevice(),
++                                                                                   pen->GetColor ());
++                        ::basegfx::B2DPolyPolygon& polygon (path->GetPolygon (*this));
++
++                        polygon.transform( rState.mapModeTransform );
++                        rendering::StrokeAttributes aStrokeAttributes;
++
++                        pen->SetStrokeAttributes (aStrokeAttributes, *this, rState);
++
++            ActionSharedPtr pPolyAction( 
++                internal::PolyPolyActionFactory::createPolyPolyAction(
++                    polygon, rFactoryParms.mrCanvas, rState, aStrokeAttributes ) );
++
++            if( pPolyAction )
++            {
++                maActions.push_back(
++                    MtfAction(
++                        pPolyAction,
++                        rFactoryParms.mrCurrActionIndex ) );
++                
++                rFactoryParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
++            }
++                        break;
++                    }
++                case EmfPlusRecordTypeDrawImagePoints:
++                    {
++                        sal_uInt32 attrIndex;
++                        sal_Int32 sourceUnit;
++
++                        rMF >> attrIndex >> sourceUnit;
++
++                        EMFP_DEBUG (printf ("EMF+ DrawImagePoints attributes index: %d source unit: %d\n", attrIndex, sourceUnit));
++                        EMFP_DEBUG (printf ("EMF+\tTODO: use image attributes\n"));
++
++                        if (sourceUnit == 2 && aObjects [flags & 0xff]) { // we handle only GraphicsUnit.Pixel now
++                            EMFPImage& image = *(EMFPImage *) aObjects [flags & 0xff];
++                            float sx, sy, sw, sh;
++                            sal_Int32 unknown;
++
++                            ReadRectangle (rMF, sx, sy, sw, sh);
++
++                            rMF >> unknown;
++
++                            EMFP_DEBUG (printf ("EMF+ DrawImagePoints source rectangle: %f,%f %fx%f unknown: 0x%08x\n", sx, sy, sw, sh, unknown));
++
++                            if (unknown == 3) { // it probably means number of points defining destination rectangle
++                                float x1, y1, x2, y2, x3, y3;
++
++                                ReadPoint (rMF, x1, y1);
++                                ReadPoint (rMF, x2, y2);
++                                ReadPoint (rMF, x3, y3);
++
++                                BitmapEx aBmp( image.graphic.GetBitmapEx () );
++                                const Rectangle aCropRect (::vcl::unotools::pointFromB2DPoint (Map (sx, sy)),
++                                                           ::vcl::unotools::sizeFromB2DSize (MapSize(sw, sh)));
++                                aBmp.Crop( aCropRect );
++
++
++                                ActionSharedPtr pBmpAction (
++                                    internal::BitmapActionFactory::createBitmapAction (
++                                        aBmp,
++                                        rState.mapModeTransform * Map (x1, y1),
++                                        rState.mapModeTransform * MapSize(x2 - x1, y3 - y1),
++                                        rCanvas,
++                                        rState));
++
++                                if( pBmpAction ) {
++                                    maActions.push_back( MtfAction( pBmpAction,
++                                                                    rFactoryParms.mrCurrActionIndex ) );
++                            
++                                    rFactoryParms.mrCurrActionIndex += pBmpAction->getActionCount()-1;
++                                }
++                            } else
++                                EMFP_DEBUG (printf ("EMF+ DrawImagePoints TODO (fixme)\n"));
++                        }
++                        break;
++                    }
++                case EmfPlusRecordTypeDrawString:
++                    EMFP_DEBUG (printf ("EMF+ DrawString\n"));
++                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++                    break;
++                case EmfPlusRecordTypeSetPageTransform:
++                    rMF >> fPageScale;
++
++                    EMFP_DEBUG (printf ("EMF+ SetPageTransform\n"));
++                    EMFP_DEBUG (printf ("EMF+\tscale: %f unit: %d\n", fPageScale, flags));
++                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++                    break;
++                case EmfPlusRecordTypeSetRenderingOrigin:
++                    rMF >> nOriginX >> nOriginY;
++                    EMFP_DEBUG (printf ("EMF+ SetRenderingOrigin\n"));
++                    EMFP_DEBUG (printf ("EMF+\torigin [x,y]: %d,%d\n", nOriginX, nOriginY));
++                    break;
++                case EmfPlusRecordTypeSetTextRenderingHint:
++                    EMFP_DEBUG (printf ("EMF+ SetTextRenderingHint\n"));
++                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++                    break;
++                case EmfPlusRecordTypeSetAntiAliasMode:
++                    EMFP_DEBUG (printf ("EMF+ SetAntiAliasMode\n"));
++                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++                    break;
++                case EmfPlusRecordTypeSetInterpolationMode:
++                    EMFP_DEBUG (printf ("EMF+ InterpolationMode\n"));
++                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++                    break;
++                case EmfPlusRecordTypeSetPixelOffsetMode:
++                    EMFP_DEBUG (printf ("EMF+ SetPixelOffsetMode\n"));
++                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++                    break;
++                case EmfPlusRecordTypeSetCompositingQuality:
++                    EMFP_DEBUG (printf ("EMF+ SetCompositingQuality\n"));
++                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++                    break;
++                case EmfPlusRecordTypeSave:
++                    EMFP_DEBUG (printf ("EMF+ Save\n"));
++                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++                    break;
++                case EmfPlusRecordTypeSetWorldTransform: {
++                    EMFP_DEBUG (printf ("EMF+ SetWorldTransform\n"));
++                    XForm transform;
++                    rMF >> transform;
++                    aWorldTransform.Set (transform);
++                    EMFP_DEBUG (printf ("EMF+\tm11: %f m12: %f\nEMF+\tm21: %f m22: %f\nEMF+\tdx: %f dy: %f\n",
++                            aWorldTransform.eM11, aWorldTransform.eM12,
++                            aWorldTransform.eM21, aWorldTransform.eM22,
++                            aWorldTransform.eDx, aWorldTransform.eDy));
++                    break;
++                }
++                case EmfPlusRecordTypeResetWorldTransform:
++                    EMFP_DEBUG (printf ("EMF+ ResetWorldTransform\n"));
++                    aWorldTransform.SetIdentity ();
++                    break;
++                case EmfPlusRecordTypeSetClipPath:
++                    {
++                        EMFP_DEBUG (printf ("EMF+ SetClipPath\n"));
++                        EMFP_DEBUG (printf ("EMF+\tpath in slot: %d\n", flags & 0xff));
++
++                        EMFPPath& path = *(EMFPPath*) aObjects [flags & 0xff];
++                        ::basegfx::B2DPolyPolygon& clipPoly (path.GetPolygon (*this));
++
++                        clipPoly.transform (rState.mapModeTransform);
++                        updateClipping (clipPoly, rFactoryParms, false);
++
++                        break;
++                    }
++                case EmfPlusRecordTypeSetClipRegion: {
++                    EMFP_DEBUG (printf ("EMF+ SetClipRegion\n"));
++                    EMFP_DEBUG (printf ("EMF+\tregion in slot: %d combine mode: %d\n", flags & 0xff, (flags & 0xff00) >> 8));
++                    EMFPRegion& region = *(EMFPRegion*) aObjects [flags & 0xff];
++
++                    // reset clip
++                    if (region.parts == 0 && region.initialState == EmfPlusRegionInitialStateInfinite) {
++                        updateClipping (::basegfx::B2DPolyPolygon (), rFactoryParms, false);
++                    } else
++                        EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++                    break;
++                }
++                case EmfPlusRecordTypeDrawDriverString:
++                    EMFP_DEBUG (printf ("EMF+ DrawDriverString, flags: 0x%04x\n", flags));
++                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++                    break;
++                default:
++                    EMFP_DEBUG (printf ("EMF+ unhandled record type: %d\n", type));
++                    EMFP_DEBUG (printf ("EMF+\tTODO\n"));
++                }
++
++                rMF.Seek (next);
++
++                length -= size;
++            }
++        }
++    }
++}

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas-polyaction.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas-polyaction.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,151 @@
+diff -rup cppcanvas-orig/source/mtfrenderer/polypolyaction.cxx cppcanvas/source/mtfrenderer/polypolyaction.cxx
+--- cppcanvas-orig/source/mtfrenderer/polypolyaction.cxx	2007-11-10 16:23:04.000000000 +0100
++++ cppcanvas/source/mtfrenderer/polypolyaction.cxx	2007-11-10 16:38:50.000000000 +0100
+@@ -44,7 +44,7 @@
+ #include <tools/gen.hxx>
+ #include <vcl/canvastools.hxx>
+ 
+-#include <basegfx/range/b2drange.hxx>
++#include <basegfx/range/b2drectangle.hxx>
+ #include <basegfx/tools/canvastools.hxx>
+ #include <basegfx/polygon/b2dpolypolygon.hxx>
+ #include <basegfx/polygon/b2dpolypolygontools.hxx>
+@@ -112,7 +112,7 @@ namespace cppcanvas 
+                                             bool                                bFill,
+                                             bool                                bStroke ) :
+                 CachedPrimitiveBase( rCanvas, false ),
+-                mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(), /*#i76339#*/ ::PolyPolygon(rPolyPoly) ) ),
++                mxPolyPoly( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( rCanvas->getUNOCanvas()->getDevice(), rPolyPoly) ),
+                 maBounds( ::basegfx::tools::getRange(rPolyPoly) ),
+                 mpCanvas( rCanvas ),
+                 maState(),
+@@ -134,7 +134,7 @@ namespace cppcanvas 
+                                             bool                                bStroke,
+                                             int                                 nTransparency ) :
+                 CachedPrimitiveBase( rCanvas, false ),
+-                mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(), /*#i76339#*/ ::PolyPolygon(rPolyPoly) ) ),
++                mxPolyPoly( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( rCanvas->getUNOCanvas()->getDevice(), rPolyPoly) ),
+                 maBounds( ::basegfx::tools::getRange(rPolyPoly) ),
+                 mpCanvas( rCanvas ),
+                 maState(),
+@@ -268,10 +268,10 @@ namespace cppcanvas 
+             class TexturedPolyPolyAction : public CachedPrimitiveBase
+             { 
+             public: 
+-                TexturedPolyPolyAction( const ::PolyPolygon&		rPoly,  
+-                                        const CanvasSharedPtr&		rCanvas, 
+-                                        const OutDevState&			rState,
+-                                        const rendering::Texture& 	rTexture ); 
++                TexturedPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly,
++                                        const CanvasSharedPtr&		     rCanvas, 
++                                        const OutDevState&			     rState,
++                                        const rendering::Texture& 	     rTexture ); 
+ 
+                 virtual bool render( const ::basegfx::B2DHomMatrix& rTransformation,
+                                      const Subset&					rSubset ) const;
+@@ -288,7 +288,7 @@ namespace cppcanvas 
+                                      const ::basegfx::B2DHomMatrix&                 rTransformation ) const;
+ 
+                 const uno::Reference< rendering::XPolyPolygon2D >	mxPolyPoly;
+-                const ::Rectangle									maBounds;
++                const ::basegfx::B2DRectangle						maBounds;
+                 const CanvasSharedPtr								mpCanvas;
+ 
+             	// stroke color is now implicit: the maState.DeviceColor member
+@@ -296,14 +296,13 @@ namespace cppcanvas 
+                 const rendering::Texture							maTexture;
+             };
+ 
+-            TexturedPolyPolyAction::TexturedPolyPolyAction( const ::PolyPolygon&		rPolyPoly, 
+-                                                            const CanvasSharedPtr&		rCanvas,
+-                                                            const OutDevState& 			rState,
+-                                                            const rendering::Texture& 	rTexture ) :
++            TexturedPolyPolyAction::TexturedPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPolyPoly, 
++                                                            const CanvasSharedPtr&		     rCanvas,
++                                                            const OutDevState& 			     rState,
++                                                            const rendering::Texture& 	     rTexture ) :
+                 CachedPrimitiveBase( rCanvas, true ),
+-                mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(), 
+-                                                                          rPolyPoly ) ),
+-                maBounds( rPolyPoly.GetBoundRect() ),
++                mxPolyPoly( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( rCanvas->getUNOCanvas()->getDevice(), rPolyPoly) ),
++                maBounds( ::basegfx::tools::getRange(rPolyPoly) ),
+                 mpCanvas( rCanvas ),
+                 maState(),
+                 maTexture( rTexture )
+@@ -351,7 +350,7 @@ namespace cppcanvas 
+                 ::canvas::tools::prependToRenderState(aLocalState, rTransformation);
+                 
+                 return tools::calcDevicePixelBounds( 
+-                    ::vcl::unotools::b2DRectangleFromRectangle( maBounds ),
++                    maBounds,
+                     mpCanvas->getViewState(),
+                     aLocalState );
+             }
+@@ -383,7 +382,7 @@ namespace cppcanvas 
+             class StrokedPolyPolyAction : public CachedPrimitiveBase
+             { 
+             public: 
+-                StrokedPolyPolyAction( const ::PolyPolygon&					rPoly,  
++                StrokedPolyPolyAction( const ::basegfx::B2DPolyPolygon&     rPoly,
+                                        const CanvasSharedPtr&				rCanvas, 
+                                        const OutDevState&					rState,
+                                        const rendering::StrokeAttributes&	rStrokeAttributes ); 
+@@ -403,20 +402,19 @@ namespace cppcanvas 
+                                      const ::basegfx::B2DHomMatrix&                 rTransformation ) const;
+ 
+                 const uno::Reference< rendering::XPolyPolygon2D >	mxPolyPoly;
+-                const ::Rectangle									maBounds;
++                const ::basegfx::B2DRectangle						maBounds;
+                 const CanvasSharedPtr								mpCanvas;
+                 rendering::RenderState								maState;
+                 const rendering::StrokeAttributes					maStrokeAttributes;
+             };
+ 
+-            StrokedPolyPolyAction::StrokedPolyPolyAction( const ::PolyPolygon&					rPolyPoly, 
++            StrokedPolyPolyAction::StrokedPolyPolyAction( const ::basegfx::B2DPolyPolygon&      rPolyPoly, 
+                                                           const CanvasSharedPtr&				rCanvas,
+                                                           const OutDevState& 					rState,
+                                                           const rendering::StrokeAttributes&	rStrokeAttributes ) :
+                 CachedPrimitiveBase( rCanvas, false ),
+-                mxPolyPoly( ::vcl::unotools::xPolyPolygonFromPolyPolygon( rCanvas->getUNOCanvas()->getDevice(), 
+-                                                                          rPolyPoly ) ),
+-                maBounds( rPolyPoly.GetBoundRect() ),
++                mxPolyPoly( ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon( rCanvas->getUNOCanvas()->getDevice(), rPolyPoly) ),
++                maBounds( ::basegfx::tools::getRange(rPolyPoly) ),
+                 mpCanvas( rCanvas ),
+                 maState(),
+                 maStrokeAttributes( rStrokeAttributes )
+@@ -462,7 +460,7 @@ namespace cppcanvas 
+                 ::canvas::tools::prependToRenderState(aLocalState, rTransformation);
+                 
+                 return tools::calcDevicePixelBounds( 
+-                    ::vcl::unotools::b2DRectangleFromRectangle( maBounds ),
++                    maBounds,
+                     mpCanvas->getViewState(),
+                     aLocalState );
+             }
+@@ -501,12 +499,12 @@ namespace cppcanvas 
+                                                         rState.isLineColorSet ) );
+         }
+ 
+-        ActionSharedPtr PolyPolyActionFactory::createPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly,  
++        ActionSharedPtr PolyPolyActionFactory::createPolyPolyAction( const ::basegfx::B2DPolyPolygon&   rPoly,  
+                                                                      const CanvasSharedPtr&             rCanvas, 
+                                                                      const OutDevState&                 rState,
+                                                                      const rendering::Texture&          rTexture )
+         {
+-            return ActionSharedPtr( new TexturedPolyPolyAction( /*#i76339#*/ ::PolyPolygon(rPoly), rCanvas, rState, rTexture ) );
++            return ActionSharedPtr( new TexturedPolyPolyAction( rPoly, rCanvas, rState, rTexture ) );
+         }
+ 
+         ActionSharedPtr PolyPolyActionFactory::createLinePolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly,  
+@@ -528,7 +526,7 @@ namespace cppcanvas 
+         {
+             OSL_ENSURE( rState.isLineColorSet,
+                         "PolyPolyActionFactory::createPolyPolyAction() for strokes called with empty line color" );
+-            return ActionSharedPtr( new StrokedPolyPolyAction( /*#i76339#*/ ::PolyPolygon(rPoly), rCanvas, rState, rStrokeAttributes ) );
++            return ActionSharedPtr( new StrokedPolyPolyAction( rPoly, rCanvas, rState, rStrokeAttributes ) );
+         }
+ 
+         ActionSharedPtr PolyPolyActionFactory::createPolyPolyAction( const ::basegfx::B2DPolyPolygon& rPoly,  

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas-renderer.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas-renderer.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,199 @@
+diff -rup cppcanvas-orig/prj/build.lst cppcanvas/prj/build.lst
+--- cppcanvas-orig/prj/build.lst	2007-08-06 12:08:27.000000000 +0200
++++ cppcanvas/prj/build.lst	2007-11-06 15:06:07.000000000 +0100
+@@ -5,3 +5,4 @@ cx	cppcanvas\source\tools				nmake	-	all
+ cx	cppcanvas\source\wrapper			nmake	-	all cx_wrapper cx_inc NULL
+ cx	cppcanvas\source\mtfrenderer		nmake	-	all	cx_mtfrenderer cx_inc NULL
+ cx	cppcanvas\util						nmake	-	all	cx_util cx_tools cx_wrapper cx_mtfrenderer NULL
++cx	cppcanvas\source\uno				nmake	-	all	cx_uno cx_tools cx_wrapper cx_mtfrenderer cx_util NULL
+--- cppcanvas/prj/d.lst
++++ cppcanvas/prj/d.lst
+@@ -1,4 +1,5 @@
+ ..\%__SRC%\bin\cppcanvas*.dll %_DEST%\bin%_EXT%\cppcanvas*.dll
++..\%__SRC%\bin\mtfrenderer*.dll %_DEST%\bin%_EXT%\mtfrenderer*.dll
+ ..\%__SRC%\lib\icppcanvas.lib %_DEST%\lib%_EXT%\icppcanvas.lib
+ ..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.*
+ 
+--- /dev/null	2007-10-08 22:21:59.000000000 +0200
++++ cppcanvas/source/uno/exports.dxp	2007-11-06 15:03:31.000000000 +0100
+@@ -0,0 +1,3 @@
++component_getImplementationEnvironment
++component_writeInfo
++component_getFactory
+--- /dev/null	2007-10-08 22:21:59.000000000 +0200
++++ cppcanvas/source/uno/exports.map	2007-11-06 15:03:38.000000000 +0100
+@@ -0,0 +1,8 @@
++CAN_1_0 {
++	global:
++		component_getImplementationEnvironment;
++		component_writeInfo;
++		component_getFactory;
++	local:
++		*;
++};
+--- /dev/null	2007-10-08 22:21:59.000000000 +0200
++++ cppcanvas/source/uno/makefile.mk	2007-11-06 15:09:24.000000000 +0100
+@@ -0,0 +1,71 @@
++#*************************************************************************
++#
++#   OpenOffice.org - a multi-platform office productivity suite
++#
++#   $RCSfile: makefile.mk,v $
++#
++#   $Revision: 1.6 $
++#
++#   last change: $Author: hr $ $Date: 2006/06/20 05:14:24 $
++#
++#   The Contents of this file are made available subject to
++#   the terms of GNU Lesser General Public License Version 2.1.
++#
++#
++#     GNU Lesser General Public License Version 2.1
++#     =============================================
++#     Copyright 2005 by Sun Microsystems, Inc.
++#     901 San Antonio Road, Palo Alto, CA 94303, USA
++#
++#     This library is free software; you can redistribute it and/or
++#     modify it under the terms of the GNU Lesser General Public
++#     License version 2.1, as published by the Free Software Foundation.
++#
++#     This library is distributed in the hope that it will be useful,
++#     but WITHOUT ANY WARRANTY; without even the implied warranty of
++#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++#     Lesser General Public License for more details.
++#
++#     You should have received a copy of the GNU Lesser General Public
++#     License along with this library; if not, write to the Free Software
++#     Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++#     MA  02111-1307  USA
++#
++#*************************************************************************
++
++PRJ=..$/..
++
++PRJNAME=cppcanvas
++TARGET=mtfrenderer
++ENABLE_EXCEPTIONS=TRUE
++
++
++# --- Settings -----------------------------------------------------------
++
++.INCLUDE :	settings.mk
++
++# --- Common ----------------------------------------------------------
++
++.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
++CDEFS+= -DVERBOSE
++.ENDIF
++
++SLOFILES =	$(SLO)$/uno_mtfrenderer.obj
++
++SHL1TARGET=$(TARGET).uno
++
++SHL1STDLIBS= $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB) $(COMPHELPERLIB) $(CPPCANVASLIB) $(BASEGFXLIB)
++
++SHL1IMPLIB=i$(TARGET)
++SHL1LIBS=$(SLB)$/$(TARGET).lib
++SHL1DEF=$(MISC)$/$(SHL1TARGET).def
++
++SHL1VERSIONMAP=exports.map
++
++DEF1NAME=$(SHL1TARGET)
++DEF1EXPORTFILE=exports.dxp
++
++# ==========================================================================
++
++.INCLUDE :	target.mk
++
+--- /dev/null	2007-10-08 22:21:59.000000000 +0200
++++ cppcanvas/source/uno/uno_mtfrenderer.cxx	2007-11-07 15:10:55.000000000 +0100
+@@ -0,0 +1,53 @@
++#include "uno_mtfrenderer.hxx"
++#include <cppcanvas/vclfactory.hxx>
++#include <comphelper/servicedecl.hxx>
++#include <cppuhelper/factory.hxx>
++
++using namespace ::com::sun::star;
++
++void MtfRenderer::setMetafile (const uno::Sequence< sal_Int8 >& rMtf) throw (uno::RuntimeException)
++{
++        // printf ("MtfRenderer::setMetafile unimplemented, use fast property set or implement me\n");
++}
++
++void MtfRenderer::draw (double fScaleX, double fScaleY) throw (uno::RuntimeException)
++{
++    if (mpMetafile && mxCanvas.get()) {
++        cppcanvas::VCLFactory& factory = cppcanvas::VCLFactory::getInstance();
++        cppcanvas::BitmapCanvasSharedPtr canvas = factory.createCanvas (mxCanvas);
++        cppcanvas::RendererSharedPtr renderer = factory.createRenderer (canvas, *mpMetafile, cppcanvas::Renderer::Parameters ());
++        ::basegfx::B2DHomMatrix aMatrix;
++        aMatrix.scale( fScaleX, fScaleY );
++        canvas->setTransformation( aMatrix );
++        renderer->draw ();
++    }
++}
++
++void MtfRenderer::setFastPropertyValue( sal_Int32 nHandle, const uno::Any& aAny)  throw (uno::RuntimeException)
++{
++    if (nHandle == 0) {
++        mpMetafile = (GDIMetaFile*) *reinterpret_cast<const sal_Int64*>(aAny.getValue()); 
++    }
++}
++
++MtfRenderer::MtfRenderer (uno::Sequence<uno::Any> const& aArgs, uno::Reference<uno::XComponentContext> const&) : MtfRendererBase (m_aMutex), mpMetafile (NULL)
++{
++    if( aArgs.getLength() == 1 ) {
++        aArgs[0] >>= mxCanvas;
++    }
++}
++
++namespace sdecl = comphelper::service_decl;
++#if defined (__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)
++ sdecl::class_<MtfRenderer, sdecl::with_args<true> > serviceImpl;
++ const sdecl::ServiceDecl MtfRendererDecl(
++     serviceImpl,
++#else
++ const sdecl::ServiceDecl MtfRendererDecl(
++     sdecl::class_<MtfRenderer, sdecl::with_args<true> >(),
++#endif
++    "com.sun.star.comp.rendering.MtfRenderer",
++    "com.sun.star.rendering.MtfRenderer" );
++
++// The C shared lib entry points
++COMPHELPER_SERVICEDECL_EXPORTS1(MtfRendererDecl)
+--- /dev/null	2007-10-08 22:21:59.000000000 +0200
++++ cppcanvas/source/uno/uno_mtfrenderer.hxx	2007-11-07 14:49:15.000000000 +0100
+@@ -0,0 +1,33 @@
++#ifndef _UNO_MTF_RENDERER_HXX_
++#define _UNO_MTF_RENDERER_HXX_
++#include <com/sun/star/rendering/MtfRenderer.hpp>
++#include <com/sun/star/rendering/XBitmapCanvas.hpp>
++#include <com/sun/star/uno/XComponentContext.hpp>
++#include <com/sun/star/beans/XFastPropertySet.hpp>
++#include <cppuhelper/compbase2.hxx>
++#include <cppuhelper/basemutex.hxx>
++#include <vcl/gdimtf.hxx>
++
++typedef cppu::WeakComponentImplHelper2<com::sun::star::rendering::XMtfRenderer, com::sun::star::beans::XFastPropertySet> MtfRendererBase;
++
++class MtfRenderer : private cppu::BaseMutex, public MtfRendererBase
++{
++public:
++    MtfRenderer (com::sun::star::uno::Sequence<com::sun::star::uno::Any> const& args,
++                 com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&);
++
++    // XMtfRenderer iface
++    void SAL_CALL setMetafile (const ::com::sun::star::uno::Sequence< sal_Int8 >& rMtf) throw (::com::sun::star::uno::RuntimeException);
++    void SAL_CALL draw (double fScaleX, double fScaleY) throw (::com::sun::star::uno::RuntimeException);
++
++    // XFastPropertySet
++    // setFastPropertyValue (0, GDIMetaFile*) is used to speedup the rendering
++    virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle)  throw (::com::sun::star::uno::RuntimeException) { return ::com::sun::star::uno::Any(); }
++    virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any&)  throw (::com::sun::star::uno::RuntimeException);
++
++private:
++    GDIMetaFile* mpMetafile;
++    com::sun::star::uno::Reference<com::sun::star::rendering::XBitmapCanvas> mxCanvas;
++};
++
++#endif

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-cppcanvas.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,79 @@
+diff -rpu cppcanvas-orig/source/mtfrenderer/implrenderer.cxx cppcanvas/source/mtfrenderer/implrenderer.cxx
+--- cppcanvas-orig/source/mtfrenderer/implrenderer.cxx	2007-08-06 12:08:27.000000000 +0200
++++ cppcanvas/source/mtfrenderer/implrenderer.cxx	2007-10-22 13:55:35.000000000 +0200
+@@ -526,6 +526,14 @@ namespace cppcanvas
+                     const uno::Sequence< double > aEndColor(
+                         ::vcl::unotools::colorToDoubleSequence( rParms.mrCanvas->getUNOCanvas()->getDevice(),
+                                                                 aVCLEndColor ) );
++                    uno::Sequence< uno::Sequence < double > > aColors(2);
++                    uno::Sequence< double > aStops(2);
++
++                    aStops[0] = 0.0;
++                    aStops[1] = 1.0;
++
++                    aColors[0] = aStartColor;
++                    aColors[1] = aEndColor;
+ 
+                     // Setup texture transformation
+                     // ----------------------------
+@@ -576,13 +584,13 @@ namespace cppcanvas
+                             {
+                                 case GRADIENT_LINEAR:
+                                     nOffsetX = rGradient.GetBorder() / 100.0;
+-                                    aTexture.Gradient = xFactory->createLinearHorizontalGradient( aStartColor,
+-                                                                                                  aEndColor );
++                                    aTexture.Gradient = xFactory->createLinearHorizontalGradient( aColors,
++                                                                                                  aStops );
+                                     break;
+ 
+                                 case GRADIENT_AXIAL:
+-                                    aTexture.Gradient = xFactory->createAxialHorizontalGradient( aStartColor,
+-                                                                                                 aEndColor );
++                                    aTexture.Gradient = xFactory->createAxialHorizontalGradient( aColors,
++                                                                                                 aStops );
+                                     break;
+ 
+                                 default: // other cases can't happen
+@@ -683,8 +691,8 @@ namespace cppcanvas
+                                     aTextureTransformation.scale( nScale, nScale );
+                                     aTextureTransformation.translate( 0.5, 0.5 );
+ 
+-                                    aTexture.Gradient = xFactory->createEllipticalGradient( aEndColor,
+-                                                                                            aStartColor,
++                                    aTexture.Gradient = xFactory->createEllipticalGradient( aColors,
++                                                                                            aStops,
+                                                                                             geometry::RealRectangle2D(0.0,0.0,
+                                                                                                                     1.0,1.0) );
+                                 }
+@@ -699,8 +707,8 @@ namespace cppcanvas
+                                     aTextureTransformation.translate( 0.5, 0.5 );
+ 
+                                     aTexture.Gradient = xFactory->createEllipticalGradient( 
+-                                        aEndColor,
+-                                        aStartColor,
++                                        aColors,
++                                        aStops,
+                                         ::basegfx::unotools::rectangle2DFromB2DRectangle( 
+                                             aBounds ));
+                                 }
+@@ -719,16 +727,16 @@ namespace cppcanvas
+                                         nScaleX = nScaleY;
+                                     }
+ 
+-                                    aTexture.Gradient = xFactory->createRectangularGradient( aEndColor,
+-                                                                                             aStartColor,
++                                    aTexture.Gradient = xFactory->createRectangularGradient( aColors,
++                                                                                             aStops,
+                                                                                              geometry::RealRectangle2D(0.0,0.0,
+                                                                                                                        1.0,1.0) );
+                                     break;
+ 
+                                 case GRADIENT_RECT:
+                                     aTexture.Gradient = xFactory->createRectangularGradient( 
+-                                        aEndColor,
+-                                        aStartColor,
++                                        aColors,
++                                        aStops,
+                                         ::basegfx::unotools::rectangle2DFromB2DRectangle( 
+                                             aBounds ) );
+                                     break;

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-offapi-renderer.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-offapi-renderer.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,35 @@
+diff -rup offapi-orig/com/sun/star/rendering/makefile.mk offapi/com/sun/star/rendering/makefile.mk
+--- offapi-orig/com/sun/star/rendering/makefile.mk	2007-09-05 21:51:02.000000000 +0200
++++ offapi/com/sun/star/rendering/makefile.mk	2007-11-05 17:24:52.000000000 +0100
+@@ -113,7 +113,8 @@ IDLFILES=\
+ 	XIeeeDoubleBitmap.idl \
+ 	XIeeeFloatBitmap.idl \
+ 	XIntegerBitmap.idl \
+-	CanvasFactory.idl
++	CanvasFactory.idl \
++	MtfRenderer.idl
+ 
+ # ------------------------------------------------------------------
+ 
+--- /dev/null	2007-10-08 22:21:59.000000000 +0200
++++ offapi/com/sun/star/rendering/MtfRenderer.idl	2007-11-07 15:00:35.000000000 +0100
+@@ -0,0 +1,19 @@
++#ifndef __com_sun_star_rendering_MtfRenderer_idl__
++#define __com_sun_star_rendering_MtfRenderer_idl__
++
++#ifndef __com_sun_star_uno_XCanvas_idl__ 
++#include <com/sun/star/rendering/XCanvas.idl> 
++#endif 
++
++module com { module sun { module star { module rendering {
++
++	interface XMtfRenderer : ::com::sun::star::uno::XInterface
++	{
++		void setMetafile( [in] sequence< byte > aMtf );
++		void draw( [in] double fScaleX, [in] double fScaleY );
++	};
++
++	service MtfRenderer : XMtfRenderer;
++}; }; }; };
++
++#endif

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-offapi.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-offapi.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,55 @@
+diff -rup offapi-orig/com/sun/star/rendering/XColorSpace.idl offapi/com/sun/star/rendering/XColorSpace.idl
+--- offapi-orig/com/sun/star/rendering/XColorSpace.idl	2007-09-05 21:51:02.000000000 +0200
++++ offapi/com/sun/star/rendering/XColorSpace.idl	2007-09-05 22:00:41.000000000 +0200
+@@ -63,6 +63,7 @@ interface XColorSpace
+ 
+ /// Shorthand for the device-dependent color components, and easier to read
+ typedef double ColorComponent;
++typedef sequence<ColorComponent> Color;
+ 
+ }; }; }; };
+ 
+diff -rup offapi-orig/com/sun/star/rendering/XParametricPolyPolygon2DFactory.idl offapi/com/sun/star/rendering/XParametricPolyPolygon2DFactory.idl
+--- offapi-orig/com/sun/star/rendering/XParametricPolyPolygon2DFactory.idl	2007-09-05 21:51:02.000000000 +0200
++++ offapi/com/sun/star/rendering/XParametricPolyPolygon2DFactory.idl	2007-09-06 17:04:28.000000000 +0200
+@@ -60,11 +60,11 @@ interface XParametricPolyPolygon2DFactor
+ {
+     /** Create a linear gradient.
+ 
+-		The gradient varies linearly between leftColor and rightColor
++		The gradient varies linearly between colors. the color positions on <0, 1> interval are given by stops values
+ 		in the x direction, and has constant color for fixed x
+ 		coordinate value in y direction
+      */
+-    XParametricPolyPolygon2D	createLinearHorizontalGradient( [in] sequence<ColorComponent> leftColor, [in] sequence<ColorComponent> rightColor )
++    XParametricPolyPolygon2D	createLinearHorizontalGradient( [in] sequence<Color> colors, [in] sequence<double> stops )
+         raises (com::sun::star::lang::IllegalArgumentException); 
+ 
+     /** Create an axial gradient.
+@@ -74,7 +74,7 @@ interface XParametricPolyPolygon2DFactor
+ 		x direction. For fixed x coordinate, the gradient has constant
+ 		color value in y direction.
+      */
+-    XParametricPolyPolygon2D	createAxialHorizontalGradient( [in] sequence<ColorComponent> middleColor, [in] sequence<ColorComponent> endColor )
++    XParametricPolyPolygon2D	createAxialHorizontalGradient( [in] sequence<Color> colors, [in] sequence<double> stops )
+         raises (com::sun::star::lang::IllegalArgumentException); 
+ 
+     /** Create an elliptical gradient.
+@@ -89,7 +89,7 @@ interface XParametricPolyPolygon2DFactor
+ 		center color: the gradient will not collapse into a single
+ 		point, but become a line of center color.
+      */
+-    XParametricPolyPolygon2D	createEllipticalGradient( [in] sequence<ColorComponent> centerColor, [in] sequence<ColorComponent> endColor, [in] ::com::sun::star::geometry::RealRectangle2D boundRect )
++    XParametricPolyPolygon2D	createEllipticalGradient( [in] sequence<Color> colors, [in] sequence<double> stops, [in] ::com::sun::star::geometry::RealRectangle2D boundRect )
+         raises (com::sun::star::lang::IllegalArgumentException); 
+ 
+     /** Create a rectangular gradient.
+@@ -104,7 +104,7 @@ interface XParametricPolyPolygon2DFactor
+ 		the center color: the gradient will not collapse into a single
+ 		point, but become a line of center color.
+      */
+-    XParametricPolyPolygon2D	createRectangularGradient( [in] sequence<ColorComponent> centerColor, [in] sequence<ColorComponent> endColor, [in] ::com::sun::star::geometry::RealRectangle2D boundRect )
++    XParametricPolyPolygon2D	createRectangularGradient( [in] sequence<Color> colors, [in] sequence<double> stops, [in] ::com::sun::star::geometry::RealRectangle2D boundRect )
+         raises (com::sun::star::lang::IllegalArgumentException); 
+ 
+     /** Create a line hash of vertical lines.

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-scp2-renderer.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-scp2-renderer.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,77 @@
+diff -rup scp2-orig/source/canvas/makefile.mk scp2/source/canvas/makefile.mk
+--- scp2-orig/source/canvas/makefile.mk	2007-11-10 13:51:54.000000000 +0100
++++ scp2/source/canvas/makefile.mk	2007-11-10 13:57:56.000000000 +0100
+@@ -56,7 +56,8 @@ SCPDEFS+=-DSYSTEM_AGG
+ 
+ PARFILES= canvascommons.par		\
+           directxcanvas.par     \
+-          vclcanvas.par
++          vclcanvas.par         \
++          mtfrenderer.par
+ 
+ .IF "$(ENABLE_CAIRO)" == "TRUE"
+ PARFILES+= cairocanvas.par
+diff -rup scp2-orig/util/makefile.mk scp2/util/makefile.mk
+--- scp2-orig/util/makefile.mk	2007-11-10 13:51:56.000000000 +0100
++++ scp2/util/makefile.mk	2007-11-10 15:58:29.000000000 +0100
+@@ -167,7 +167,8 @@ SCP1FILES += \
+ .ENDIF
+ 
+ SCP1FILES += \
+-             vclcanvas.par
++             vclcanvas.par \
++             mtfrenderer.par
+ 
+ .IF "$(ENABLE_CAIRO)" == "TRUE"
+ SCP1FILES += cairocanvas.par
+--- /dev/null	2007-10-08 22:21:59.000000000 +0200
++++ scp2/source/canvas/mtfrenderer.scp	2007-11-10 13:57:06.000000000 +0100
+@@ -0,0 +1,48 @@
++/*************************************************************************
++ *
++ *  OpenOffice.org - a multi-platform office productivity suite
++ *
++ *  $RCSfile: cairocanvas.scp,v $
++ *
++ *  $Revision: 1.3 $
++ *
++ *  last change: $Author: kz $ $Date: 2006/12/13 16:12:23 $
++ *
++ *  The Contents of this file are made available subject to
++ *  the terms of GNU Lesser General Public License Version 2.1.
++ *
++ *
++ *    GNU Lesser General Public License Version 2.1
++ *    =============================================
++ *    Copyright 2005 by Sun Microsystems, Inc.
++ *    901 San Antonio Road, Palo Alto, CA 94303, USA
++ *
++ *    This library is free software; you can redistribute it and/or
++ *    modify it under the terms of the GNU Lesser General Public
++ *    License version 2.1, as published by the Free Software Foundation.
++ *
++ *    This library is distributed in the hope that it will be useful,
++ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
++ *    Lesser General Public License for more details.
++ *
++ *    You should have received a copy of the GNU Lesser General Public
++ *    License along with this library; if not, write to the Free Software
++ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ *    MA  02111-1307  USA
++ *
++************************************************************************/
++
++#include "macros.inc"
++
++File gid_File_Lib_MtfRenderer
++    TXT_FILE_BODY;
++    Styles = (PACKED,UNO_COMPONENT);
++    RegistryID = gid_Starregistry_Services_Rdb;
++    Dir = gid_Dir_Program;
++  #ifdef UNX
++    Name = STRING(CONCAT2(libmtfrenderer.uno,UNXSUFFIX));
++  #else
++    Name = "mtfrenderer.uno.dll";
++  #endif
++End

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-svtools.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-svtools.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,258 @@
+diff -rup svtools/source/filter.vcl/wmf-orig/enhwmf.cxx svtools/source/filter.vcl/wmf/enhwmf.cxx
+--- svtools/source/filter.vcl/wmf-orig/enhwmf.cxx	2007-08-03 10:55:01.000000000 +0200
++++ svtools/source/filter.vcl/wmf/enhwmf.cxx	2007-10-30 16:37:13.000000000 +0100
+@@ -168,6 +168,8 @@
+ #define EMR_SETLINKEDUFIS              119
+ #define EMR_SETTEXTJUSTIFICATION       120
+ 
++#define EMFP_DEBUG(x)
++//#define EMFP_DEBUG(x) x
+ 
+ //-----------------------------------------------------------------------------------
+ 
+@@ -239,6 +241,110 @@ static sal_Bool ImplReadRegion( PolyPoly
+     return bOk;
+ }
+ 
++EMFP_DEBUG(void dumpWords( SvStream& s, int i )
++{
++    sal_uInt32 pos = s.Tell();
++    INT16 data;
++    for( ; i > 0; i -- ) {
++        s >> data;
++        EMFP_DEBUG(printf ("\t\t\tdata: %04hx\n", data));
++    }
++    s.Seek (pos);
++});
++
++void EnhWMFReader::ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC)
++{
++    if (!bEMFPlus) {
++        pOut->PassEMFPlusHeaderInfo();
++
++        // debug code - write the stream to debug file /tmp/emf-stream.emf
++        EMFP_DEBUG(int pos = pWMF->Tell();
++        pWMF->Seek(0);
++        SvFileStream file( UniString::CreateFromAscii( "/tmp/emf-stream.emf" ), STREAM_WRITE | STREAM_TRUNC );
++
++        *pWMF >> file;
++        file.Flush();
++        file.Close();
++
++        pWMF->Seek( pos );)
++    }
++    bEMFPlus = true;
++
++    void *buffer = malloc( length );
++
++    int count = 0, next, pos = pWMF->Tell();
++    pOut->PassEMFPlus( buffer, pWMF->Read( buffer, length ) );
++    pWMF->Seek( pos );
++
++    bHaveDC = false;
++
++    length -= 4;
++
++    while (length > 0) {
++        UINT16 type, flags;
++        UINT32 size, dataSize;
++        sal_uInt32 next;
++
++        *pWMF >> type >> flags >> size >> dataSize;
++
++        EMFP_DEBUG(printf ("\t\tEMF+ record type: %d\n", type));
++
++        // GetDC
++        if( type == 16388 ) {
++            bHaveDC = true;
++            EMFP_DEBUG(printf ("\t\tEMF+ lock DC (device context)\n", type));
++        }
++
++        next = pWMF->Tell() + ( size - 12 );
++
++        length -= size;
++
++        pWMF->Seek( next );
++    }
++
++    free( buffer );
++}
++
++void EnhWMFReader::ReadGDIComment()
++{
++    sal_uInt32 type;
++
++    *pWMF >> type;
++
++    switch( type ) {
++    case 2: {
++        sal_Int32 x, y, r, b;
++
++        EMFP_DEBUG(printf ("\t\tBEGINGROUP\n"));
++
++        *pWMF >> x >> y >> r >> b;
++        EMFP_DEBUG(printf ("\t\tbounding rectangle: %d,%d x %d,%d\n", x, y, r, b));
++
++        sal_uInt32 l;
++
++        *pWMF >> l;
++        EMFP_DEBUG(printf ("\t\tdescription length: %d\n", l));
++
++        break;
++    }
++    case 3: {
++        sal_uInt32 x, y, w, h;
++
++        EMFP_DEBUG(printf ("\t\tENDGROUP\n"));
++        break;
++    }
++    case 0x40000004: {
++        sal_uInt32 x, y, w, h;
++
++        EMFP_DEBUG(printf ("\t\tMULTIFORMATS\n"));
++        break;
++    }
++    default:
++        EMFP_DEBUG(printf ("\t\tunknown GDIComment\n"));
++        EMFP_DEBUG(dumpWords (*pWMF, 16));
++    }
++}
++
+ BOOL EnhWMFReader::ReadEnhWMF()
+ {
+ 	sal_uInt32  nStretchBltMode = 0;
+@@ -249,6 +355,14 @@ BOOL EnhWMFReader::ReadEnhWMF()
+ 	sal_Int16   nX16, nY16;
+ 
+ 	sal_Bool	bFlag, bStatus = ReadHeader();
++    sal_Bool    bHaveDC = false;
++
++#ifdef UNX
++    static sal_Bool bEnableEMFPlus = ( getenv( "EMF_PLUS_DISABLE" ) == NULL );
++#else
++    // TODO: make it possible to disable emf+ on windows
++    static sal_Bool bEnableEMFPlus = sal_True;
++#endif
+ 
+ 	while( bStatus && nRecordCount-- )
+ 	{
+@@ -273,6 +387,33 @@ BOOL EnhWMFReader::ReadEnhWMF()
+ 
+ 		bFlag = sal_False;
+ 
++        EMFP_DEBUG(printf ("0x%04x-0x%04x record type: %d size: %d\n", nNextPos - nRecSize, nNextPos, nRecType, nRecSize));
++
++        if( bEnableEMFPlus && nRecType == EMR_GDICOMMENT ) {
++            sal_uInt32 length;
++
++            *pWMF >> length;
++
++            EMFP_DEBUG(printf ("\tGDI comment\n\t\tlength: %d\n", length));
++
++            if( length >= 4 ) {
++                UINT32 id;
++
++                *pWMF >> id;
++
++                EMFP_DEBUG(printf ("\t\tbegin %c%c%c%c id: 0x%x\n", (char)(id & 0xff), (char)((id & 0xff00) >> 8), (char)((id & 0xff0000) >> 16), (char)((id & 0xff000000) >> 24), id));
++
++                // EMF+ comment (fixme: BE?)
++                if( id == 0x2B464D45 && nRecSize >= 12 )
++                    ReadEMFPlusComment( length, bHaveDC );
++                // GDIC comment, doesn't do anything useful yet => enabled only for debug
++                else if( id == 0x43494447 && nRecSize >= 12 )
++                    EMFP_DEBUG(ReadGDIComment());
++                else
++                    EMFP_DEBUG(printf ("\t\tunknown id: 0x%x\n", id));
++            }
++        } else if( !bEMFPlus || bHaveDC || nRecType == EMR_EOF )
++
+ 		switch( nRecType )
+ 		{
+ 			case EMR_POLYBEZIERTO :
+diff -rup svtools/source/filter.vcl/wmf-orig/winmtf.cxx svtools/source/filter.vcl/wmf/winmtf.cxx
+--- svtools/source/filter.vcl/wmf-orig/winmtf.cxx	2007-08-03 10:55:01.000000000 +0200
++++ svtools/source/filter.vcl/wmf/winmtf.cxx	2007-10-30 13:46:54.000000000 +0100
+@@ -49,6 +49,9 @@
+ 
+ // ------------------------------------------------------------------------
+ 
++#define EMFP_DEBUG(x)
++//#define EMFP_DEBUG(x) x
++
+ #define WIN_MTF_MAX_POLYPOLYCOUNT	16
+ 
+ void WinMtfClipPath::ImpUpdateType()
+@@ -2234,3 +2237,36 @@ void WinMtfOutput::Pop()
+ 	}
+ }
+ 
++void WinMtfOutput::PassEMFPlusHeaderInfo()
++{
++    EMFP_DEBUG(printf ("\t\t\tadd EMF_PLUS header info\n"));
++
++    SvMemoryStream mem;
++    sal_Int32 nLeft, nRight, nTop, nBottom;
++
++    nLeft = mrclFrame.Left();
++	nTop = mrclFrame.Top();
++	nRight = mrclFrame.Right();
++	nBottom = mrclFrame.Bottom();
++
++    // emf header info
++    mem << nLeft << nTop << nRight << nBottom;
++    mem << mnPixX << mnPixY << mnMillX << mnMillY;
++
++    float one, zero;
++
++    one = 1;
++    zero = 0;
++
++    // add transformation matrix to be used in vcl's metaact.cxx for
++    // rotate and scale operations
++    mem << one << zero << zero << one << zero << zero;
++
++    mpGDIMetaFile->AddAction( new MetaCommentAction( "EMF_PLUS_HEADER_INFO", 0, (const BYTE*) mem.GetData(), mem.GetSize() ) );
++}
++
++void WinMtfOutput::PassEMFPlus( void* pBuffer, UINT32 nLength )
++{
++    EMFP_DEBUG(printf ("\t\t\tadd EMF_PLUS comment length %d\n", nLength));
++    mpGDIMetaFile->AddAction( new MetaCommentAction( "EMF_PLUS", 0, static_cast<const BYTE*>(pBuffer), nLength ) );
++}
+diff -rup svtools/source/filter.vcl/wmf-orig/winmtf.hxx svtools/source/filter.vcl/wmf/winmtf.hxx
+--- svtools/source/filter.vcl/wmf-orig/winmtf.hxx	2007-08-03 10:55:01.000000000 +0200
++++ svtools/source/filter.vcl/wmf/winmtf.hxx	2007-10-30 16:34:44.000000000 +0100
+@@ -713,6 +713,9 @@ class WinMtfOutput
+ 		void				SetClipPath( const PolyPolygon& rPolyPoly, sal_Int32 nClippingMode, sal_Bool bIsMapped );
+ 		void				UpdateClipRegion();
+ 
++        void                PassEMFPlus( void* pBuffer, UINT32 nLength );
++        void                PassEMFPlusHeaderInfo();
++
+ 							WinMtfOutput( GDIMetaFile& rGDIMetaFile );
+ 		virtual				~WinMtfOutput();
+ };
+@@ -751,6 +754,8 @@ class EnhWMFReader : public WinMtf
+ {
+ 	sal_Bool		bRecordPath;
+ 	sal_Int32		nRecordCount;
++    BOOL            bEMFPlus;
++
+ 
+ 	BOOL			ReadHeader();
+ 	Rectangle		ReadRectangle( INT32, INT32, INT32, INT32 );			// Liesst und konvertiert ein Rechteck
+@@ -758,10 +763,12 @@ class EnhWMFReader : public WinMtf
+ 
+ public:
+ 					EnhWMFReader( SvStream& rStreamWMF, GDIMetaFile& rGDIMetaFile, FilterConfigItem* pConfigItem = NULL )
+-									: WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ), bRecordPath( sal_False ) {};
++									: WinMtf( new WinMtfOutput( rGDIMetaFile ), rStreamWMF, pConfigItem ), bRecordPath( sal_False ), bEMFPlus (FALSE) {};
+ 					~EnhWMFReader();
+ 
+ 	BOOL			ReadEnhWMF();
++    void            ReadEMFPlusComment(sal_uInt32 length, sal_Bool& bHaveDC);
++    void            ReadGDIComment();
+ };
+ 
+ //============================ WMFReader ==================================

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-vcl-bitmap.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-vcl-bitmap.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,166 @@
+diff -rup ../src680-m224/vcl/inc/vcl/salbmp.hxx vcl/inc/vcl/salbmp.hxx
+--- ../src680-m224/vcl/inc/vcl/salbmp.hxx	2007-04-11 20:05:11.000000000 +0200
++++ vcl/inc/vcl/salbmp.hxx	2007-10-10 15:46:55.000000000 +0200
+@@ -44,6 +44,8 @@
+ #include <vcl/dllapi.h>
+ #endif
+ 
++#include <com/sun/star/rendering/XBitmapCanvas.hpp>
++
+ struct BitmapBuffer;
+ class SalGraphics;
+ class BitmapPalette;
+@@ -63,6 +65,9 @@ public:
+                                     SalGraphics* pGraphics ) = 0;
+ 	virtual bool			Create( const SalBitmap& rSalBmp,
+                                     USHORT nNewBitCount ) = 0;
++	virtual bool			Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
++                                    Size& rSize,
++                                    bool bMask = false ) = 0;
+ 	virtual void			Destroy() = 0;
+ 	virtual Size			GetSize() const = 0;
+ 	virtual USHORT			GetBitCount() const = 0;
+diff -rup ../src680-m224/vcl/unx/headless/svpbmp.cxx vcl/unx/headless/svpbmp.cxx
+--- ../src680-m224/vcl/unx/headless/svpbmp.cxx	2007-07-24 12:25:56.000000000 +0200
++++ vcl/unx/headless/svpbmp.cxx	2007-10-10 15:56:29.000000000 +0200
+@@ -124,6 +124,11 @@ bool SvpSalBitmap::Create( const SalBitm
+     return false;
+ }
+ 
++bool SvpSalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > /*xBitmapCanvas*/, Size& /*rSize*/, bool /*bMask*/ )
++{
++    return false;
++}
++
+ void SvpSalBitmap::Destroy()
+ {
+     m_aBitmap.reset();
+diff -rup ../src680-m224/vcl/unx/headless/svpbmp.hxx vcl/unx/headless/svpbmp.hxx
+--- ../src680-m224/vcl/unx/headless/svpbmp.hxx	2007-07-24 12:26:10.000000000 +0200
++++ vcl/unx/headless/svpbmp.hxx	2007-10-10 15:55:45.000000000 +0200
+@@ -61,6 +61,9 @@ public:
+                                     SalGraphics* pGraphics );
+ 	virtual bool			Create( const SalBitmap& rSalBmp,
+                                     USHORT nNewBitCount );
++    virtual bool            Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
++                                    Size& rSize,
++                                    bool bMask = false );
+ 	virtual void			Destroy();
+ 	virtual Size			GetSize() const;
+ 	virtual USHORT			GetBitCount() const;
+diff -rup ../src680-m224/vcl/unx/inc/salbmp.h vcl/unx/inc/salbmp.h
+--- ../src680-m224/vcl/unx/inc/salbmp.h	2007-06-27 22:40:18.000000000 +0200
++++ vcl/unx/inc/salbmp.h	2007-10-10 15:47:30.000000000 +0200
+@@ -127,6 +127,9 @@ public:					
+                                     SalGraphics* pGraphics );
+ 	virtual bool			Create( const SalBitmap& rSalBmp,
+                                     USHORT nNewBitCount );
++    virtual bool			Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
++                                    Size& rSize,
++                                    bool bMask = false );
+ 						
+ 	virtual void			Destroy();
+ 						
+diff -rup ../src680-m224/vcl/unx/source/gdi/salbmp.cxx vcl/unx/source/gdi/salbmp.cxx
+--- ../src680-m224/vcl/unx/source/gdi/salbmp.cxx	2007-06-27 22:49:34.000000000 +0200
++++ vcl/unx/source/gdi/salbmp.cxx	2007-10-23 18:29:07.000000000 +0200
+@@ -72,6 +72,7 @@
+ #ifndef _SV_BITMAP_HXX
+ #include <vcl/bitmap.hxx>
+ #endif
++#include <com/sun/star/beans/XFastPropertySet.hpp>
+
+ // -----------
+ // - Defines -
+@@ -740,6 +743,31 @@ bool X11SalBitmap::Create( const SalBitm
+ 
+ // -----------------------------------------------------------------------------
+ 
++bool X11SalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas, Size& rSize, bool bMask )
++{
++    ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, ::com::sun::star::uno::UNO_QUERY );
++    if( xFastPropertySet.get() ) {
++        long pixmapHandle;
++        sal_Int32 depth;
++        ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > args;
++
++        if( xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args ) {
++            if( ( args[1] >>= pixmapHandle ) && ( args[2] >>= depth ) ) {
++                bool bSuccess = ImplCreateFromDrawable( pixmapHandle, 0, depth, 0, 0, (long) rSize.Width(), (long) rSize.Height() );
++                bool bFreePixmap;
++                if( bSuccess && (args[0] >>= bFreePixmap) && bFreePixmap )
++                    XFreePixmap( GetX11SalData()->GetDisplay()->GetDisplay(), pixmapHandle );
++
++                return bSuccess;
++            }
++        }
++    }
++
++    return false;
++}
++
++// -----------------------------------------------------------------------------
++
+ void X11SalBitmap::Destroy()
+ {
+        if( mpDIB )
+diff -rup ../src680-m224/vcl/aqua/inc/salbmp.h vcl/aqua/inc/salbmp.h
+--- ../src680-m224/vcl/aqua/inc/salbmp.h	2007-07-05 17:58:54.000000000 +0200
++++ vcl/aqua/inc/salbmp.h	2007-10-31 16:02:15.000000000 +0100
+@@ -117,6 +117,9 @@ public:
+     bool            Create( const SalBitmap& rSalBmp );
+     bool            Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics );
+     bool            Create( const SalBitmap& rSalBmp, USHORT nNewBitCount );
++    virtual bool    Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
++                            Size& rSize,
++                            bool bMask = false );
+     
+     void            Destroy();
+     
+diff -rup ../src680-m224/vcl/aqua/source/gdi/salbmp.cxx vcl/aqua/source/gdi/salbmp.cxx
+--- ../src680-m224/vcl/aqua/source/gdi/salbmp.cxx	2007-07-05 12:13:21.000000000 +0200
++++ vcl/aqua/source/gdi/salbmp.cxx	2007-10-31 16:03:49.000000000 +0100
+@@ -218,6 +218,13 @@ bool AquaSalBitmap::Create( const SalBit
+ 
+ // ------------------------------------------------------------------
+ 
++bool AquaSalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > /*xBitmapCanvas*/, Size& /*rSize*/, bool /*bMask*/ )
++{
++    return false;
++}
++
++// ------------------------------------------------------------------
++
+ void AquaSalBitmap::Destroy()
+ {
+ 	DestroyContext();
+diff -rup ../src680-m224/vcl/win/inc/salbmp.h vcl/win/inc/salbmp.h
+--- ../src680-m224/vcl/win/inc/salbmp.h	2007-06-27 22:52:50.000000000 +0200
++++ vcl/win/inc/salbmp.h	2007-10-31 16:01:37.000000000 +0100
+@@ -93,6 +93,9 @@ public:
+ 	virtual bool                Create( const SalBitmap& rSalBmpImpl );
+ 	virtual bool                Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics );
+ 	virtual bool                Create( const SalBitmap& rSalBmpImpl, USHORT nNewBitCount );
++	virtual bool                Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > xBitmapCanvas,
++                                           Size& rSize,
++                                           bool bMask = false );
+ 
+ 	virtual void                Destroy();
+ 
+diff -rup ../src680-m224/vcl/win/source/gdi/salbmp.cxx vcl/win/source/gdi/salbmp.cxx
+--- ../src680-m224/vcl/win/source/gdi/salbmp.cxx	2007-06-27 22:57:18.000000000 +0200
++++ vcl/win/source/gdi/salbmp.cxx	2007-10-31 16:04:27.000000000 +0100
+@@ -288,6 +288,13 @@ bool WinSalBitmap::Create( const SalBitm
+ 
+ // ------------------------------------------------------------------
+ 
++bool WinSalBitmap::Create( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > /*xBitmapCanvas*/, Size& /*rSize*/, bool /*bMask*/ )
++{
++    return false;
++}
++
++// ------------------------------------------------------------------
++
+ void WinSalBitmap::Destroy()
+ {
+ 	if( mhDIB )

Added: branches/sled-10-ooo-build-2-3/patches/emf+/emf+-vcl-renderer.diff
==============================================================================
--- (empty file)
+++ branches/sled-10-ooo-build-2-3/patches/emf+/emf+-vcl-renderer.diff	Mon Jan  7 11:09:20 2008
@@ -0,0 +1,205 @@
+diff -rup vcl-orig/inc/vcl/gdimtf.hxx vcl/inc/vcl/gdimtf.hxx
+--- vcl-orig/inc/vcl/gdimtf.hxx	2007-11-09 16:53:41.000000000 +0100
++++ vcl/inc/vcl/gdimtf.hxx	2007-11-07 18:06:27.000000000 +0100
+@@ -156,6 +156,7 @@ private:
+                                                       const OutputDevice&   rMapDev,
+                                                       const PolyPolygon&    rPolyPoly,
+                                                       const Gradient&	  	rGrad 		);
++	SAL_DLLPRIVATE bool			   ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize );
+ 
+ //#endif // __PRIVATE
+ 
+diff -rup vcl-orig/source/gdi/gdimtf.cxx vcl/source/gdi/gdimtf.cxx
+--- vcl-orig/source/gdi/gdimtf.cxx	2007-11-09 16:53:43.000000000 +0100
++++ vcl/source/gdi/gdimtf.cxx	2007-11-09 17:09:31.000000000 +0100
+@@ -66,8 +66,47 @@
+ #ifndef _SV_VIRDEV_HXX
+ #include <vcl/virdev.hxx>
+ #endif
++#ifndef _SV_SALBMP_HXX
++#include <vcl/salbmp.hxx>
++#endif
++#ifndef _SV_SVAPP_HXX
++#include <vcl/svapp.hxx>
++#endif
++#ifndef _SV_SVDATA_HXX
++#include <vcl/svdata.hxx>
++#endif
++#ifndef _SV_SALINST_HXX
++#include <vcl/salinst.hxx>
++#endif
++#ifndef _SV_GDIMTF_HXX
+ #include <vcl/gdimtf.hxx>
++#endif
++#ifndef _SV_GRAPHICTOOLS_HXX
+ #include <vcl/graphictools.hxx>
++#endif
++#ifndef _SV_CANVASTOOLS_HXX
++#include <vcl/canvastools.hxx>
++#endif
++#ifndef _SV_UNOHELP_HXX
++#include <vcl/unohelp.hxx>
++#endif
++#ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSET_HPP_
++#include <com/sun/star/beans/XFastPropertySet.hpp>
++#endif
++#ifndef _COM_SUN_STAR_RENDERING_XCANVAS_HPP_
++#include <com/sun/star/rendering/XCanvas.hpp>
++#endif
++#ifndef _COM_SUN_STAR_RENDERING_MTFRENDERER_HPP_
++#include <com/sun/star/rendering/MtfRenderer.hpp>
++#endif
++#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
++#include <comphelper/processfactory.hxx>
++#endif
++#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
++#include <com/sun/star/lang/XMultiServiceFactory.hpp>
++#endif
++
++using namespace com::sun::star;
+ 
+ // -----------
+ // - Defines -
+@@ -502,6 +541,76 @@ void GDIMetaFile::Play( OutputDevice* pO
+ 
+ // ------------------------------------------------------------------------
+ 
++bool GDIMetaFile::ImplPlayWithRenderer( OutputDevice* pOut, const Point& rPos, Size rDestSize )
++{
++    const Window* win = dynamic_cast <Window*> ( pOut );
++
++    if (!win)
++        win = Application::GetActiveTopWindow();
++    if (!win)
++        win = Application::GetFirstTopLevelWindow();
++
++    if (win) {
++        const uno::Reference<rendering::XCanvas>& xCanvas = win->GetCanvas ();
++        Size aSize (rDestSize.Width () + 1, rDestSize.Height () + 1);
++        const uno::Reference<rendering::XBitmap>& xBitmap = xCanvas->getDevice ()->createCompatibleAlphaBitmap (vcl::unotools::integerSize2DFromSize( aSize));
++        uno::Reference< lang::XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory();
++        if( xFactory.is() && xBitmap.is () ) {
++            uno::Reference< rendering::XMtfRenderer > xMtfRenderer;
++            uno::Sequence< uno::Any > args (1);
++            uno::Reference< rendering::XBitmapCanvas > xBitmapCanvas( xBitmap->queryBitmapCanvas() );
++            if( xBitmapCanvas.is() ) {
++                args[0] = uno::Any( xBitmapCanvas );
++                xMtfRenderer.set( xFactory->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "com.sun.star.rendering.MtfRenderer" ),
++                                                                         args ), uno::UNO_QUERY );
++                
++                if( xMtfRenderer.is() ) {
++                    xBitmapCanvas->clear();
++                    uno::Reference< beans::XFastPropertySet > xMtfFastPropertySet( xMtfRenderer, uno::UNO_QUERY );
++                    if( xMtfFastPropertySet.is() )
++                        // set this metafile to the renderer to
++                        // speedup things (instead of copying data to
++                        // sequence of bytes passed to renderer)
++                        xMtfFastPropertySet->setFastPropertyValue( 0, uno::Any( reinterpret_cast<sal_Int64>( this ) ) );
++
++                    xMtfRenderer->draw( rDestSize.Width(), rDestSize.Height() );
++
++                    uno::Reference< beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, uno::UNO_QUERY );
++                    if( xFastPropertySet.get() ) {
++                        // 0 means get BitmapEx
++                        uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 );
++                        BitmapEx* pBitmapEx = (BitmapEx*) *reinterpret_cast<const sal_Int64*>(aAny.getValue()); 
++                        if( pBitmapEx ) {
++                            pOut->DrawBitmapEx( rPos, *pBitmapEx );
++                            delete pBitmapEx;
++                            return true;
++                        }
++                    }
++                    
++                    SalBitmap* pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
++                    SalBitmap* pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap();
++
++                    if( pSalBmp->Create( xBitmapCanvas, aSize ) && pSalMask->Create( xBitmapCanvas, aSize, true ) ) {
++                        Bitmap aBitmap( pSalBmp );
++                        Bitmap aMask( pSalMask );
++                        AlphaMask aAlphaMask( aMask );
++                        BitmapEx aBitmapEx( aBitmap, aAlphaMask );
++                        pOut->DrawBitmapEx( rPos, aBitmapEx );
++                        return true;
++                    }
++
++                    delete pSalBmp;
++                    delete pSalMask;
++                }
++            }
++        }
++    }
++
++    return false;
++}
++
++// ------------------------------------------------------------------------
++
+ void GDIMetaFile::Play( OutputDevice* pOut, const Point& rPos,
+ 						const Size& rSize, ULONG nPos )
+ {
+@@ -511,8 +619,12 @@ void GDIMetaFile::Play( OutputDevice* pO
+ 
+ 	if( aDestSize.Width() && aDestSize.Height() )
+ 	{
+-		Size			aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
+-		GDIMetaFile*	pMtf = pOut->GetConnectMetaFile();
++        GDIMetaFile*	pMtf = pOut->GetConnectMetaFile();
++
++        if( !pMtf && ImplPlayWithRenderer( pOut, rPos, aDestSize ) )
++            return;
++
++        Size aTmpPrefSize( pOut->LogicToPixel( GetPrefSize(), aDrawMap ) );
+ 
+ 		if( !aTmpPrefSize.Width() )
+ 			aTmpPrefSize.Width() = aDestSize.Width();
+diff -rup vcl-orig/source/gdi/makefile.mk vcl/source/gdi/makefile.mk
+--- vcl-orig/source/gdi/makefile.mk	2007-11-09 16:53:43.000000000 +0100
++++ vcl/source/gdi/makefile.mk	2007-11-07 11:06:41.000000000 +0100
+@@ -125,6 +126,7 @@ SLOFILES=	$(SLO)$/salmisc.obj 	\
+ 
+ EXCEPTIONSFILES=	$(SLO)$/outdev.obj		\
+ 					$(SLO)$/outdev3.obj 	\
++					$(SLO)$/gdimtf.obj 	\
+ 					$(SLO)$/gfxlink.obj		\
+ 					$(SLO)$/print.obj		\
+                     $(SLO)$/print2.obj		\
+diff -rup vcl-orig/source/gdi/metaact.cxx vcl/source/gdi/metaact.cxx
+--- vcl-orig/source/gdi/metaact.cxx	2007-11-09 16:53:43.000000000 +0100
++++ vcl/source/gdi/metaact.cxx	2007-11-10 13:44:40.000000000 +0100
+@@ -4041,8 +4047,34 @@ void MetaCommentAction::Scale( double fX
+ 				}
+ 				delete[] mpData;
+ 				ImplInitDynamicData( static_cast<const BYTE*>( aDest.GetData() ), aDest.Tell() );
+-			}
+-		}
++            } else if( maComment.Equals( "EMF_PLUS_HEADER_INFO" ) ) {
++				SvMemoryStream	aMemStm( (void*)mpData, mnDataSize, STREAM_READ );
++				SvMemoryStream	aDest;
++
++                sal_Int32 nLeft, nRight, nTop, nBottom;
++                sal_Int32 nPixX, nPixY, nMillX, nMillY;
++                float m11, m12, m21, m22, mdx, mdy;
++
++                // read data
++                aMemStm >> nLeft >> nTop >> nRight >> nBottom;
++                aMemStm >> nPixX >> nPixY >> nMillX >> nMillY;
++                aMemStm >> m11 >> m12 >> m21 >> m22 >> mdx >> mdy;
++
++                // add scale to the transformation
++                m11 *= fXScale;
++                m12 *= fXScale;
++                m22 *= fYScale;
++                m21 *= fYScale;
++
++                // prepare new data
++                aDest << nLeft << nTop << nRight << nBottom;
++                aDest << nPixX << nPixY << nMillX << nMillY;
++                aDest << m11 << m12 << m21 << m22 << mdx << mdy;
++
++                // save them
++				ImplInitDynamicData( static_cast<const BYTE*>( aDest.GetData() ), aDest.Tell() );
++            }
++        }
+ 	}
+ }
+ 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]