1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_SLIDESHOW_UNOVIEWCONTAINER_HXX
25 #define INCLUDED_SLIDESHOW_UNOVIEWCONTAINER_HXX
26 
27 #include <com/sun/star/uno/Reference.hxx>
28 
29 #include <boost/shared_ptr.hpp>
30 #include <boost/utility.hpp>
31 
32 #include <vector>
33 
34 #include "unoview.hxx"
35 
36 
37 namespace com { namespace sun { namespace star { namespace presentation
38 {
39     class XSlideShowView;
40 } } } }
41 
42 /* Definition of UnoViewContainer class */
43 
44 namespace slideshow
45 {
46     namespace internal
47     {
48         /** Contains UnoViews
49          */
50         class UnoViewContainer : private boost::noncopyable
51         {
52         public:
53             UnoViewContainer();
54 
55             /** Add a view to this container
56 
57             	@return true, if the view was successfully added
58             	(false is e.g. returned, if the view was already
59             	added)
60              */
61             bool addView( const UnoViewSharedPtr& rView );
62 
63             /** Remove a previously added a view from this container
64 
65 	        	@return true, if this view was successfully removed, false
66                 otherwise (e.g. if this view wasn't added in the first place)
67             */
68             bool removeView( const UnoViewSharedPtr& rView );
69 
70             /** Remove a previously added a view from this container
71 
72 	        	@return the View object, if this view was successfully
73 	        	removed, and an empty shared_ptr otherwise (e.g. if
74 	        	this view wasn't added in the first place)
75             */
76             UnoViewSharedPtr removeView( const ::com::sun::star::uno::Reference<
77                                          			::com::sun::star::presentation::XSlideShowView >& xView );
78 
79             /// Dispose all stored views. Implies clear().
80             void dispose();
81 
82             // the following parrots STL container concept methods
83             // ===================================================
84 
size() const85             std::size_t size() const { return maViews.size(); }
empty() const86             bool empty() const { return maViews.empty(); }
87 
clear()88             void clear() { maViews.clear(); }
89 
90 
begin()91             UnoViewVector::iterator 		begin() { return maViews.begin(); }
begin() const92             UnoViewVector::const_iterator 	begin() const { return maViews.begin(); }
end()93             UnoViewVector::iterator 		end() { return maViews.end(); }
end() const94             UnoViewVector::const_iterator 	end() const { return maViews.end(); }
95 
96         private:
97             /// All added views
98             UnoViewVector	maViews;
99         };
100 
101         typedef ::boost::shared_ptr< UnoViewContainer > UnoViewContainerSharedPtr;
102 
103     }
104 }
105 
106 #endif /* INCLUDED_SLIDESHOW_UNOVIEWCONTAINER_HXX */
107