LCOV - code coverage report
Current view: top level - libreoffice/canvas/source/null - null_devicehelper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 64 0.0 %
Date: 2012-12-27 Functions: 0 26 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             : 
      21             : #include <canvas/debug.hxx>
      22             : #include <canvas/verbosetrace.hxx>
      23             : #include <canvas/canvastools.hxx>
      24             : 
      25             : #include <osl/mutex.hxx>
      26             : #include <rtl/instance.hxx>
      27             : #include <cppuhelper/compbase1.hxx>
      28             : 
      29             : #include <com/sun/star/lang/NoSupportException.hpp>
      30             : 
      31             : #include <basegfx/tools/canvastools.hxx>
      32             : #include <basegfx/tools/unopolypolygon.hxx>
      33             : #include <vcl/canvastools.hxx>
      34             : 
      35             : #include "null_spritecanvas.hxx"
      36             : #include "null_canvasbitmap.hxx"
      37             : #include "null_devicehelper.hxx"
      38             : 
      39             : 
      40             : using namespace ::com::sun::star;
      41             : 
      42             : namespace nullcanvas
      43             : {
      44           0 :     DeviceHelper::DeviceHelper() :
      45             :         mpSpriteCanvas( NULL ),
      46             :         maSize(),
      47           0 :         mbFullScreen(false)
      48             :     {
      49           0 :     }
      50             : 
      51           0 :     void DeviceHelper::init( SpriteCanvas&              rSpriteCanvas,
      52             :                              const ::basegfx::B2ISize&  rSize,
      53             :                              bool                       bFullscreen )
      54             :     {
      55           0 :         mpSpriteCanvas = &rSpriteCanvas;
      56           0 :         maSize = rSize;
      57           0 :         mbFullScreen = bFullscreen;
      58           0 :     }
      59             : 
      60           0 :     void DeviceHelper::disposing()
      61             :     {
      62             :         // release all references
      63           0 :         mpSpriteCanvas = NULL;
      64           0 :     }
      65             : 
      66           0 :     geometry::RealSize2D DeviceHelper::getPhysicalResolution()
      67             :     {
      68           0 :         return geometry::RealSize2D( 75, 75 );
      69             :     }
      70             : 
      71           0 :     geometry::RealSize2D DeviceHelper::getPhysicalSize()
      72             :     {
      73           0 :         return geometry::RealSize2D( 210, 280 );
      74             :     }
      75             : 
      76           0 :     uno::Reference< rendering::XLinePolyPolygon2D > DeviceHelper::createCompatibleLinePolyPolygon(
      77             :         const uno::Reference< rendering::XGraphicDevice >&              /*rDevice*/,
      78             :         const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >&  points )
      79             :     {
      80             :         // disposed?
      81           0 :         if( !mpSpriteCanvas )
      82           0 :             return uno::Reference< rendering::XLinePolyPolygon2D >(); // we're disposed
      83             : 
      84             :         return uno::Reference< rendering::XLinePolyPolygon2D >(
      85             :             new ::basegfx::unotools::UnoPolyPolygon(
      86           0 :                 ::basegfx::unotools::polyPolygonFromPoint2DSequenceSequence( points )));
      87             :     }
      88             : 
      89           0 :     uno::Reference< rendering::XBezierPolyPolygon2D > DeviceHelper::createCompatibleBezierPolyPolygon(
      90             :         const uno::Reference< rendering::XGraphicDevice >&                      /*rDevice*/,
      91             :         const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >&  points )
      92             :     {
      93             :         // disposed?
      94           0 :         if( !mpSpriteCanvas )
      95           0 :             return uno::Reference< rendering::XBezierPolyPolygon2D >(); // we're disposed
      96             : 
      97             :         return uno::Reference< rendering::XBezierPolyPolygon2D >(
      98             :             new ::basegfx::unotools::UnoPolyPolygon(
      99           0 :                 ::basegfx::unotools::polyPolygonFromBezier2DSequenceSequence( points ) ) );
     100             :     }
     101             : 
     102           0 :     uno::Reference< rendering::XBitmap > DeviceHelper::createCompatibleBitmap(
     103             :         const uno::Reference< rendering::XGraphicDevice >&  /*rDevice*/,
     104             :         const geometry::IntegerSize2D&                      size )
     105             :     {
     106             :         // disposed?
     107           0 :         if( !mpSpriteCanvas )
     108           0 :             return uno::Reference< rendering::XBitmap >(); // we're disposed
     109             : 
     110             :         return uno::Reference< rendering::XBitmap >(
     111             :             new CanvasBitmap(
     112             :                 ::basegfx::unotools::b2ISizeFromIntegerSize2D( size ),
     113             :                 mpSpriteCanvas,
     114           0 :                 false ));
     115             :     }
     116             : 
     117           0 :     uno::Reference< rendering::XVolatileBitmap > DeviceHelper::createVolatileBitmap(
     118             :         const uno::Reference< rendering::XGraphicDevice >&  /*rDevice*/,
     119             :         const geometry::IntegerSize2D&                      /*size*/ )
     120             :     {
     121           0 :         return uno::Reference< rendering::XVolatileBitmap >();
     122             :     }
     123             : 
     124           0 :     uno::Reference< rendering::XBitmap > DeviceHelper::createCompatibleAlphaBitmap(
     125             :         const uno::Reference< rendering::XGraphicDevice >&  /*rDevice*/,
     126             :         const geometry::IntegerSize2D&                      size )
     127             :     {
     128             :         // disposed?
     129           0 :         if( !mpSpriteCanvas )
     130           0 :             return uno::Reference< rendering::XBitmap >(); // we're disposed
     131             : 
     132             :         return uno::Reference< rendering::XBitmap >(
     133             :             new CanvasBitmap(
     134             :                 ::basegfx::unotools::b2ISizeFromIntegerSize2D( size ),
     135             :                 mpSpriteCanvas,
     136           0 :                 true ));
     137             :     }
     138             : 
     139           0 :     uno::Reference< rendering::XVolatileBitmap > DeviceHelper::createVolatileAlphaBitmap(
     140             :         const uno::Reference< rendering::XGraphicDevice >&  /*rDevice*/,
     141             :         const geometry::IntegerSize2D&                      /*size*/ )
     142             :     {
     143           0 :         return uno::Reference< rendering::XVolatileBitmap >();
     144             :     }
     145             : 
     146           0 :     sal_Bool DeviceHelper::hasFullScreenMode()
     147             :     {
     148             :         // TODO(F3): offer fullscreen mode the XCanvas way
     149           0 :         return false;
     150             :     }
     151             : 
     152           0 :     sal_Bool DeviceHelper::enterFullScreenMode( sal_Bool /*bEnter*/ )
     153             :     {
     154             :         // TODO(F3): offer fullscreen mode the XCanvas way
     155           0 :         return false;
     156             :     }
     157             : 
     158           0 :     ::sal_Int32 DeviceHelper::createBuffers( ::sal_Int32 /*nBuffers*/ )
     159             :     {
     160             :         // TODO(F3): implement XBufferStrategy interface. For now, we
     161             :         // _always_ will have exactly one backbuffer
     162           0 :         return 1;
     163             :     }
     164             : 
     165           0 :     void DeviceHelper::destroyBuffers()
     166             :     {
     167             :         // TODO(F3): implement XBufferStrategy interface. For now, we
     168             :         // _always_ will have exactly one backbuffer
     169           0 :     }
     170             : 
     171           0 :     ::sal_Bool DeviceHelper::showBuffer( bool bIsVisible, ::sal_Bool bUpdateAll )
     172             :     {
     173             :         // forward to sprite canvas helper
     174           0 :         if( !bIsVisible || !mpSpriteCanvas )
     175           0 :             return false;
     176             : 
     177           0 :         return mpSpriteCanvas->updateScreen( bUpdateAll );
     178             :     }
     179             : 
     180           0 :     ::sal_Bool DeviceHelper::switchBuffer( bool bIsVisible, ::sal_Bool bUpdateAll )
     181             :     {
     182             :         // no difference for VCL canvas
     183           0 :         return showBuffer( bIsVisible, bUpdateAll );
     184             :     }
     185             : 
     186           0 :     uno::Any DeviceHelper::isAccelerated() const
     187             :     {
     188           0 :         return ::com::sun::star::uno::makeAny(false);
     189             :     }
     190             : 
     191           0 :     uno::Any DeviceHelper::getDeviceHandle() const
     192             :     {
     193           0 :         return uno::Any();
     194             :     }
     195             : 
     196           0 :     uno::Any DeviceHelper::getSurfaceHandle() const
     197             :     {
     198           0 :         return uno::Any();
     199             :     }
     200             : 
     201             :     namespace
     202             :     {
     203             :         struct DeviceColorSpace: public rtl::StaticWithInit<uno::Reference<rendering::XColorSpace>,
     204             :                                                             DeviceColorSpace>
     205             :         {
     206           0 :             uno::Reference<rendering::XColorSpace> operator()()
     207             :             {
     208           0 :                 return vcl::unotools::createStandardColorSpace();
     209             :             }
     210             :         };
     211             :     }
     212             : 
     213           0 :     uno::Reference<rendering::XColorSpace> DeviceHelper::getColorSpace() const
     214             :     {
     215             :         // always the same
     216           0 :         return DeviceColorSpace::get();
     217             :     }
     218             : 
     219           0 :     void DeviceHelper::notifySizeUpdate( const awt::Rectangle& /*rBounds*/ )
     220             :     {
     221             :         // TODO
     222           0 :     }
     223             : 
     224           0 :     void DeviceHelper::dumpScreenContent() const
     225             :     {
     226             :         OSL_TRACE( "%s\n",
     227             :                    BOOST_CURRENT_FUNCTION );
     228           0 :     }
     229           0 : }
     230             : 
     231             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10