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