LCOV - code coverage report
Current view: top level - canvas/source/cairo - cairo_spritecanvas.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 11 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             : #ifndef INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITECANVAS_HXX
      21             : #define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITECANVAS_HXX
      22             : 
      23             : #include <com/sun/star/uno/XComponentContext.hpp>
      24             : #include <com/sun/star/beans/XPropertySet.hpp>
      25             : #include <com/sun/star/lang/XInitialization.hpp>
      26             : #include <com/sun/star/lang/XServiceInfo.hpp>
      27             : #include <com/sun/star/lang/XServiceName.hpp>
      28             : #include <com/sun/star/awt/XWindowListener.hpp>
      29             : #include <com/sun/star/util/XUpdatable.hpp>
      30             : #include <com/sun/star/rendering/XSpriteCanvas.hpp>
      31             : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
      32             : #include <com/sun/star/rendering/XGraphicDevice.hpp>
      33             : #include <com/sun/star/rendering/XBufferController.hpp>
      34             : 
      35             : #include <cppuhelper/compbase9.hxx>
      36             : #include <comphelper/uno3.hxx>
      37             : 
      38             : #include <canvas/base/spritecanvasbase.hxx>
      39             : #include <canvas/base/disambiguationhelper.hxx>
      40             : #include <canvas/base/bufferedgraphicdevicebase.hxx>
      41             : 
      42             : #include <basegfx/vector/b2isize.hxx>
      43             : 
      44             : #include "cairo_spritedevicehelper.hxx"
      45             : #include "cairo_repainttarget.hxx"
      46             : #include "cairo_surfaceprovider.hxx"
      47             : #include "cairo_spritecanvashelper.hxx"
      48             : 
      49             : #define SPRITECANVAS_SERVICE_NAME        "com.sun.star.rendering.SpriteCanvas.Cairo"
      50             : #define SPRITECANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.SpriteCanvas.Cairo"
      51             : 
      52             : namespace cairocanvas
      53             : {
      54             :     typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::rendering::XSpriteCanvas,
      55             :                                                 ::com::sun::star::rendering::XIntegerBitmap,
      56             :                                                 ::com::sun::star::rendering::XGraphicDevice,
      57             :                                                 ::com::sun::star::lang::XMultiServiceFactory,
      58             :                                                 ::com::sun::star::rendering::XBufferController,
      59             :                                                 ::com::sun::star::awt::XWindowListener,
      60             :                                                 ::com::sun::star::util::XUpdatable,
      61             :                                                 ::com::sun::star::beans::XPropertySet,
      62             :                                                 ::com::sun::star::lang::XServiceName >  WindowGraphicDeviceBase_Base;
      63             :     typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >,
      64             :                                                  SpriteDeviceHelper,
      65             :                                                  ::osl::MutexGuard,
      66             :                                                  ::cppu::OWeakObject > SpriteCanvasBase_Base;
      67             :     /** Mixin SpriteSurface
      68             : 
      69             :         Have to mixin the SpriteSurface before deriving from
      70             :         ::canvas::SpriteCanvasBase, as this template should already
      71             :         implement some of those interface methods.
      72             : 
      73             :         The reason why this appears kinda convoluted is the fact that
      74             :         we cannot specify non-IDL types as WeakComponentImplHelperN
      75             :         template args, and furthermore, don't want to derive
      76             :         ::canvas::SpriteCanvasBase directly from
      77             :         ::canvas::SpriteSurface (because derivees of
      78             :         ::canvas::SpriteCanvasBase have to explicitly forward the
      79             :         XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
      80             :         anyway). Basically, ::canvas::CanvasCustomSpriteBase should
      81             :         remain a base class that provides implementation, not to
      82             :         enforce any specific interface on its derivees.
      83             :      */
      84           0 :     class SpriteCanvasBaseSpriteSurface_Base : public SpriteCanvasBase_Base,
      85             :                                                public ::canvas::SpriteSurface,
      86             :                                                public SurfaceProvider
      87             :     {
      88             :     };
      89             : 
      90             :     typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base,
      91             :                                         SpriteCanvasHelper,
      92             :                                         ::osl::MutexGuard,
      93             :                                         ::cppu::OWeakObject >           SpriteCanvasBaseT;
      94             : 
      95             :     /** Product of this component's factory.
      96             : 
      97             :         The SpriteCanvas object combines the actual Window canvas with
      98             :         the XGraphicDevice interface. This is because there's a
      99             :         one-to-one relation between them, anyway, since each window
     100             :         can have exactly one canvas and one associated
     101             :         XGraphicDevice. And to avoid messing around with circular
     102             :         references, this is implemented as one single object.
     103             :      */
     104           0 :     class SpriteCanvas : public SpriteCanvasBaseT,
     105             :                          public RepaintTarget
     106             :     {
     107             :     public:
     108             :         SpriteCanvas( const ::com::sun::star::uno::Sequence<
     109             :                             ::com::sun::star::uno::Any >&               aArguments,
     110             :                       const ::com::sun::star::uno::Reference<
     111             :                             ::com::sun::star::uno::XComponentContext >& rxContext );
     112             : 
     113             :         void initialize();
     114             : 
     115             :         /// Dispose all internal references
     116             :         virtual void disposeThis() SAL_OVERRIDE;
     117             : 
     118             :         // Forwarding the XComponent implementation to the
     119             :         // cppu::ImplHelper templated base
     120             :         //                                    Classname     Base doing refcounting        Base implementing the XComponent interface
     121             :         //                                       |                 |                            |
     122             :         //                                       V                 V                            V
     123           0 :         DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
     124             : 
     125             :         // XBufferController (partial)
     126             :         virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     127             :         virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     128             : 
     129             :         // XSpriteCanvas (partial)
     130             :         virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     131             : 
     132             :         // XServiceName
     133             :         virtual OUString SAL_CALL getServiceName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     134             : 
     135             :         // SurfaceProvider
     136             :         virtual SurfaceSharedPtr getSurface() SAL_OVERRIDE;
     137             :         virtual SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, Content aContent = CAIRO_CONTENT_COLOR_ALPHA ) SAL_OVERRIDE;
     138             :         virtual SurfaceSharedPtr createSurface( ::Bitmap& rBitmap ) SAL_OVERRIDE;
     139             :         virtual SurfaceSharedPtr changeSurface( bool bHasAlpha, bool bCopyContent ) SAL_OVERRIDE;
     140             :         virtual OutputDevice* getOutputDevice() SAL_OVERRIDE;
     141             : 
     142             :         // RepaintTarget
     143             :         virtual bool repaint( const ::cairo::SurfaceSharedPtr&                pSurface,
     144             :                               const ::com::sun::star::rendering::ViewState&   viewState,
     145             :                               const ::com::sun::star::rendering::RenderState& renderState ) SAL_OVERRIDE;
     146             : 
     147             :         SurfaceSharedPtr getWindowSurface();
     148             :         SurfaceSharedPtr getBufferSurface();
     149             : 
     150             :         const ::basegfx::B2ISize& getSizePixel();
     151             :         void setSizePixel( const ::basegfx::B2ISize& rSize );
     152             :         void flush();
     153             : 
     154             :      private:
     155             :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
     156             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
     157             :     };
     158             : 
     159             :     typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
     160             : }
     161             : 
     162             : #endif
     163             : 
     164             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10