Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_CANVAS_SOURCE_VCL_CANVASCUSTOMSPRITE_HXX
21 : #define INCLUDED_CANVAS_SOURCE_VCL_CANVASCUSTOMSPRITE_HXX
22 :
23 : #include <cppuhelper/compbase4.hxx>
24 : #include <comphelper/uno3.hxx>
25 :
26 : #include <com/sun/star/lang/XServiceInfo.hpp>
27 : #include <com/sun/star/lang/XComponent.hpp>
28 : #include <com/sun/star/rendering/XCustomSprite.hpp>
29 : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
30 : #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
31 :
32 : #include <vcl/virdev.hxx>
33 :
34 : #include <canvas/vclwrapper.hxx>
35 : #include <canvas/base/basemutexhelper.hxx>
36 : #include <canvas/base/spritesurface.hxx>
37 : #include <canvas/base/canvascustomspritebase.hxx>
38 :
39 : #include "sprite.hxx"
40 : #include "canvashelper.hxx"
41 : #include "spritehelper.hxx"
42 : #include "backbuffer.hxx"
43 : #include "impltools.hxx"
44 : #include "spritecanvas.hxx"
45 : #include "repainttarget.hxx"
46 :
47 :
48 : namespace vclcanvas
49 : {
50 : typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XCustomSprite,
51 : ::com::sun::star::rendering::XBitmapCanvas,
52 : ::com::sun::star::rendering::XIntegerBitmap,
53 : ::com::sun::star::lang::XServiceInfo > CanvasCustomSpriteBase_Base;
54 : /** Mixin Sprite
55 :
56 : Have to mixin the Sprite interface before deriving from
57 : ::canvas::CanvasCustomSpriteBase, as this template should
58 : already implement some of those interface methods.
59 :
60 : The reason why this appears kinda convoluted is the fact that
61 : we cannot specify non-IDL types as WeakComponentImplHelperN
62 : template args, and furthermore, don't want to derive
63 : ::canvas::CanvasCustomSpriteBase directly from
64 : ::canvas::Sprite (because derivees of
65 : ::canvas::CanvasCustomSpriteBase have to explicitly forward
66 : the XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
67 : anyway). Basically, ::canvas::CanvasCustomSpriteBase should
68 : remain a base class that provides implementation, not to
69 : enforce any specific interface on its derivees.
70 : */
71 0 : class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >,
72 : public Sprite
73 : {
74 : };
75 :
76 : typedef ::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base,
77 : SpriteHelper,
78 : CanvasHelper,
79 : tools::LocalGuard,
80 : ::cppu::OWeakObject > CanvasCustomSpriteBaseT;
81 :
82 : /* Definition of CanvasCustomSprite class */
83 :
84 0 : class CanvasCustomSprite : public CanvasCustomSpriteBaseT,
85 : public RepaintTarget
86 : {
87 : public:
88 : CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
89 : ::com::sun::star::rendering::XGraphicDevice& rDevice,
90 : const ::canvas::SpriteSurface::Reference& rOwningSpriteCanvas,
91 : const OutDevProviderSharedPtr& rOutDevProvider,
92 : bool bShowSpriteBounds );
93 :
94 : // Forwarding the XComponent implementation to the
95 : // cppu::ImplHelper templated base
96 : // Classname Base doing refcount Base implementing the XComponent interface
97 : // | | |
98 : // V V V
99 0 : DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite, CanvasCustomSpriteBase_Base, ::cppu::WeakComponentImplHelperBase )
100 :
101 : // XServiceInfo
102 : virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
103 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
104 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
105 :
106 : // Sprite
107 : virtual void redraw( OutputDevice& rOutDev,
108 : bool bBufferedUpdate ) const SAL_OVERRIDE;
109 : virtual void redraw( OutputDevice& rOutDev,
110 : const ::basegfx::B2DPoint& rPos,
111 : bool bBufferedUpdate ) const SAL_OVERRIDE;
112 :
113 : // RepaintTarget
114 : virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
115 : const ::com::sun::star::rendering::ViewState& viewState,
116 : const ::com::sun::star::rendering::RenderState& renderState,
117 : const ::Point& rPt,
118 : const ::Size& rSz,
119 : const GraphicAttr& rAttr ) const SAL_OVERRIDE;
120 : };
121 : }
122 :
123 : #endif // INCLUDED_CANVAS_SOURCE_VCL_CANVASCUSTOMSPRITE_HXX
124 :
125 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|