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 
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 > 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  private:
100  css::uno::Sequence< css::uno::Any > maArguments;
101  css::uno::Reference< css::uno::XComponentContext > mxComponentContext;
102  };
103 
104  typedef ::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas,
105  css::rendering::XIntegerBitmap,
106  css::rendering::XGraphicDevice,
107  css::lang::XMultiServiceFactory,
108  css::util::XUpdatable,
109  css::beans::XPropertySet,
110  css::lang::XServiceName > GraphicDeviceBase2_Base;
111  typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase2_Base >,
112  DeviceHelper,
113  ::osl::MutexGuard,
115  typedef ::canvas::IntegerBitmapBase<
119  ::osl::MutexGuard,
121 
131  class BitmapCanvas : public BitmapCanvasBaseT, public BitmapProvider
132  {
133  public:
134  BitmapCanvas( const css::uno::Sequence< css::uno::Any >& aArguments,
135  const css::uno::Reference< css::uno::XComponentContext >& rxContext );
136 
137  void initialize();
138 
140  virtual void disposeThis() override;
141 
142  // Forwarding the XComponent implementation to the
143  // cppu::ImplHelper templated base
144  // Classname Base doing refcounting Base implementing the XComponent interface
145  // | | |
146  // V V V
147  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( BitmapCanvas, GraphicDeviceBase2_Base, ::cppu::WeakComponentImplHelperBase )
148 
149  // XServiceName
150  virtual OUString SAL_CALL getServiceName( ) override;
151 
152  // BitmapProvider
153  virtual IBitmapSharedPtr getBitmap() const override;
154 
155  private:
156  css::uno::Sequence< css::uno::Any > maArguments;
157  css::uno::Reference< css::uno::XComponentContext > mxComponentContext;
159  };
160 }
161 
162 #endif
163 
164 /* 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:114
std::shared_ptr< IBitmap > IBitmapSharedPtr
Definition: dx_ibitmap.hxx:59
virtual void disposeThis() override
Dispose all internal references.
Definition: dx_canvas.cxx:198
#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:100
Product of this component's factory.
Definition: dx_canvas.hxx:131
Helper class for basic canvas functionality.
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
Definition: dx_canvas.hxx:101
Product of this component's factory.
Definition: dx_canvas.hxx:76
IBitmapSharedPtr mpTarget
Definition: dx_canvas.hxx:158
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
Definition: dx_canvas.hxx:157
virtual void disposeThis() override
Dispose all internal references.
Definition: dx_canvas.cxx:123
::cppu::WeakComponentImplHelper< css::rendering::XBitmapCanvas, css::rendering::XIntegerBitmap, css::rendering::XGraphicDevice, css::lang::XMultiServiceFactory, css::util::XUpdatable, css::beans::XPropertySet, css::lang::XServiceName > GraphicDeviceBase2_Base
Definition: dx_canvas.hxx:110
::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:138
::cppu::WeakComponentImplHelper< css::rendering::XCanvas, css::rendering::XGraphicDevice, css::lang::XMultiServiceFactory, css::util::XUpdatable, css::beans::XPropertySet, css::lang::XServiceName > GraphicDeviceBase1_Base
Definition: dx_canvas.hxx:57
css::uno::Sequence< css::uno::Any > maArguments
Definition: dx_canvas.hxx:156
virtual IBitmapSharedPtr getBitmap() const override
Definition: dx_canvas.cxx:214
virtual OUString SAL_CALL getServiceName() override
Definition: dx_canvas.cxx:209
::canvas::IntegerBitmapBase< canvas::BitmapCanvasBase2< CanvasBase2_Base, BitmapCanvasHelper,::osl::MutexGuard,::cppu::OWeakObject > > BitmapCanvasBaseT
Definition: dx_canvas.hxx:120
virtual OUString SAL_CALL getServiceName() override
Definition: dx_canvas.cxx:133