update dev300-m58
[ooovba.git] / canvas / source / null / null_canvascustomsprite.hxx
blob394c8a230c58c03f914a76f3c43ca98dfbb012c3
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: null_canvascustomsprite.hxx,v $
10 * $Revision: 1.3 $
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 _NULLCANVAS_CANVASCUSTOMSPRITE_HXX
32 #define _NULLCANVAS_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 "sprite.hxx"
51 #include "null_canvashelper.hxx"
52 #include "null_spritehelper.hxx"
53 #include "null_spritecanvas.hxx"
54 #include "null_usagecounter.hxx"
57 namespace nullcanvas
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 CanvasHelper,
88 ::osl::MutexGuard,
89 ::cppu::OWeakObject > CanvasCustomSpriteBaseT;
91 /* Definition of CanvasCustomSprite class */
93 class CanvasCustomSprite : public CanvasCustomSpriteBaseT,
94 private UsageCounter< CanvasCustomSprite >
96 public:
97 /** Create a custom sprite
99 @param rSpriteSize
100 Size of the sprite in pixel
102 @param rRefDevice
103 Associated output device
105 @param rSpriteCanvas
106 Target canvas
108 @param rDevice
109 Target DX device
111 CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
112 const SpriteCanvasRef& rRefDevice );
114 virtual void SAL_CALL disposing();
116 // Forwarding the XComponent implementation to the
117 // cppu::ImplHelper templated base
118 // Classname Base doing refcount Base implementing the XComponent interface
119 // | | |
120 // V V V
121 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite, CanvasCustomSpriteBase_Base, ::cppu::WeakComponentImplHelperBase );
123 // XServiceInfo
124 virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
125 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
126 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
128 // Sprite
129 virtual void redraw() const;
131 private:
132 /** MUST hold here, too, since CanvasHelper only contains a
133 raw pointer (without refcounting)
135 SpriteCanvasRef mpSpriteCanvas;
139 #endif /* _NULLCANVAS_CANVASCUSTOMSPRITE_HXX */