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 #define CANVAS_SERVICE_NAME "com.sun.star.rendering.Canvas.Cairo"
44 #define CANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.Canvas.Cairo"
45 
46 namespace cairocanvas
47 {
48  typedef ::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas,
49  css::rendering::XIntegerBitmap,
50  css::rendering::XGraphicDevice,
51  css::lang::XMultiServiceFactory,
52  css::util::XUpdatable,
53  css::beans::XPropertySet,
54  css::lang::XServiceName > GraphicDeviceBase_Base;
55  typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase_Base >,
57  ::osl::MutexGuard,
59 
75  class CanvasBaseSurfaceProvider_Base : public CanvasBase_Base,
76  public SurfaceProvider
77  {
78  };
79 
80  typedef ::canvas::IntegerBitmapBase<
84  ::osl::MutexGuard,
86 
96  class Canvas : public CanvasBaseT,
97  public RepaintTarget
98  {
99  public:
100  Canvas( const css::uno::Sequence< css::uno::Any >& aArguments,
101  const css::uno::Reference< css::uno::XComponentContext >& rxContext );
102 
103  void initialize();
104 
106  virtual ~Canvas() override;
107 
109  virtual void disposeThis() override;
110 
111  // Forwarding the XComponent implementation to the
112  // cppu::ImplHelper templated base
113  // Classname Base doing refcounting Base implementing the XComponent interface
114  // | | |
115  // V V V
116  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas, GraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
117 
118  // XServiceName
119  virtual OUString SAL_CALL getServiceName( ) override;
120 
121  // RepaintTarget
122  virtual bool repaint( const ::cairo::SurfaceSharedPtr& pSurface,
123  const css::rendering::ViewState& viewState,
124  const css::rendering::RenderState& renderState ) override;
125 
126  // SurfaceProvider
127  virtual ::cairo::SurfaceSharedPtr getSurface() override;
128  virtual ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, int aContent ) override;
129  virtual ::cairo::SurfaceSharedPtr createSurface( ::Bitmap& rBitmap ) override;
130  virtual ::cairo::SurfaceSharedPtr changeSurface() override;
131  virtual OutputDevice* getOutputDevice() override;
132 
133  private:
134  css::uno::Sequence< css::uno::Any > maArguments;
135  };
136 }
137 
138 /* 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