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 :
10 : #ifndef INCLUDED_CANVAS_SOURCE_OPENGL_OGL_CANVASCUSTOMSPRITE_HXX
11 : #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_CANVASCUSTOMSPRITE_HXX
12 :
13 : #include <cppuhelper/compbase2.hxx>
14 : #include <comphelper/uno3.hxx>
15 :
16 : #include <com/sun/star/lang/XComponent.hpp>
17 : #include <com/sun/star/rendering/XCustomSprite.hpp>
18 : #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
19 :
20 : #include <basegfx/point/b2dpoint.hxx>
21 : #include <basegfx/vector/b2isize.hxx>
22 : #include <basegfx/matrix/b2dhommatrix.hxx>
23 :
24 : #include <canvas/base/basemutexhelper.hxx>
25 :
26 : #include "ogl_spritecanvas.hxx"
27 : #include "ogl_canvashelper.hxx"
28 :
29 :
30 : namespace oglcanvas
31 : {
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;
39 :
40 : /* Definition of CanvasCustomSprite class */
41 :
42 0 : class CanvasCustomSprite : public CanvasCustomSpriteBaseT
43 : {
44 : public:
45 : /** Create a custom sprite
46 :
47 : @param rSpriteSize
48 : Size of the sprite in pixel
49 :
50 : @param rRefDevice
51 : Associated output device
52 :
53 : @param rSpriteCanvas
54 : Target canvas
55 :
56 : @param rDevice
57 : Target DX device
58 : */
59 : CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
60 : const SpriteCanvasRef& rRefDevice,
61 : SpriteDeviceHelper& rDeviceHelper );
62 :
63 : virtual void disposeThis() SAL_OVERRIDE;
64 :
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;
73 :
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;
76 :
77 0 : double getPriority() const { return mfPriority; }
78 :
79 : /// Render sprite content at sprite position
80 : bool renderSprite() const;
81 :
82 : private:
83 : /** MUST hold here, too, since CanvasHelper only contains a
84 : raw pointer (without refcounting)
85 : */
86 : SpriteCanvasRef mpSpriteCanvas;
87 : const ::com::sun::star::geometry::RealSize2D maSize;
88 :
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;
95 : };
96 : }
97 :
98 : #endif
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|