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/lang/XServiceInfo.hpp>
26 #include <com/sun/star/util/XUpdatable.hpp>
27 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
28 #include <com/sun/star/rendering/XGraphicDevice.hpp>
29 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
30 
31 #include <cppuhelper/compbase.hxx>
32 #include <comphelper/uno3.hxx>
33 
34 #include <base/basemutexhelper.hxx>
38 
39 #include "cairo_canvashelper.hxx"
40 #include "cairo_devicehelper.hxx"
41 #include "cairo_repainttarget.hxx"
43 
44 namespace cairocanvas
45 {
46  typedef ::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas,
47  css::rendering::XIntegerBitmap,
48  css::rendering::XGraphicDevice,
49  css::lang::XMultiServiceFactory,
50  css::util::XUpdatable,
51  css::beans::XPropertySet,
52  css::lang::XServiceName,
53  css::lang::XServiceInfo > GraphicDeviceBase_Base;
54  typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase_Base >,
56  ::osl::MutexGuard,
58 
74  class CanvasBaseSurfaceProvider_Base : public CanvasBase_Base,
75  public SurfaceProvider
76  {
77  };
78 
79  typedef ::canvas::IntegerBitmapBase<
83  ::osl::MutexGuard,
85 
95  class Canvas : public CanvasBaseT,
96  public RepaintTarget
97  {
98  public:
99  Canvas( const css::uno::Sequence< css::uno::Any >& aArguments,
100  const css::uno::Reference< css::uno::XComponentContext >& rxContext );
101 
102  void initialize();
103 
105  virtual ~Canvas() override;
106 
108  virtual void disposeThis() override;
109 
110  // Forwarding the XComponent implementation to the
111  // cppu::ImplHelper templated base
112  // Classname Base doing refcounting Base implementing the XComponent interface
113  // | | |
114  // V V V
115  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas, GraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
116 
117  // XServiceName
118  virtual OUString SAL_CALL getServiceName( ) override;
119 
120  // XServiceInfo
121  virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName) override;
122  virtual OUString SAL_CALL getImplementationName() override;
123  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
124 
125  // RepaintTarget
126  virtual bool repaint( const ::cairo::SurfaceSharedPtr& pSurface,
127  const css::rendering::ViewState& viewState,
128  const css::rendering::RenderState& renderState ) override;
129 
130  // SurfaceProvider
131  virtual ::cairo::SurfaceSharedPtr getSurface() override;
132  virtual ::cairo::SurfaceSharedPtr createSurface( const ::basegfx::B2ISize& rSize, int aContent ) override;
133  virtual ::cairo::SurfaceSharedPtr createSurface( ::Bitmap& rBitmap ) override;
134  virtual ::cairo::SurfaceSharedPtr changeSurface() override;
135  virtual OutputDevice* getOutputDevice() override;
136 
137  private:
138  css::uno::Sequence< css::uno::Any > maArguments;
139  };
140 }
141 
142 /* 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.
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
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
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
unsigned char sal_Bool
::canvas::IntegerBitmapBase< canvas::BitmapCanvasBase2< CanvasBaseSurfaceProvider_Base, CanvasHelper,::osl::MutexGuard,::cppu::OWeakObject > > CanvasBaseT
::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas, css::rendering::XIntegerBitmap, css::rendering::XGraphicDevice, css::lang::XMultiServiceFactory, css::util::XUpdatable, css::beans::XPropertySet, css::lang::XServiceName, css::lang::XServiceInfo > GraphicDeviceBase_Base
virtual OutputDevice * getOutputDevice() override
virtual OUString SAL_CALL getImplementationName() override
css::uno::Sequence< css::uno::Any > maArguments
virtual ::cairo::SurfaceSharedPtr getSurface() override
const char sServiceName[]
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