LibreOffice Module canvas (master)  1
dx_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  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVASCUSTOMSPRITE_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVASCUSTOMSPRITE_HXX
22 
23 #include <cppuhelper/compbase.hxx>
24 #include <comphelper/uno3.hxx>
25 
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/lang/XComponent.hpp>
28 #include <com/sun/star/rendering/XCustomSprite.hpp>
29 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
30 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
31 
35 
38 
39 #include "dx_sprite.hxx"
40 #include "dx_surfacebitmap.hxx"
42 #include "dx_spritehelper.hxx"
43 #include "dx_spritecanvas.hxx"
44 
45 
46 namespace dxcanvas
47 {
48  typedef ::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite,
49  css::rendering::XBitmapCanvas,
50  css::rendering::XIntegerBitmap,
51  css::lang::XServiceInfo > CanvasCustomSpriteBase_Base;
69  class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >,
70  public Sprite
71  {
72  };
73 
74  typedef ::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base,
77  ::osl::MutexGuard,
79 
80  /* Definition of CanvasCustomSprite class */
81 
82  class CanvasCustomSprite : public CanvasCustomSpriteBaseT
83  {
84  public:
99  CanvasCustomSprite( const css::geometry::RealSize2D& rSpriteSize,
100  const SpriteCanvasRef& rRefDevice,
101  const IDXRenderModuleSharedPtr& rRenderModule,
102  const std::shared_ptr<canvas::ISurfaceProxyManager>& rSurfaceProxy,
103  bool bShowSpriteBounds );
104 
105  virtual void disposeThis() override;
106 
107  // Forwarding the XComponent implementation to the
108  // cppu::ImplHelper templated base
109  // Classname Base doing refcount Base implementing the XComponent interface
110  // | | |
111  // V V V
112  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite, CanvasCustomSpriteBase_Base, ::cppu::WeakComponentImplHelperBase )
113 
114  // XServiceInfo
115  virtual OUString SAL_CALL getImplementationName() override;
116  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
117  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
118 
119  // Sprite
120  virtual void redraw() const override;
121 
122  private:
128  };
129 }
130 
131 #endif // INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVASCUSTOMSPRITE_HXX
132 
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class for basic canvas functionality.
SpriteCanvasRef mpSpriteCanvas
MUST hold here, too, since BitmapCanvasHelper only contains a raw pointer (without refcounting) ...
std::shared_ptr< IDXRenderModule > IDXRenderModuleSharedPtr
CanvasCustomSprite(const css::geometry::RealSize2D &rSpriteSize, const SpriteCanvasRef &rRefDevice, const IDXRenderModuleSharedPtr &rRenderModule, const std::shared_ptr< canvas::ISurfaceProxyManager > &rSurfaceProxy, bool bShowSpriteBounds)
Create a custom sprite.
#define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper)
Base class, initializing its own baseclass with m_aMutex.
::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base, SpriteHelper, BitmapCanvasHelper,::osl::MutexGuard,::cppu::OWeakObject > CanvasCustomSpriteBaseT
virtual void disposeThis() override
Object is being disposed.
unsigned char sal_Bool
Specialization of canvas::Sprite interface, to also provide redraw methods.
Definition: dx_sprite.hxx:30
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
std::shared_ptr< DXSurfaceBitmap > DXSurfaceBitmapSharedPtr
virtual void redraw() const override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite, css::rendering::XBitmapCanvas, css::rendering::XIntegerBitmap, css::lang::XServiceInfo > CanvasCustomSpriteBase_Base
Helper class for canvas sprites.
DXSurfaceBitmapSharedPtr mpSurface