merge the formfield patch from ooo-build
[ooovba.git] / canvas / source / vcl / canvas.hxx
blob773a5ec589afbcb8e35a42f516f8dad815c550ba
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: 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 _VCLCANVAS_CANVAS_HXX_
32 #define _VCLCANVAS_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 <comphelper/uno3.hxx>
49 #include <canvas/base/basemutexhelper.hxx>
50 #include <canvas/base/integerbitmapbase.hxx>
51 #include <canvas/base/graphicdevicebase.hxx>
53 #include "canvashelper.hxx"
54 #include "impltools.hxx"
55 #include "devicehelper.hxx"
56 #include "repainttarget.hxx"
58 #define CANVAS_SERVICE_NAME "com.sun.star.rendering.Canvas.VCL"
59 #define CANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.Canvas.VCL"
61 namespace vclcanvas
63 typedef ::cppu::WeakComponentImplHelper7< ::com::sun::star::rendering::XBitmapCanvas,
64 ::com::sun::star::rendering::XIntegerBitmap,
65 ::com::sun::star::rendering::XGraphicDevice,
66 ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
67 ::com::sun::star::util::XUpdatable,
68 ::com::sun::star::beans::XPropertySet,
69 ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base;
70 typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase_Base >,
71 DeviceHelper,
72 tools::LocalGuard,
73 ::cppu::OWeakObject > CanvasBase_Base;
74 typedef ::canvas::IntegerBitmapBase< CanvasBase_Base,
75 CanvasHelper,
76 tools::LocalGuard,
77 ::cppu::OWeakObject > CanvasBaseT;
79 /** Product of this component's factory.
81 The Canvas object combines the actual Window canvas with
82 the XGraphicDevice interface. This is because there's a
83 one-to-one relation between them, anyway, since each window
84 can have exactly one canvas and one associated
85 XGraphicDevice. And to avoid messing around with circular
86 references, this is implemented as one single object.
88 class Canvas : public CanvasBaseT,
89 public RepaintTarget
91 public:
92 Canvas( const ::com::sun::star::uno::Sequence<
93 ::com::sun::star::uno::Any >& aArguments,
94 const ::com::sun::star::uno::Reference<
95 ::com::sun::star::uno::XComponentContext >& rxContext );
97 void initialize();
99 /// For resource tracking
100 ~Canvas();
102 #if defined __SUNPRO_CC
103 using CanvasBaseT::disposing;
104 #endif
106 /// Dispose all internal references
107 virtual void SAL_CALL disposing();
109 // Forwarding the XComponent implementation to the
110 // cppu::ImplHelper templated base
111 // Classname Base doing refcounting Base implementing the XComponent interface
112 // | | |
113 // V V V
114 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( Canvas, GraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase );
116 // XServiceName
117 virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
119 // RepaintTarget
120 virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
121 const com::sun::star::rendering::ViewState& viewState,
122 const com::sun::star::rendering::RenderState& renderState,
123 const ::Point& rPt,
124 const ::Size& rSz,
125 const GraphicAttr& rAttr ) const;
127 private:
128 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
129 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
132 typedef ::rtl::Reference< Canvas > CanvasRef;
135 #endif