LCOV - code coverage report
Current view: top level - cppcanvas/source/wrapper - implspritecanvas.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 42 0.0 %
Date: 2014-04-14 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             : #include <basegfx/matrix/b2dhommatrix.hxx>
      21             : #include <basegfx/tools/canvastools.hxx>
      22             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      23             : #include <com/sun/star/rendering/InterpolationMode.hpp>
      24             : 
      25             : #include <implspritecanvas.hxx>
      26             : #include <implcustomsprite.hxx>
      27             : 
      28             : 
      29             : using namespace ::com::sun::star;
      30             : 
      31             : namespace cppcanvas
      32             : {
      33             :     namespace internal
      34             :     {
      35           0 :         ImplSpriteCanvas::TransformationArbiter::TransformationArbiter() :
      36           0 :             maTransformation()
      37             :         {
      38           0 :         }
      39             : 
      40           0 :         void ImplSpriteCanvas::TransformationArbiter::setTransformation( const ::basegfx::B2DHomMatrix& rViewTransform )
      41             :         {
      42           0 :             maTransformation = rViewTransform;
      43           0 :         }
      44             : 
      45           0 :         ::basegfx::B2DHomMatrix ImplSpriteCanvas::TransformationArbiter::getTransformation() const
      46             :         {
      47           0 :             return maTransformation;
      48             :         }
      49             : 
      50             : 
      51           0 :         ImplSpriteCanvas::ImplSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& rCanvas ) :
      52             :             ImplCanvas( uno::Reference< rendering::XCanvas >(rCanvas,
      53             :                                                              uno::UNO_QUERY) ),
      54             :             mxSpriteCanvas( rCanvas ),
      55           0 :             mpTransformArbiter( new TransformationArbiter() )
      56             :         {
      57             :             OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::ImplSpriteCanvas(): Invalid canvas" );
      58           0 :         }
      59             : 
      60           0 :         ImplSpriteCanvas::ImplSpriteCanvas(const ImplSpriteCanvas& rOrig) :
      61             :             Canvas(),
      62             :             SpriteCanvas(),
      63             :             ImplCanvas( rOrig ),
      64           0 :             mxSpriteCanvas( rOrig.getUNOSpriteCanvas() ),
      65           0 :             mpTransformArbiter( new TransformationArbiter() )
      66             :         {
      67             :             OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::ImplSpriteCanvas( const ImplSpriteCanvas& ): Invalid canvas" );
      68             : 
      69           0 :             mpTransformArbiter->setTransformation( getTransformation() );
      70           0 :         }
      71             : 
      72           0 :         ImplSpriteCanvas::~ImplSpriteCanvas()
      73             :         {
      74           0 :         }
      75             : 
      76           0 :         void ImplSpriteCanvas::setTransformation( const ::basegfx::B2DHomMatrix& rMatrix )
      77             :         {
      78           0 :             mpTransformArbiter->setTransformation( rMatrix );
      79             : 
      80           0 :             ImplCanvas::setTransformation( rMatrix );
      81           0 :         }
      82             : 
      83           0 :         bool ImplSpriteCanvas::updateScreen( bool bUpdateAll ) const
      84             :         {
      85             :             OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::updateScreen(): Invalid canvas" );
      86             : 
      87           0 :             if( !mxSpriteCanvas.is() )
      88           0 :                 return false;
      89             : 
      90           0 :             return mxSpriteCanvas->updateScreen( bUpdateAll );
      91             :         }
      92             : 
      93           0 :         CustomSpriteSharedPtr ImplSpriteCanvas::createCustomSprite( const ::basegfx::B2DSize& rSize ) const
      94             :         {
      95             :             OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::createCustomSprite(): Invalid canvas" );
      96             : 
      97           0 :             if( !mxSpriteCanvas.is() )
      98           0 :                 return CustomSpriteSharedPtr();
      99             : 
     100             :             return CustomSpriteSharedPtr(
     101             :                 new ImplCustomSprite( mxSpriteCanvas,
     102           0 :                                       mxSpriteCanvas->createCustomSprite( ::basegfx::unotools::size2DFromB2DSize(rSize) ),
     103           0 :                                       mpTransformArbiter ) );
     104             :         }
     105             : 
     106           0 :         SpriteSharedPtr ImplSpriteCanvas::createClonedSprite( const SpriteSharedPtr& rSprite ) const
     107             :         {
     108             :             OSL_ENSURE( mxSpriteCanvas.is(), "ImplSpriteCanvas::createCustomSprite(): Invalid canvas" );
     109             :             OSL_ENSURE( rSprite.get() != NULL && rSprite->getUNOSprite().is(),
     110             :                         "ImplSpriteCanvas::createCustomSprite(): Invalid sprite" );
     111             : 
     112           0 :             if( !mxSpriteCanvas.is() ||
     113           0 :                 rSprite.get() == NULL ||
     114           0 :                 !rSprite->getUNOSprite().is() )
     115             :             {
     116           0 :                 return SpriteSharedPtr();
     117             :             }
     118             : 
     119             :             return SpriteSharedPtr(
     120             :                 new ImplSprite( mxSpriteCanvas,
     121           0 :                                 mxSpriteCanvas->createClonedSprite( rSprite->getUNOSprite() ),
     122           0 :                                 mpTransformArbiter ) );
     123             :         }
     124             : 
     125           0 :         CanvasSharedPtr ImplSpriteCanvas::clone() const
     126             :         {
     127           0 :             return SpriteCanvasSharedPtr( new ImplSpriteCanvas( *this ) );
     128             :         }
     129             : 
     130           0 :         uno::Reference< rendering::XSpriteCanvas > ImplSpriteCanvas::getUNOSpriteCanvas() const
     131             :         {
     132           0 :             return mxSpriteCanvas;
     133             :         }
     134             : 
     135             :     }
     136             : }
     137             : 
     138             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10