1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_CANVAS_SOURCE_VCL_CANVASCUSTOMSPRITE_HXX
21 #define INCLUDED_CANVAS_SOURCE_VCL_CANVASCUSTOMSPRITE_HXX
23 #include <cppuhelper/compbase4.hxx>
24 #include <comphelper/uno3.hxx>
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>
32 #include <vcl/virdev.hxx>
34 #include <canvas/vclwrapper.hxx>
35 #include <canvas/base/basemutexhelper.hxx>
36 #include <canvas/base/spritesurface.hxx>
37 #include <canvas/base/canvascustomspritebase.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"
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
;
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.
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.
71 class CanvasCustomSpriteSpriteBase_Base
: public ::canvas::BaseMutexHelper
< CanvasCustomSpriteBase_Base
>,
76 typedef ::canvas::CanvasCustomSpriteBase
< CanvasCustomSpriteSpriteBase_Base
,
80 ::cppu::OWeakObject
> CanvasCustomSpriteBaseT
;
82 /* Definition of CanvasCustomSprite class */
84 class CanvasCustomSprite
: public CanvasCustomSpriteBaseT
,
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
);
94 // Forwarding the XComponent implementation to the
95 // cppu::ImplHelper templated base
96 // Classname Base doing refcount Base implementing the XComponent interface
99 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite
, CanvasCustomSpriteBase_Base
, ::cppu::WeakComponentImplHelperBase
)
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
;
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
;
114 virtual bool repaint( const GraphicObjectSharedPtr
& rGrf
,
115 const ::com::sun::star::rendering::ViewState
& viewState
,
116 const ::com::sun::star::rendering::RenderState
& renderState
,
119 const GraphicAttr
& rAttr
) const SAL_OVERRIDE
;
123 #endif // INCLUDED_CANVAS_SOURCE_VCL_CANVASCUSTOMSPRITE_HXX
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */