LCOV - code coverage report
Current view: top level - cppcanvas/source/uno - uno_mtfrenderer.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 20 22 90.9 %
Date: 2015-06-13 12:38:46 Functions: 6 7 85.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  */
       9             : 
      10             : #include "uno_mtfrenderer.hxx"
      11             : #include <cppcanvas/vclfactory.hxx>
      12             : #include <comphelper/servicedecl.hxx>
      13             : #include <cppuhelper/factory.hxx>
      14             : 
      15             : using namespace ::com::sun::star;
      16             : 
      17           0 : void MtfRenderer::setMetafile (const uno::Sequence< sal_Int8 >& /*rMtf*/) throw (uno::RuntimeException, std::exception)
      18             : {
      19             :         // printf ("MtfRenderer::setMetafile unimplemented, use fast property set or implement me\n");
      20           0 : }
      21             : 
      22           2 : void MtfRenderer::draw (double fScaleX, double fScaleY) throw (uno::RuntimeException, std::exception)
      23             : {
      24           2 :     if (mpMetafile && mxCanvas.get()) {
      25           2 :         cppcanvas::BitmapCanvasSharedPtr canvas = cppcanvas::VCLFactory::createBitmapCanvas (mxCanvas);
      26           4 :         cppcanvas::RendererSharedPtr renderer = cppcanvas::VCLFactory::createRenderer (canvas, *mpMetafile, cppcanvas::Renderer::Parameters ());
      27           4 :         ::basegfx::B2DHomMatrix aMatrix;
      28           2 :         aMatrix.scale( fScaleX, fScaleY );
      29           2 :         canvas->setTransformation( aMatrix );
      30           4 :         renderer->draw ();
      31             :     }
      32           2 : }
      33             : 
      34           2 : void MtfRenderer::setFastPropertyValue( sal_Int32 nHandle, const uno::Any& aAny)  throw (uno::RuntimeException, std::exception)
      35             : {
      36           2 :     if (nHandle == 0) {
      37           2 :         mpMetafile = reinterpret_cast<GDIMetaFile*>( *static_cast<const sal_Int64*>(aAny.getValue()) );
      38             :     }
      39           2 : }
      40             : 
      41           2 : MtfRenderer::MtfRenderer (uno::Sequence<uno::Any> const& aArgs, uno::Reference<uno::XComponentContext> const&) : MtfRendererBase (m_aMutex), mpMetafile (NULL)
      42             : {
      43           2 :     if( aArgs.getLength() == 1 ) {
      44           2 :         aArgs[0] >>= mxCanvas;
      45             :     }
      46           2 : }
      47             : 
      48             : namespace sdecl = comphelper::service_decl;
      49           2 :  const sdecl::ServiceDecl MtfRendererDecl(
      50             :      sdecl::class_<MtfRenderer, sdecl::with_args<true> >(),
      51             :     "com.sun.star.comp.rendering.MtfRenderer",
      52           2 :     "com.sun.star.rendering.MtfRenderer" );
      53             : 
      54             : // The C shared lib entry points
      55           4 : COMPHELPER_SERVICEDECL_EXPORTS1(mtfrenderer, MtfRendererDecl)
      56             : 
      57             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11