Branch libreoffice-5-0-4
[LibreOffice.git] / canvas / source / opengl / ogl_canvascustomsprite.hxx
blob7708e9570ced1dd340bbc8b1506c195374cf0f0f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #ifndef INCLUDED_CANVAS_SOURCE_OPENGL_OGL_CANVASCUSTOMSPRITE_HXX
11 #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_CANVASCUSTOMSPRITE_HXX
13 #include <cppuhelper/compbase2.hxx>
14 #include <comphelper/uno3.hxx>
16 #include <com/sun/star/lang/XComponent.hpp>
17 #include <com/sun/star/rendering/XCustomSprite.hpp>
18 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
20 #include <basegfx/point/b2dpoint.hxx>
21 #include <basegfx/vector/b2isize.hxx>
22 #include <basegfx/matrix/b2dhommatrix.hxx>
24 #include <canvas/base/basemutexhelper.hxx>
26 #include "ogl_spritecanvas.hxx"
27 #include "ogl_canvashelper.hxx"
30 namespace oglcanvas
32 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XCustomSprite,
33 ::com::sun::star::rendering::XCanvas > CanvasCustomSpriteBase_Base;
34 typedef ::canvas::CanvasBase<
35 ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >,
36 CanvasHelper,
37 ::osl::MutexGuard,
38 ::cppu::OWeakObject > CanvasCustomSpriteBaseT;
40 /* Definition of CanvasCustomSprite class */
42 class CanvasCustomSprite : public CanvasCustomSpriteBaseT
44 public:
45 /** Create a custom sprite
47 @param rSpriteSize
48 Size of the sprite in pixel
50 @param rRefDevice
51 Associated output device
53 @param rSpriteCanvas
54 Target canvas
56 @param rDevice
57 Target DX device
59 CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
60 const SpriteCanvasRef& rRefDevice,
61 SpriteDeviceHelper& rDeviceHelper );
63 virtual void disposeThis() SAL_OVERRIDE;
65 // XSprite
66 virtual void SAL_CALL setAlpha( double alpha ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
67 virtual void SAL_CALL move( const ::com::sun::star::geometry::RealPoint2D& aNewPos, const ::com::sun::star::rendering::ViewState& viewState, const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
68 virtual void SAL_CALL transform( const ::com::sun::star::geometry::AffineMatrix2D& aTransformation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 virtual void SAL_CALL clip( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& aClip ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
70 virtual void SAL_CALL setPriority( double nPriority ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 virtual void SAL_CALL show() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
72 virtual void SAL_CALL hide() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
74 // XCustomSprite
75 virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > SAL_CALL getContentCanvas() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
77 double getPriority() const { return mfPriority; }
79 /// Render sprite content at sprite position
80 bool renderSprite() const;
82 private:
83 /** MUST hold here, too, since CanvasHelper only contains a
84 raw pointer (without refcounting)
86 SpriteCanvasRef mpSpriteCanvas;
87 const ::com::sun::star::geometry::RealSize2D maSize;
89 ::com::sun::star::uno::Reference<
90 ::com::sun::star::rendering::XPolyPolygon2D > mxClip;
91 ::com::sun::star::geometry::AffineMatrix2D maTransformation;
92 ::basegfx::B2DPoint maPosition;
93 double mfAlpha;
94 double mfPriority;
98 #endif
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */