Line data Source code
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 : #ifndef WAITSYMBOL_HXX_INCLUDED
21 : #define WAITSYMBOL_HXX_INCLUDED
22 :
23 : #include <com/sun/star/rendering/XBitmap.hpp>
24 : #include <cppcanvas/customsprite.hxx>
25 :
26 : #include "vieweventhandler.hxx"
27 : #include "screenupdater.hxx"
28 : #include "eventmultiplexer.hxx"
29 : #include "unoview.hxx"
30 :
31 : #include <boost/shared_ptr.hpp>
32 : #include <boost/bind.hpp>
33 : #include <boost/utility.hpp>
34 : #include <vector>
35 :
36 : namespace slideshow {
37 : namespace internal {
38 :
39 : class EventMultiplexer;
40 : typedef boost::shared_ptr<class WaitSymbol> WaitSymbolSharedPtr;
41 :
42 : /// On-screen 'hour glass' for when slideshow is unresponsive
43 0 : class WaitSymbol : public ViewEventHandler,
44 : private ::boost::noncopyable
45 : {
46 : public:
47 : static WaitSymbolSharedPtr create( const ::com::sun::star::uno::Reference<
48 : ::com::sun::star::rendering::XBitmap>& xBitmap,
49 : ScreenUpdater& rScreenUpdater,
50 : EventMultiplexer& rEventMultiplexer,
51 : const UnoViewContainer& rViewContainer );
52 :
53 : /** Shows the wait symbol.
54 : */
55 0 : void show() { setVisible(true); }
56 :
57 : /** Hides the wait symbol.
58 : */
59 0 : void hide() { setVisible(false); }
60 :
61 : private:
62 : WaitSymbol( const ::com::sun::star::uno::Reference<
63 : ::com::sun::star::rendering::XBitmap>& xBitmap,
64 : ScreenUpdater& rScreenUpdater,
65 : const UnoViewContainer& rViewContainer );
66 :
67 : // ViewEventHandler
68 : virtual void viewAdded( const UnoViewSharedPtr& rView ) SAL_OVERRIDE;
69 : virtual void viewRemoved( const UnoViewSharedPtr& rView ) SAL_OVERRIDE;
70 : virtual void viewChanged( const UnoViewSharedPtr& rView ) SAL_OVERRIDE;
71 : virtual void viewsChanged() SAL_OVERRIDE;
72 :
73 : void setVisible( const bool bVisible );
74 : ::basegfx::B2DPoint calcSpritePos( UnoViewSharedPtr const & rView ) const;
75 :
76 : template <typename func_type>
77 : void for_each_sprite( func_type const & func ) const
78 : {
79 : ViewsVecT::const_iterator iPos( maViews.begin() );
80 : const ViewsVecT::const_iterator iEnd( maViews.end() );
81 : for ( ; iPos != iEnd; ++iPos )
82 : if( iPos->second )
83 : func( iPos->second );
84 : }
85 :
86 : typedef ::std::vector<
87 : ::std::pair<UnoViewSharedPtr,
88 : cppcanvas::CustomSpriteSharedPtr> > ViewsVecT;
89 :
90 : ::com::sun::star::uno::Reference<
91 : ::com::sun::star::rendering::XBitmap> mxBitmap;
92 :
93 : ViewsVecT maViews;
94 : ScreenUpdater& mrScreenUpdater;
95 : bool mbVisible;
96 : };
97 :
98 : } // namespace internal
99 : } // namespace presentation
100 :
101 : #endif
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|