Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _NULLCANVAS_CANVASCUSTOMSPRITE_HXX
30 : : #define _NULLCANVAS_CANVASCUSTOMSPRITE_HXX
31 : :
32 : : #include <cppuhelper/compbase4.hxx>
33 : : #include <comphelper/uno3.hxx>
34 : :
35 : : #include <com/sun/star/lang/XServiceInfo.hpp>
36 : : #include <com/sun/star/lang/XComponent.hpp>
37 : : #include <com/sun/star/rendering/XCustomSprite.hpp>
38 : : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
39 : : #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
40 : :
41 : : #include <basegfx/point/b2dpoint.hxx>
42 : : #include <basegfx/vector/b2isize.hxx>
43 : : #include <basegfx/matrix/b2dhommatrix.hxx>
44 : :
45 : : #include <canvas/base/disambiguationhelper.hxx>
46 : : #include <canvas/base/canvascustomspritebase.hxx>
47 : :
48 : : #include "sprite.hxx"
49 : : #include "null_canvashelper.hxx"
50 : : #include "null_spritehelper.hxx"
51 : : #include "null_spritecanvas.hxx"
52 : : #include "null_usagecounter.hxx"
53 : :
54 : :
55 : : namespace nullcanvas
56 : : {
57 : : typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XCustomSprite,
58 : : ::com::sun::star::rendering::XBitmapCanvas,
59 : : ::com::sun::star::rendering::XIntegerBitmap,
60 : : ::com::sun::star::lang::XServiceInfo > CanvasCustomSpriteBase_Base;
61 : : /** Mixin Sprite
62 : :
63 : : Have to mixin the Sprite interface before deriving from
64 : : ::canvas::CanvasCustomSpriteBase, as this template should
65 : : already implement some of those interface methods.
66 : :
67 : : The reason why this appears kinda convoluted is the fact that
68 : : we cannot specify non-IDL types as WeakComponentImplHelperN
69 : : template args, and furthermore, don't want to derive
70 : : ::canvas::CanvasCustomSpriteBase directly from
71 : : ::canvas::Sprite (because derivees of
72 : : ::canvas::CanvasCustomSpriteBase have to explicitly forward
73 : : the XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
74 : : anyway). Basically, ::canvas::CanvasCustomSpriteBase should
75 : : remain a base class that provides implementation, not to
76 : : enforce any specific interface on its derivees.
77 : : */
78 : 0 : class CanvasCustomSpriteSpriteBase_Base : public ::canvas::DisambiguationHelper< CanvasCustomSpriteBase_Base >,
79 : : public Sprite
80 : : {
81 : : };
82 : :
83 : : typedef ::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base,
84 : : SpriteHelper,
85 : : CanvasHelper,
86 : : ::osl::MutexGuard,
87 : : ::cppu::OWeakObject > CanvasCustomSpriteBaseT;
88 : :
89 : : /* Definition of CanvasCustomSprite class */
90 : :
91 : 0 : class CanvasCustomSprite : public CanvasCustomSpriteBaseT,
92 : : private UsageCounter< CanvasCustomSprite >
93 : : {
94 : : public:
95 : : /** Create a custom sprite
96 : :
97 : : @param rSpriteSize
98 : : Size of the sprite in pixel
99 : :
100 : : @param rRefDevice
101 : : Associated output device
102 : :
103 : : @param rSpriteCanvas
104 : : Target canvas
105 : :
106 : : @param rDevice
107 : : Target DX device
108 : : */
109 : : CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
110 : : const SpriteCanvasRef& rRefDevice );
111 : :
112 : : virtual void disposeThis();
113 : :
114 : : // Forwarding the XComponent implementation to the
115 : : // cppu::ImplHelper templated base
116 : : // Classname Base doing refcount Base implementing the XComponent interface
117 : : // | | |
118 : : // V V V
119 : 0 : DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite, CanvasCustomSpriteBase_Base, ::cppu::WeakComponentImplHelperBase );
120 : :
121 : : // XServiceInfo
122 : : virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
123 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
124 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
125 : :
126 : : // Sprite
127 : : virtual void redraw() const;
128 : :
129 : : private:
130 : : /** MUST hold here, too, since CanvasHelper only contains a
131 : : raw pointer (without refcounting)
132 : : */
133 : : SpriteCanvasRef mpSpriteCanvas;
134 : : };
135 : : }
136 : :
137 : : #endif /* _NULLCANVAS_CANVASCUSTOMSPRITE_HXX */
138 : :
139 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|