LibreOffice Module canvas (master)  1
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/rendering/XBitmapCanvas.hpp>
27 #include <com/sun/star/rendering/XCustomSprite.hpp>
28 #include <com/sun/star/rendering/XIntegerBitmap.hpp>
29 
30 #include <base/basemutexhelper.hxx>
31 #include <base/spritesurface.hxx>
33 
34 #include "sprite.hxx"
35 #include "canvashelper.hxx"
36 #include "spritehelper.hxx"
37 #include "impltools.hxx"
38 #include "repainttarget.hxx"
39 
40 
41 namespace vclcanvas
42 {
43  typedef ::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite,
44  css::rendering::XBitmapCanvas,
45  css::rendering::XIntegerBitmap,
46  css::lang::XServiceInfo > CanvasCustomSpriteBase_Base;
64  class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >,
65  public Sprite
66  {
67  };
68 
69  typedef ::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base,
74 
75  /* Definition of CanvasCustomSprite class */
76 
77  class CanvasCustomSprite : public CanvasCustomSpriteBaseT,
78  public RepaintTarget
79  {
80  public:
81  CanvasCustomSprite( const css::geometry::RealSize2D& rSpriteSize,
82  css::rendering::XGraphicDevice& rDevice,
83  const ::canvas::SpriteSurface::Reference& rOwningSpriteCanvas,
84  const OutDevProviderSharedPtr& rOutDevProvider,
85  bool bShowSpriteBounds );
86 
87  // Forwarding the XComponent implementation to the
88  // cppu::ImplHelper templated base
89  // Classname Base doing refcount Base implementing the XComponent interface
90  // | | |
91  // V V V
92  DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( CanvasCustomSprite, CanvasCustomSpriteBase_Base, ::cppu::WeakComponentImplHelperBase )
93 
94  // XServiceInfo
95  virtual OUString SAL_CALL getImplementationName() override;
96  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
97  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
98 
99  // Sprite
100  virtual void redraw( OutputDevice& rOutDev,
101  bool bBufferedUpdate ) const override;
102  virtual void redraw( OutputDevice& rOutDev,
103  const ::basegfx::B2DPoint& rPos,
104  bool bBufferedUpdate ) const override;
105 
106  // RepaintTarget
107  virtual bool repaint( const GraphicObjectSharedPtr& rGrf,
108  const css::rendering::ViewState& viewState,
109  const css::rendering::RenderState& renderState,
110  const ::Point& rPt,
111  const ::Size& rSz,
112  const GraphicAttr& rAttr ) const override;
113  };
114 }
115 
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< OutDevProvider > OutDevProviderSharedPtr
::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite, css::rendering::XBitmapCanvas, css::rendering::XIntegerBitmap, css::lang::XServiceInfo > CanvasCustomSpriteBase_Base
virtual void redraw(OutputDevice &rOutDev, bool bBufferedUpdate) const override
#define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper)
Helper class for basic canvas functionality.
Base class, initializing its own baseclass with m_aMutex.
std::shared_ptr< GraphicObject > GraphicObjectSharedPtr
Target interface for XCachedPrimitive implementations.
unsigned char sal_Bool
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
CanvasCustomSprite(const css::geometry::RealSize2D &rSpriteSize, css::rendering::XGraphicDevice &rDevice, const ::canvas::SpriteSurface::Reference &rOwningSpriteCanvas, const OutDevProviderSharedPtr &rOutDevProvider, bool bShowSpriteBounds)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Specialization of canvas::Sprite interface, to also provide redraw methods.
virtual bool repaint(const GraphicObjectSharedPtr &rGrf, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, const ::Point &rPt, const ::Size &rSz, const GraphicAttr &rAttr) const override
Helper class for canvas sprites.
::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base, SpriteHelper, CanvasHelper, tools::LocalGuard,::cppu::OWeakObject > CanvasCustomSpriteBaseT