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_DIRECTX_DX_CANVASCUSTOMSPRITE_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_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 <basegfx/point/b2dpoint.hxx>
33 #include <basegfx/vector/b2isize.hxx>
34 #include <basegfx/matrix/b2dhommatrix.hxx>
36 #include <canvas/base/basemutexhelper.hxx>
37 #include <canvas/base/canvascustomspritebase.hxx>
39 #include "dx_sprite.hxx"
40 #include "dx_surfacebitmap.hxx"
41 #include "dx_bitmapcanvashelper.hxx"
42 #include "dx_spritehelper.hxx"
43 #include "dx_spritecanvas.hxx"
48 typedef ::cppu::WeakComponentImplHelper4
< ::com::sun::star::rendering::XCustomSprite
,
49 ::com::sun::star::rendering::XBitmapCanvas
,
50 ::com::sun::star::rendering::XIntegerBitmap
,
51 ::com::sun::star::lang::XServiceInfo
> CanvasCustomSpriteBase_Base
;
54 Have to mixin the Sprite interface before deriving from
55 ::canvas::CanvasCustomSpriteBase, as this template should
56 already implement some of those interface methods.
58 The reason why this appears kinda convoluted is the fact that
59 we cannot specify non-IDL types as WeakComponentImplHelperN
60 template args, and furthermore, don't want to derive
61 ::canvas::CanvasCustomSpriteBase directly from
62 ::canvas::Sprite (because derivees of
63 ::canvas::CanvasCustomSpriteBase have to explicitly forward
64 the XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
65 anyway). Basically, ::canvas::CanvasCustomSpriteBase should
66 remain a base class that provides implementation, not to
67 enforce any specific interface on its derivees.
69 class CanvasCustomSpriteSpriteBase_Base
: public ::canvas::BaseMutexHelper
< CanvasCustomSpriteBase_Base
>,
74 typedef ::canvas::CanvasCustomSpriteBase
< CanvasCustomSpriteSpriteBase_Base
,
78 ::cppu::OWeakObject
> CanvasCustomSpriteBaseT
;
80 /* Definition of CanvasCustomSprite class */
82 class CanvasCustomSprite
: public CanvasCustomSpriteBaseT
85 /** Create a custom sprite
88 Size of the sprite in pixel
91 Associated output device
99 CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D
& rSpriteSize
,
100 const SpriteCanvasRef
& rRefDevice
,
101 const IDXRenderModuleSharedPtr
& rRenderModule
,
102 const ::canvas::ISurfaceProxyManagerSharedPtr
& rSurfaceProxy
,
103 bool bShowSpriteBounds
);
105 virtual void disposeThis() SAL_OVERRIDE
;
107 // Forwarding the XComponent implementation to the
108 // cppu::ImplHelper templated base
109 // Classname Base doing refcount Base implementing the XComponent interface
112 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite
, CanvasCustomSpriteBase_Base
, ::cppu::WeakComponentImplHelperBase
)
115 virtual OUString SAL_CALL
getImplementationName() throw( ::com::sun::star::uno::RuntimeException
);
116 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw( ::com::sun::star::uno::RuntimeException
);
117 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException
);
120 virtual void redraw() const;
123 /** MUST hold here, too, since BitmapCanvasHelper only contains a
124 raw pointer (without refcounting)
126 SpriteCanvasRef mpSpriteCanvas
;
127 DXSurfaceBitmapSharedPtr mpSurface
;
131 #endif // INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVASCUSTOMSPRITE_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */