xref: /AOO41X/main/canvas/source/directx/dx_canvas.hxx (revision 91c99ff47293b0d0832bde809a8978c8bfc37548)
1*91c99ff4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*91c99ff4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*91c99ff4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*91c99ff4SAndrew Rist  * distributed with this work for additional information
6*91c99ff4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*91c99ff4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*91c99ff4SAndrew Rist  * "License"); you may not use this file except in compliance
9*91c99ff4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*91c99ff4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*91c99ff4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*91c99ff4SAndrew Rist  * software distributed under the License is distributed on an
15*91c99ff4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*91c99ff4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*91c99ff4SAndrew Rist  * specific language governing permissions and limitations
18*91c99ff4SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*91c99ff4SAndrew Rist  *************************************************************/
21*91c99ff4SAndrew Rist 
22*91c99ff4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _DXCANVAS_CANVAS_HXX_
25cdf0e10cSrcweir #define _DXCANVAS_CANVAS_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <rtl/ref.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
30cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceName.hpp>
32cdf0e10cSrcweir #include <com/sun/star/util/XUpdatable.hpp>
33cdf0e10cSrcweir #include <com/sun/star/rendering/XBitmapCanvas.hpp>
34cdf0e10cSrcweir #include <com/sun/star/rendering/XIntegerBitmap.hpp>
35cdf0e10cSrcweir #include <com/sun/star/rendering/XGraphicDevice.hpp>
36cdf0e10cSrcweir #include <com/sun/star/rendering/XBufferController.hpp>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <cppuhelper/compbase7.hxx>
39cdf0e10cSrcweir #include <cppuhelper/compbase6.hxx>
40cdf0e10cSrcweir #include <comphelper/uno3.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <canvas/base/integerbitmapbase.hxx>
43cdf0e10cSrcweir #include <canvas/base/basemutexhelper.hxx>
44cdf0e10cSrcweir #include <canvas/base/graphicdevicebase.hxx>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #include "dx_bitmapprovider.hxx"
47cdf0e10cSrcweir #include "dx_canvashelper.hxx"
48cdf0e10cSrcweir #include "dx_bitmapcanvashelper.hxx"
49cdf0e10cSrcweir #include "dx_impltools.hxx"
50cdf0e10cSrcweir #include "dx_devicehelper.hxx"
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 
53cdf0e10cSrcweir namespace dxcanvas
54cdf0e10cSrcweir {
55cdf0e10cSrcweir     typedef ::cppu::WeakComponentImplHelper6< ::com::sun::star::rendering::XCanvas,
56cdf0e10cSrcweir                                      		  ::com::sun::star::rendering::XGraphicDevice,
57cdf0e10cSrcweir                                               ::com::sun::star::lang::XMultiServiceFactory,
58cdf0e10cSrcweir 											  ::com::sun::star::util::XUpdatable,
59cdf0e10cSrcweir                                               ::com::sun::star::beans::XPropertySet,
60cdf0e10cSrcweir                                               ::com::sun::star::lang::XServiceName >	GraphicDeviceBase1_Base;
61cdf0e10cSrcweir     typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase1_Base >,
62cdf0e10cSrcweir                                            DeviceHelper,
63cdf0e10cSrcweir                                            ::osl::MutexGuard,
64cdf0e10cSrcweir                                            ::cppu::OWeakObject > 	CanvasBase1_Base;
65cdf0e10cSrcweir 	typedef ::canvas::CanvasBase< CanvasBase1_Base,
66cdf0e10cSrcweir                                   CanvasHelper,
67cdf0e10cSrcweir                                   ::osl::MutexGuard,
68cdf0e10cSrcweir                                   ::cppu::OWeakObject >		CanvasBaseT;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     /** Product of this component's factory.
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 		The Canvas object combines the actual Window canvas with
73cdf0e10cSrcweir 		the XGraphicDevice interface. This is because there's a
74cdf0e10cSrcweir 		one-to-one relation between them, anyway, since each window
75cdf0e10cSrcweir 		can have exactly one canvas and one associated
76cdf0e10cSrcweir 		XGraphicDevice. And to avoid messing around with circular
77cdf0e10cSrcweir 		references, this is implemented as one single object.
78cdf0e10cSrcweir      */
79cdf0e10cSrcweir     class Canvas : public CanvasBaseT
80cdf0e10cSrcweir     {
81cdf0e10cSrcweir     public:
82cdf0e10cSrcweir         Canvas( const ::com::sun::star::uno::Sequence<
83cdf0e10cSrcweir                       ::com::sun::star::uno::Any >&               aArguments,
84cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference<
85cdf0e10cSrcweir                       ::com::sun::star::uno::XComponentContext >& rxContext );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir         void initialize();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir         /// Dispose all internal references
90cdf0e10cSrcweir         virtual void SAL_CALL disposing();
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 		// Forwarding the XComponent implementation to the
93cdf0e10cSrcweir         // cppu::ImplHelper templated base
94cdf0e10cSrcweir         //                                    Classname   Base doing refcounting    Base implementing the XComponent interface
95cdf0e10cSrcweir         //                                       |                 |                            |
96cdf0e10cSrcweir         //                                       V                 V                            V
97cdf0e10cSrcweir         DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas, GraphicDeviceBase1_Base, ::cppu::WeakComponentImplHelperBase );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir         // XServiceName
100cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getServiceName(  ) throw (::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     private:
103cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >                maArguments;
104cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
105cdf0e10cSrcweir     };
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     typedef ::rtl::Reference< Canvas > CanvasRef;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     //////////////////////////////////////////////////////////////////////////////////////////////////////
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas,
112cdf0e10cSrcweir 			                         		  ::com::sun::star::rendering::XIntegerBitmap,
113cdf0e10cSrcweir                                      		  ::com::sun::star::rendering::XGraphicDevice,
114cdf0e10cSrcweir                                               ::com::sun::star::lang::XMultiServiceFactory,
115cdf0e10cSrcweir 											  ::com::sun::star::util::XUpdatable,
116cdf0e10cSrcweir                                               ::com::sun::star::beans::XPropertySet,
117cdf0e10cSrcweir                                               ::com::sun::star::lang::XServiceName >	GraphicDeviceBase2_Base;
118cdf0e10cSrcweir     typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase2_Base >,
119cdf0e10cSrcweir                                            DeviceHelper,
120cdf0e10cSrcweir                                            ::osl::MutexGuard,
121cdf0e10cSrcweir                                            ::cppu::OWeakObject > 	CanvasBase2_Base;
122cdf0e10cSrcweir 	typedef ::canvas::IntegerBitmapBase< CanvasBase2_Base,
123cdf0e10cSrcweir                                          BitmapCanvasHelper,
124cdf0e10cSrcweir                                          ::osl::MutexGuard,
125cdf0e10cSrcweir                                          ::cppu::OWeakObject >		BitmapCanvasBaseT;
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     /** Product of this component's factory.
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 		The Canvas object combines the actual Window canvas with
130cdf0e10cSrcweir 		the XGraphicDevice interface. This is because there's a
131cdf0e10cSrcweir 		one-to-one relation between them, anyway, since each window
132cdf0e10cSrcweir 		can have exactly one canvas and one associated
133cdf0e10cSrcweir 		XGraphicDevice. And to avoid messing around with circular
134cdf0e10cSrcweir 		references, this is implemented as one single object.
135cdf0e10cSrcweir      */
136cdf0e10cSrcweir     class BitmapCanvas : public BitmapCanvasBaseT, public BitmapProvider
137cdf0e10cSrcweir     {
138cdf0e10cSrcweir     public:
139cdf0e10cSrcweir         BitmapCanvas( const ::com::sun::star::uno::Sequence<
140cdf0e10cSrcweir                       	::com::sun::star::uno::Any >&               aArguments,
141cdf0e10cSrcweir                       const ::com::sun::star::uno::Reference<
142cdf0e10cSrcweir                       	::com::sun::star::uno::XComponentContext >& rxContext );
143cdf0e10cSrcweir 
144cdf0e10cSrcweir         void initialize();
145cdf0e10cSrcweir 
146cdf0e10cSrcweir         /// Dispose all internal references
147cdf0e10cSrcweir         virtual void SAL_CALL disposing();
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 		// Forwarding the XComponent implementation to the
150cdf0e10cSrcweir         // cppu::ImplHelper templated base
151cdf0e10cSrcweir         //                                    Classname   Base doing refcounting    Base implementing the XComponent interface
152cdf0e10cSrcweir         //                                       |                 |                            |
153cdf0e10cSrcweir         //                                       V                 V                            V
154cdf0e10cSrcweir         DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( BitmapCanvas, GraphicDeviceBase2_Base, ::cppu::WeakComponentImplHelperBase );
155cdf0e10cSrcweir 
156cdf0e10cSrcweir         // XServiceName
157cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getServiceName(  ) throw (::com::sun::star::uno::RuntimeException);
158cdf0e10cSrcweir 
159cdf0e10cSrcweir         // BitmapProvider
160cdf0e10cSrcweir         virtual IBitmapSharedPtr getBitmap() const;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir      private:
163cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >                maArguments;
164cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
165cdf0e10cSrcweir         IBitmapSharedPtr                                                             mpTarget;
166cdf0e10cSrcweir     };
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     typedef ::rtl::Reference< BitmapCanvas > BitmapCanvasRef;
169cdf0e10cSrcweir }
170cdf0e10cSrcweir 
171cdf0e10cSrcweir #endif
172