bump product version to 7.6.3.2-android
[LibreOffice.git] / canvas / source / vcl / canvascustomsprite.hxx
blob1a7d3ccfb69e545e8cfa68a07edd94616979b7ba
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <cppuhelper/compbase.hxx>
23 #include <comphelper/uno3.hxx>
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>
30 #include <base/basemutexhelper.hxx>
31 #include <base/spritesurface.hxx>
32 #include <base/canvascustomspritebase.hxx>
34 #include "sprite.hxx"
35 #include "canvashelper.hxx"
36 #include "spritehelper.hxx"
37 #include "impltools.hxx"
38 #include "repainttarget.hxx"
41 namespace vclcanvas
43 typedef ::cppu::WeakComponentImplHelper< css::rendering::XCustomSprite,
44 css::rendering::XBitmapCanvas,
45 css::rendering::XIntegerBitmap,
46 css::lang::XServiceInfo > CanvasCustomSpriteBase_Base;
47 /** Mixin Sprite
49 Have to mixin the Sprite interface before deriving from
50 ::canvas::CanvasCustomSpriteBase, as this template should
51 already implement some of those interface methods.
53 The reason why this appears kinda convoluted is the fact that
54 we cannot specify non-IDL types as WeakComponentImplHelper
55 template args, and furthermore, don't want to derive
56 ::canvas::CanvasCustomSpriteBase directly from
57 ::canvas::Sprite (because derivees of
58 ::canvas::CanvasCustomSpriteBase have to explicitly forward
59 the XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS)
60 anyway). Basically, ::canvas::CanvasCustomSpriteBase should
61 remain a base class that provides implementation, not to
62 enforce any specific interface on its derivees.
64 class CanvasCustomSpriteSpriteBase_Base : public ::canvas::BaseMutexHelper< CanvasCustomSpriteBase_Base >,
65 public Sprite
69 typedef ::canvas::CanvasCustomSpriteBase< CanvasCustomSpriteSpriteBase_Base,
70 SpriteHelper,
71 CanvasHelper,
72 tools::LocalGuard,
73 ::cppu::OWeakObject > CanvasCustomSpriteBaseT;
75 /* Definition of CanvasCustomSprite class */
77 class CanvasCustomSprite : public CanvasCustomSpriteBaseT,
78 public RepaintTarget
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 );
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 )
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;
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;
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;
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */