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 #pragma once
21 
22 #include <cppuhelper/compbase.hxx>
23 #include <comphelper/uno3.hxx>
24 
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/lang/XComponent.hpp>
27 #include <com/sun/star/rendering/XCustomSprite.hpp>
28 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
29 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
30 
34 
35 #include <base/basemutexhelper.hxx>
37 
38 #include "dx_sprite.hxx"
39 #include "dx_surfacebitmap.hxx"
41 #include "dx_spritehelper.hxx"
42 #include "dx_spritecanvas.hxx"
43 
44 
45 namespace dxcanvas
46 {
47  typedef ::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite,
48  css::rendering::XBitmapCanvas,
49  css::rendering::XIntegerBitmap,
50  css::lang::XServiceInfo > CanvasCustomSpriteBase_Base;
68  class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >,
69  public Sprite
70  {
71  };
72 
73  typedef ::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base,
76  ::osl::MutexGuard,
78 
79  /* Definition of CanvasCustomSprite class */
80 
81  class CanvasCustomSprite : public CanvasCustomSpriteBaseT
82  {
83  public:
98  CanvasCustomSprite( const css::geometry::RealSize2D& rSpriteSize,
99  const SpriteCanvasRef& rRefDevice,
100  const IDXRenderModuleSharedPtr& rRenderModule,
101  const std::shared_ptr<canvas::ISurfaceProxyManager>& rSurfaceProxy,
102  bool bShowSpriteBounds );
103 
104  virtual void disposeThis() override;
105 
106  // Forwarding the XComponent implementation to the
107  // cppu::ImplHelper templated base
108  // Classname Base doing refcount Base implementing the XComponent interface
109  // | | |
110  // V V V
111  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite, CanvasCustomSpriteBase_Base, ::cppu::WeakComponentImplHelperBase )
112 
113  // XServiceInfo
114  virtual OUString SAL_CALL getImplementationName() override;
115  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
116  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
117 
118  // Sprite
119  virtual void redraw() const override;
120 
121  private:
127  };
128 }
129 
130 /* 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:29
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