update dev300-m58
[ooovba.git] / canvas / source / directx / dx_canvas.hxx
blob4e3ef4c4b2450bcd99e74601b158588de753c478
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dx_canvas.hxx,v $
10 * $Revision: 1.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DXCANVAS_CANVAS_HXX_
32 #define _DXCANVAS_CANVAS_HXX_
34 #include <rtl/ref.hxx>
36 #include <com/sun/star/uno/XComponentContext.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <com/sun/star/lang/XServiceName.hpp>
39 #include <com/sun/star/util/XUpdatable.hpp>
40 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
41 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
42 #include <com/sun/star/rendering/XGraphicDevice.hpp>
43 #include <com/sun/star/rendering/XBufferController.hpp>
44 #include <com/sun/star/rendering/XParametricPolyPolygon2DFactory.hpp>
46 #include <cppuhelper/compbase7.hxx>
47 #include <cppuhelper/compbase6.hxx>
48 #include <comphelper/uno3.hxx>
50 #include <canvas/base/integerbitmapbase.hxx>
51 #include <canvas/base/basemutexhelper.hxx>
52 #include <canvas/base/graphicdevicebase.hxx>
54 #include "dx_bitmapprovider.hxx"
55 #include "dx_canvashelper.hxx"
56 #include "dx_bitmapcanvashelper.hxx"
57 #include "dx_impltools.hxx"
58 #include "dx_devicehelper.hxx"
61 namespace dxcanvas
63 typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::rendering::XCanvas,
64 ::com::sun::star::rendering::XGraphicDevice,
65 ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
66 ::com::sun::star::util::XUpdatable,
67 ::com::sun::star::beans::XPropertySet,
68 ::com::sun::star::lang::XServiceName > GraphicDeviceBase1_Base;
69 typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase1_Base >,
70 DeviceHelper,
71 ::osl::MutexGuard,
72 ::cppu::OWeakObject > CanvasBase1_Base;
73 typedef ::canvas::CanvasBase< CanvasBase1_Base,
74 CanvasHelper,
75 ::osl::MutexGuard,
76 ::cppu::OWeakObject > CanvasBaseT;
78 /** Product of this component's factory.
80 The Canvas object combines the actual Window canvas with
81 the XGraphicDevice interface. This is because there's a
82 one-to-one relation between them, anyway, since each window
83 can have exactly one canvas and one associated
84 XGraphicDevice. And to avoid messing around with circular
85 references, this is implemented as one single object.
87 class Canvas : public CanvasBaseT
89 public:
90 Canvas( const ::com::sun::star::uno::Sequence<
91 ::com::sun::star::uno::Any >& aArguments,
92 const ::com::sun::star::uno::Reference<
93 ::com::sun::star::uno::XComponentContext >& rxContext );
95 void initialize();
97 /// Dispose all internal references
98 virtual void SAL_CALL disposing();
100 // Forwarding the XComponent implementation to the
101 // cppu::ImplHelper templated base
102 // Classname Base doing refcounting Base implementing the XComponent interface
103 // | | |
104 // V V V
105 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas, GraphicDeviceBase1_Base, ::cppu::WeakComponentImplHelperBase );
107 // XServiceName
108 virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
110 private:
111 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
112 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
115 typedef ::rtl::Reference< Canvas > CanvasRef;
117 //////////////////////////////////////////////////////////////////////////////////////////////////////
119 typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas,
120 ::com::sun::star::rendering::XIntegerBitmap,
121 ::com::sun::star::rendering::XGraphicDevice,
122 ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
123 ::com::sun::star::util::XUpdatable,
124 ::com::sun::star::beans::XPropertySet,
125 ::com::sun::star::lang::XServiceName > GraphicDeviceBase2_Base;
126 typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase2_Base >,
127 DeviceHelper,
128 ::osl::MutexGuard,
129 ::cppu::OWeakObject > CanvasBase2_Base;
130 typedef ::canvas::IntegerBitmapBase< CanvasBase2_Base,
131 BitmapCanvasHelper,
132 ::osl::MutexGuard,
133 ::cppu::OWeakObject > BitmapCanvasBaseT;
135 /** Product of this component's factory.
137 The Canvas object combines the actual Window canvas with
138 the XGraphicDevice interface. This is because there's a
139 one-to-one relation between them, anyway, since each window
140 can have exactly one canvas and one associated
141 XGraphicDevice. And to avoid messing around with circular
142 references, this is implemented as one single object.
144 class BitmapCanvas : public BitmapCanvasBaseT, public BitmapProvider
146 public:
147 BitmapCanvas( const ::com::sun::star::uno::Sequence<
148 ::com::sun::star::uno::Any >& aArguments,
149 const ::com::sun::star::uno::Reference<
150 ::com::sun::star::uno::XComponentContext >& rxContext );
152 void initialize();
154 /// Dispose all internal references
155 virtual void SAL_CALL disposing();
157 // Forwarding the XComponent implementation to the
158 // cppu::ImplHelper templated base
159 // Classname Base doing refcounting Base implementing the XComponent interface
160 // | | |
161 // V V V
162 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( BitmapCanvas, GraphicDeviceBase2_Base, ::cppu::WeakComponentImplHelperBase );
164 // XServiceName
165 virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
167 // BitmapProvider
168 virtual IBitmapSharedPtr getBitmap() const;
170 private:
171 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
172 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
173 IBitmapSharedPtr mpTarget;
176 typedef ::rtl::Reference< BitmapCanvas > BitmapCanvasRef;
179 #endif