1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_
29*cdf0e10cSrcweir #define __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
32*cdf0e10cSrcweir                with solaris headers ...
33*cdf0e10cSrcweir */
34*cdf0e10cSrcweir #include <vector>
35*cdf0e10cSrcweir #include <stdexcept>
36*cdf0e10cSrcweir #include <algorithm>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
39*cdf0e10cSrcweir //	my own includes
40*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
41*cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx>
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir #ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_
44*cdf0e10cSrcweir #include <threadhelp/transactionbase.hxx>
45*cdf0e10cSrcweir #endif
46*cdf0e10cSrcweir #include <macros/debug.hxx>
47*cdf0e10cSrcweir #include <general.h>
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
50*cdf0e10cSrcweir //	interface includes
51*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
52*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
53*cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp>
54*cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx>
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
57*cdf0e10cSrcweir //	other includes
58*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
59*cdf0e10cSrcweir #include <cppuhelper/weakref.hxx>
60*cdf0e10cSrcweir #include <vos/ref.hxx>
61*cdf0e10cSrcweir #include <rtl/ustring.hxx>
62*cdf0e10cSrcweir #include <vcl/evntpost.hxx>
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
65*cdf0e10cSrcweir //	namespace
66*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir namespace framework{
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
71*cdf0e10cSrcweir //	exported const
72*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
75*cdf0e10cSrcweir //	exported definitions
76*cdf0e10cSrcweir //_________________________________________________________________________________________________________________
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir typedef ::std::vector< css::uno::Reference< css::frame::XFrame > >	TFrameContainer		;
79*cdf0e10cSrcweir typedef TFrameContainer::iterator									TFrameIterator		;
80*cdf0e10cSrcweir typedef TFrameContainer::const_iterator								TConstFrameIterator	;
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir /*-************************************************************************************************************//**
83*cdf0e10cSrcweir     @short          implement a container to hold childs of frame, task or desktop
84*cdf0e10cSrcweir     @descr          Every object of frame, task or desktop hold reference to his childs. These container is used as helper
85*cdf0e10cSrcweir                     to do this. Some helper-classe like OFrames or OTasksAccess use it to. They hold a pointer to an instance
86*cdf0e10cSrcweir                     of this class, which is a member of a frame, task or desktop! You can append and remove frames.
87*cdf0e10cSrcweir                     It's possible to set one of these frames as active or deactive. You could have full index-access to
88*cdf0e10cSrcweir                     container-items.
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir     @base           ThreadHelpBase
91*cdf0e10cSrcweir                         guarantee right initialized lock member during boostrap!
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 	@devstatus		ready to use
94*cdf0e10cSrcweir 	@threadsafe		yes
95*cdf0e10cSrcweir     @modified       01.07.2002 14:39, as96863
96*cdf0e10cSrcweir *//*-*************************************************************************************************************/
97*cdf0e10cSrcweir class FrameContainer : private ThreadHelpBase
98*cdf0e10cSrcweir {
99*cdf0e10cSrcweir     //_______________________________________
100*cdf0e10cSrcweir     // member
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 	private:
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir         /// list to hold all frames
105*cdf0e10cSrcweir         TFrameContainer m_aContainer;
106*cdf0e10cSrcweir         /// one container item can be the current active frame. Its neccessary for Desktop or Frame implementation.
107*cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > m_xActiveFrame;
108*cdf0e10cSrcweir /*DEPRECATEME
109*cdf0e10cSrcweir         /// indicates using of the automatic async quit feature in case last task will be closed
110*cdf0e10cSrcweir         sal_Bool m_bAsyncQuit;
111*cdf0e10cSrcweir         /// used to execute the terminate request asyncronous
112*cdf0e10cSrcweir         ::vcl::EventPoster m_aAsyncCall;
113*cdf0e10cSrcweir         /// used for async quit feature (must be weak to prevent us against strange situations!)
114*cdf0e10cSrcweir         css::uno::WeakReference< css::frame::XDesktop > m_xDesktop;
115*cdf0e10cSrcweir */
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir     //_______________________________________
118*cdf0e10cSrcweir     // interface
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir 	public:
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir         /// constructor / destructor
123*cdf0e10cSrcweir                  FrameContainer();
124*cdf0e10cSrcweir 		virtual ~FrameContainer();
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir         /// add/remove/mark container items
127*cdf0e10cSrcweir         void                                      append     ( const css::uno::Reference< css::frame::XFrame >& xFrame );
128*cdf0e10cSrcweir         void                                      remove     ( const css::uno::Reference< css::frame::XFrame >& xFrame );
129*cdf0e10cSrcweir         void                                      setActive  ( const css::uno::Reference< css::frame::XFrame >& xFrame );
130*cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > getActive  (                                                         ) const;
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir         /// checks and free memory
133*cdf0e10cSrcweir         sal_Bool exist      ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const;
134*cdf0e10cSrcweir         void     clear      (                                                         );
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir         /// deprecated IndexAccess!
137*cdf0e10cSrcweir         sal_uInt32                                getCount  (                   ) const;
138*cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > operator[]( sal_uInt32 nIndex ) const;
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir         /// replacement for deprectaed index access
141*cdf0e10cSrcweir         css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > getAllElements() const;
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir         /// special helper for Frame::findFrame()
144*cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > searchOnAllChildrens   ( const ::rtl::OUString& sName ) const;
145*cdf0e10cSrcweir         css::uno::Reference< css::frame::XFrame > searchOnDirectChildrens( const ::rtl::OUString& sName ) const;
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir }; // class FrameContainer
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir } // namespace framework
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_
152