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 #pragma once
11 
12 #include <rtl/ref.hxx>
13 
14 #include <com/sun/star/uno/XComponentContext.hpp>
15 #include <com/sun/star/beans/XPropertySet.hpp>
16 #include <com/sun/star/lang/XServiceName.hpp>
17 #include <com/sun/star/awt/XWindowListener.hpp>
18 #include <com/sun/star/util/XUpdatable.hpp>
19 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
20 #include <com/sun/star/rendering/XGraphicDevice.hpp>
21 #include <com/sun/star/rendering/XBufferController.hpp>
22 
23 #include <cppuhelper/compbase.hxx>
24 #include <comphelper/uno3.hxx>
25 
26 #include <base/canvasbase.hxx>
29 
31 #include "ogl_canvashelper.hxx"
32 
33 
34 namespace oglcanvas
35 {
37 
38  typedef ::cppu::WeakComponentImplHelper< css::rendering::XSpriteCanvas,
39  css::rendering::XGraphicDevice,
40  css::lang::XMultiServiceFactory,
41  css::rendering::XBufferController,
42  css::awt::XWindowListener,
43  css::util::XUpdatable,
44  css::beans::XPropertySet,
45  css::lang::XServiceName > WindowGraphicDeviceBase_Base;
46  typedef ::canvas::BufferedGraphicDeviceBase<
49  ::osl::MutexGuard,
51 
52  typedef ::canvas::CanvasBase< SpriteCanvasDeviceBaseT,
54  ::osl::MutexGuard,
56 
66  class SpriteCanvas : public SpriteCanvasBaseT
67  {
68  public:
69  SpriteCanvas( const css::uno::Sequence<
70  css::uno::Any >& aArguments,
71  const css::uno::Reference<
72  css::uno::XComponentContext >& rxContext );
73 
74  void initialize();
75 
77  virtual void disposeThis() override;
78 
79  // Forwarding the XComponent implementation to the
80  // cppu::ImplHelper templated base
81  // Classname Base doing refcounting Base implementing the XComponent interface
82  // | | |
83  // V V V
84  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase )
85 
86  // XBufferController (partial)
87  virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) override;
88  virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) override;
89 
90  // XSpriteCanvas
91  virtual css::uno::Reference< css::rendering::XAnimatedSprite > SAL_CALL createSpriteFromAnimation( const css::uno::Reference< css::rendering::XAnimation >& animation ) override;
92  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;
93  virtual css::uno::Reference< css::rendering::XCustomSprite > SAL_CALL createCustomSprite( const css::geometry::RealSize2D& spriteSize ) override;
94  virtual css::uno::Reference< css::rendering::XSprite > SAL_CALL createClonedSprite( const css::uno::Reference< css::rendering::XSprite >& original ) override;
95  virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) override;
96 
97  // XServiceName
98  virtual OUString SAL_CALL getServiceName( ) override;
99 
100  void show( const ::rtl::Reference< CanvasCustomSprite >& );
101  void hide( const ::rtl::Reference< CanvasCustomSprite >& );
102 
105  void renderRecordedActions() const;
106 
107  private:
108  css::uno::Sequence< css::uno::Any > maArguments;
109  };
110 
111  typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
112 }
113 
114 /* 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