1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: waitsymbol.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #if ! defined(WAITSYMBOL_HXX_INCLUDED)
32 #define WAITSYMBOL_HXX_INCLUDED
34 #include <com/sun/star/rendering/XBitmap.hpp>
35 #include <cppcanvas/customsprite.hxx>
37 #include "vieweventhandler.hxx"
38 #include "screenupdater.hxx"
39 #include "eventmultiplexer.hxx"
40 #include "unoview.hxx"
42 #include <boost/shared_ptr.hpp>
43 #include <boost/bind.hpp>
44 #include <boost/utility.hpp> // for noncopyable
50 class EventMultiplexer
;
51 typedef boost::shared_ptr
<class WaitSymbol
> WaitSymbolSharedPtr
;
53 class WaitSymbol
: public ViewEventHandler
,
54 private ::boost::noncopyable
57 static WaitSymbolSharedPtr
create( const ::com::sun::star::uno::Reference
<
58 ::com::sun::star::rendering::XBitmap
>& xBitmap
,
59 ScreenUpdater
& rScreenUpdater
,
60 EventMultiplexer
& rEventMultiplexer
,
61 const UnoViewContainer
& rViewContainer
);
63 /** Shows the wait symbol.
65 void show() { setVisible(true); }
67 /** Hides the wait symbol.
69 void hide() { setVisible(false); }
72 WaitSymbol( const ::com::sun::star::uno::Reference
<
73 ::com::sun::star::rendering::XBitmap
>& xBitmap
,
74 ScreenUpdater
& rScreenUpdater
,
75 const UnoViewContainer
& rViewContainer
);
78 virtual void viewAdded( const UnoViewSharedPtr
& rView
);
79 virtual void viewRemoved( const UnoViewSharedPtr
& rView
);
80 virtual void viewChanged( const UnoViewSharedPtr
& rView
);
81 virtual void viewsChanged();
83 void setVisible( const bool bVisible
);
84 ::basegfx::B2DPoint
calcSpritePos( UnoViewSharedPtr
const & rView
) const;
86 template <typename func_type
>
87 void for_each_sprite( func_type
const & func
) const
89 ViewsVecT::const_iterator
iPos( maViews
.begin() );
90 const ViewsVecT::const_iterator
iEnd( maViews
.end() );
91 for ( ; iPos
!= iEnd
; ++iPos
)
96 typedef ::std::vector
<
97 ::std::pair
<UnoViewSharedPtr
,
98 cppcanvas::CustomSpriteSharedPtr
> > ViewsVecT
;
100 ::com::sun::star::uno::Reference
<
101 ::com::sun::star::rendering::XBitmap
> mxBitmap
;
104 ScreenUpdater
& mrScreenUpdater
;
108 } // namespace internal
109 } // namespace presentation