fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / canvas / base / sprite.hxx
blob4ebafd57f998f4a82a01e1c0b543e93fdfcd01bb
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 #ifndef INCLUDED_CANVAS_SPRITE_HXX
21 #define INCLUDED_CANVAS_SPRITE_HXX
23 #include <rtl/ref.hxx>
24 #include <com/sun/star/lang/XComponent.hpp>
25 #include <com/sun/star/rendering/XCanvas.hpp>
26 #include <basegfx/point/b2dpoint.hxx>
27 #include <basegfx/vector/b2dsize.hxx>
29 namespace basegfx
31 class B2DPoint;
32 class B2DVector;
33 class B2DRange;
36 namespace canvas
38 /* Definition of Sprite interface (as we mix with UNO here, has to
39 be XInterface - reference holders to a Sprite must be able to
40 control lifetime of reference target)
43 /** Helper interface to connect SpriteCanvas with various
44 sprite implementations.
46 This interface should be implemented from every sprite class,
47 as it provides essential repaint and update area facilitates.
49 @derive typically, each canvas implementation will derive
50 another interface from this one, that adds rendering
51 functionality (which, of course, is impossible here in a
52 generic way)
54 class Sprite : public ::com::sun::star::lang::XComponent
56 public:
57 typedef ::rtl::Reference< Sprite > Reference;
59 /** Query whether sprite update will fully cover the given area.
61 Use this method to determine whether any background
62 content (regardless of static or sprite) needs an update
63 before rendering this sprite.
65 @return true, if sprite redraw will fully overwrite given
66 area (and thus, the background need not be redrawn
67 beforehand).
69 virtual bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const = 0;
71 /** Query whether content has changed
73 virtual bool isContentChanged() const = 0;
75 /** Query position of the left, top pixel of the sprite
77 virtual ::basegfx::B2DPoint getPosPixel() const = 0;
79 /** Query size of the sprite in pixel.
81 virtual ::basegfx::B2DVector getSizePixel() const = 0;
83 /** Get area that is currently covered by the sprite
85 This area is already adapted to clipping, alpha and
86 transformation state of this sprite.
88 virtual ::basegfx::B2DRange getUpdateArea() const = 0;
90 /** Query sprite priority
92 virtual double getPriority() const = 0;
94 protected:
95 ~Sprite() {}
98 /** Functor providing a StrictWeakOrdering for sprite references
100 struct SpriteWeakOrder
102 bool operator()( const Sprite::Reference& rLHS,
103 const Sprite::Reference& rRHS )
105 const double nPrioL( rLHS->getPriority() );
106 const double nPrioR( rRHS->getPriority() );
108 // if prios are equal, tie-break on ptr value
109 return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR;
114 #endif /* INCLUDED_CANVAS_SPRITE_HXX */
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */