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