CWS-TOOLING: integrate CWS os146
[LibreOffice.git] / canvas / source / directx / dx_canvas.hxx
blobbe15b875c4b6746d552891da20ba8ddccef9eac1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _DXCANVAS_CANVAS_HXX_
29 #define _DXCANVAS_CANVAS_HXX_
31 #include <rtl/ref.hxx>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/lang/XServiceName.hpp>
36 #include <com/sun/star/util/XUpdatable.hpp>
37 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
38 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
39 #include <com/sun/star/rendering/XGraphicDevice.hpp>
40 #include <com/sun/star/rendering/XBufferController.hpp>
42 #include <cppuhelper/compbase7.hxx>
43 #include <cppuhelper/compbase6.hxx>
44 #include <comphelper/uno3.hxx>
46 #include <canvas/base/integerbitmapbase.hxx>
47 #include <canvas/base/basemutexhelper.hxx>
48 #include <canvas/base/graphicdevicebase.hxx>
50 #include "dx_bitmapprovider.hxx"
51 #include "dx_canvashelper.hxx"
52 #include "dx_bitmapcanvashelper.hxx"
53 #include "dx_impltools.hxx"
54 #include "dx_devicehelper.hxx"
57 namespace dxcanvas
59 typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::rendering::XCanvas,
60 ::com::sun::star::rendering::XGraphicDevice,
61 ::com::sun::star::lang::XMultiServiceFactory,
62 ::com::sun::star::util::XUpdatable,
63 ::com::sun::star::beans::XPropertySet,
64 ::com::sun::star::lang::XServiceName > GraphicDeviceBase1_Base;
65 typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase1_Base >,
66 DeviceHelper,
67 ::osl::MutexGuard,
68 ::cppu::OWeakObject > CanvasBase1_Base;
69 typedef ::canvas::CanvasBase< CanvasBase1_Base,
70 CanvasHelper,
71 ::osl::MutexGuard,
72 ::cppu::OWeakObject > CanvasBaseT;
74 /** Product of this component's factory.
76 The Canvas object combines the actual Window canvas with
77 the XGraphicDevice interface. This is because there's a
78 one-to-one relation between them, anyway, since each window
79 can have exactly one canvas and one associated
80 XGraphicDevice. And to avoid messing around with circular
81 references, this is implemented as one single object.
83 class Canvas : public CanvasBaseT
85 public:
86 Canvas( const ::com::sun::star::uno::Sequence<
87 ::com::sun::star::uno::Any >& aArguments,
88 const ::com::sun::star::uno::Reference<
89 ::com::sun::star::uno::XComponentContext >& rxContext );
91 void initialize();
93 /// Dispose all internal references
94 virtual void SAL_CALL disposing();
96 // Forwarding the XComponent implementation to the
97 // cppu::ImplHelper templated base
98 // Classname Base doing refcounting Base implementing the XComponent interface
99 // | | |
100 // V V V
101 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas, GraphicDeviceBase1_Base, ::cppu::WeakComponentImplHelperBase );
103 // XServiceName
104 virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
106 private:
107 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
108 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
111 typedef ::rtl::Reference< Canvas > CanvasRef;
113 //////////////////////////////////////////////////////////////////////////////////////////////////////
115 typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas,
116 ::com::sun::star::rendering::XIntegerBitmap,
117 ::com::sun::star::rendering::XGraphicDevice,
118 ::com::sun::star::lang::XMultiServiceFactory,
119 ::com::sun::star::util::XUpdatable,
120 ::com::sun::star::beans::XPropertySet,
121 ::com::sun::star::lang::XServiceName > GraphicDeviceBase2_Base;
122 typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase2_Base >,
123 DeviceHelper,
124 ::osl::MutexGuard,
125 ::cppu::OWeakObject > CanvasBase2_Base;
126 typedef ::canvas::IntegerBitmapBase< CanvasBase2_Base,
127 BitmapCanvasHelper,
128 ::osl::MutexGuard,
129 ::cppu::OWeakObject > BitmapCanvasBaseT;
131 /** Product of this component's factory.
133 The Canvas object combines the actual Window canvas with
134 the XGraphicDevice interface. This is because there's a
135 one-to-one relation between them, anyway, since each window
136 can have exactly one canvas and one associated
137 XGraphicDevice. And to avoid messing around with circular
138 references, this is implemented as one single object.
140 class BitmapCanvas : public BitmapCanvasBaseT, public BitmapProvider
142 public:
143 BitmapCanvas( const ::com::sun::star::uno::Sequence<
144 ::com::sun::star::uno::Any >& aArguments,
145 const ::com::sun::star::uno::Reference<
146 ::com::sun::star::uno::XComponentContext >& rxContext );
148 void initialize();
150 /// Dispose all internal references
151 virtual void SAL_CALL disposing();
153 // Forwarding the XComponent implementation to the
154 // cppu::ImplHelper templated base
155 // Classname Base doing refcounting Base implementing the XComponent interface
156 // | | |
157 // V V V
158 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( BitmapCanvas, GraphicDeviceBase2_Base, ::cppu::WeakComponentImplHelperBase );
160 // XServiceName
161 virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
163 // BitmapProvider
164 virtual IBitmapSharedPtr getBitmap() const;
166 private:
167 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
168 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
169 IBitmapSharedPtr mpTarget;
172 typedef ::rtl::Reference< BitmapCanvas > BitmapCanvasRef;
175 #endif