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 _VCLCANVAS_CANVASCUSTOMSPRITE_HXX
30 : : #define _VCLCANVAS_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 <vcl/virdev.hxx>
42 : :
43 : : #include <canvas/vclwrapper.hxx>
44 : : #include <canvas/base/disambiguationhelper.hxx>
45 : : #include <canvas/base/spritesurface.hxx>
46 : : #include <canvas/base/canvascustomspritebase.hxx>
47 : :
48 : : #include "sprite.hxx"
49 : : #include "canvashelper.hxx"
50 : : #include "spritehelper.hxx"
51 : : #include "backbuffer.hxx"
52 : : #include "impltools.hxx"
53 : : #include "spritecanvas.hxx"
54 : : #include "repainttarget.hxx"
55 : :
56 : :
57 : : namespace vclcanvas
58 : : {
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
64 : :
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.
68 : :
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 explicitly 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.
79 : : */
80 : 0 : class CanvasCustomSpriteSpriteBase_Base : public ::canvas::DisambiguationHelper< CanvasCustomSpriteBase_Base >,
81 : : public Sprite
82 : : {
83 : : };
84 : :
85 : : typedef ::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base,
86 : : SpriteHelper,
87 : : CanvasHelper,
88 : : tools::LocalGuard,
89 : : ::cppu::OWeakObject > CanvasCustomSpriteBaseT;
90 : :
91 : : /* Definition of CanvasCustomSprite class */
92 : :
93 : 0 : class CanvasCustomSprite : public CanvasCustomSpriteBaseT,
94 : : public RepaintTarget
95 : : {
96 : : public:
97 : : CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
98 : : ::com::sun::star::rendering::XGraphicDevice& rDevice,
99 : : const ::canvas::SpriteSurface::Reference& rOwningSpriteCanvas,
100 : : const OutDevProviderSharedPtr& rOutDevProvider,
101 : : bool bShowSpriteBounds );
102 : :
103 : : // Forwarding the XComponent implementation to the
104 : : // cppu::ImplHelper templated base
105 : : // Classname Base doing refcount Base implementing the XComponent interface
106 : : // | | |
107 : : // V V V
108 : 0 : DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite, CanvasCustomSpriteBase_Base, ::cppu::WeakComponentImplHelperBase );
109 : :
110 : : // XServiceInfo
111 : : virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
112 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
113 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
114 : :
115 : : // Sprite
116 : : virtual void redraw( OutputDevice& rOutDev,
117 : : bool bBufferedUpdate ) const;
118 : : virtual void redraw( OutputDevice& rOutDev,
119 : : const ::basegfx::B2DPoint& rPos,
120 : : bool bBufferedUpdate ) const;
121 : :
122 : : // RepaintTarget
123 : : virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
124 : : const ::com::sun::star::rendering::ViewState& viewState,
125 : : const ::com::sun::star::rendering::RenderState& renderState,
126 : : const ::Point& rPt,
127 : : const ::Size& rSz,
128 : : const GraphicAttr& rAttr ) const;
129 : : };
130 : : }
131 : :
132 : : #endif /* _VCLCANVAS_CANVASCUSTOMSPRITE_HXX */
133 : :
134 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|