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
);
26 void MtfRenderer::setFastPropertyValue( sal_Int32 nHandle
, const uno::Any
& aAny
) throw (uno::RuntimeException
)
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(
46 const sdecl::ServiceDecl
MtfRendererDecl(
47 sdecl::class_
<MtfRenderer
, sdecl::with_args
<true> >(),
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
)