1f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f8e07b45SAndrew Rist  * distributed with this work for additional information
6f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f8e07b45SAndrew Rist  *
11f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f8e07b45SAndrew Rist  *
13f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18f8e07b45SAndrew Rist  * under the License.
19f8e07b45SAndrew Rist  *
20f8e07b45SAndrew Rist  *************************************************************/
21f8e07b45SAndrew Rist 
22f8e07b45SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_
25cdf0e10cSrcweir #define __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
28cdf0e10cSrcweir                with solaris headers ...
29cdf0e10cSrcweir */
30cdf0e10cSrcweir #include <vector>
31cdf0e10cSrcweir #include <stdexcept>
32cdf0e10cSrcweir #include <algorithm>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir //_________________________________________________________________________________________________________________
35cdf0e10cSrcweir //	my own includes
36cdf0e10cSrcweir //_________________________________________________________________________________________________________________
37cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_
40cdf0e10cSrcweir #include <threadhelp/transactionbase.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #include <macros/debug.hxx>
43cdf0e10cSrcweir #include <general.h>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir //_________________________________________________________________________________________________________________
46cdf0e10cSrcweir //	interface includes
47cdf0e10cSrcweir //_________________________________________________________________________________________________________________
48cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
49cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp>
50cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //_________________________________________________________________________________________________________________
53cdf0e10cSrcweir //	other includes
54cdf0e10cSrcweir //_________________________________________________________________________________________________________________
55cdf0e10cSrcweir #include <cppuhelper/weakref.hxx>
56cdf0e10cSrcweir #include <vos/ref.hxx>
57cdf0e10cSrcweir #include <rtl/ustring.hxx>
58cdf0e10cSrcweir #include <vcl/evntpost.hxx>
59cdf0e10cSrcweir 
60cdf0e10cSrcweir //_________________________________________________________________________________________________________________
61cdf0e10cSrcweir //	namespace
62cdf0e10cSrcweir //_________________________________________________________________________________________________________________
63cdf0e10cSrcweir 
64cdf0e10cSrcweir namespace framework{
65cdf0e10cSrcweir 
66cdf0e10cSrcweir //_________________________________________________________________________________________________________________
67cdf0e10cSrcweir //	exported const
68cdf0e10cSrcweir //_________________________________________________________________________________________________________________
69cdf0e10cSrcweir 
70cdf0e10cSrcweir //_________________________________________________________________________________________________________________
71cdf0e10cSrcweir //	exported definitions
72cdf0e10cSrcweir //_________________________________________________________________________________________________________________
73cdf0e10cSrcweir 
74cdf0e10cSrcweir typedef ::std::vector< css::uno::Reference< css::frame::XFrame > >	TFrameContainer		;
75cdf0e10cSrcweir typedef TFrameContainer::iterator									TFrameIterator		;
76cdf0e10cSrcweir typedef TFrameContainer::const_iterator								TConstFrameIterator	;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir /*-************************************************************************************************************//**
79cdf0e10cSrcweir     @short          implement a container to hold childs of frame, task or desktop
80cdf0e10cSrcweir     @descr          Every object of frame, task or desktop hold reference to his childs. These container is used as helper
81cdf0e10cSrcweir                     to do this. Some helper-classe like OFrames or OTasksAccess use it to. They hold a pointer to an instance
82cdf0e10cSrcweir                     of this class, which is a member of a frame, task or desktop! You can append and remove frames.
83cdf0e10cSrcweir                     It's possible to set one of these frames as active or deactive. You could have full index-access to
84cdf0e10cSrcweir                     container-items.
85cdf0e10cSrcweir 
86cdf0e10cSrcweir     @base           ThreadHelpBase
87cdf0e10cSrcweir                         guarantee right initialized lock member during boostrap!
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	@devstatus		ready to use
90cdf0e10cSrcweir 	@threadsafe		yes
91cdf0e10cSrcweir     @modified       01.07.2002 14:39, as96863
92cdf0e10cSrcweir *//*-*************************************************************************************************************/
93cdf0e10cSrcweir class FrameContainer : private ThreadHelpBase
94cdf0e10cSrcweir {
95cdf0e10cSrcweir     //_______________________________________
96cdf0e10cSrcweir     // member
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	private:
99cdf0e10cSrcweir 
100cdf0e10cSrcweir         /// list to hold all frames
101cdf0e10cSrcweir         TFrameContainer m_aContainer;
102*07a3d7f1SPedro Giffuni         /// one container item can be the current active frame. Its necessary for Desktop or Frame implementation.
103cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > m_xActiveFrame;
104cdf0e10cSrcweir /*DEPRECATEME
105cdf0e10cSrcweir         /// indicates using of the automatic async quit feature in case last task will be closed
106cdf0e10cSrcweir         sal_Bool m_bAsyncQuit;
107cdf0e10cSrcweir         /// used to execute the terminate request asyncronous
108cdf0e10cSrcweir         ::vcl::EventPoster m_aAsyncCall;
109cdf0e10cSrcweir         /// used for async quit feature (must be weak to prevent us against strange situations!)
110cdf0e10cSrcweir         css::uno::WeakReference< css::frame::XDesktop > m_xDesktop;
111cdf0e10cSrcweir */
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     //_______________________________________
114cdf0e10cSrcweir     // interface
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	public:
117cdf0e10cSrcweir 
118cdf0e10cSrcweir         /// constructor / destructor
119cdf0e10cSrcweir                  FrameContainer();
120cdf0e10cSrcweir 		virtual ~FrameContainer();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir         /// add/remove/mark container items
123cdf0e10cSrcweir         void                                      append     ( const css::uno::Reference< css::frame::XFrame >& xFrame );
124cdf0e10cSrcweir         void                                      remove     ( const css::uno::Reference< css::frame::XFrame >& xFrame );
125cdf0e10cSrcweir         void                                      setActive  ( const css::uno::Reference< css::frame::XFrame >& xFrame );
126cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > getActive  (                                                         ) const;
127cdf0e10cSrcweir 
128cdf0e10cSrcweir         /// checks and free memory
129cdf0e10cSrcweir         sal_Bool exist      ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const;
130cdf0e10cSrcweir         void     clear      (                                                         );
131cdf0e10cSrcweir 
132cdf0e10cSrcweir         /// deprecated IndexAccess!
133cdf0e10cSrcweir         sal_uInt32                                getCount  (                   ) const;
134cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > operator[]( sal_uInt32 nIndex ) const;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         /// replacement for deprectaed index access
137cdf0e10cSrcweir         css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > getAllElements() const;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir         /// special helper for Frame::findFrame()
140cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > searchOnAllChildrens   ( const ::rtl::OUString& sName ) const;
141cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > searchOnDirectChildrens( const ::rtl::OUString& sName ) const;
142cdf0e10cSrcweir 
143cdf0e10cSrcweir }; // class FrameContainer
144cdf0e10cSrcweir 
145cdf0e10cSrcweir } // namespace framework
146cdf0e10cSrcweir 
147cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_
148