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