merge the formfield patch from ooo-build
[ooovba.git] / cppcanvas / source / uno / uno_mtfrenderer.cxx
blob804e9bf0bc818daf143c4dcdc7a804eb8e282223
1 #include "uno_mtfrenderer.hxx"
2 #include <cppcanvas/vclfactory.hxx>
3 #include <comphelper/servicedecl.hxx>
4 #include <cppuhelper/factory.hxx>
6 using namespace ::com::sun::star;
8 void MtfRenderer::setMetafile (const uno::Sequence< sal_Int8 >& rMtf) throw (uno::RuntimeException)
10 // printf ("MtfRenderer::setMetafile unimplemented, use fast property set or implement me\n");
13 void MtfRenderer::draw (double fScaleX, double fScaleY) throw (uno::RuntimeException)
15 if (mpMetafile && mxCanvas.get()) {
16 cppcanvas::VCLFactory& factory = cppcanvas::VCLFactory::getInstance();
17 cppcanvas::BitmapCanvasSharedPtr canvas = factory.createCanvas (mxCanvas);
18 cppcanvas::RendererSharedPtr renderer = factory.createRenderer (canvas, *mpMetafile, cppcanvas::Renderer::Parameters ());
19 ::basegfx::B2DHomMatrix aMatrix;
20 aMatrix.scale( fScaleX, fScaleY );
21 canvas->setTransformation( aMatrix );
22 renderer->draw ();
26 void MtfRenderer::setFastPropertyValue( sal_Int32 nHandle, const uno::Any& aAny) throw (uno::RuntimeException)
28 if (nHandle == 0) {
29 mpMetafile = (GDIMetaFile*) *reinterpret_cast<const sal_Int64*>(aAny.getValue());
33 MtfRenderer::MtfRenderer (uno::Sequence<uno::Any> const& aArgs, uno::Reference<uno::XComponentContext> const&) : MtfRendererBase (m_aMutex), mpMetafile (NULL)
35 if( aArgs.getLength() == 1 ) {
36 aArgs[0] >>= mxCanvas;
40 namespace sdecl = comphelper::service_decl;
41 #if defined (__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ <= 3)
42 sdecl::class_<MtfRenderer, sdecl::with_args<true> > serviceImpl;
43 const sdecl::ServiceDecl MtfRendererDecl(
44 serviceImpl,
45 #else
46 const sdecl::ServiceDecl MtfRendererDecl(
47 sdecl::class_<MtfRenderer, sdecl::with_args<true> >(),
48 #endif
49 "com.sun.star.comp.rendering.MtfRenderer",
50 "com.sun.star.rendering.MtfRenderer" );
52 // The C shared lib entry points
53 COMPHELPER_SERVICEDECL_EXPORTS1(MtfRendererDecl)