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_CANVASCUSTOMSPRITE_HXX
29 #define _DXCANVAS_CANVASCUSTOMSPRITE_HXX
31 #include <cppuhelper/compbase4.hxx>
32 #include <comphelper/uno3.hxx>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/lang/XComponent.hpp>
36 #include <com/sun/star/rendering/XCustomSprite.hpp>
37 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
38 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
40 #include <basegfx/point/b2dpoint.hxx>
41 #include <basegfx/vector/b2isize.hxx>
42 #include <basegfx/matrix/b2dhommatrix.hxx>
44 #include <canvas/base/basemutexhelper.hxx>
45 #include <canvas/base/canvascustomspritebase.hxx>
47 #include "dx_sprite.hxx"
48 #include "dx_surfacebitmap.hxx"
49 #include "dx_bitmapcanvashelper.hxx"
50 #include "dx_spritehelper.hxx"
51 #include "dx_spritecanvas.hxx"
56 typedef ::cppu::WeakComponentImplHelper4
< ::com::sun::star::rendering::XCustomSprite
,
57 ::com::sun::star::rendering::XBitmapCanvas
,
58 ::com::sun::star::rendering::XIntegerBitmap
,
59 ::com::sun::star::lang::XServiceInfo
> CanvasCustomSpriteBase_Base
;
62 Have to mixin the Sprite interface before deriving from
63 ::canvas::CanvasCustomSpriteBase, as this template should
64 already implement some of those interface methods.
66 The reason why this appears kinda convoluted is the fact that
67 we cannot specify non-IDL types as WeakComponentImplHelperN
68 template args, and furthermore, don't want to derive
69 ::canvas::CanvasCustomSpriteBase directly from
70 ::canvas::Sprite (because derivees of
71 ::canvas::CanvasCustomSpriteBase have to explicitely forward
72 the XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
73 anyway). Basically, ::canvas::CanvasCustomSpriteBase should
74 remain a base class that provides implementation, not to
75 enforce any specific interface on its derivees.
77 class CanvasCustomSpriteSpriteBase_Base
: public ::canvas::BaseMutexHelper
< CanvasCustomSpriteBase_Base
>,
82 typedef ::canvas::CanvasCustomSpriteBase
< CanvasCustomSpriteSpriteBase_Base
,
86 ::cppu::OWeakObject
> CanvasCustomSpriteBaseT
;
88 /* Definition of CanvasCustomSprite class */
90 class CanvasCustomSprite
: public CanvasCustomSpriteBaseT
93 /** Create a custom sprite
96 Size of the sprite in pixel
99 Associated output device
107 CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D
& rSpriteSize
,
108 const SpriteCanvasRef
& rRefDevice
,
109 const IDXRenderModuleSharedPtr
& rRenderModule
,
110 const ::canvas::ISurfaceProxyManagerSharedPtr
& rSurfaceProxy
,
111 bool bShowSpriteBounds
);
113 virtual void SAL_CALL
disposing();
115 // Forwarding the XComponent implementation to the
116 // cppu::ImplHelper templated base
117 // Classname Base doing refcount Base implementing the XComponent interface
120 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite
, CanvasCustomSpriteBase_Base
, ::cppu::WeakComponentImplHelperBase
);
123 virtual ::rtl::OUString SAL_CALL
getImplementationName() throw( ::com::sun::star::uno::RuntimeException
);
124 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
125 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException
);
128 virtual void redraw() const;
131 /** MUST hold here, too, since BitmapCanvasHelper only contains a
132 raw pointer (without refcounting)
134 SpriteCanvasRef mpSpriteCanvas
;
135 DXSurfaceBitmapSharedPtr mpSurface
;
139 #endif /* _DXCANVAS_CANVASCUSTOMSPRITE_HXX */