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_SPRITECANVAS_HXX
11 : #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_SPRITECANVAS_HXX
12 :
13 : #include <rtl/ref.hxx>
14 :
15 : #include <com/sun/star/uno/XComponentContext.hpp>
16 : #include <com/sun/star/beans/XPropertySet.hpp>
17 : #include <com/sun/star/lang/XServiceName.hpp>
18 : #include <com/sun/star/awt/XWindowListener.hpp>
19 : #include <com/sun/star/util/XUpdatable.hpp>
20 : #include <com/sun/star/rendering/XSpriteCanvas.hpp>
21 : #include <com/sun/star/rendering/XGraphicDevice.hpp>
22 : #include <com/sun/star/rendering/XBufferController.hpp>
23 :
24 : #include <cppuhelper/compbase8.hxx>
25 : #include <comphelper/uno3.hxx>
26 :
27 : #include <canvas/base/spritecanvasbase.hxx>
28 : #include <canvas/base/disambiguationhelper.hxx>
29 : #include <canvas/base/bufferedgraphicdevicebase.hxx>
30 :
31 : #include "ogl_spritedevicehelper.hxx"
32 : #include "ogl_canvashelper.hxx"
33 :
34 :
35 : namespace oglcanvas
36 : {
37 : class CanvasCustomSprite;
38 :
39 : typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::rendering::XSpriteCanvas,
40 : ::com::sun::star::rendering::XGraphicDevice,
41 : ::com::sun::star::lang::XMultiServiceFactory,
42 : ::com::sun::star::rendering::XBufferController,
43 : ::com::sun::star::awt::XWindowListener,
44 : ::com::sun::star::util::XUpdatable,
45 : ::com::sun::star::beans::XPropertySet,
46 : ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base;
47 : typedef ::canvas::BufferedGraphicDeviceBase<
48 : ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >,
49 : SpriteDeviceHelper,
50 : ::osl::MutexGuard,
51 : ::cppu::OWeakObject > SpriteCanvasDeviceBaseT;
52 :
53 : typedef ::canvas::CanvasBase< SpriteCanvasDeviceBaseT,
54 : CanvasHelper,
55 : ::osl::MutexGuard,
56 : ::cppu::OWeakObject > SpriteCanvasBaseT;
57 :
58 : /** Product of this component's factory.
59 :
60 : The SpriteCanvas object combines the actual Window canvas with
61 : the XGraphicDevice interface. This is because there's a
62 : one-to-one relation between them, anyway, since each window
63 : can have exactly one canvas and one associated
64 : XGraphicDevice. And to avoid messing around with circular
65 : references, this is implemented as one single object.
66 : */
67 0 : class SpriteCanvas : public SpriteCanvasBaseT
68 : {
69 : public:
70 : SpriteCanvas( const ::com::sun::star::uno::Sequence<
71 : ::com::sun::star::uno::Any >& aArguments,
72 : const ::com::sun::star::uno::Reference<
73 : ::com::sun::star::uno::XComponentContext >& rxContext );
74 :
75 : void initialize();
76 :
77 : /// Dispose all internal references
78 : virtual void disposeThis() SAL_OVERRIDE;
79 :
80 : // Forwarding the XComponent implementation to the
81 : // cppu::ImplHelper templated base
82 : // Classname Base doing refcounting Base implementing the XComponent interface
83 : // | | |
84 : // V V V
85 0 : DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
86 :
87 : // XBufferController (partial)
88 : virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
89 : virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 :
91 : // XSpriteCanvas
92 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromAnimation( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromBitmaps( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > >& animationBitmaps, ::sal_Int8 interpolationMode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCustomSprite > SAL_CALL createCustomSprite( const ::com::sun::star::geometry::RealSize2D& spriteSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite > SAL_CALL createClonedSprite( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 : virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll )
97 : throw (::com::sun::star::uno::RuntimeException,
98 : std::exception) SAL_OVERRIDE;
99 :
100 : // XServiceName
101 : virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 :
103 : void show( const ::rtl::Reference< CanvasCustomSprite >& );
104 : void hide( const ::rtl::Reference< CanvasCustomSprite >& );
105 :
106 : /** Write out recorded actions
107 : */
108 : bool renderRecordedActions() const;
109 :
110 : private:
111 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
112 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
113 : };
114 :
115 : typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
116 : }
117 :
118 : #endif
119 :
120 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|