1*6d739b60SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*6d739b60SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*6d739b60SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*6d739b60SAndrew Rist  * distributed with this work for additional information
6*6d739b60SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*6d739b60SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*6d739b60SAndrew Rist  * "License"); you may not use this file except in compliance
9*6d739b60SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*6d739b60SAndrew Rist  *
11*6d739b60SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*6d739b60SAndrew Rist  *
13*6d739b60SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*6d739b60SAndrew Rist  * software distributed under the License is distributed on an
15*6d739b60SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*6d739b60SAndrew Rist  * KIND, either express or implied.  See the License for the
17*6d739b60SAndrew Rist  * specific language governing permissions and limitations
18*6d739b60SAndrew Rist  * under the License.
19*6d739b60SAndrew Rist  *
20*6d739b60SAndrew Rist  *************************************************************/
21*6d739b60SAndrew Rist 
22*6d739b60SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_framework.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_________________________________________________________________________________________________________________
28cdf0e10cSrcweir //	my own includes
29cdf0e10cSrcweir //_________________________________________________________________________________________________________________
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #ifndef __FRAMEWORK_FRAMECONTAINER_HXX_
32cdf0e10cSrcweir #include <classes/framecontainer.hxx>
33cdf0e10cSrcweir #endif
34cdf0e10cSrcweir #include <threadhelp/writeguard.hxx>
35cdf0e10cSrcweir #include <threadhelp/readguard.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #ifndef __FRAMEWORK_COMMANDS_HXX_
38cdf0e10cSrcweir #include <commands.h>
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir 
41cdf0e10cSrcweir //_________________________________________________________________________________________________________________
42cdf0e10cSrcweir //	interface includes
43cdf0e10cSrcweir //_________________________________________________________________________________________________________________
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FRAME_FRAMESEARCH_FLAG_HPP_
46cdf0e10cSrcweir #include <com/sun/star/frame/FrameSearchFlag.hpp>
47cdf0e10cSrcweir #endif
48cdf0e10cSrcweir 
49cdf0e10cSrcweir //_________________________________________________________________________________________________________________
50cdf0e10cSrcweir //	includes of other projects
51cdf0e10cSrcweir //_________________________________________________________________________________________________________________
52cdf0e10cSrcweir #include <vcl/svapp.hxx>
53cdf0e10cSrcweir 
54cdf0e10cSrcweir //_________________________________________________________________________________________________________________
55cdf0e10cSrcweir //	namespace
56cdf0e10cSrcweir //_________________________________________________________________________________________________________________
57cdf0e10cSrcweir 
58cdf0e10cSrcweir namespace framework{
59cdf0e10cSrcweir 
60cdf0e10cSrcweir //_________________________________________________________________________________________________________________
61cdf0e10cSrcweir //	non exported const
62cdf0e10cSrcweir //_________________________________________________________________________________________________________________
63cdf0e10cSrcweir 
64cdf0e10cSrcweir //_________________________________________________________________________________________________________________
65cdf0e10cSrcweir //	non exported definitions
66cdf0e10cSrcweir //_________________________________________________________________________________________________________________
67cdf0e10cSrcweir 
68cdf0e10cSrcweir //_________________________________________________________________________________________________________________
69cdf0e10cSrcweir //	declarations
70cdf0e10cSrcweir //_________________________________________________________________________________________________________________
71cdf0e10cSrcweir 
72cdf0e10cSrcweir /**-***************************************************************************************************************
73cdf0e10cSrcweir     @short      initialize an empty container
74cdf0e10cSrcweir     @descr      The container will be empty then - special features (e.g. the async quit mechanism) are disabled.
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     @threadsafe not neccessary - its not a singleton
77cdf0e10cSrcweir     @modified   01.07.2002 14:42,as96863
78cdf0e10cSrcweir  *****************************************************************************************************************/
FrameContainer()79cdf0e10cSrcweir FrameContainer::FrameContainer()
80cdf0e10cSrcweir         // initialize base classes first.
81cdf0e10cSrcweir         // Order is neccessary for right initilization of his and OUR member ... m_aLock
82cdf0e10cSrcweir         : ThreadHelpBase ( &Application::GetSolarMutex()                  )
83cdf0e10cSrcweir /*DEPRECATEME
84cdf0e10cSrcweir         , m_bAsyncQuit   ( sal_False                                      ) // default must be "disabled"!
85cdf0e10cSrcweir         , m_aAsyncCall   ( LINK( this, FrameContainer, implts_asyncQuit ) )
86cdf0e10cSrcweir */
87cdf0e10cSrcweir {
88cdf0e10cSrcweir }
89cdf0e10cSrcweir 
90cdf0e10cSrcweir /**-***************************************************************************************************************
91cdf0e10cSrcweir     @short      deinitialize may a filled container
92cdf0e10cSrcweir     @descr      Special features (if the currently are running) will be dsiabled and we free all used other ressources.
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     @threadsafe not neccessary - its not a singleton
95cdf0e10cSrcweir     @modified   01.07.2002 14:43,as96863
96cdf0e10cSrcweir  *****************************************************************************************************************/
~FrameContainer()97cdf0e10cSrcweir FrameContainer::~FrameContainer()
98cdf0e10cSrcweir {
99cdf0e10cSrcweir 	// Don't forget to free memory!
100cdf0e10cSrcweir     m_aContainer.clear();
101cdf0e10cSrcweir     m_xActiveFrame.clear();
102cdf0e10cSrcweir }
103cdf0e10cSrcweir 
104cdf0e10cSrcweir /**-***************************************************************************************************************
105cdf0e10cSrcweir     @short      append a new frame to the container
106cdf0e10cSrcweir     @descr      We accept the incoming frame only, if it is a valid reference and dosnt exist already.
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     @param      xFrame
109cdf0e10cSrcweir                     frame, which should be added to this container
110cdf0e10cSrcweir                     Must be a valid reference.
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     @threadsafe yes
113cdf0e10cSrcweir     @modified   01.07.2002 14:44,as96863
114cdf0e10cSrcweir  *****************************************************************************************************************/
append(const css::uno::Reference<css::frame::XFrame> & xFrame)115cdf0e10cSrcweir void FrameContainer::append( const css::uno::Reference< css::frame::XFrame >& xFrame )
116cdf0e10cSrcweir {
117cdf0e10cSrcweir     if (xFrame.is() && ! exist(xFrame))
118cdf0e10cSrcweir     {
119cdf0e10cSrcweir         /* SAFE { */
120cdf0e10cSrcweir         WriteGuard aWriteLock( m_aLock );
121cdf0e10cSrcweir         m_aContainer.push_back( xFrame );
122cdf0e10cSrcweir         aWriteLock.unlock();
123cdf0e10cSrcweir         /* } SAFE */
124cdf0e10cSrcweir     }
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir /**-***************************************************************************************************************
128cdf0e10cSrcweir     @short      remove a frame from the container
129cdf0e10cSrcweir     @descr      In case we remove the last frame and our internal special feature (the async quit mechanism)
130cdf0e10cSrcweir                 was enabled by the desktop instance, we start it.
131cdf0e10cSrcweir 
132cdf0e10cSrcweir     @param      xFrame
133cdf0e10cSrcweir                     frame, which should be deleted from this container
134cdf0e10cSrcweir                     Must be a valid reference.
135cdf0e10cSrcweir 
136cdf0e10cSrcweir     @threadsafe yes
137cdf0e10cSrcweir     @modified   01.07.2002 14:52,as96863
138cdf0e10cSrcweir  *****************************************************************************************************************/
remove(const css::uno::Reference<css::frame::XFrame> & xFrame)139cdf0e10cSrcweir void FrameContainer::remove( const css::uno::Reference< css::frame::XFrame >& xFrame )
140cdf0e10cSrcweir {
141cdf0e10cSrcweir     /* SAFE { */
142cdf0e10cSrcweir     // write lock neccessary for follwing erase()!
143cdf0e10cSrcweir     WriteGuard aWriteLock( m_aLock );
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     TFrameIterator aSearchedItem = ::std::find( m_aContainer.begin(), m_aContainer.end(), xFrame );
146cdf0e10cSrcweir     if (aSearchedItem!=m_aContainer.end())
147cdf0e10cSrcweir     {
148cdf0e10cSrcweir         m_aContainer.erase( aSearchedItem );
149cdf0e10cSrcweir 
150cdf0e10cSrcweir         // If removed frame was the current active frame - reset state variable.
151cdf0e10cSrcweir         if (m_xActiveFrame==xFrame)
152cdf0e10cSrcweir             m_xActiveFrame = css::uno::Reference< css::frame::XFrame >();
153cdf0e10cSrcweir 
154cdf0e10cSrcweir         // We don't need the write lock any longer ...
155cdf0e10cSrcweir         // downgrade to read access.
156cdf0e10cSrcweir         aWriteLock.downgrade();
157cdf0e10cSrcweir /*DEPRECATEME
158cdf0e10cSrcweir         // If last frame was removed and special quit mode is enabled by the desktop
159cdf0e10cSrcweir         // we must terminate the application by using this asynchronous callback!
160cdf0e10cSrcweir         if (m_aContainer.size()<1 && m_bAsyncQuit)
161cdf0e10cSrcweir             m_aAsyncCall.Post(0);
162cdf0e10cSrcweir */
163cdf0e10cSrcweir     }
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     aWriteLock.unlock();
166cdf0e10cSrcweir     // } SAFE
167cdf0e10cSrcweir }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir /**-***************************************************************************************************************
170cdf0e10cSrcweir     @short      check if the given frame currently exist inside the container
171cdf0e10cSrcweir     @descr      -
172cdf0e10cSrcweir 
173cdf0e10cSrcweir     @param      xFrame
174cdf0e10cSrcweir                     reference to the queried frame
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     @return     <TRUE/> if frame is oart of this container
177cdf0e10cSrcweir                 <FALSE/> otherwhise
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     @threadsafe yes
180cdf0e10cSrcweir     @modified   01.07.2002 14:55,as96863
181cdf0e10cSrcweir  *****************************************************************************************************************/
exist(const css::uno::Reference<css::frame::XFrame> & xFrame) const182cdf0e10cSrcweir sal_Bool FrameContainer::exist( const css::uno::Reference< css::frame::XFrame >& xFrame ) const
183cdf0e10cSrcweir {
184cdf0e10cSrcweir     /* SAFE { */
185cdf0e10cSrcweir     ReadGuard aReadLock( m_aLock );
186cdf0e10cSrcweir     return( ::std::find( m_aContainer.begin(), m_aContainer.end(), xFrame ) != m_aContainer.end() );
187cdf0e10cSrcweir     /* } SAFE */
188cdf0e10cSrcweir }
189cdf0e10cSrcweir 
190cdf0e10cSrcweir /**-***************************************************************************************************************
191cdf0e10cSrcweir     @short      delete all existing items of the container
192cdf0e10cSrcweir     @descr      -
193cdf0e10cSrcweir 
194cdf0e10cSrcweir     @threadsafe yes
195cdf0e10cSrcweir     @modified   01.07.2002 15:00,as96863
196cdf0e10cSrcweir  *****************************************************************************************************************/
clear()197cdf0e10cSrcweir void FrameContainer::clear()
198cdf0e10cSrcweir {
199cdf0e10cSrcweir     // SAFE {
200cdf0e10cSrcweir     WriteGuard aWriteLock( m_aLock );
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 	// Clear the container ...
203cdf0e10cSrcweir     m_aContainer.clear();
204cdf0e10cSrcweir 	// ... and don't forget to reset the active frame.
205cdf0e10cSrcweir 	// Its an reference to a valid container-item.
206cdf0e10cSrcweir 	// But no container item => no active frame!
207cdf0e10cSrcweir     m_xActiveFrame = css::uno::Reference< css::frame::XFrame >();
208cdf0e10cSrcweir /*DEPRECATEME
209cdf0e10cSrcweir     // If special quit mode is used - we must terminate the desktop.
210cdf0e10cSrcweir 	// He is the owner of this container and can't work without any visible tasks/frames!
211cdf0e10cSrcweir     if (m_bAsyncQuit)
212cdf0e10cSrcweir         m_aAsyncCall.Post(0);
213cdf0e10cSrcweir */
214cdf0e10cSrcweir 
215cdf0e10cSrcweir     aWriteLock.unlock();
216cdf0e10cSrcweir     // } SAFE
217cdf0e10cSrcweir }
218cdf0e10cSrcweir 
219cdf0e10cSrcweir /**-***************************************************************************************************************
220cdf0e10cSrcweir     @short      returns count of all current existing frames
221cdf0e10cSrcweir     @descr      -
222cdf0e10cSrcweir 
223cdf0e10cSrcweir     @deprecated This value can't be guaranteed for multithreading environments.
224cdf0e10cSrcweir                 So it will be marked as deprecated and should be replaced by "getAllElements()".
225cdf0e10cSrcweir 
226cdf0e10cSrcweir     @return     the count of existing container items
227cdf0e10cSrcweir 
228cdf0e10cSrcweir     @threadsafe yes
229cdf0e10cSrcweir     @modified   01.07.2002 15:00,as96863
230cdf0e10cSrcweir  *****************************************************************************************************************/
getCount() const231cdf0e10cSrcweir sal_uInt32 FrameContainer::getCount() const
232cdf0e10cSrcweir {
233cdf0e10cSrcweir     /* SAFE { */
234cdf0e10cSrcweir     ReadGuard aReadLock( m_aLock );
235cdf0e10cSrcweir     return( (sal_uInt32)m_aContainer.size() );
236cdf0e10cSrcweir     /* } SAFE */
237cdf0e10cSrcweir }
238cdf0e10cSrcweir 
239cdf0e10cSrcweir /**-***************************************************************************************************************
240cdf0e10cSrcweir     @short      returns one item of this container
241cdf0e10cSrcweir     @descr      -
242cdf0e10cSrcweir 
243cdf0e10cSrcweir     @deprecated This value can't be guaranteed for multithreading environments.
244cdf0e10cSrcweir                 So it will be marked as deprecated and should be replaced by "getAllElements()".
245cdf0e10cSrcweir 
246cdf0e10cSrcweir     @param      nIndex
247cdf0e10cSrcweir                     a valud between 0 and (getCount()-1) to adress one container item
248cdf0e10cSrcweir 
249cdf0e10cSrcweir     @return     a reference to a frame inside the container, which match with given index
250cdf0e10cSrcweir 
251cdf0e10cSrcweir     @threadsafe yes
252cdf0e10cSrcweir     @modified   01.07.2002 15:03,as96863
253cdf0e10cSrcweir  *****************************************************************************************************************/
operator [](sal_uInt32 nIndex) const254cdf0e10cSrcweir css::uno::Reference< css::frame::XFrame > FrameContainer::operator[]( sal_uInt32 nIndex ) const
255cdf0e10cSrcweir {
256cdf0e10cSrcweir 
257cdf0e10cSrcweir     css::uno::Reference< css::frame::XFrame > xFrame;
258cdf0e10cSrcweir     try
259cdf0e10cSrcweir     {
260cdf0e10cSrcweir         // Get element form container WITH automatic test of ranges!
261cdf0e10cSrcweir         // If index not valid, a out_of_range exception is thrown.
262cdf0e10cSrcweir         /* SAFE { */
263cdf0e10cSrcweir         ReadGuard aReadLock( m_aLock );
264cdf0e10cSrcweir         xFrame = m_aContainer.at( nIndex );
265cdf0e10cSrcweir         aReadLock.unlock();
266cdf0e10cSrcweir         /* } SAFE */
267cdf0e10cSrcweir     }
268cdf0e10cSrcweir     catch( std::out_of_range& )
269cdf0e10cSrcweir     {
270cdf0e10cSrcweir         // The index is not valid for current container-content - we must handle this case!
271cdf0e10cSrcweir         // We can return the default value ...
272cdf0e10cSrcweir         LOG_EXCEPTION( "FrameContainer::operator[]", "Exception catched ...", DECLARE_ASCII("::std::out_of_range") )
273cdf0e10cSrcweir     }
274cdf0e10cSrcweir 	return xFrame;
275cdf0e10cSrcweir }
276cdf0e10cSrcweir 
277cdf0e10cSrcweir /**-***************************************************************************************************************
278cdf0e10cSrcweir     @short      returns a snapshot of all currently existing frames inside this container
279cdf0e10cSrcweir     @descr      Should be used to replace the deprecated functions getCount()/operator[]!
280cdf0e10cSrcweir 
281cdf0e10cSrcweir     @return     a list of all frame refrences inside this container
282cdf0e10cSrcweir 
283cdf0e10cSrcweir     @threadsafe yes
284cdf0e10cSrcweir     @modified   01.07.2002 15:09,as96863
285cdf0e10cSrcweir  *****************************************************************************************************************/
getAllElements() const286cdf0e10cSrcweir css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > FrameContainer::getAllElements() const
287cdf0e10cSrcweir {
288cdf0e10cSrcweir     /* SAFE { */
289cdf0e10cSrcweir     ReadGuard aReadLock( m_aLock );
290cdf0e10cSrcweir 
291cdf0e10cSrcweir     sal_Int32                                                       nPosition = 0;
292cdf0e10cSrcweir     css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > lElements ( (sal_uInt32)m_aContainer.size() );
293cdf0e10cSrcweir     for (TConstFrameIterator pItem=m_aContainer.begin(); pItem!=m_aContainer.end(); ++pItem)
294cdf0e10cSrcweir         lElements[nPosition++] = *pItem;
295cdf0e10cSrcweir 
296cdf0e10cSrcweir     aReadLock.unlock();
297cdf0e10cSrcweir     /* } SAFE */
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 	return lElements;
300cdf0e10cSrcweir }
301cdf0e10cSrcweir 
302cdf0e10cSrcweir /**-***************************************************************************************************************
303cdf0e10cSrcweir     @short      set the given frame as  the new active one inside this container
304cdf0e10cSrcweir     @descr      We accept this frame only, if it's already a part of this container.
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     @param      xFrame
307cdf0e10cSrcweir                     reference to the new active frame
308cdf0e10cSrcweir                     Must be a valid reference and already part of this container.
309cdf0e10cSrcweir 
310cdf0e10cSrcweir     @threadsafe yes
311cdf0e10cSrcweir     @modified   01.07.2002 15:11,as96863
312cdf0e10cSrcweir  *****************************************************************************************************************/
setActive(const css::uno::Reference<css::frame::XFrame> & xFrame)313cdf0e10cSrcweir void FrameContainer::setActive( const css::uno::Reference< css::frame::XFrame >& xFrame )
314cdf0e10cSrcweir {
315cdf0e10cSrcweir     if ( !xFrame.is() || exist(xFrame) )
316cdf0e10cSrcweir     {
317cdf0e10cSrcweir         /* SAFE { */
318cdf0e10cSrcweir         WriteGuard aWriteLock( m_aLock );
319cdf0e10cSrcweir         m_xActiveFrame = xFrame;
320cdf0e10cSrcweir         aWriteLock.unlock();
321cdf0e10cSrcweir         /* } SAFE */
322cdf0e10cSrcweir     }
323cdf0e10cSrcweir }
324cdf0e10cSrcweir 
325cdf0e10cSrcweir /**-***************************************************************************************************************
326cdf0e10cSrcweir     @short      return sthe current active frame of this container
327cdf0e10cSrcweir     @descr      Value can be null in case the frame was removed from the container and nobody
328cdf0e10cSrcweir                 from outside decide which of all others should be the new one ...
329cdf0e10cSrcweir 
330cdf0e10cSrcweir     @return     a reference to the current active frame
331cdf0e10cSrcweir                 Value can be NULL!
332cdf0e10cSrcweir 
333cdf0e10cSrcweir     @threadsafe yes
334cdf0e10cSrcweir     @modified   01.07.2002 15:11,as96863
335cdf0e10cSrcweir  *****************************************************************************************************************/
getActive() const336cdf0e10cSrcweir css::uno::Reference< css::frame::XFrame > FrameContainer::getActive() const
337cdf0e10cSrcweir {
338cdf0e10cSrcweir     /* SAFE { */
339cdf0e10cSrcweir     ReadGuard aReadLock( m_aLock );
340cdf0e10cSrcweir     return m_xActiveFrame;
341cdf0e10cSrcweir     /* } SAFE */
342cdf0e10cSrcweir }
343cdf0e10cSrcweir 
344cdf0e10cSrcweir /**-***************************************************************************************************************
345cdf0e10cSrcweir     @short      implements a simple search based on current container items
346cdf0e10cSrcweir     @descr      It can be used for findFrame() and implements a deep down search.
347cdf0e10cSrcweir 
348cdf0e10cSrcweir     @param      sName
349cdf0e10cSrcweir                     target name, which is searched
350cdf0e10cSrcweir 
351cdf0e10cSrcweir     @return     reference to the found frame or NULL if not.
352cdf0e10cSrcweir 
353cdf0e10cSrcweir     @threadsafe yes
354cdf0e10cSrcweir     @modified   01.07.2002 15:22,as96863
355cdf0e10cSrcweir  *****************************************************************************************************************/
searchOnAllChildrens(const::rtl::OUString & sName) const356cdf0e10cSrcweir css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnAllChildrens( const ::rtl::OUString& sName ) const
357cdf0e10cSrcweir {
358cdf0e10cSrcweir     /* SAFE { */
359cdf0e10cSrcweir     ReadGuard aReadLock( m_aLock );
360cdf0e10cSrcweir 
361cdf0e10cSrcweir     // Step over all child frames. But if direct child isn't the right one search on his children first - before
362cdf0e10cSrcweir     // you go to next direct child of this container!
363cdf0e10cSrcweir     css::uno::Reference< css::frame::XFrame > xSearchedFrame;
364cdf0e10cSrcweir     for( TConstFrameIterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
365cdf0e10cSrcweir     {
366cdf0e10cSrcweir         if ((*pIterator)->getName()==sName)
367cdf0e10cSrcweir         {
368cdf0e10cSrcweir             xSearchedFrame = *pIterator;
369cdf0e10cSrcweir             break;
370cdf0e10cSrcweir         }
371cdf0e10cSrcweir         else
372cdf0e10cSrcweir         {
373cdf0e10cSrcweir             xSearchedFrame = (*pIterator)->findFrame( sName, css::frame::FrameSearchFlag::CHILDREN );
374cdf0e10cSrcweir             if (xSearchedFrame.is())
375cdf0e10cSrcweir                 break;
376cdf0e10cSrcweir         }
377cdf0e10cSrcweir     }
378cdf0e10cSrcweir     aReadLock.unlock();
379cdf0e10cSrcweir     /* } SAFE */
380cdf0e10cSrcweir 	return xSearchedFrame;
381cdf0e10cSrcweir }
382cdf0e10cSrcweir 
383cdf0e10cSrcweir /**-***************************************************************************************************************
384cdf0e10cSrcweir     @short      implements a simple search based on current container items
385cdf0e10cSrcweir     @descr      It can be used for findFrame() and search on members of this container only!
386cdf0e10cSrcweir 
387cdf0e10cSrcweir     @param      sName
388cdf0e10cSrcweir                     target name, which is searched
389cdf0e10cSrcweir 
390cdf0e10cSrcweir     @return     reference to the found frame or NULL if not.
391cdf0e10cSrcweir 
392cdf0e10cSrcweir     @threadsafe yes
393cdf0e10cSrcweir     @modified   01.07.2002 15:22,as96863
394cdf0e10cSrcweir  *****************************************************************************************************************/
searchOnDirectChildrens(const::rtl::OUString & sName) const395cdf0e10cSrcweir css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnDirectChildrens( const ::rtl::OUString& sName ) const
396cdf0e10cSrcweir {
397cdf0e10cSrcweir     /* SAFE { */
398cdf0e10cSrcweir     ReadGuard aReadLock( m_aLock );
399cdf0e10cSrcweir 
400cdf0e10cSrcweir     css::uno::Reference< css::frame::XFrame > xSearchedFrame;
401cdf0e10cSrcweir     for( TConstFrameIterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
402cdf0e10cSrcweir     {
403cdf0e10cSrcweir         if ((*pIterator)->getName()==sName)
404cdf0e10cSrcweir         {
405cdf0e10cSrcweir             xSearchedFrame = *pIterator;
406cdf0e10cSrcweir             break;
407cdf0e10cSrcweir         }
408cdf0e10cSrcweir     }
409cdf0e10cSrcweir     aReadLock.unlock();
410cdf0e10cSrcweir     /* } SAFE */
411cdf0e10cSrcweir 	return xSearchedFrame;
412cdf0e10cSrcweir }
413cdf0e10cSrcweir 
414cdf0e10cSrcweir } //  namespace framework
415