LCOV - code coverage report
Current view: top level - cppcanvas/source/wrapper - implcanvas.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 41 0.0 %
Date: 2014-11-03 Functions: 0 16 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 <rtl/ustring.hxx>
      22             : #include <basegfx/matrix/b2dhommatrix.hxx>
      23             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      24             : #include <basegfx/tools/canvastools.hxx>
      25             : 
      26             : #include <com/sun/star/rendering/XCanvas.hpp>
      27             : 
      28             : #include <canvas/canvastools.hxx>
      29             : #include <cppcanvas/polypolygon.hxx>
      30             : 
      31             : #include "implfont.hxx"
      32             : #include "implcolor.hxx"
      33             : #include "implcanvas.hxx"
      34             : 
      35             : 
      36             : using namespace ::com::sun::star;
      37             : 
      38             : namespace cppcanvas
      39             : {
      40             :     namespace internal
      41             :     {
      42             : 
      43           0 :         ImplCanvas::ImplCanvas( const uno::Reference< rendering::XCanvas >& xCanvas ) :
      44             :             maViewState(),
      45             :             maClipPolyPolygon(),
      46           0 :             mxCanvas( xCanvas )
      47             :         {
      48             :             OSL_ENSURE( mxCanvas.is(), "Canvas::Canvas() invalid XCanvas" );
      49             : 
      50           0 :             ::canvas::tools::initViewState( maViewState );
      51           0 :         }
      52             : 
      53           0 :         ImplCanvas::~ImplCanvas()
      54             :         {
      55           0 :         }
      56             : 
      57           0 :         void ImplCanvas::setTransformation( const ::basegfx::B2DHomMatrix& rMatrix )
      58             :         {
      59           0 :             ::canvas::tools::setViewStateTransform( maViewState, rMatrix );
      60           0 :         }
      61             : 
      62           0 :         ::basegfx::B2DHomMatrix ImplCanvas::getTransformation() const
      63             :         {
      64           0 :             ::basegfx::B2DHomMatrix aMatrix;
      65             :             return ::canvas::tools::getViewStateTransform( aMatrix,
      66           0 :                                                            maViewState );
      67             :         }
      68             : 
      69           0 :         void ImplCanvas::setClip( const ::basegfx::B2DPolyPolygon& rClipPoly )
      70             :         {
      71             :             // TODO(T3): not thread-safe. B2DPolyPolygon employs copy-on-write
      72           0 :             maClipPolyPolygon.reset( rClipPoly );
      73           0 :             maViewState.Clip.clear();
      74           0 :         }
      75             : 
      76           0 :         void ImplCanvas::setClip()
      77             :         {
      78           0 :             maClipPolyPolygon.reset();
      79           0 :             maViewState.Clip.clear();
      80           0 :         }
      81             : 
      82           0 :         ::basegfx::B2DPolyPolygon const* ImplCanvas::getClip() const
      83             :         {
      84           0 :             return !maClipPolyPolygon ? NULL : &(*maClipPolyPolygon);
      85             :         }
      86             : 
      87           0 :         FontSharedPtr ImplCanvas::createFont( const OUString& rFontName, const double& rCellSize ) const
      88             :         {
      89           0 :             return FontSharedPtr( new ImplFont( getUNOCanvas(), rFontName, rCellSize ) );
      90             :         }
      91             : 
      92           0 :         ColorSharedPtr ImplCanvas::createColor() const
      93             :         {
      94           0 :             return ColorSharedPtr( new ImplColor( getUNOCanvas()->getDevice() ) );
      95             :         }
      96             : 
      97           0 :         CanvasSharedPtr ImplCanvas::clone() const
      98             :         {
      99           0 :             return CanvasSharedPtr( new ImplCanvas( *this ) );
     100             :         }
     101             : 
     102           0 :         void ImplCanvas::clear() const
     103             :         {
     104             :             OSL_ENSURE( mxCanvas.is(), "ImplCanvas::clear(): Invalid XCanvas" );
     105           0 :             mxCanvas->clear();
     106           0 :         }
     107             : 
     108           0 :         uno::Reference< rendering::XCanvas > ImplCanvas::getUNOCanvas() const
     109             :         {
     110             :             OSL_ENSURE( mxCanvas.is(), "ImplCanvas::getUNOCanvas(): Invalid XCanvas" );
     111             : 
     112           0 :             return mxCanvas;
     113             :         }
     114             : 
     115           0 :         rendering::ViewState ImplCanvas::getViewState() const
     116             :         {
     117           0 :             if( maClipPolyPolygon && !maViewState.Clip.is() )
     118             :             {
     119           0 :                 if( !mxCanvas.is() )
     120           0 :                     return maViewState;
     121             : 
     122           0 :                 maViewState.Clip = ::basegfx::unotools::xPolyPolygonFromB2DPolyPolygon(
     123           0 :                     mxCanvas->getDevice(),
     124           0 :                     *maClipPolyPolygon );
     125             :             }
     126             : 
     127           0 :             return maViewState;
     128             :         }
     129             : 
     130             :     }
     131             : }
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10