1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include "uno_mtfrenderer.hxx"
11 #include <cppcanvas/vclfactory.hxx>
12 #include <comphelper/servicedecl.hxx>
13 #include <cppuhelper/factory.hxx>
15 using namespace ::com::sun::star
;
17 void MtfRenderer::setMetafile (const uno::Sequence
< sal_Int8
>& /*rMtf*/) throw (uno::RuntimeException
, std::exception
)
19 // printf ("MtfRenderer::setMetafile unimplemented, use fast property set or implement me\n");
22 void MtfRenderer::draw (double fScaleX
, double fScaleY
) throw (uno::RuntimeException
, std::exception
)
24 if (mpMetafile
&& mxCanvas
.get()) {
25 cppcanvas::BitmapCanvasSharedPtr canvas
= cppcanvas::VCLFactory::createBitmapCanvas (mxCanvas
);
26 cppcanvas::RendererSharedPtr renderer
= cppcanvas::VCLFactory::createRenderer (canvas
, *mpMetafile
, cppcanvas::Renderer::Parameters ());
27 ::basegfx::B2DHomMatrix aMatrix
;
28 aMatrix
.scale( fScaleX
, fScaleY
);
29 canvas
->setTransformation( aMatrix
);
34 void MtfRenderer::setFastPropertyValue( sal_Int32 nHandle
, const uno::Any
& aAny
) throw (uno::RuntimeException
, std::exception
)
37 mpMetafile
= reinterpret_cast<GDIMetaFile
*>( *static_cast<const sal_Int64
*>(aAny
.getValue()) );
41 MtfRenderer::MtfRenderer (uno::Sequence
<uno::Any
> const& aArgs
, uno::Reference
<uno::XComponentContext
> const&) : MtfRendererBase (m_aMutex
), mpMetafile (NULL
)
43 if( aArgs
.getLength() == 1 ) {
44 aArgs
[0] >>= mxCanvas
;
48 namespace sdecl
= comphelper::service_decl
;
49 const sdecl::ServiceDecl
MtfRendererDecl(
50 sdecl::class_
<MtfRenderer
, sdecl::with_args
<true> >(),
51 "com.sun.star.comp.rendering.MtfRenderer",
52 "com.sun.star.rendering.MtfRenderer" );
54 // The C shared lib entry points
55 COMPHELPER_SERVICEDECL_EXPORTS1(mtfrenderer
, MtfRendererDecl
)
57 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */