update dev300-m58
[ooovba.git] / sdext / source / presenter / PresenterSprite.hxx
blobac8fa7e3031bc1c7ff8ce5117420dae61014c3fa
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterSprite.hxx,v $
11 * $Revision: 1.4 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef SDEXT_PRESENTER_PRESENTER_SPRITE_HXX
33 #define SDEXT_PRESENTER_PRESENTER_SPRITE_HXX
35 #include <com/sun/star/rendering/XCustomSprite.hpp>
36 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
37 #include <boost/noncopyable.hpp>
39 namespace css = ::com::sun::star;
41 namespace sdext { namespace presenter {
43 /** A wrapper around a com::sun::star::rendering::XCustomSprite that allows
44 not only setting values like size, location, and transformation but also
45 provides read access to them.
46 It also handles the showing and hiding of a sprite. This includes not
47 to show the sprite when its size is not yet defined (results in a crash)
48 and hiding a sprite before disposing it (results in zombie sprites.)
50 class PresenterSprite
51 : private ::boost::noncopyable
53 public:
54 PresenterSprite (void);
55 virtual ~PresenterSprite (void);
57 /** The given sprite canvas is used as factory to create the sprite that
58 is wrapped by objects of this class.
59 It is also used to call updateScreen() at (wrapped by the Update() method).
61 void SetFactory (
62 const ::css::uno::Reference<css::rendering::XSpriteCanvas>& rxSpriteFactory);
64 ::css::uno::Reference<css::rendering::XCanvas> GetCanvas (void);
66 void Show (void);
67 void Hide (void);
68 bool IsVisible (void) const;
70 void SetPriority (const double nPriority);
71 double GetPriority (void) const;
73 void Resize (const css::geometry::RealSize2D& rSize);
74 css::geometry::RealSize2D GetSize (void) const;
76 void MoveTo (const css::geometry::RealPoint2D& rLocation);
77 css::geometry::RealPoint2D GetLocation (void) const;
79 void Transform (const css::geometry::AffineMatrix2D& rTransform);
80 css::geometry::AffineMatrix2D GetTransform (void) const;
82 void SetAlpha (const double nAlpha);
83 double GetAlpha (void) const;
85 void Update (void);
87 private:
88 ::css::uno::Reference<css::rendering::XSpriteCanvas> mxSpriteFactory;
89 ::css::uno::Reference<css::rendering::XCustomSprite> mxSprite;
90 css::geometry::RealSize2D maSize;
91 css::geometry::RealPoint2D maLocation;
92 css::geometry::AffineMatrix2D maTransform;
93 bool mbIsVisible;
94 double mnPriority;
95 double mnAlpha;
97 void ProvideSprite (void);
98 void DisposeSprite (void);
103 #endif