LibreOffice Module canvas (master)  1
ogl_canvascustomsprite.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 <cppuhelper/compbase.hxx>
13 
14 #include <com/sun/star/rendering/XCustomSprite.hpp>
15 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
16 
18 
19 #include <base/basemutexhelper.hxx>
20 
21 #include "ogl_spritecanvas.hxx"
22 #include "ogl_canvashelper.hxx"
23 
24 
25 namespace oglcanvas
26 {
27  typedef ::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite,
28  css::rendering::XCanvas > CanvasCustomSpriteBase_Base;
29  typedef ::canvas::CanvasBase<
32  ::osl::MutexGuard,
34 
35  /* Definition of CanvasCustomSprite class */
36 
37  class CanvasCustomSprite : public CanvasCustomSpriteBaseT
38  {
39  public:
54  CanvasCustomSprite( const css::geometry::RealSize2D& rSpriteSize,
55  const SpriteCanvasRef& rRefDevice,
56  SpriteDeviceHelper& rDeviceHelper );
57 
58  virtual void disposeThis() override;
59 
60  // XSprite
61  virtual void SAL_CALL setAlpha( double alpha ) override;
62  virtual void SAL_CALL move( const css::geometry::RealPoint2D& aNewPos, const css::rendering::ViewState& viewState, const css::rendering::RenderState& renderState ) override;
63  virtual void SAL_CALL transform( const css::geometry::AffineMatrix2D& aTransformation ) override;
64  virtual void SAL_CALL clip( const css::uno::Reference< css::rendering::XPolyPolygon2D >& aClip ) override;
65  virtual void SAL_CALL setPriority( double nPriority ) override;
66  virtual void SAL_CALL show() override;
67  virtual void SAL_CALL hide() override;
68 
69  // XCustomSprite
70  virtual css::uno::Reference< css::rendering::XCanvas > SAL_CALL getContentCanvas() override;
71 
72  double getPriority() const { return mfPriority; }
73 
75  bool renderSprite() const;
76 
77  private:
82  const css::geometry::RealSize2D maSize;
83 
84  css::uno::Reference< css::rendering::XPolyPolygon2D > mxClip;
85  css::geometry::AffineMatrix2D maTransformation;
87  double mfAlpha;
88  double mfPriority;
89  };
90 }
91 
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::canvas::CanvasBase< ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >, CanvasHelper,::osl::MutexGuard,::cppu::OWeakObject > CanvasCustomSpriteBaseT
bool renderSprite() const
Render sprite content at sprite position.
Helper class for basic canvas functionality.
const css::geometry::RealSize2D maSize
virtual void SAL_CALL hide() override
virtual void SAL_CALL setPriority(double nPriority) override
css::uno::Reference< css::rendering::XPolyPolygon2D > mxClip
virtual void SAL_CALL move(const css::geometry::RealPoint2D &aNewPos, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState) override
virtual void SAL_CALL clip(const css::uno::Reference< css::rendering::XPolyPolygon2D > &aClip) override
virtual css::uno::Reference< css::rendering::XCanvas > SAL_CALL getContentCanvas() override
SpriteCanvasRef mpSpriteCanvas
MUST hold here, too, since CanvasHelper only contains a raw pointer (without refcounting) ...
virtual void SAL_CALL setAlpha(double alpha) override
::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite, css::rendering::XCanvas > CanvasCustomSpriteBase_Base
css::geometry::AffineMatrix2D maTransformation
CanvasCustomSprite(const css::geometry::RealSize2D &rSpriteSize, const SpriteCanvasRef &rRefDevice, SpriteDeviceHelper &rDeviceHelper)
Create a custom sprite.
virtual void SAL_CALL transform(const css::geometry::AffineMatrix2D &aTransformation) override
virtual void SAL_CALL show() override