LibreOffice Module canvas (master)  1
dx_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 <rtl/ref.hxx>
23 
24 #include <com/sun/star/uno/XComponentContext.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/lang/XServiceName.hpp>
27 #include <com/sun/star/util/XUpdatable.hpp>
28 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
29 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
30 #include <com/sun/star/rendering/XGraphicDevice.hpp>
31 #include <com/sun/star/rendering/XBufferController.hpp>
32 
33 #include <cppuhelper/compbase.hxx>
34 #include <comphelper/uno3.hxx>
35 
37 #include <base/basemutexhelper.hxx>
39 #include <base/canvasbase.hxx>
41 
42 #include "dx_bitmapprovider.hxx"
43 #include "dx_canvashelper.hxx"
45 #include "dx_impltools.hxx"
46 #include "dx_devicehelper.hxx"
47 
48 
49 namespace dxcanvas
50 {
51  typedef ::cppu::WeakComponentImplHelper< css::rendering::XCanvas,
52  css::rendering::XGraphicDevice,
53  css::lang::XMultiServiceFactory,
54  css::util::XUpdatable,
55  css::beans::XPropertySet,
56  css::lang::XServiceName,
57  css::lang::XServiceInfo> GraphicDeviceBase1_Base;
58  typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase1_Base >,
60  ::osl::MutexGuard,
62  typedef ::canvas::CanvasBase< CanvasBase1_Base,
64  ::osl::MutexGuard,
66 
76  class Canvas : public CanvasBaseT
77  {
78  public:
79  Canvas( const css::uno::Sequence<
80  css::uno::Any >& aArguments,
81  const css::uno::Reference<
82  css::uno::XComponentContext >& rxContext );
83 
84  void initialize();
85 
87  virtual void disposeThis() override;
88 
89  // Forwarding the XComponent implementation to the
90  // cppu::ImplHelper templated base
91  // Classname Base doing refcounting Base implementing the XComponent interface
92  // | | |
93  // V V V
94  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas, GraphicDeviceBase1_Base, ::cppu::WeakComponentImplHelperBase )
95 
96  // XServiceName
97  virtual OUString SAL_CALL getServiceName( ) override;
98 
99  // XServiceInfo
100  virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames( ) override;
101  virtual OUString SAL_CALL getImplementationName( ) override;
102  virtual sal_Bool SAL_CALL supportsService( const OUString& ) override;
103 
104  private:
105  css::uno::Sequence< css::uno::Any > maArguments;
106  css::uno::Reference< css::uno::XComponentContext > mxComponentContext;
107  };
108 
109  typedef ::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas,
110  css::rendering::XIntegerBitmap,
111  css::rendering::XGraphicDevice,
112  css::lang::XMultiServiceFactory,
113  css::util::XUpdatable,
114  css::beans::XPropertySet,
115  css::lang::XServiceName,
116  css::lang::XServiceInfo > GraphicDeviceBase2_Base;
117  typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase2_Base >,
118  DeviceHelper,
119  ::osl::MutexGuard,
121  typedef ::canvas::IntegerBitmapBase<
125  ::osl::MutexGuard,
127 
137  class BitmapCanvas : public BitmapCanvasBaseT, public BitmapProvider
138  {
139  public:
140  BitmapCanvas( const css::uno::Sequence< css::uno::Any >& aArguments,
141  const css::uno::Reference< css::uno::XComponentContext >& rxContext );
142 
143  void initialize();
144 
146  virtual void disposeThis() override;
147 
148  // Forwarding the XComponent implementation to the
149  // cppu::ImplHelper templated base
150  // Classname Base doing refcounting Base implementing the XComponent interface
151  // | | |
152  // V V V
153  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( BitmapCanvas, GraphicDeviceBase2_Base, ::cppu::WeakComponentImplHelperBase )
154 
155  // XServiceName
156  virtual OUString SAL_CALL getServiceName( ) override;
157 
158  // XServiceInfo
159  virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames( ) override;
160  virtual OUString SAL_CALL getImplementationName( ) override;
161  virtual sal_Bool SAL_CALL supportsService( const OUString& ) override;
162 
163  // BitmapProvider
164  virtual IBitmapSharedPtr getBitmap() const override;
165 
166  private:
167  css::uno::Sequence< css::uno::Any > maArguments;
168  css::uno::Reference< css::uno::XComponentContext > mxComponentContext;
170  };
171 }
172 
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Canvas(const css::uno::Sequence< css::uno::Any > &aArguments, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Helper class for basic canvas functionality.
::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase2_Base >, DeviceHelper,::osl::MutexGuard,::cppu::OWeakObject > CanvasBase2_Base
Definition: dx_canvas.hxx:120
std::shared_ptr< IBitmap > IBitmapSharedPtr
Definition: dx_ibitmap.hxx:58
virtual sal_Bool SAL_CALL supportsService(const OUString &) override
Definition: dx_canvas.cxx:139
virtual void disposeThis() override
Dispose all internal references.
Definition: dx_canvas.cxx:204
#define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper)
::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase1_Base >, DeviceHelper,::osl::MutexGuard,::cppu::OWeakObject > CanvasBase1_Base
Definition: dx_canvas.hxx:61
Sequence< PropertyValue > aArguments
css::uno::Sequence< css::uno::Any > maArguments
Definition: dx_canvas.hxx:105
Product of this component's factory.
Definition: dx_canvas.hxx:137
::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 > GraphicDeviceBase2_Base
Definition: dx_canvas.hxx:116
Helper class for basic canvas functionality.
::cppu::WeakComponentImplHelper< css::rendering::XCanvas, css::rendering::XGraphicDevice, css::lang::XMultiServiceFactory, css::util::XUpdatable, css::beans::XPropertySet, css::lang::XServiceName, css::lang::XServiceInfo > GraphicDeviceBase1_Base
Definition: dx_canvas.hxx:57
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
Definition: dx_canvas.hxx:106
Product of this component's factory.
Definition: dx_canvas.hxx:76
unsigned char sal_Bool
virtual OUString SAL_CALL getImplementationName() override
Definition: dx_canvas.cxx:135
IBitmapSharedPtr mpTarget
Definition: dx_canvas.hxx:169
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
Definition: dx_canvas.hxx:168
virtual void disposeThis() override
Dispose all internal references.
Definition: dx_canvas.cxx:115
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: dx_canvas.cxx:131
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: dx_canvas.cxx:221
::canvas::CanvasBase< CanvasBase1_Base, CanvasHelper,::osl::MutexGuard,::cppu::OWeakObject > CanvasBaseT
Definition: dx_canvas.hxx:65
BitmapCanvas(const css::uno::Sequence< css::uno::Any > &aArguments, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Definition: dx_canvas.cxx:144
virtual sal_Bool SAL_CALL supportsService(const OUString &) override
Definition: dx_canvas.cxx:229
css::uno::Sequence< css::uno::Any > maArguments
Definition: dx_canvas.hxx:167
virtual IBitmapSharedPtr getBitmap() const override
Definition: dx_canvas.cxx:234
virtual OUString SAL_CALL getServiceName() override
Definition: dx_canvas.cxx:215
::canvas::IntegerBitmapBase< canvas::BitmapCanvasBase2< CanvasBase2_Base, BitmapCanvasHelper,::osl::MutexGuard,::cppu::OWeakObject > > BitmapCanvasBaseT
Definition: dx_canvas.hxx:126
virtual OUString SAL_CALL getImplementationName() override
Definition: dx_canvas.cxx:225
virtual OUString SAL_CALL getServiceName() override
Definition: dx_canvas.cxx:125