LCOV - code coverage report
Current view: top level - canvas/source/cairo - cairo_canvas.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 2 2 100.0 %
Date: 2014-11-03 Functions: 5 9 55.6 %
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_CANVAS_HXX
      21             : #define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_CANVAS_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/XInitialization.hpp>
      28             : #include <com/sun/star/lang/XServiceInfo.hpp>
      29             : #include <com/sun/star/lang/XServiceName.hpp>
      30             : #include <com/sun/star/awt/XWindowListener.hpp>
      31             : #include <com/sun/star/util/XUpdatable.hpp>
      32             : #include <com/sun/star/rendering/XSpriteCanvas.hpp>
      33             : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
      34             : #include <com/sun/star/rendering/XGraphicDevice.hpp>
      35             : #include <com/sun/star/rendering/XBufferController.hpp>
      36             : 
      37             : #include <cppuhelper/compbase7.hxx>
      38             : #include <comphelper/uno3.hxx>
      39             : 
      40             : #include <canvas/base/spritecanvasbase.hxx>
      41             : #include <canvas/base/basemutexhelper.hxx>
      42             : #include <canvas/base/bufferedgraphicdevicebase.hxx>
      43             : 
      44             : #include <basegfx/vector/b2isize.hxx>
      45             : 
      46             : #include "cairo_devicehelper.hxx"
      47             : #include "cairo_repainttarget.hxx"
      48             : #include "cairo_surfaceprovider.hxx"
      49             : #include "cairo_spritecanvashelper.hxx"
      50             : 
      51             : #define CANVAS_SERVICE_NAME        "com.sun.star.rendering.Canvas.Cairo"
      52             : #define CANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.Canvas.Cairo"
      53             : 
      54             : namespace cairocanvas
      55             : {
      56             :     typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas,
      57             :                                                 ::com::sun::star::rendering::XIntegerBitmap,
      58             :                                                 ::com::sun::star::rendering::XGraphicDevice,
      59             :                                                 ::com::sun::star::lang::XMultiServiceFactory,
      60             :                                                 ::com::sun::star::util::XUpdatable,
      61             :                                                 ::com::sun::star::beans::XPropertySet,
      62             :                                                 ::com::sun::star::lang::XServiceName >  GraphicDeviceBase_Base;
      63             :     typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase_Base >,
      64             :                                                  DeviceHelper,
      65             :                                                  ::osl::MutexGuard,
      66             :                                                  ::cppu::OWeakObject > CanvasBase_Base;
      67             : 
      68             :     /** Mixin SurfaceProvider
      69             : 
      70             :         Have to mixin the SurfaceProvider before deriving from
      71             :         ::canvas::CanvasBase, as this template should already
      72             :         implement some of those interface methods.
      73             : 
      74             :         The reason why this appears kinda convoluted is the fact that
      75             :         we cannot specify non-IDL types as WeakComponentImplHelperN
      76             :         template args, and furthermore, don't want to derive
      77             :         ::canvas::CanvasBase directly from
      78             :         SurfaceProvider (because derivees of
      79             :         ::canvas::CanvasBase have to explicitly forward the
      80             :         XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
      81             :         anyway).
      82             :      */
      83           4 :     class CanvasBaseSurfaceProvider_Base : public CanvasBase_Base,
      84             :                                            public SurfaceProvider
      85             :     {
      86             :     };
      87             : 
      88             :     typedef ::canvas::IntegerBitmapBase<
      89             :         canvas::BitmapCanvasBase2<
      90             :             CanvasBaseSurfaceProvider_Base,
      91             :             CanvasHelper,
      92             :             ::osl::MutexGuard,
      93             :             ::cppu::OWeakObject> > CanvasBaseT;
      94             : 
      95             :     /** Product of this component's factory.
      96             : 
      97             :         The Canvas 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             :     class Canvas : public CanvasBaseT,
     105             :                    public RepaintTarget
     106             :     {
     107             :     public:
     108             :         Canvas( 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             :         /// For resource tracking
     116             :         virtual ~Canvas();
     117             : 
     118             :         /// Dispose all internal references
     119             :         virtual void disposeThis() SAL_OVERRIDE;
     120             : 
     121             :         // Forwarding the XComponent implementation to the
     122             :         // cppu::ImplHelper templated base
     123             :         //                          Classname     Base doing refcounting        Base implementing the XComponent interface
     124             :         //                            |                 |                            |
     125             :         //                            V                 V                            V
     126          14 :         DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas, GraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
     127             : 
     128             :         // XServiceName
     129             :         virtual OUString SAL_CALL getServiceName(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     130             : 
     131             :         // RepaintTarget
     132             :         virtual bool repaint( const ::cairo::SurfaceSharedPtr& pSurface,
     133             :                   const ::com::sun::star::rendering::ViewState& viewState,
     134             :                   const ::com::sun::star::rendering::RenderState&   renderState ) SAL_OVERRIDE;
     135             : 
     136             :         // SurfaceProvider
     137             :         virtual ::cairo::SurfaceSharedPtr getSurface() SAL_OVERRIDE;
     138             :         virtual ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, ::cairo::Content aContent = CAIRO_CONTENT_COLOR_ALPHA ) SAL_OVERRIDE;
     139             :         virtual ::cairo::SurfaceSharedPtr createSurface( ::Bitmap& rBitmap ) SAL_OVERRIDE;
     140             :         virtual ::cairo::SurfaceSharedPtr changeSurface( bool bHasAlpha, bool bCopyContent ) SAL_OVERRIDE;
     141             :         virtual OutputDevice* getOutputDevice() SAL_OVERRIDE;
     142             : 
     143             :      private:
     144             :         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >                maArguments;
     145             :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
     146             :     };
     147             : 
     148             :     typedef ::rtl::Reference< Canvas > CanvasRef;
     149             : }
     150             : 
     151             : #endif
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10