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 #ifndef INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVAS_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_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/XServiceName.hpp>
28 #include <com/sun/star/util/XUpdatable.hpp>
29 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
30 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
31 #include <com/sun/star/rendering/XGraphicDevice.hpp>
32 #include <com/sun/star/rendering/XBufferController.hpp>
33 
34 #include <cppuhelper/compbase.hxx>
35 #include <comphelper/uno3.hxx>
36 
38 #include <base/basemutexhelper.hxx>
40 #include <base/canvasbase.hxx>
42 
43 #include "dx_bitmapprovider.hxx"
44 #include "dx_canvashelper.hxx"
46 #include "dx_impltools.hxx"
47 #include "dx_devicehelper.hxx"
48 
49 
50 namespace dxcanvas
51 {
52  typedef ::cppu::WeakComponentImplHelper< css::rendering::XCanvas,
53  css::rendering::XGraphicDevice,
54  css::lang::XMultiServiceFactory,
55  css::util::XUpdatable,
56  css::beans::XPropertySet,
57  css::lang::XServiceName,
58  css::lang::XServiceInfo> GraphicDeviceBase1_Base;
59  typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase1_Base >,
61  ::osl::MutexGuard,
63  typedef ::canvas::CanvasBase< CanvasBase1_Base,
65  ::osl::MutexGuard,
67 
77  class Canvas : public CanvasBaseT
78  {
79  public:
80  Canvas( const css::uno::Sequence<
81  css::uno::Any >& aArguments,
82  const css::uno::Reference<
83  css::uno::XComponentContext >& rxContext );
84 
85  void initialize();
86 
88  virtual void disposeThis() override;
89 
90  // Forwarding the XComponent implementation to the
91  // cppu::ImplHelper templated base
92  // Classname Base doing refcounting Base implementing the XComponent interface
93  // | | |
94  // V V V
95  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas, GraphicDeviceBase1_Base, ::cppu::WeakComponentImplHelperBase )
96 
97  // XServiceName
98  virtual OUString SAL_CALL getServiceName( ) override;
99 
100  // XServiceInfo
101  virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames( ) override;
102  virtual OUString SAL_CALL getImplementationName( ) override;
103  virtual sal_Bool SAL_CALL supportsService( const OUString& ) override;
104 
105  private:
106  css::uno::Sequence< css::uno::Any > maArguments;
107  css::uno::Reference< css::uno::XComponentContext > mxComponentContext;
108  };
109 
110  typedef ::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas,
111  css::rendering::XIntegerBitmap,
112  css::rendering::XGraphicDevice,
113  css::lang::XMultiServiceFactory,
114  css::util::XUpdatable,
115  css::beans::XPropertySet,
116  css::lang::XServiceName,
117  css::lang::XServiceInfo > GraphicDeviceBase2_Base;
118  typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase2_Base >,
119  DeviceHelper,
120  ::osl::MutexGuard,
122  typedef ::canvas::IntegerBitmapBase<
126  ::osl::MutexGuard,
128 
138  class BitmapCanvas : public BitmapCanvasBaseT, public BitmapProvider
139  {
140  public:
141  BitmapCanvas( const css::uno::Sequence< css::uno::Any >& aArguments,
142  const css::uno::Reference< css::uno::XComponentContext >& rxContext );
143 
144  void initialize();
145 
147  virtual void disposeThis() override;
148 
149  // Forwarding the XComponent implementation to the
150  // cppu::ImplHelper templated base
151  // Classname Base doing refcounting Base implementing the XComponent interface
152  // | | |
153  // V V V
154  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( BitmapCanvas, GraphicDeviceBase2_Base, ::cppu::WeakComponentImplHelperBase )
155 
156  // XServiceName
157  virtual OUString SAL_CALL getServiceName( ) override;
158 
159  // XServiceInfo
160  virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames( ) override;
161  virtual OUString SAL_CALL getImplementationName( ) override;
162  virtual sal_Bool SAL_CALL supportsService( const OUString& ) override;
163 
164  // BitmapProvider
165  virtual IBitmapSharedPtr getBitmap() const override;
166 
167  private:
168  css::uno::Sequence< css::uno::Any > maArguments;
169  css::uno::Reference< css::uno::XComponentContext > mxComponentContext;
171  };
172 }
173 
174 #endif
175 
176 /* 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:121
std::shared_ptr< IBitmap > IBitmapSharedPtr
Definition: dx_ibitmap.hxx:59
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:62
Sequence< PropertyValue > aArguments
css::uno::Sequence< css::uno::Any > maArguments
Definition: dx_canvas.hxx:106
Product of this component's factory.
Definition: dx_canvas.hxx:138
::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:117
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:58
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
Definition: dx_canvas.hxx:107
Product of this component's factory.
Definition: dx_canvas.hxx:77
unsigned char sal_Bool
virtual OUString SAL_CALL getImplementationName() override
Definition: dx_canvas.cxx:135
IBitmapSharedPtr mpTarget
Definition: dx_canvas.hxx:170
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
Definition: dx_canvas.hxx:169
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:66
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:168
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:127
virtual OUString SAL_CALL getImplementationName() override
Definition: dx_canvas.cxx:225
virtual OUString SAL_CALL getServiceName() override
Definition: dx_canvas.cxx:125