LCOV - code coverage report
Current view: top level - canvas/source/vcl - spritecanvas.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 4 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 _VCLCANVAS_SPRITECANVAS_HXX_
      30                 :            : #define _VCLCANVAS_SPRITECANVAS_HXX_
      31                 :            : 
      32                 :            : #include <rtl/ref.hxx>
      33                 :            : 
      34                 :            : #include <com/sun/star/uno/XComponentContext.hpp>
      35                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      36                 :            : #include <com/sun/star/lang/XServiceName.hpp>
      37                 :            : #include <com/sun/star/awt/XWindowListener.hpp>
      38                 :            : #include <com/sun/star/util/XUpdatable.hpp>
      39                 :            : #include <com/sun/star/rendering/XSpriteCanvas.hpp>
      40                 :            : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
      41                 :            : #include <com/sun/star/rendering/XGraphicDevice.hpp>
      42                 :            : #include <com/sun/star/rendering/XBufferController.hpp>
      43                 :            : 
      44                 :            : #include <cppuhelper/compbase9.hxx>
      45                 :            : #include <comphelper/uno3.hxx>
      46                 :            : 
      47                 :            : #include <canvas/base/spritecanvasbase.hxx>
      48                 :            : #include <canvas/base/disambiguationhelper.hxx>
      49                 :            : #include <canvas/base/bufferedgraphicdevicebase.hxx>
      50                 :            : 
      51                 :            : #include "spritecanvashelper.hxx"
      52                 :            : #include "impltools.hxx"
      53                 :            : #include "spritedevicehelper.hxx"
      54                 :            : #include "repainttarget.hxx"
      55                 :            : 
      56                 :            : 
      57                 :            : #define SPRITECANVAS_SERVICE_NAME        "com.sun.star.rendering.SpriteCanvas.VCL"
      58                 :            : #define SPRITECANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.SpriteCanvas.VCL"
      59                 :            : 
      60                 :            : namespace vclcanvas
      61                 :            : {
      62                 :            :     typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::rendering::XSpriteCanvas,
      63                 :            :                                               ::com::sun::star::rendering::XIntegerBitmap,
      64                 :            :                                               ::com::sun::star::rendering::XGraphicDevice,
      65                 :            :                                               ::com::sun::star::lang::XMultiServiceFactory,
      66                 :            :                                               ::com::sun::star::rendering::XBufferController,
      67                 :            :                                               ::com::sun::star::awt::XWindowListener,
      68                 :            :                                               ::com::sun::star::util::XUpdatable,
      69                 :            :                                               ::com::sun::star::beans::XPropertySet,
      70                 :            :                                               ::com::sun::star::lang::XServiceName >    WindowGraphicDeviceBase_Base;
      71                 :            :     typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >,
      72                 :            :                                                  SpriteDeviceHelper,
      73                 :            :                                                  tools::LocalGuard,
      74                 :            :                                                  ::cppu::OWeakObject >  SpriteCanvasBase_Base;
      75                 :            : 
      76                 :            :     /** Mixin SpriteSurface
      77                 :            : 
      78                 :            :         Have to mixin the SpriteSurface before deriving from
      79                 :            :         ::canvas::SpriteCanvasBase, as this template should already
      80                 :            :         implement some of those interface methods.
      81                 :            : 
      82                 :            :         The reason why this appears kinda convoluted is the fact that
      83                 :            :         we cannot specify non-IDL types as WeakComponentImplHelperN
      84                 :            :         template args, and furthermore, don't want to derive
      85                 :            :         ::canvas::SpriteCanvasBase directly from
      86                 :            :         ::canvas::SpriteSurface (because derivees of
      87                 :            :         ::canvas::SpriteCanvasBase have to explicitly forward the
      88                 :            :         XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
      89                 :            :         anyway). Basically, ::canvas::CanvasCustomSpriteBase should
      90                 :            :         remain a base class that provides implementation, not to
      91                 :            :         enforce any specific interface on its derivees.
      92                 :            :      */
      93                 :          0 :     class SpriteCanvasBaseSpriteSurface_Base : public SpriteCanvasBase_Base,
      94                 :            :                                                public ::canvas::SpriteSurface
      95                 :            :     {
      96                 :            :     };
      97                 :            : 
      98                 :            :     typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base,
      99                 :            :                                         SpriteCanvasHelper,
     100                 :            :                                         tools::LocalGuard,
     101                 :            :                                         ::cppu::OWeakObject >           SpriteCanvasBaseT;
     102                 :            : 
     103                 :            :     /** Product of this component's factory.
     104                 :            : 
     105                 :            :         The SpriteCanvas object combines the actual Window canvas with
     106                 :            :         the XGraphicDevice interface. This is because there's a
     107                 :            :         one-to-one relation between them, anyway, since each window
     108                 :            :         can have exactly one canvas and one associated
     109                 :            :         XGraphicDevice. And to avoid messing around with circular
     110                 :            :         references, this is implemented as one single object.
     111                 :            :      */
     112                 :            :     class SpriteCanvas : public SpriteCanvasBaseT,
     113                 :            :                          public RepaintTarget
     114                 :            :     {
     115                 :            :     public:
     116                 :            :         SpriteCanvas( const ::com::sun::star::uno::Sequence<
     117                 :            :                             ::com::sun::star::uno::Any >&               aArguments,
     118                 :            :                       const ::com::sun::star::uno::Reference<
     119                 :            :                             ::com::sun::star::uno::XComponentContext >& rxContext );
     120                 :            : 
     121                 :            :         void initialize();
     122                 :            : 
     123                 :            :         /// For resource tracking
     124                 :            :         ~SpriteCanvas();
     125                 :            : 
     126                 :            :         /// Dispose all internal references
     127                 :            :         virtual void disposeThis();
     128                 :            : 
     129                 :            :         // Forwarding the XComponent implementation to the
     130                 :            :         // cppu::ImplHelper templated base
     131                 :            :         //                                    Classname     Base doing refcounting        Base implementing the XComponent interface
     132                 :            :         //                                       |                 |                            |
     133                 :            :         //                                       V                 V                            V
     134                 :          0 :         DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase );
     135                 :            : 
     136                 :            :         // XBufferController (partial)
     137                 :            :         virtual ::sal_Bool SAL_CALL showBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
     138                 :            :         virtual ::sal_Bool SAL_CALL switchBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
     139                 :            : 
     140                 :            :         // XSpriteCanvas (partial)
     141                 :            :         virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException);
     142                 :            : 
     143                 :            :         // XServiceName
     144                 :            :         virtual ::rtl::OUString SAL_CALL getServiceName(  ) throw (::com::sun::star::uno::RuntimeException);
     145                 :            : 
     146                 :            :         // RepaintTarget
     147                 :            :         virtual bool repaint( const GraphicObjectSharedPtr&                   rGrf,
     148                 :            :                               const ::com::sun::star::rendering::ViewState&   viewState,
     149                 :            :                               const ::com::sun::star::rendering::RenderState& renderState,
     150                 :            :                               const ::Point&                                  rPt,
     151                 :            :                               const ::Size&                                   rSz,
     152                 :            :                               const GraphicAttr&                              rAttr ) const;
     153                 :            : 
     154                 :            :         /// Get backbuffer for this canvas
     155                 :          0 :         OutDevProviderSharedPtr getFrontBuffer() const { return maDeviceHelper.getOutDev(); }
     156                 :            :         /// Get window for this canvas
     157                 :          0 :         BackBufferSharedPtr getBackBuffer() const { return maDeviceHelper.getBackBuffer(); }
     158                 :            : 
     159                 :            :     private:
     160                 :            :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
     161                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
     162                 :            :     };
     163                 :            : 
     164                 :            :     typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
     165                 :            :     typedef ::rtl::Reference< SpriteCanvas > DeviceRef;
     166                 :            : 
     167                 :            : }
     168                 :            : 
     169                 :            : #endif
     170                 :            : 
     171                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10