LibreOffice Module canvas (master)  1
cairo_canvas.hxx
Go to the documentation of this file.
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 #pragma once
21 
22 #include <com/sun/star/uno/XComponentContext.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/lang/XServiceName.hpp>
25 #include <com/sun/star/util/XUpdatable.hpp>
26 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
27 #include <com/sun/star/rendering/XGraphicDevice.hpp>
28 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
29 
30 #include <cppuhelper/compbase.hxx>
31 #include <comphelper/uno3.hxx>
32 
33 #include <base/basemutexhelper.hxx>
37 
38 #include "cairo_canvashelper.hxx"
39 #include "cairo_devicehelper.hxx"
40 #include "cairo_repainttarget.hxx"
42 
43 namespace cairocanvas
44 {
45  typedef ::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas,
46  css::rendering::XIntegerBitmap,
47  css::rendering::XGraphicDevice,
48  css::lang::XMultiServiceFactory,
49  css::util::XUpdatable,
50  css::beans::XPropertySet,
51  css::lang::XServiceName > GraphicDeviceBase_Base;
52  typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase_Base >,
54  ::osl::MutexGuard,
56 
72  class CanvasBaseSurfaceProvider_Base : public CanvasBase_Base,
73  public SurfaceProvider
74  {
75  };
76 
77  typedef ::canvas::IntegerBitmapBase<
81  ::osl::MutexGuard,
83 
93  class Canvas : public CanvasBaseT,
94  public RepaintTarget
95  {
96  public:
97  Canvas( const css::uno::Sequence< css::uno::Any >& aArguments,
98  const css::uno::Reference< css::uno::XComponentContext >& rxContext );
99 
100  void initialize();
101 
103  virtual ~Canvas() override;
104 
106  virtual void disposeThis() override;
107 
108  // Forwarding the XComponent implementation to the
109  // cppu::ImplHelper templated base
110  // Classname Base doing refcounting Base implementing the XComponent interface
111  // | | |
112  // V V V
113  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas, GraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
114 
115  // XServiceName
116  virtual OUString SAL_CALL getServiceName( ) override;
117 
118  // RepaintTarget
119  virtual bool repaint( const ::cairo::SurfaceSharedPtr& pSurface,
120  const css::rendering::ViewState& viewState,
121  const css::rendering::RenderState& renderState ) override;
122 
123  // SurfaceProvider
124  virtual ::cairo::SurfaceSharedPtr getSurface() override;
125  virtual ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, int aContent ) override;
126  virtual ::cairo::SurfaceSharedPtr createSurface( ::Bitmap& rBitmap ) override;
127  virtual ::cairo::SurfaceSharedPtr changeSurface() override;
128  virtual OutputDevice* getOutputDevice() override;
129 
130  private:
131  css::uno::Sequence< css::uno::Any > maArguments;
132  };
133 }
134 
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Canvas(const css::uno::Sequence< css::uno::Any > &aArguments, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Target interface for XCachedPrimitive implementations.
Target interface for XCachedPrimitive implementations.
#define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper)
virtual void disposeThis() override
Dispose all internal references.
Sequence< PropertyValue > aArguments
Product of this component's factory.
virtual ~Canvas() override
For resource tracking.
::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase_Base >, DeviceHelper,::osl::MutexGuard,::cppu::OWeakObject > CanvasBase_Base
virtual ::cairo::SurfaceSharedPtr changeSurface() override
::canvas::IntegerBitmapBase< canvas::BitmapCanvasBase2< CanvasBaseSurfaceProvider_Base, CanvasHelper,::osl::MutexGuard,::cppu::OWeakObject > > CanvasBaseT
virtual OutputDevice * getOutputDevice() override
css::uno::Sequence< css::uno::Any > maArguments
virtual ::cairo::SurfaceSharedPtr getSurface() override
::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas, css::rendering::XIntegerBitmap, css::rendering::XGraphicDevice, css::lang::XMultiServiceFactory, css::util::XUpdatable, css::beans::XPropertySet, css::lang::XServiceName > GraphicDeviceBase_Base
virtual ::cairo::SurfaceSharedPtr createSurface(const ::basegfx::B2ISize &rSize, int aContent) override
virtual OUString SAL_CALL getServiceName() override
virtual bool repaint(const ::cairo::SurfaceSharedPtr &pSurface, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState) override