LCOV - code coverage report
Current view: top level - canvas/source/vcl - spritecanvas.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 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_VCL_SPRITECANVAS_HXX
      21             : #define INCLUDED_CANVAS_SOURCE_VCL_SPRITECANVAS_HXX
      22             : 
      23             : #include <rtl/ref.hxx>
      24             : 
      25             : #include <com/sun/star/uno/XComponentContext.hpp>
      26             : #include <com/sun/star/beans/XPropertySet.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 "spritecanvashelper.hxx"
      43             : #include "impltools.hxx"
      44             : #include "spritedevicehelper.hxx"
      45             : #include "repainttarget.hxx"
      46             : 
      47             : 
      48             : #define SPRITECANVAS_SERVICE_NAME        "com.sun.star.rendering.SpriteCanvas.VCL"
      49             : #define SPRITECANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.SpriteCanvas.VCL"
      50             : 
      51             : namespace vclcanvas
      52             : {
      53             :     typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::rendering::XSpriteCanvas,
      54             :                                               ::com::sun::star::rendering::XIntegerBitmap,
      55             :                                               ::com::sun::star::rendering::XGraphicDevice,
      56             :                                               ::com::sun::star::lang::XMultiServiceFactory,
      57             :                                               ::com::sun::star::rendering::XBufferController,
      58             :                                               ::com::sun::star::awt::XWindowListener,
      59             :                                               ::com::sun::star::util::XUpdatable,
      60             :                                               ::com::sun::star::beans::XPropertySet,
      61             :                                               ::com::sun::star::lang::XServiceName >    WindowGraphicDeviceBase_Base;
      62             :     typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >,
      63             :                                                  SpriteDeviceHelper,
      64             :                                                  tools::LocalGuard,
      65             :                                                  ::cppu::OWeakObject >  SpriteCanvasBase_Base;
      66             : 
      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             :     {
      87             :     };
      88             : 
      89             :     typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base,
      90             :                                         SpriteCanvasHelper,
      91             :                                         tools::LocalGuard,
      92             :                                         ::cppu::OWeakObject >           SpriteCanvasBaseT;
      93             : 
      94             :     /** Product of this component's factory.
      95             : 
      96             :         The SpriteCanvas object combines the actual Window canvas with
      97             :         the XGraphicDevice interface. This is because there's a
      98             :         one-to-one relation between them, anyway, since each window
      99             :         can have exactly one canvas and one associated
     100             :         XGraphicDevice. And to avoid messing around with circular
     101             :         references, this is implemented as one single object.
     102             :      */
     103             :     class SpriteCanvas : public SpriteCanvasBaseT,
     104             :                          public RepaintTarget
     105             :     {
     106             :     public:
     107             :         SpriteCanvas( const ::com::sun::star::uno::Sequence<
     108             :                             ::com::sun::star::uno::Any >&               aArguments,
     109             :                       const ::com::sun::star::uno::Reference<
     110             :                             ::com::sun::star::uno::XComponentContext >& rxContext );
     111             : 
     112             :         void initialize();
     113             : 
     114             :         /// For resource tracking
     115             :         virtual ~SpriteCanvas();
     116             : 
     117             :         /// Dispose all internal references
     118             :         virtual void disposeThis() SAL_OVERRIDE;
     119             : 
     120             :         // Forwarding the XComponent implementation to the
     121             :         // cppu::ImplHelper templated base
     122             :         //                                    Classname     Base doing refcounting        Base implementing the XComponent interface
     123             :         //                                       |                 |                            |
     124             :         //                                       V                 V                            V
     125           0 :         DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
     126             : 
     127             :         // XBufferController (partial)
     128             :         virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     129             :         virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     130             : 
     131             :         // XSpriteCanvas (partial)
     132             :         virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     133             : 
     134             :         // XServiceName
     135             :         virtual OUString SAL_CALL getServiceName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     136             : 
     137             :         // RepaintTarget
     138             :         virtual bool repaint( const GraphicObjectSharedPtr&                   rGrf,
     139             :                               const ::com::sun::star::rendering::ViewState&   viewState,
     140             :                               const ::com::sun::star::rendering::RenderState& renderState,
     141             :                               const ::Point&                                  rPt,
     142             :                               const ::Size&                                   rSz,
     143             :                               const GraphicAttr&                              rAttr ) const SAL_OVERRIDE;
     144             : 
     145             :         /// Get backbuffer for this canvas
     146           0 :         OutDevProviderSharedPtr getFrontBuffer() const { return maDeviceHelper.getOutDev(); }
     147             :         /// Get window for this canvas
     148           0 :         BackBufferSharedPtr getBackBuffer() const { return maDeviceHelper.getBackBuffer(); }
     149             : 
     150             :     private:
     151             :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
     152             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
     153             :     };
     154             : 
     155             :     typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
     156             :     typedef ::rtl::Reference< SpriteCanvas > DeviceRef;
     157             : 
     158             : }
     159             : 
     160             : #endif
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10