LCOV - code coverage report
Current view: top level - canvas/source/vcl - canvas.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 36 0.0 %
Date: 2014-04-14 Functions: 0 14 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             : #include <tools/diagnose_ex.h>
      25             : 
      26             : #include <com/sun/star/registry/XRegistryKey.hpp>
      27             : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
      28             : #include <com/sun/star/lang/NoSupportException.hpp>
      29             : #include <com/sun/star/uno/XComponentContext.hpp>
      30             : 
      31             : #include <vcl/canvastools.hxx>
      32             : #include <vcl/outdev.hxx>
      33             : #include <vcl/window.hxx>
      34             : #include <vcl/bitmapex.hxx>
      35             : 
      36             : #include <basegfx/tools/canvastools.hxx>
      37             : 
      38             : #include <algorithm>
      39             : 
      40             : #include "canvas.hxx"
      41             : #include "windowoutdevholder.hxx"
      42             : 
      43             : using namespace ::com::sun::star;
      44             : 
      45             : namespace vclcanvas
      46             : {
      47             :     namespace
      48             :     {
      49           0 :         class OutDevHolder : public OutDevProvider,
      50             :             private ::boost::noncopyable
      51             :         {
      52             :         public:
      53           0 :             explicit OutDevHolder( OutputDevice& rOutDev ) :
      54           0 :                 mrOutDev(rOutDev)
      55           0 :             {}
      56             : 
      57             :         private:
      58           0 :             virtual OutputDevice&       getOutDev() SAL_OVERRIDE { return mrOutDev; }
      59           0 :             virtual const OutputDevice& getOutDev() const SAL_OVERRIDE { return mrOutDev; }
      60             : 
      61             :             // TODO(Q2): Lifetime issue. This _only_ works reliably,
      62             :             // if disposing the Canvas correctly disposes all
      63             :             // entities which hold this pointer.
      64             :             OutputDevice& mrOutDev;
      65             :         };
      66             :     }
      67             : 
      68           0 :     Canvas::Canvas( const uno::Sequence< uno::Any >&                aArguments,
      69             :                     const uno::Reference< uno::XComponentContext >& rxContext ) :
      70             :         maArguments(aArguments),
      71           0 :         mxComponentContext( rxContext )
      72             :     {
      73           0 :     }
      74             : 
      75           0 :     void Canvas::initialize()
      76             :     {
      77             :         // #i64742# Only perform initialization when not in probe mode
      78           0 :         if( maArguments.getLength() == 0 )
      79           0 :             return;
      80             : 
      81             :         /* maArguments:
      82             :            0: ptr to creating instance (Window or VirtualDevice)
      83             :            1: SystemEnvData as a streamed Any (or empty for VirtualDevice)
      84             :            2: current bounds of creating instance
      85             :            3: bool, denoting always on top state for Window (always false for VirtualDevice)
      86             :            4: XWindow for creating Window (or empty for VirtualDevice)
      87             :            5: SystemGraphicsData as a streamed Any
      88             :          */
      89           0 :         SolarMutexGuard aGuard;
      90             : 
      91             :         VERBOSE_TRACE( "VCLCanvas::initialize called" );
      92             : 
      93           0 :         ENSURE_ARG_OR_THROW( maArguments.getLength() >= 6 &&
      94             :                              maArguments[0].getValueTypeClass() == uno::TypeClass_HYPER,
      95             :                              "Canvas::initialize: wrong number of arguments, or wrong types" );
      96             : 
      97           0 :         sal_Int64 nPtr = 0;
      98           0 :         maArguments[0] >>= nPtr;
      99             : 
     100           0 :         OutputDevice* pOutDev = reinterpret_cast<OutputDevice*>(nPtr);
     101           0 :         if( !pOutDev )
     102             :             throw lang::NoSupportException(
     103             :                 OUString( "Passed OutDev invalid!" ),
     104           0 :                 NULL);
     105             : 
     106           0 :         OutDevProviderSharedPtr pOutdevProvider( new OutDevHolder(*pOutDev) );
     107             : 
     108             :         // setup helper
     109           0 :         maDeviceHelper.init( pOutdevProvider );
     110             :         maCanvasHelper.init( *this,
     111             :                              pOutdevProvider,
     112             :                              true,   // OutDev state preservation
     113           0 :                              false ); // no alpha on surface
     114             : 
     115           0 :         maArguments.realloc(0);
     116             :     }
     117             : 
     118           0 :     Canvas::~Canvas()
     119             :     {
     120             :         OSL_TRACE( "Canvas destroyed" );
     121           0 :     }
     122             : 
     123           0 :     void Canvas::disposeThis()
     124             :     {
     125           0 :         SolarMutexGuard aGuard;
     126             : 
     127           0 :         mxComponentContext.clear();
     128             : 
     129             :         // forward to parent
     130           0 :         CanvasBaseT::disposeThis();
     131           0 :     }
     132             : 
     133           0 :     OUString SAL_CALL Canvas::getServiceName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
     134             :     {
     135           0 :         return OUString( CANVAS_SERVICE_NAME );
     136             :     }
     137             : 
     138           0 :     bool Canvas::repaint( const GraphicObjectSharedPtr& rGrf,
     139             :                           const rendering::ViewState&   viewState,
     140             :                           const rendering::RenderState& renderState,
     141             :                           const ::Point&                rPt,
     142             :                           const ::Size&                 rSz,
     143             :                           const GraphicAttr&            rAttr ) const
     144             :     {
     145           0 :         SolarMutexGuard aGuard;
     146             : 
     147           0 :         return maCanvasHelper.repaint( rGrf, viewState, renderState, rPt, rSz, rAttr );
     148             :     }
     149           0 : }
     150             : 
     151             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10