merge the formfield patch from ooo-build
[ooovba.git] / canvas / source / directx / dx_canvascustomsprite.hxx
blobc075a3daf24f10b7a8d325e0447ee41fbea83b9f
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_canvascustomsprite.hxx,v $
10 * $Revision: 1.4 $
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_CANVASCUSTOMSPRITE_HXX
32 #define _DXCANVAS_CANVASCUSTOMSPRITE_HXX
34 #include <cppuhelper/compbase4.hxx>
35 #include <comphelper/uno3.hxx>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/lang/XComponent.hpp>
39 #include <com/sun/star/rendering/XCustomSprite.hpp>
40 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
41 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
43 #include <basegfx/point/b2dpoint.hxx>
44 #include <basegfx/vector/b2isize.hxx>
45 #include <basegfx/matrix/b2dhommatrix.hxx>
47 #include <canvas/base/basemutexhelper.hxx>
48 #include <canvas/base/canvascustomspritebase.hxx>
50 #include "dx_sprite.hxx"
51 #include "dx_surfacebitmap.hxx"
52 #include "dx_bitmapcanvashelper.hxx"
53 #include "dx_spritehelper.hxx"
54 #include "dx_spritecanvas.hxx"
57 namespace dxcanvas
59 typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XCustomSprite,
60 ::com::sun::star::rendering::XBitmapCanvas,
61 ::com::sun::star::rendering::XIntegerBitmap,
62 ::com::sun::star::lang::XServiceInfo > CanvasCustomSpriteBase_Base;
63 /** Mixin Sprite
65 Have to mixin the Sprite interface before deriving from
66 ::canvas::CanvasCustomSpriteBase, as this template should
67 already implement some of those interface methods.
69 The reason why this appears kinda convoluted is the fact that
70 we cannot specify non-IDL types as WeakComponentImplHelperN
71 template args, and furthermore, don't want to derive
72 ::canvas::CanvasCustomSpriteBase directly from
73 ::canvas::Sprite (because derivees of
74 ::canvas::CanvasCustomSpriteBase have to explicitely forward
75 the XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
76 anyway). Basically, ::canvas::CanvasCustomSpriteBase should
77 remain a base class that provides implementation, not to
78 enforce any specific interface on its derivees.
80 class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >,
81 public Sprite
85 typedef ::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base,
86 SpriteHelper,
87 BitmapCanvasHelper,
88 ::osl::MutexGuard,
89 ::cppu::OWeakObject > CanvasCustomSpriteBaseT;
91 /* Definition of CanvasCustomSprite class */
93 class CanvasCustomSprite : public CanvasCustomSpriteBaseT
95 public:
96 /** Create a custom sprite
98 @param rSpriteSize
99 Size of the sprite in pixel
101 @param rRefDevice
102 Associated output device
104 @param rSpriteCanvas
105 Target canvas
107 @param rDevice
108 Target DX device
110 CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
111 const SpriteCanvasRef& rRefDevice,
112 const IDXRenderModuleSharedPtr& rRenderModule,
113 const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy,
114 bool bShowSpriteBounds );
116 virtual void SAL_CALL disposing();
118 // Forwarding the XComponent implementation to the
119 // cppu::ImplHelper templated base
120 // Classname Base doing refcount Base implementing the XComponent interface
121 // | | |
122 // V V V
123 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite, CanvasCustomSpriteBase_Base, ::cppu::WeakComponentImplHelperBase );
125 // XServiceInfo
126 virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
127 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
128 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
130 // Sprite
131 virtual void redraw() const;
133 private:
134 /** MUST hold here, too, since BitmapCanvasHelper only contains a
135 raw pointer (without refcounting)
137 SpriteCanvasRef mpSpriteCanvas;
138 DXSurfaceBitmapSharedPtr mpSurface;
142 #endif /* _DXCANVAS_CANVASCUSTOMSPRITE_HXX */