LCOV - code coverage report
Current view: top level - canvas/source/cairo - cairo_canvascustomsprite.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-08-25 Functions: 0 11 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _CAIROCANVAS_CANVASCUSTOMSPRITE_HXX
      30                 :            : #define _CAIROCANVAS_CANVASCUSTOMSPRITE_HXX
      31                 :            : 
      32                 :            : #include <cppuhelper/compbase4.hxx>
      33                 :            : #include <comphelper/uno3.hxx>
      34                 :            : 
      35                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      36                 :            : #include <com/sun/star/lang/XComponent.hpp>
      37                 :            : #include <com/sun/star/rendering/XCustomSprite.hpp>
      38                 :            : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
      39                 :            : #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
      40                 :            : 
      41                 :            : #include <basegfx/point/b2dpoint.hxx>
      42                 :            : #include <basegfx/vector/b2isize.hxx>
      43                 :            : #include <basegfx/matrix/b2dhommatrix.hxx>
      44                 :            : 
      45                 :            : #include <canvas/base/disambiguationhelper.hxx>
      46                 :            : #include <canvas/base/canvascustomspritebase.hxx>
      47                 :            : 
      48                 :            : #include "cairo_sprite.hxx"
      49                 :            : #include "cairo_cairo.hxx"
      50                 :            : #include "cairo_canvashelper.hxx"
      51                 :            : #include "cairo_repainttarget.hxx"
      52                 :            : #include "cairo_spritehelper.hxx"
      53                 :            : #include "cairo_spritecanvas.hxx"
      54                 :            : 
      55                 :            : 
      56                 :            : namespace cairocanvas
      57                 :            : {
      58                 :            :     typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XCustomSprite,
      59                 :            :                                                ::com::sun::star::rendering::XBitmapCanvas,
      60                 :            :                                               ::com::sun::star::rendering::XIntegerBitmap,
      61                 :            :                                                 ::com::sun::star::lang::XServiceInfo >  CanvasCustomSpriteBase_Base;
      62                 :            :     /** Mixin Sprite
      63                 :            : 
      64                 :            :         Have to mixin the Sprite interface before deriving from
      65                 :            :         ::canvas::CanvasCustomSpriteBase, as this template should
      66                 :            :         already implement some of those interface methods.
      67                 :            : 
      68                 :            :         The reason why this appears kinda convoluted is the fact that
      69                 :            :         we cannot specify non-IDL types as WeakComponentImplHelperN
      70                 :            :         template args, and furthermore, don't want to derive
      71                 :            :         ::canvas::CanvasCustomSpriteBase directly from
      72                 :            :         ::canvas::Sprite (because derivees of
      73                 :            :         ::canvas::CanvasCustomSpriteBase have to explicitly forward
      74                 :            :         the XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
      75                 :            :         anyway). Basically, ::canvas::CanvasCustomSpriteBase should
      76                 :            :         remain a base class that provides implementation, not to
      77                 :            :         enforce any specific interface on its derivees.
      78                 :            :      */
      79                 :          0 :     class CanvasCustomSpriteSpriteBase_Base : public ::canvas::DisambiguationHelper< CanvasCustomSpriteBase_Base >,
      80                 :            :                                                  public Sprite,
      81                 :            :                                               public SurfaceProvider
      82                 :            :     {
      83                 :            :     };
      84                 :            : 
      85                 :            :     typedef ::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base,
      86                 :            :                                               SpriteHelper,
      87                 :            :                                               CanvasHelper,
      88                 :            :                                               ::osl::MutexGuard,
      89                 :            :                                               ::cppu::OWeakObject >                     CanvasCustomSpriteBaseT;
      90                 :            : 
      91                 :            :     /* Definition of CanvasCustomSprite class */
      92                 :            : 
      93                 :          0 :     class CanvasCustomSprite : public CanvasCustomSpriteBaseT,
      94                 :            :                                public RepaintTarget
      95                 :            :     {
      96                 :            :     public:
      97                 :            :         /** Create a custom sprite
      98                 :            : 
      99                 :            :             @param rSpriteSize
     100                 :            :             Size of the sprite in pixel
     101                 :            : 
     102                 :            :             @param rRefDevice
     103                 :            :             Associated output device
     104                 :            : 
     105                 :            :             @param rSpriteCanvas
     106                 :            :             Target canvas
     107                 :            : 
     108                 :            :             @param rDevice
     109                 :            :             Target DX device
     110                 :            :          */
     111                 :            :         CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D&   rSpriteSize,
     112                 :            :                             const SpriteCanvasRef&                          rRefDevice );
     113                 :            : 
     114                 :            :         virtual void disposeThis();
     115                 :            : 
     116                 :            :         // Forwarding the XComponent implementation to the
     117                 :            :         // cppu::ImplHelper templated base
     118                 :            :         //                                    Classname           Base doing refcount          Base implementing the XComponent interface
     119                 :            :         //                                          |                    |                         |
     120                 :            :         //                                          V                    V                         V
     121                 :          0 :         DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite, CanvasCustomSpriteBase_Base, ::cppu::WeakComponentImplHelperBase );
     122                 :            : 
     123                 :            :         // XServiceInfo
     124                 :            :         virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
     125                 :            :         virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
     126                 :            :         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()  throw( ::com::sun::star::uno::RuntimeException );
     127                 :            : 
     128                 :            :         // Sprite
     129                 :            :         virtual void redraw( const ::cairo::CairoSharedPtr& pCairo,
     130                 :            :                              bool                           bBufferedUpdate ) const;
     131                 :            :         virtual void redraw( const ::cairo::CairoSharedPtr& pCairo,
     132                 :            :                              const ::basegfx::B2DPoint&     rOrigOutputPos,
     133                 :            :                              bool                           bBufferedUpdate ) const;
     134                 :            : 
     135                 :            :         // RepaintTarget
     136                 :            :         virtual bool repaint( const ::cairo::SurfaceSharedPtr&                pSurface,
     137                 :            :                               const ::com::sun::star::rendering::ViewState&   viewState,
     138                 :            :                               const ::com::sun::star::rendering::RenderState& renderState );
     139                 :            : 
     140                 :            :         // SurfaceProvider
     141                 :            :         virtual SurfaceSharedPtr getSurface();
     142                 :            :         virtual SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, Content aContent = CAIRO_CONTENT_COLOR_ALPHA );
     143                 :            :         virtual SurfaceSharedPtr createSurface( ::Bitmap& rBitmap );
     144                 :            :         virtual SurfaceSharedPtr changeSurface( bool bHasAlpha, bool bCopyContent );
     145                 :            :         virtual OutputDevice* getOutputDevice();
     146                 :            : 
     147                 :            :     private:
     148                 :            :         /** MUST hold here, too, since CanvasHelper only contains a
     149                 :            :             raw pointer (without refcounting)
     150                 :            :         */
     151                 :            :         SpriteCanvasRef           mpSpriteCanvas;
     152                 :            :         ::cairo::SurfaceSharedPtr mpBufferSurface;
     153                 :            :         ::basegfx::B2ISize        maSize;
     154                 :            :     };
     155                 :            : }
     156                 :            : 
     157                 :            : #endif /* _CAIROCANVAS_CANVASCUSTOMSPRITE_HXX */
     158                 :            : 
     159                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10