Branch libreoffice-5-0-4
[LibreOffice.git] / canvas / source / opengl / ogl_spritecanvas.hxx
blob6d4995b2e51787233d63d84cb2ee463d1791fe04
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_SPRITECANVAS_HXX
11 #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_SPRITECANVAS_HXX
13 #include <rtl/ref.hxx>
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>
24 #include <cppuhelper/compbase8.hxx>
25 #include <comphelper/uno3.hxx>
27 #include <canvas/base/spritecanvasbase.hxx>
28 #include <canvas/base/disambiguationhelper.hxx>
29 #include <canvas/base/bufferedgraphicdevicebase.hxx>
31 #include "ogl_spritedevicehelper.hxx"
32 #include "ogl_canvashelper.hxx"
35 namespace oglcanvas
37 class CanvasCustomSprite;
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;
53 typedef ::canvas::CanvasBase< SpriteCanvasDeviceBaseT,
54 CanvasHelper,
55 ::osl::MutexGuard,
56 ::cppu::OWeakObject > SpriteCanvasBaseT;
58 /** Product of this component's factory.
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.
67 class SpriteCanvas : public SpriteCanvasBaseT
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 );
75 void initialize();
77 /// Dispose all internal references
78 virtual void disposeThis() SAL_OVERRIDE;
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 DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
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;
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;
100 // XServiceName
101 virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 void show( const ::rtl::Reference< CanvasCustomSprite >& );
104 void hide( const ::rtl::Reference< CanvasCustomSprite >& );
106 /** Write out recorded actions
108 bool renderRecordedActions() const;
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;
115 typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
118 #endif
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */