Bump for 3.6-28
[LibreOffice.git] / cppcanvas / source / uno / uno_mtfrenderer.cxx
blobab480af456f5a8943f4b0bb1656df4f7b3f6bba1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2010 Novell, Inc.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "uno_mtfrenderer.hxx"
30 #include <cppcanvas/vclfactory.hxx>
31 #include <comphelper/servicedecl.hxx>
32 #include <cppuhelper/factory.hxx>
34 using namespace ::com::sun::star;
36 void MtfRenderer::setMetafile (const uno::Sequence< sal_Int8 >& /*rMtf*/) throw (uno::RuntimeException)
38 // printf ("MtfRenderer::setMetafile unimplemented, use fast property set or implement me\n");
41 void MtfRenderer::draw (double fScaleX, double fScaleY) throw (uno::RuntimeException)
43 if (mpMetafile && mxCanvas.get()) {
44 cppcanvas::VCLFactory& factory = cppcanvas::VCLFactory::getInstance();
45 cppcanvas::BitmapCanvasSharedPtr canvas = factory.createCanvas (mxCanvas);
46 cppcanvas::RendererSharedPtr renderer = factory.createRenderer (canvas, *mpMetafile, cppcanvas::Renderer::Parameters ());
47 ::basegfx::B2DHomMatrix aMatrix;
48 aMatrix.scale( fScaleX, fScaleY );
49 canvas->setTransformation( aMatrix );
50 renderer->draw ();
54 void MtfRenderer::setFastPropertyValue( sal_Int32 nHandle, const uno::Any& aAny) throw (uno::RuntimeException)
56 if (nHandle == 0) {
57 mpMetafile = (GDIMetaFile*) *reinterpret_cast<const sal_Int64*>(aAny.getValue());
61 MtfRenderer::MtfRenderer (uno::Sequence<uno::Any> const& aArgs, uno::Reference<uno::XComponentContext> const&) : MtfRendererBase (m_aMutex), mpMetafile (NULL)
63 if( aArgs.getLength() == 1 ) {
64 aArgs[0] >>= mxCanvas;
68 namespace sdecl = comphelper::service_decl;
69 const sdecl::ServiceDecl MtfRendererDecl(
70 sdecl::class_<MtfRenderer, sdecl::with_args<true> >(),
71 "com.sun.star.comp.rendering.MtfRenderer",
72 "com.sun.star.rendering.MtfRenderer" );
74 // The C shared lib entry points
75 COMPHELPER_SERVICEDECL_EXPORTS1(mtfrenderer, MtfRendererDecl)
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */