Files
libreoffice/framework/inc/classes/framecontainer.hxx

223 lines
8.9 KiB
C++
Raw Normal View History

2000-09-18 15:33:13 +00:00
/*************************************************************************
*
* $RCSfile: framecontainer.hxx,v $
*
* $Revision: 1.15 $
2000-09-18 15:33:13 +00:00
*
* last change: $Author: as $ $Date: 2002-07-02 07:23:29 $
2000-09-18 15:33:13 +00:00
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_
#define __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
2001-06-11 09:29:50 +00:00
#ifndef __FRAMEWORK_THREADHELP_THREADHELPBASE_HXX_
#include <threadhelp/threadhelpbase.hxx>
#endif
2001-05-02 12:00:52 +00:00
#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_
#include <threadhelp/transactionbase.hxx>
#endif
2001-03-09 13:42:26 +00:00
#ifndef __FRAMEWORK_CLASSES_TARGETFINDER_HXX_
#include <classes/targetfinder.hxx>
#endif
#ifndef __FRAMEWORK_CLASSES_ASYNCQUIT_HXX_
#include <classes/asyncquit.hxx>
#endif
2000-09-18 15:33:13 +00:00
#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
#include <macros/debug.hxx>
#endif
#ifndef __FRAMEWORK_GENERAL_H_
#include <general.h>
#endif
2000-09-18 15:33:13 +00:00
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_
#include <com/sun/star/frame/XFrame.hpp>
#endif
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
2001-05-21 05:13:00 +00:00
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
2000-09-18 15:33:13 +00:00
#endif
#ifndef __SGI_STL_VECTOR
2001-02-12 12:12:34 +00:00
#include <vector>
2000-09-18 15:33:13 +00:00
#endif
2000-10-19 10:00:38 +00:00
#ifndef _VOS_REF_HXX_
#include <vos/ref.hxx>
#endif
2001-03-09 13:42:26 +00:00
#ifndef _RTL_USTRING_
2001-05-15 04:44:14 +00:00
#include <rtl/ustring.hxx>
2001-03-09 13:42:26 +00:00
#endif
#include <vector>
#include <stdexcept>
#include <algorithm>
2000-09-18 15:33:13 +00:00
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
// exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// exported definitions
//_________________________________________________________________________________________________________________
typedef ::std::vector< css::uno::Reference< css::frame::XFrame > > TFrameContainer ;
typedef TFrameContainer::iterator TFrameIterator ;
typedef TFrameContainer::const_iterator TConstFrameIterator ;
2001-03-09 13:42:26 +00:00
2000-09-18 15:33:13 +00:00
/*-************************************************************************************************************//**
@short implement a container to hold childs of frame, task or desktop
@descr Every object of frame, task or desktop hold reference to his childs. These container is used as helper
to do this. Some helper-classe like OFrames or OTasksAccess use it to. They hold a pointer to an instance
of this class, which is a member of a frame, task or desktop! You can append and remove frames.
It's possible to set one of these frames as active or deactive. You could have full index-access to
container-items.
2000-09-18 15:33:13 +00:00
2001-06-11 09:29:50 +00:00
@base ThreadHelpBase
guarantee right initialized lock member during boostrap!
2000-09-18 15:33:13 +00:00
@devstatus ready to use
@threadsafe yes
@modified 01.07.2002 14:39, as96863
2000-09-18 15:33:13 +00:00
*//*-*************************************************************************************************************/
2001-06-11 09:29:50 +00:00
class FrameContainer : private ThreadHelpBase
2000-09-18 15:33:13 +00:00
{
//_______________________________________
// member
2000-09-18 15:33:13 +00:00
private:
2000-09-18 15:33:13 +00:00
/// list to hold all frames
TFrameContainer m_aContainer;
/// one container item can be the current active frame. Its neccessary for Desktop or Frame implementation.
css::uno::Reference< css::frame::XFrame > m_xActiveFrame;
/// if an instance of this class is used at the desktop and last frame will be removed we must terminate the desktop
::vos::ORef< AsyncQuit > m_rQuitTimer;
2000-09-18 15:33:13 +00:00
//_______________________________________
// interface
2000-09-18 15:33:13 +00:00
public:
2000-09-18 15:33:13 +00:00
/// constructor / destructor
FrameContainer();
2000-09-18 15:33:13 +00:00
virtual ~FrameContainer();
/// add/remove/mark container items
void append ( const css::uno::Reference< css::frame::XFrame >& xFrame );
void remove ( const css::uno::Reference< css::frame::XFrame >& xFrame );
void setActive ( const css::uno::Reference< css::frame::XFrame >& xFrame );
css::uno::Reference< css::frame::XFrame > getActive ( ) const;
2000-09-18 15:33:13 +00:00
/// checks and free memory
sal_Bool exist ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const;
sal_Bool hasElements( ) const;
void clear ( );
2000-09-18 15:33:13 +00:00
/// deprecated IndexAccess!
sal_uInt32 getCount ( ) const;
css::uno::Reference< css::frame::XFrame > operator[]( sal_uInt32 nIndex ) const;
2000-09-18 15:33:13 +00:00
/// replacement for deprectaed index access
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > getAllElements() const;
2000-09-18 15:33:13 +00:00
/// for special feature "async quit timer" of desktop only!
void enableQuitTimer ( const css::uno::Reference< css::frame::XDesktop >& xDesktop );
void disableQuitTimer( );
2001-03-09 13:42:26 +00:00
/// special helper for Frame::findFrame()
css::uno::Reference< css::frame::XFrame > searchOnAllChildrens ( const ::rtl::OUString& sName ) const;
css::uno::Reference< css::frame::XFrame > searchOnDirectChildrens( const ::rtl::OUString& sName ) const;
2001-03-09 13:42:26 +00:00
//_______________________________________
// debug!
2000-09-18 15:33:13 +00:00
#ifdef ENABLE_ASSERTIONS
public:
2000-09-18 15:33:13 +00:00
void impldbg_checkForZombie() const;
2000-09-18 15:33:13 +00:00
#endif // #ifdef ENABLE_ASSERTIONS
2000-09-18 15:33:13 +00:00
}; // class FrameContainer
2000-09-18 15:33:13 +00:00
} // namespace framework
2000-09-18 15:33:13 +00:00
#endif // #ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_