LCOV - code coverage report
Current view: top level - cppcanvas/source/wrapper - vclfactory.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 24 0.0 %
Date: 2014-04-14 Functions: 0 9 0.0 %
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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <rtl/instance.hxx>
      21             : #include <osl/getglobalmutex.hxx>
      22             : #include <osl/diagnose.h>
      23             : #include <com/sun/star/rendering/InterpolationMode.hpp>
      24             : #include <vcl/window.hxx>
      25             : #include <vcl/graph.hxx>
      26             : #include <vcl/canvastools.hxx>
      27             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      28             : 
      29             : #include <cppcanvas/vclfactory.hxx>
      30             : 
      31             : #include <implbitmapcanvas.hxx>
      32             : #include <implspritecanvas.hxx>
      33             : #include <implpolypolygon.hxx>
      34             : #include <implbitmap.hxx>
      35             : #include <implrenderer.hxx>
      36             : #include <implsprite.hxx>
      37             : 
      38             : using namespace ::com::sun::star;
      39             : 
      40             : namespace cppcanvas
      41             : {
      42             :     /* Singleton handling */
      43             :     struct InitInstance
      44             :     {
      45           0 :         VCLFactory* operator()()
      46             :         {
      47           0 :             return new VCLFactory();
      48             :         }
      49             :     };
      50             : 
      51           0 :     VCLFactory& VCLFactory::getInstance()
      52             :     {
      53             :         return *rtl_Instance< VCLFactory, InitInstance, ::osl::MutexGuard,
      54             :             ::osl::GetGlobalMutex >::create(
      55           0 :                 InitInstance(), ::osl::GetGlobalMutex());
      56             :     }
      57             : 
      58           0 :     VCLFactory::VCLFactory()
      59             :     {
      60           0 :     }
      61             : 
      62           0 :     CanvasSharedPtr VCLFactory::createCanvas( const uno::Reference< rendering::XCanvas >& xCanvas )
      63             :     {
      64             :         return CanvasSharedPtr(
      65           0 :             new internal::ImplCanvas( xCanvas ) );
      66             :     }
      67             : 
      68           0 :     BitmapCanvasSharedPtr VCLFactory::createBitmapCanvas( const uno::Reference< rendering::XBitmapCanvas >& xCanvas )
      69             :     {
      70             :         return BitmapCanvasSharedPtr(
      71           0 :             new internal::ImplBitmapCanvas( xCanvas ) );
      72             :     }
      73             : 
      74           0 :     SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const ::Window& rVCLWindow ) const
      75             :     {
      76             :         return SpriteCanvasSharedPtr(
      77             :             new internal::ImplSpriteCanvas(
      78             :                 uno::Reference< rendering::XSpriteCanvas >(
      79             :                     rVCLWindow.GetSpriteCanvas(),
      80           0 :                     uno::UNO_QUERY) ) );
      81             :     }
      82             : 
      83           0 :     SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& xCanvas ) const
      84             :     {
      85             :         return SpriteCanvasSharedPtr(
      86           0 :             new internal::ImplSpriteCanvas( xCanvas ) );
      87             :     }
      88             : 
      89           0 :     BitmapSharedPtr VCLFactory::createBitmap( const CanvasSharedPtr&    rCanvas,
      90             :                                               const ::BitmapEx&         rBmpEx ) const
      91             :     {
      92             :         OSL_ENSURE( rCanvas.get() != NULL &&
      93             :                     rCanvas->getUNOCanvas().is(),
      94             :                     "VCLFactory::createBitmap(): Invalid canvas" );
      95             : 
      96           0 :         if( rCanvas.get() == NULL )
      97           0 :             return BitmapSharedPtr();
      98             : 
      99           0 :         uno::Reference< rendering::XCanvas > xCanvas( rCanvas->getUNOCanvas() );
     100           0 :         if( !xCanvas.is() )
     101           0 :             return BitmapSharedPtr();
     102             : 
     103             :         return BitmapSharedPtr( new internal::ImplBitmap( rCanvas,
     104             :                                                           ::vcl::unotools::xBitmapFromBitmapEx(
     105           0 :                                                               xCanvas->getDevice(),
     106           0 :                                                               rBmpEx) ) );
     107             :     }
     108             : 
     109           0 :     RendererSharedPtr VCLFactory::createRenderer( const CanvasSharedPtr&        rCanvas,
     110             :                                                   const ::GDIMetaFile&          rMtf,
     111             :                                                   const Renderer::Parameters&   rParms ) const
     112             :     {
     113             :         return RendererSharedPtr( new internal::ImplRenderer( rCanvas,
     114             :                                                               rMtf,
     115           0 :                                                               rParms ) );
     116             :     }
     117             : }
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10