LibreOffice Module canvas (master)  1
ogl_spritecanvas.hxx
Go to the documentation of this file.
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/compbase.hxx>
25 #include <comphelper/uno3.hxx>
26 
27 #include <base/canvasbase.hxx>
30 
32 #include "ogl_canvashelper.hxx"
33 
34 
35 namespace oglcanvas
36 {
38 
39  typedef ::cppu::WeakComponentImplHelper< css::rendering::XSpriteCanvas,
40  css::rendering::XGraphicDevice,
41  css::lang::XMultiServiceFactory,
42  css::rendering::XBufferController,
43  css::awt::XWindowListener,
44  css::util::XUpdatable,
45  css::beans::XPropertySet,
46  css::lang::XServiceName > WindowGraphicDeviceBase_Base;
47  typedef ::canvas::BufferedGraphicDeviceBase<
50  ::osl::MutexGuard,
52 
53  typedef ::canvas::CanvasBase< SpriteCanvasDeviceBaseT,
55  ::osl::MutexGuard,
57 
67  class SpriteCanvas : public SpriteCanvasBaseT
68  {
69  public:
70  SpriteCanvas( const css::uno::Sequence<
71  css::uno::Any >& aArguments,
72  const css::uno::Reference<
73  css::uno::XComponentContext >& rxContext );
74 
75  void initialize();
76 
78  virtual void disposeThis() 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  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
86 
87  // XBufferController (partial)
88  virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) override;
89  virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) override;
90 
91  // XSpriteCanvas
92  virtual css::uno::Reference< css::rendering::XAnimatedSprite > SAL_CALL createSpriteFromAnimation( const css::uno::Reference< css::rendering::XAnimation >& animation ) override;
93  virtual css::uno::Reference< css::rendering::XAnimatedSprite > SAL_CALL createSpriteFromBitmaps( const css::uno::Sequence< css::uno::Reference< css::rendering::XBitmap > >& animationBitmaps, ::sal_Int8 interpolationMode ) override;
94  virtual css::uno::Reference< css::rendering::XCustomSprite > SAL_CALL createCustomSprite( const css::geometry::RealSize2D& spriteSize ) override;
95  virtual css::uno::Reference< css::rendering::XSprite > SAL_CALL createClonedSprite( const css::uno::Reference< css::rendering::XSprite >& original ) override;
96  virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) override;
97 
98  // XServiceName
99  virtual OUString SAL_CALL getServiceName( ) override;
100 
101  void show( const ::rtl::Reference< CanvasCustomSprite >& );
102  void hide( const ::rtl::Reference< CanvasCustomSprite >& );
103 
106  void renderRecordedActions() const;
107 
108  private:
109  css::uno::Sequence< css::uno::Any > maArguments;
110  };
111 
112  typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
113 }
114 
115 #endif
116 
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Bool SAL_CALL updateScreen(sal_Bool bUpdateAll) override
::rtl::Reference< SpriteCanvas > SpriteCanvasRef
::canvas::BufferedGraphicDeviceBase< ::canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >, SpriteDeviceHelper,::osl::MutexGuard,::cppu::OWeakObject > SpriteCanvasDeviceBaseT
signed char sal_Int8
Helper class for basic canvas functionality.
css::uno::Sequence< css::uno::Any > maArguments
#define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper)
virtual css::uno::Reference< css::rendering::XAnimatedSprite > SAL_CALL createSpriteFromAnimation(const css::uno::Reference< css::rendering::XAnimation > &animation) override
Sequence< PropertyValue > aArguments
SpriteCanvas(const css::uno::Sequence< css::uno::Any > &aArguments, const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Base class, initializing its own baseclass with m_aMutex.
::cppu::WeakComponentImplHelper< css::rendering::XSpriteCanvas, css::rendering::XGraphicDevice, css::lang::XMultiServiceFactory, css::rendering::XBufferController, css::awt::XWindowListener, css::util::XUpdatable, css::beans::XPropertySet, css::lang::XServiceName > WindowGraphicDeviceBase_Base
void renderRecordedActions() const
Write out recorded actions.
unsigned char sal_Bool
virtual sal_Bool SAL_CALL switchBuffer(sal_Bool bUpdateAll) override
virtual sal_Bool SAL_CALL showBuffer(sal_Bool bUpdateAll) override
::canvas::CanvasBase< SpriteCanvasDeviceBaseT, CanvasHelper,::osl::MutexGuard,::cppu::OWeakObject > SpriteCanvasBaseT
void show(const ::rtl::Reference< CanvasCustomSprite > &)
Product of this component's factory.
virtual css::uno::Reference< css::rendering::XCustomSprite > SAL_CALL createCustomSprite(const css::geometry::RealSize2D &spriteSize) override
virtual void disposeThis() override
Dispose all internal references.
virtual css::uno::Reference< css::rendering::XAnimatedSprite > SAL_CALL createSpriteFromBitmaps(const css::uno::Sequence< css::uno::Reference< css::rendering::XBitmap > > &animationBitmaps,::sal_Int8 interpolationMode) override
void hide(const ::rtl::Reference< CanvasCustomSprite > &)
virtual OUString SAL_CALL getServiceName() override
virtual css::uno::Reference< css::rendering::XSprite > SAL_CALL createClonedSprite(const css::uno::Reference< css::rendering::XSprite > &original) override