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 #ifndef INCLUDED_SLIDESHOW_UNOVIEWCONTAINER_HXX 29 #define INCLUDED_SLIDESHOW_UNOVIEWCONTAINER_HXX 30 31 #include <com/sun/star/uno/Reference.hxx> 32 33 #include <boost/shared_ptr.hpp> 34 #include <boost/utility.hpp> 35 36 #include <vector> 37 38 #include "unoview.hxx" 39 40 41 namespace com { namespace sun { namespace star { namespace presentation 42 { 43 class XSlideShowView; 44 } } } } 45 46 /* Definition of UnoViewContainer class */ 47 48 namespace slideshow 49 { 50 namespace internal 51 { 52 /** Contains UnoViews 53 */ 54 class UnoViewContainer : private boost::noncopyable 55 { 56 public: 57 UnoViewContainer(); 58 59 /** Add a view to this container 60 61 @return true, if the view was successfully added 62 (false is e.g. returned, if the view was already 63 added) 64 */ 65 bool addView( const UnoViewSharedPtr& rView ); 66 67 /** Remove a previously added a view from this container 68 69 @return true, if this view was successfully removed, false 70 otherwise (e.g. if this view wasn't added in the first place) 71 */ 72 bool removeView( const UnoViewSharedPtr& rView ); 73 74 /** Remove a previously added a view from this container 75 76 @return the View object, if this view was successfully 77 removed, and an empty shared_ptr otherwise (e.g. if 78 this view wasn't added in the first place) 79 */ 80 UnoViewSharedPtr removeView( const ::com::sun::star::uno::Reference< 81 ::com::sun::star::presentation::XSlideShowView >& xView ); 82 83 /// Dispose all stored views. Implies clear(). 84 void dispose(); 85 86 // the following parrots STL container concept methods 87 // =================================================== 88 89 std::size_t size() const { return maViews.size(); } 90 bool empty() const { return maViews.empty(); } 91 92 void clear() { maViews.clear(); } 93 94 95 UnoViewVector::iterator begin() { return maViews.begin(); } 96 UnoViewVector::const_iterator begin() const { return maViews.begin(); } 97 UnoViewVector::iterator end() { return maViews.end(); } 98 UnoViewVector::const_iterator end() const { return maViews.end(); } 99 100 private: 101 /// All added views 102 UnoViewVector maViews; 103 }; 104 105 typedef ::boost::shared_ptr< UnoViewContainer > UnoViewContainerSharedPtr; 106 107 } 108 } 109 110 #endif /* INCLUDED_SLIDESHOW_UNOVIEWCONTAINER_HXX */ 111