update ooo310-m15
[ooovba.git] / applied_patches / 0727-emf+-cppcanvas-renderer.diff
blob9acecb0879f409cfa08886f74cb1b6f995b89397
1 diff -rup cppcanvas-orig/prj/build.lst cppcanvas/prj/build.lst
2 --- cppcanvas-orig/prj/build.lst 2007-08-06 12:08:27.000000000 +0200
3 +++ cppcanvas/prj/build.lst 2007-11-06 15:06:07.000000000 +0100
4 @@ -5,3 +5,4 @@ cx cppcanvas\source\tools nmake - all
5 cx cppcanvas\source\wrapper nmake - all cx_wrapper cx_inc NULL
6 cx cppcanvas\source\mtfrenderer nmake - all cx_mtfrenderer cx_inc NULL
7 cx cppcanvas\util nmake - all cx_util cx_tools cx_wrapper cx_mtfrenderer NULL
8 +cx cppcanvas\source\uno nmake - all cx_uno cx_tools cx_wrapper cx_mtfrenderer cx_util NULL
9 --- cppcanvas/prj/d.lst
10 +++ cppcanvas/prj/d.lst
11 @@ -1,4 +1,5 @@
12 ..\%__SRC%\bin\cppcanv*.dll %_DEST%\bin%_EXT%\cppcanv*.dll
13 +..\%__SRC%\bin\mtfrenderer*.dll %_DEST%\bin%_EXT%\mtfrenderer*.dll
14 ..\%__SRC%\lib\icppcanvas.lib %_DEST%\lib%_EXT%\icppcanvas.lib
15 ..\%__SRC%\lib\lib*.* %_DEST%\lib%_EXT%\lib*.*
17 --- /dev/null 2007-10-08 22:21:59.000000000 +0200
18 +++ cppcanvas/source/uno/exports.dxp 2007-11-06 15:03:31.000000000 +0100
19 @@ -0,0 +1,3 @@
20 +component_getImplementationEnvironment
21 +component_writeInfo
22 +component_getFactory
23 --- /dev/null 2007-10-08 22:21:59.000000000 +0200
24 +++ cppcanvas/source/uno/exports.map 2007-11-06 15:03:38.000000000 +0100
25 @@ -0,0 +1,8 @@
26 +CAN_1_0 {
27 + global:
28 + component_getImplementationEnvironment;
29 + component_writeInfo;
30 + component_getFactory;
31 + local:
32 + *;
33 +};
34 --- /dev/null 2007-10-08 22:21:59.000000000 +0200
35 +++ cppcanvas/source/uno/makefile.mk 2007-11-06 15:09:24.000000000 +0100
36 @@ -0,0 +1,71 @@
37 +#*************************************************************************
39 +# OpenOffice.org - a multi-platform office productivity suite
41 +# $RCSfile: makefile.mk,v $
43 +# $Revision: 1.6 $
45 +# last change: $Author: hr $ $Date: 2006/06/20 05:14:24 $
47 +# The Contents of this file are made available subject to
48 +# the terms of GNU Lesser General Public License Version 2.1.
51 +# GNU Lesser General Public License Version 2.1
52 +# =============================================
53 +# Copyright 2005 by Sun Microsystems, Inc.
54 +# 901 San Antonio Road, Palo Alto, CA 94303, USA
56 +# This library is free software; you can redistribute it and/or
57 +# modify it under the terms of the GNU Lesser General Public
58 +# License version 2.1, as published by the Free Software Foundation.
60 +# This library is distributed in the hope that it will be useful,
61 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
62 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
63 +# Lesser General Public License for more details.
65 +# You should have received a copy of the GNU Lesser General Public
66 +# License along with this library; if not, write to the Free Software
67 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
68 +# MA 02111-1307 USA
70 +#*************************************************************************
72 +PRJ=..$/..
74 +PRJNAME=cppcanvas
75 +TARGET=mtfrenderer
76 +ENABLE_EXCEPTIONS=TRUE
79 +# --- Settings -----------------------------------------------------------
81 +.INCLUDE : settings.mk
83 +# --- Common ----------------------------------------------------------
85 +.IF "$(verbose)"!="" || "$(VERBOSE)"!=""
86 +CDEFS+= -DVERBOSE
87 +.ENDIF
89 +SLOFILES = $(SLO)$/uno_mtfrenderer.obj
91 +SHL1TARGET=$(TARGET).uno
93 +SHL1STDLIBS= $(SALLIB) $(CPPULIB) $(CPPUHELPERLIB) $(COMPHELPERLIB) $(CPPCANVASLIB) $(BASEGFXLIB)
95 +SHL1IMPLIB=i$(TARGET)
96 +SHL1LIBS=$(SLB)$/$(TARGET).lib
97 +SHL1DEF=$(MISC)$/$(SHL1TARGET).def
99 +SHL1VERSIONMAP=exports.map
101 +DEF1NAME=$(SHL1TARGET)
102 +DEF1EXPORTFILE=exports.dxp
104 +# ==========================================================================
106 +.INCLUDE : target.mk
108 --- /dev/null 2007-10-08 22:21:59.000000000 +0200
109 +++ cppcanvas/source/uno/uno_mtfrenderer.cxx 2007-11-07 15:10:55.000000000 +0100
110 @@ -0,0 +1,53 @@
111 +#include "uno_mtfrenderer.hxx"
112 +#include <cppcanvas/vclfactory.hxx>
113 +#include <comphelper/servicedecl.hxx>
114 +#include <cppuhelper/factory.hxx>
116 +using namespace ::com::sun::star;
118 +void MtfRenderer::setMetafile (const uno::Sequence< sal_Int8 >& rMtf) throw (uno::RuntimeException)
120 + // printf ("MtfRenderer::setMetafile unimplemented, use fast property set or implement me\n");
123 +void MtfRenderer::draw (double fScaleX, double fScaleY) throw (uno::RuntimeException)
125 + if (mpMetafile && mxCanvas.get()) {
126 + cppcanvas::VCLFactory& factory = cppcanvas::VCLFactory::getInstance();
127 + cppcanvas::BitmapCanvasSharedPtr canvas = factory.createCanvas (mxCanvas);
128 + cppcanvas::RendererSharedPtr renderer = factory.createRenderer (canvas, *mpMetafile, cppcanvas::Renderer::Parameters ());
129 + ::basegfx::B2DHomMatrix aMatrix;
130 + aMatrix.scale( fScaleX, fScaleY );
131 + canvas->setTransformation( aMatrix );
132 + renderer->draw ();
136 +void MtfRenderer::setFastPropertyValue( sal_Int32 nHandle, const uno::Any& aAny) throw (uno::RuntimeException)
138 + if (nHandle == 0) {
139 + mpMetafile = (GDIMetaFile*) *reinterpret_cast<const sal_Int64*>(aAny.getValue());
143 +MtfRenderer::MtfRenderer (uno::Sequence<uno::Any> const& aArgs, uno::Reference<uno::XComponentContext> const&) : MtfRendererBase (m_aMutex), mpMetafile (NULL)
145 + if( aArgs.getLength() == 1 ) {
146 + aArgs[0] >>= mxCanvas;
150 +namespace sdecl = comphelper::service_decl;
151 +#if defined (__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)
152 + sdecl::class_<MtfRenderer, sdecl::with_args<true> > serviceImpl;
153 + const sdecl::ServiceDecl MtfRendererDecl(
154 + serviceImpl,
155 +#else
156 + const sdecl::ServiceDecl MtfRendererDecl(
157 + sdecl::class_<MtfRenderer, sdecl::with_args<true> >(),
158 +#endif
159 + "com.sun.star.comp.rendering.MtfRenderer",
160 + "com.sun.star.rendering.MtfRenderer" );
162 +// The C shared lib entry points
163 +COMPHELPER_SERVICEDECL_EXPORTS1(MtfRendererDecl)
164 --- /dev/null 2007-10-08 22:21:59.000000000 +0200
165 +++ cppcanvas/source/uno/uno_mtfrenderer.hxx 2007-11-07 14:49:15.000000000 +0100
166 @@ -0,0 +1,33 @@
167 +#ifndef _UNO_MTF_RENDERER_HXX_
168 +#define _UNO_MTF_RENDERER_HXX_
169 +#include <com/sun/star/rendering/MtfRenderer.hpp>
170 +#include <com/sun/star/rendering/XBitmapCanvas.hpp>
171 +#include <com/sun/star/uno/XComponentContext.hpp>
172 +#include <com/sun/star/beans/XFastPropertySet.hpp>
173 +#include <cppuhelper/compbase2.hxx>
174 +#include <cppuhelper/basemutex.hxx>
175 +#include <vcl/gdimtf.hxx>
177 +typedef cppu::WeakComponentImplHelper2<com::sun::star::rendering::XMtfRenderer, com::sun::star::beans::XFastPropertySet> MtfRendererBase;
179 +class MtfRenderer : private cppu::BaseMutex, public MtfRendererBase
181 +public:
182 + MtfRenderer (com::sun::star::uno::Sequence<com::sun::star::uno::Any> const& args,
183 + com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&);
185 + // XMtfRenderer iface
186 + void SAL_CALL setMetafile (const ::com::sun::star::uno::Sequence< sal_Int8 >& rMtf) throw (::com::sun::star::uno::RuntimeException);
187 + void SAL_CALL draw (double fScaleX, double fScaleY) throw (::com::sun::star::uno::RuntimeException);
189 + // XFastPropertySet
190 + // setFastPropertyValue (0, GDIMetaFile*) is used to speedup the rendering
191 + virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) throw (::com::sun::star::uno::RuntimeException) { return ::com::sun::star::uno::Any(); }
192 + virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any&) throw (::com::sun::star::uno::RuntimeException);
194 +private:
195 + GDIMetaFile* mpMetafile;
196 + com::sun::star::uno::Reference<com::sun::star::rendering::XBitmapCanvas> mxCanvas;
199 +#endif