#i4835# disable quit timer for some more command line arguments
This commit is contained in:
parent
cc0fff0b75
commit
ba8d2e9b6a
@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: framecontainer.hxx,v $
|
* $RCSfile: framecontainer.hxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.14 $
|
* $Revision: 1.15 $
|
||||||
*
|
*
|
||||||
* last change: $Author: as $ $Date: 2002-05-23 12:49:35 $
|
* last change: $Author: as $ $Date: 2002-07-02 07:23:29 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@ -148,419 +148,75 @@ typedef TFrameContainer::const_iterator TConstFrameI
|
|||||||
It's possible to set one of these frames as active or deactive. You could have full index-access to
|
It's possible to set one of these frames as active or deactive. You could have full index-access to
|
||||||
container-items.
|
container-items.
|
||||||
|
|
||||||
@implements -
|
|
||||||
@base ThreadHelpBase
|
@base ThreadHelpBase
|
||||||
TransactionBase
|
guarantee right initialized lock member during boostrap!
|
||||||
|
|
||||||
@devstatus ready to use
|
@devstatus ready to use
|
||||||
@threadsafe yes
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 14:39, as96863
|
||||||
*//*-*************************************************************************************************************/
|
*//*-*************************************************************************************************************/
|
||||||
|
|
||||||
class FrameContainer : private ThreadHelpBase
|
class FrameContainer : private ThreadHelpBase
|
||||||
, private TransactionBase
|
|
||||||
{
|
{
|
||||||
//-------------------------------------------------------------------------------------------------------------
|
//_______________________________________
|
||||||
// public methods
|
// member
|
||||||
//-------------------------------------------------------------------------------------------------------------
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/// 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;
|
||||||
|
|
||||||
|
//_______________________________________
|
||||||
|
// interface
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------
|
/// constructor / destructor
|
||||||
// constructor / destructor
|
FrameContainer();
|
||||||
//---------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short standard constructor
|
|
||||||
@descr This will initialize an empty container.
|
|
||||||
|
|
||||||
@seealso -
|
|
||||||
|
|
||||||
@param -
|
|
||||||
@return -
|
|
||||||
|
|
||||||
@onerror -
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
FrameContainer();
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short standard destructor to delete instance
|
|
||||||
@descr This will clear the container, if programmer forget this.
|
|
||||||
|
|
||||||
@seealso method clear()
|
|
||||||
|
|
||||||
@param -
|
|
||||||
@return -
|
|
||||||
|
|
||||||
@onerror -
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
virtual ~FrameContainer();
|
virtual ~FrameContainer();
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
/// add/remove/mark container items
|
||||||
@short append a new frame to the end of container
|
void append ( const css::uno::Reference< css::frame::XFrame >& xFrame );
|
||||||
@descr The reference must be valid! If it's not, we do nothing.
|
void remove ( const css::uno::Reference< css::frame::XFrame >& xFrame );
|
||||||
If a lock is set, we do nothing to.
|
void setActive ( const css::uno::Reference< css::frame::XFrame >& xFrame );
|
||||||
(In debug version an assertion is thrown to show the programmer possible problems!)
|
css::uno::Reference< css::frame::XFrame > getActive ( ) const;
|
||||||
|
|
||||||
@seealso -
|
/// checks and free memory
|
||||||
|
sal_Bool exist ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const;
|
||||||
@param "xFrame" is the frame to add in container.
|
sal_Bool hasElements( ) const;
|
||||||
@return -
|
void clear ( );
|
||||||
|
|
||||||
@onerror -
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
void append( const css::uno::Reference< css::frame::XFrame >& xFrame );
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short remove an existing frame from the container
|
|
||||||
@descr The reference must be valid! If element not exist in container we do nothing.
|
|
||||||
If a lock is set, we do nothing to.
|
|
||||||
(In debug version an assertion is thrown to show the programmer possible problems!)
|
|
||||||
|
|
||||||
@seealso method clear()
|
|
||||||
|
|
||||||
@param "xFrame" is the frame to remove from the container.
|
|
||||||
@return -
|
|
||||||
|
|
||||||
@onerror -
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
void remove( const css::uno::Reference< css::frame::XFrame >& xFrame );
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short ask for an existing frame in container
|
|
||||||
@descr Use it to get information about existing items in container.
|
|
||||||
The reference must be valid! The lock is ignored! (We do not change the content of container.)
|
|
||||||
|
|
||||||
@seealso -
|
|
||||||
|
|
||||||
@param "xFrame" is the frame to search.
|
|
||||||
@return sal_True , if frame exist<BR>
|
|
||||||
sal_False, other way.
|
|
||||||
|
|
||||||
@onerror We return sal_False.
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
sal_Bool exist( const css::uno::Reference< css::frame::XFrame >& xFrame ) const;
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short clear the container and free memory
|
|
||||||
@descr This will clear the container. If you call this method again and the container is already empty, we do nothing!
|
|
||||||
If a lock is set, we do nothing.
|
|
||||||
(In debug version an assertion is thrown to show the programmer this problem!)
|
|
||||||
|
|
||||||
@seealso method remove()
|
|
||||||
|
|
||||||
@param -
|
|
||||||
@return -
|
|
||||||
|
|
||||||
@onerror -
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
void clear();
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short get count of items in container
|
|
||||||
@descr We ignore the lock - because caller can know these value but he can use it for
|
|
||||||
direct indexaccess only, if a lock is set!
|
|
||||||
|
|
||||||
@seealso -
|
|
||||||
|
|
||||||
@param -
|
|
||||||
@return count of container items.
|
|
||||||
|
|
||||||
@onerror -
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
sal_uInt32 getCount() const;
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short get item of container by index
|
|
||||||
@descr If no lock is set, we return NULL. The index must in range [0 ... count-1]!
|
|
||||||
|
|
||||||
@seealso -
|
|
||||||
|
|
||||||
@param -
|
|
||||||
@return Frame item, if index valid<BR>
|
|
||||||
NULL, other way.
|
|
||||||
|
|
||||||
@onerror We return NULL!
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
|
/// deprecated IndexAccess!
|
||||||
|
sal_uInt32 getCount ( ) const;
|
||||||
css::uno::Reference< css::frame::XFrame > operator[]( sal_uInt32 nIndex ) const;
|
css::uno::Reference< css::frame::XFrame > operator[]( sal_uInt32 nIndex ) const;
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
/// replacement for deprectaed index access
|
||||||
@short get all current items of container as snapshot
|
|
||||||
@descr No lock must set. We return a snapshot only.
|
|
||||||
|
|
||||||
@seealso -
|
|
||||||
|
|
||||||
@param -
|
|
||||||
@return Sequence of frames
|
|
||||||
|
|
||||||
@onerror -
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > getAllElements() const;
|
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > getAllElements() const;
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
/// for special feature "async quit timer" of desktop only!
|
||||||
@short ask it to get information about existing elements
|
void enableQuitTimer ( const css::uno::Reference< css::frame::XDesktop >& xDesktop );
|
||||||
@descr No lock must set. We use current container items only.
|
void disableQuitTimer( );
|
||||||
|
|
||||||
@seealso -
|
|
||||||
|
|
||||||
@param -
|
|
||||||
@return sal_True , if one or more elements exist<BR>
|
|
||||||
sal_False, other way.
|
|
||||||
|
|
||||||
@onerror We return sal_False.
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
sal_Bool hasElements() const;
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short set the current active frame in container
|
|
||||||
@descr Some implementations like Desktop or Frame need an active frame.
|
|
||||||
But this frame must be a child of these objects! Its not possible to hold an extra reference
|
|
||||||
for these special case. Its better to control this rule by the container himself.
|
|
||||||
He know, which frame is child or not.
|
|
||||||
|
|
||||||
@seealso method Desktop::setActiveFrame()
|
|
||||||
@seealso method Frame::setActiveFrame()
|
|
||||||
|
|
||||||
@param "xFrame" must a valid reference to an existing frame in container.
|
|
||||||
@return -
|
|
||||||
|
|
||||||
@onerror If refrence not valid, we throw an assertion!
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
void setActive( const css::uno::Reference< css::frame::XFrame >& xFrame );
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short get the current active frame in container.
|
|
||||||
@descr -
|
|
||||||
|
|
||||||
@seealso method Desktop::getActiveFrame()
|
|
||||||
@seealso method Frame::getActiveFrame()
|
|
||||||
|
|
||||||
@param -
|
|
||||||
@return A valid reference, if an active one exist.
|
|
||||||
A null-reference, other way.
|
|
||||||
|
|
||||||
@onerror We return a null-reference.
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
css::uno::Reference< css::frame::XFrame > getActive() const;
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short Enable or disable automatic termination of desktop if last frame was removed from container
|
|
||||||
@descr Only the desktop should use this functions!
|
|
||||||
|
|
||||||
@seealso class Desktop
|
|
||||||
@seealso class AsyncQuit
|
|
||||||
|
|
||||||
@param "xDesktop", reference to the desktop which sould be terminated on timer end.
|
|
||||||
@return -
|
|
||||||
|
|
||||||
@onerror -
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
void enableQuitTimer ( const css::uno::Reference< css::frame::XDesktop >& xDesktop );
|
|
||||||
void disableQuitTimer ( );
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short implements default searches at children ...
|
|
||||||
@descr You CAN use these implementation or write your own code!
|
|
||||||
With these method we support a search for a target at your children.
|
|
||||||
|
|
||||||
@ATTENTION These methods never create a new tree node!
|
|
||||||
If searched target not exist we return NULL.
|
|
||||||
|
|
||||||
@seealso -
|
|
||||||
|
|
||||||
@param "sTargetName" This must be a non special target name. (_blank _self ... are not allowed! _beamer is a valid name!)
|
|
||||||
@return A reference to an existing frame or null if search failed.
|
|
||||||
|
|
||||||
@onerror A null reference is returned.
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
|
/// special helper for Frame::findFrame()
|
||||||
css::uno::Reference< css::frame::XFrame > searchOnAllChildrens ( const ::rtl::OUString& sName ) const;
|
css::uno::Reference< css::frame::XFrame > searchOnAllChildrens ( const ::rtl::OUString& sName ) const;
|
||||||
css::uno::Reference< css::frame::XFrame > searchOnDirectChildrens( const ::rtl::OUString& sName ) const;
|
css::uno::Reference< css::frame::XFrame > searchOnDirectChildrens( const ::rtl::OUString& sName ) const;
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------
|
//_______________________________________
|
||||||
// protected methods
|
// debug!
|
||||||
//-------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------
|
|
||||||
// private methods
|
|
||||||
//-------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void impl_clear();
|
|
||||||
void impl_disableQuitTimer();
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------
|
|
||||||
// debug methods
|
|
||||||
// (should be private everyway!)
|
|
||||||
//-------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*-****************************************************************************************************//**
|
|
||||||
@short debug-method to check incoming parameter of some other mehods of this class
|
|
||||||
@descr The following methods are used to check parameters for other methods
|
|
||||||
of this class. The return value is used directly for an ASSERT(...).
|
|
||||||
|
|
||||||
@attention We don't need any mutex/lock here. We check incoming parameter only - no internal member!
|
|
||||||
|
|
||||||
@seealso ASSERTs in implementation!
|
|
||||||
|
|
||||||
@param references to checking variables
|
|
||||||
@return sal_False on invalid parameter<BR>
|
|
||||||
sal_True otherway
|
|
||||||
|
|
||||||
@onerror -
|
|
||||||
*//*-*****************************************************************************************************/
|
|
||||||
|
|
||||||
#ifdef ENABLE_ASSERTIONS
|
#ifdef ENABLE_ASSERTIONS
|
||||||
|
|
||||||
private:
|
public:
|
||||||
|
|
||||||
//*********************************************************************************************************
|
void impldbg_checkForZombie() const;
|
||||||
// - check for NULL pointer or invalid references
|
|
||||||
inline sal_Bool implcp_append( const css::uno::Reference< css::frame::XFrame >& xFrame ) const
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
( &xFrame == NULL ) ||
|
|
||||||
( xFrame.is() == sal_False )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//*********************************************************************************************************
|
|
||||||
// - check for NULL pointer or invalid references only
|
|
||||||
// Don't look for Zombies here!
|
|
||||||
inline sal_Bool implcp_remove( const css::uno::Reference< css::frame::XFrame >& xFrame ) const
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
( &xFrame == NULL ) ||
|
|
||||||
( xFrame.is() == sal_False )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//*********************************************************************************************************
|
|
||||||
// - check for NULL pointer or invalid references
|
|
||||||
inline sal_Bool implcp_exist( const css::uno::Reference< css::frame::XFrame >& xFrame ) const
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
( &xFrame == NULL ) ||
|
|
||||||
( xFrame.is() == sal_False )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//*********************************************************************************************************
|
|
||||||
// - check if index out of range
|
|
||||||
inline sal_Bool implcp_IndexOperator( sal_uInt32 nIndex, sal_uInt32 nMax ) const
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
( nIndex < 0 ) ||
|
|
||||||
( nIndex >= nMax )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//*********************************************************************************************************
|
|
||||||
// - check for NULL pointer
|
|
||||||
// - a null reference is allowed - because sometimes we must deactivate path to bottom
|
|
||||||
inline sal_Bool implcp_setActive( const css::uno::Reference< css::frame::XFrame >& xFrame ) const
|
|
||||||
{
|
|
||||||
return( &xFrame == NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
//*********************************************************************************************************
|
|
||||||
// - check for null pointer
|
|
||||||
// - look for special target names ... some of them are not allowed as valid frame name
|
|
||||||
// Attention: "_beamer" is a valid name.
|
|
||||||
inline sal_Bool implcp_searchDeepDown( const ::rtl::OUString& sName ) const
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
( &sName == NULL ) ||
|
|
||||||
( sName == SPECIALTARGET_BLANK ) ||
|
|
||||||
( sName == SPECIALTARGET_SELF ) ||
|
|
||||||
( sName == SPECIALTARGET_TOP ) ||
|
|
||||||
( sName == SPECIALTARGET_PARENT )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//*********************************************************************************************************
|
|
||||||
// - check for null pointer
|
|
||||||
// - look for special target names ... some of them are not allowed as valid frame name
|
|
||||||
// Attention: "_beamer" is a valid name.
|
|
||||||
inline sal_Bool implcp_searchFlatDown( const ::rtl::OUString& sName ) const
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
( &sName == NULL ) ||
|
|
||||||
( sName == SPECIALTARGET_BLANK ) ||
|
|
||||||
( sName == SPECIALTARGET_SELF ) ||
|
|
||||||
( sName == SPECIALTARGET_TOP ) ||
|
|
||||||
( sName == SPECIALTARGET_PARENT )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//*********************************************************************************************************
|
|
||||||
// - check for null pointer
|
|
||||||
// - look for special target names ... some of them are not allowed as valid frame name
|
|
||||||
// Attention: "_beamer" is a valid name.
|
|
||||||
inline sal_Bool implcp_searchDirectChildren( const ::rtl::OUString& sName ) const
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
( &sName == NULL ) ||
|
|
||||||
( sName == SPECIALTARGET_BLANK ) ||
|
|
||||||
( sName == SPECIALTARGET_SELF ) ||
|
|
||||||
( sName == SPECIALTARGET_TOP ) ||
|
|
||||||
( sName == SPECIALTARGET_PARENT )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/*TODO
|
|
||||||
|
|
||||||
This method is not threadsafe ...
|
|
||||||
Correct it!
|
|
||||||
|
|
||||||
//*********************************************************************************************************
|
|
||||||
// Special debug mode.
|
|
||||||
// If these container closed - we should search for created zombie frames before.
|
|
||||||
// Sometimes a frame was inserted which hold no component inside!
|
|
||||||
// They are created by failed dispatch calls ...
|
|
||||||
inline sal_Bool impldbg_existZombie() const
|
|
||||||
{
|
|
||||||
sal_Bool bZombieExist = sal_False;
|
|
||||||
for( TConstFrameIterator pItem=m_aContainer.begin(); pItem!=m_aContainer.end(); ++pItem )
|
|
||||||
{
|
|
||||||
if( (*pItem)->getComponentWindow().is() == sal_False )
|
|
||||||
{
|
|
||||||
bZombieExist = sal_True;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bZombieExist;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#endif // #ifdef ENABLE_ASSERTIONS
|
#endif // #ifdef ENABLE_ASSERTIONS
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------
|
}; // class FrameContainer
|
||||||
// private variables
|
|
||||||
// (should be private everyway!)
|
|
||||||
//-------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
private:
|
} // namespace framework
|
||||||
|
|
||||||
TFrameContainer m_aContainer ; /// list to hold all frames
|
#endif // #ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_
|
||||||
css::uno::Reference< css::frame::XFrame > m_xActiveFrame ; /// one container item can be the current active frame. Its neccessary for Desktop or Frame implementation.
|
|
||||||
::vos::ORef< AsyncQuit > m_rQuitTimer ; /// if an instance of these class used by desktop and last frame will be removed we must terminate the desktop
|
|
||||||
|
|
||||||
}; // class FrameContainer
|
|
||||||
|
|
||||||
} // namespace framework
|
|
||||||
|
|
||||||
#endif // #ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: commands.h,v $
|
* $RCSfile: commands.h,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
*
|
*
|
||||||
* last change: $Author: as $ $Date: 2001-04-11 11:25:21 $
|
* last change: $Author: as $ $Date: 2002-07-02 07:22:42 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@ -91,6 +91,8 @@ namespace framework{
|
|||||||
|
|
||||||
#define COMMAND_PLUGIN DECLARE_ASCII("-plugin" ) /// office is plugged into a browser
|
#define COMMAND_PLUGIN DECLARE_ASCII("-plugin" ) /// office is plugged into a browser
|
||||||
#define COMMAND_HEADLESS DECLARE_ASCII("-headless" ) /// office runs in headless mode for scripting
|
#define COMMAND_HEADLESS DECLARE_ASCII("-headless" ) /// office runs in headless mode for scripting
|
||||||
|
#define COMMAND_INVISIBLE DECLARE_ASCII("-invisible" ) /// office runs in invisible mode which supress splash screen and first empry document
|
||||||
|
#define COMMAND_SERVER DECLARE_ASCII("-server" ) /// office runs as server
|
||||||
|
|
||||||
/*-************************************************************************************************************//**
|
/*-************************************************************************************************************//**
|
||||||
@short This method parse command line of office and search for any argument.
|
@short This method parse command line of office and search for any argument.
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: framecontainer.cxx,v $
|
* $RCSfile: framecontainer.cxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.16 $
|
* $Revision: 1.17 $
|
||||||
*
|
*
|
||||||
* last change: $Author: as $ $Date: 2002-05-23 12:51:21 $
|
* last change: $Author: as $ $Date: 2002-07-02 07:25:01 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to the terms of
|
* The Contents of this file are made available subject to the terms of
|
||||||
* either of the following licenses
|
* either of the following licenses
|
||||||
@ -67,10 +67,6 @@
|
|||||||
#include <classes/framecontainer.hxx>
|
#include <classes/framecontainer.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONGUARD_HXX_
|
|
||||||
#include <threadhelp/transactionguard.hxx>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __FRAMEWORK_THREADHELP_WRITEGUARD_HXX_
|
#ifndef __FRAMEWORK_THREADHELP_WRITEGUARD_HXX_
|
||||||
#include <threadhelp/writeguard.hxx>
|
#include <threadhelp/writeguard.hxx>
|
||||||
#endif
|
#endif
|
||||||
@ -79,6 +75,10 @@
|
|||||||
#include <threadhelp/readguard.hxx>
|
#include <threadhelp/readguard.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __FRAMEWORK_COMMANDS_HXX_
|
||||||
|
#include <commands.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
//_________________________________________________________________________________________________________________
|
//_________________________________________________________________________________________________________________
|
||||||
// interface includes
|
// interface includes
|
||||||
//_________________________________________________________________________________________________________________
|
//_________________________________________________________________________________________________________________
|
||||||
@ -101,11 +101,6 @@
|
|||||||
|
|
||||||
namespace framework{
|
namespace framework{
|
||||||
|
|
||||||
using namespace ::std ;
|
|
||||||
using namespace ::rtl ;
|
|
||||||
using namespace ::com::sun::star::uno ;
|
|
||||||
using namespace ::com::sun::star::frame ;
|
|
||||||
|
|
||||||
//_________________________________________________________________________________________________________________
|
//_________________________________________________________________________________________________________________
|
||||||
// non exported const
|
// non exported const
|
||||||
//_________________________________________________________________________________________________________________
|
//_________________________________________________________________________________________________________________
|
||||||
@ -118,94 +113,85 @@ using namespace ::com::sun::star::frame ;
|
|||||||
// declarations
|
// declarations
|
||||||
//_________________________________________________________________________________________________________________
|
//_________________________________________________________________________________________________________________
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// constructor
|
@short initialize an empty container
|
||||||
//*****************************************************************************************************************
|
@descr The container will be empty then - special features (e.g. the async quit timer) are disabled.
|
||||||
|
|
||||||
|
@threadsafe not neccessary - its not a singleton
|
||||||
|
@modified 01.07.2002 14:42,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
FrameContainer::FrameContainer()
|
FrameContainer::FrameContainer()
|
||||||
// initialize base classes first.
|
// initialize base classes first.
|
||||||
// Order is neccessary for right initilization of his and OUR member ... m_aLock, m_aTransactionManager ...
|
// Order is neccessary for right initilization of his and OUR member ... m_aLock
|
||||||
: ThreadHelpBase ( &Application::GetSolarMutex() )
|
: ThreadHelpBase ( &Application::GetSolarMutex() )
|
||||||
, TransactionBase( )
|
|
||||||
{
|
{
|
||||||
// Make object ready for working.
|
|
||||||
// change working mode from E_INIT to E_WORK
|
|
||||||
// We don't must look for current set modi -
|
|
||||||
// a ctor couldn't be called more then ones ... I think so :-)
|
|
||||||
m_aTransactionManager.setWorkingMode( E_WORK );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// destructor
|
@short deinitialize may a filled container
|
||||||
//*****************************************************************************************************************
|
@descr Special features (if the currently are running) will be dsiabled and we free all used other ressources.
|
||||||
|
|
||||||
|
@threadsafe not neccessary - its not a singleton
|
||||||
|
@modified 01.07.2002 14:43,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
FrameContainer::~FrameContainer()
|
FrameContainer::~FrameContainer()
|
||||||
{
|
{
|
||||||
// Disable object for working!
|
|
||||||
// All further requests will be refused ...
|
|
||||||
// but I think it's alittle bit superflous by using in dtor ...
|
|
||||||
// May be - it's neccessary?
|
|
||||||
// So we wait for current working reader/writer till they finish her work.
|
|
||||||
m_aTransactionManager.setWorkingMode( E_BEFORECLOSE );
|
|
||||||
|
|
||||||
// Disable possible active quit timer!
|
// Disable possible active quit timer!
|
||||||
// He can be active for owner=desktop only.
|
// He can be active for owner=desktop only.
|
||||||
impl_disableQuitTimer();
|
disableQuitTimer();
|
||||||
// Don't forget to free memory!
|
// Don't forget to free memory!
|
||||||
impl_clear();
|
clear();
|
||||||
|
|
||||||
m_aTransactionManager.setWorkingMode( E_CLOSE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short append a new frame to the container
|
||||||
//*****************************************************************************************************************
|
@descr We accept the incoming frame only, if it is a valid reference and dosnt exist already.
|
||||||
void FrameContainer::append( const Reference< XFrame >& xFrame )
|
|
||||||
|
@param xFrame
|
||||||
|
frame, which should be added to this container
|
||||||
|
Must be a valid reference.
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 14:44,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
|
void FrameContainer::append( const css::uno::Reference< css::frame::XFrame >& xFrame )
|
||||||
{
|
{
|
||||||
// Safe impossible cases
|
if (xFrame.is() && ! exist(xFrame))
|
||||||
// a) This method is not defined for ALL incoming parameters!
|
{
|
||||||
// b) Warn programmer at already existing elements in container.
|
/* SAFE { */
|
||||||
// c) Warn programmer if an already existing frame has no component inside!
|
WriteGuard aWriteLock( m_aLock );
|
||||||
// These frames are created (e.g. by dispatch()) but not used ...
|
m_aContainer.push_back( xFrame );
|
||||||
LOG_ASSERT2( implcp_append( xFrame ), "FrameContainer::append()", "Invalid parameter detected!" )
|
aWriteLock.unlock();
|
||||||
LOG_ASSERT2( exist(xFrame)==sal_True, "FrameContainer::append()", "New frame already exist in container!" )
|
/* } SAFE */
|
||||||
|
}
|
||||||
// Register transaction. Reject wrong calls.
|
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
|
||||||
WriteGuard aWriteLock( m_aLock );
|
|
||||||
|
|
||||||
// Append new frame to container.
|
|
||||||
m_aContainer.push_back( xFrame );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short remove a frame from the container
|
||||||
//*****************************************************************************************************************
|
@descr In case we remove the last frame and our internal special feature (the async quit timer)
|
||||||
void FrameContainer::remove( const Reference< XFrame >& xFrame )
|
was enabled by the desktop instance, we start it.
|
||||||
|
|
||||||
|
@param xFrame
|
||||||
|
frame, which should be deleted from this container
|
||||||
|
Must be a valid reference.
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 14:52,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
|
void FrameContainer::remove( const css::uno::Reference< css::frame::XFrame >& xFrame )
|
||||||
{
|
{
|
||||||
// Safe impossible cases
|
/* SAFE { */
|
||||||
// a) This method is not defined for ALL incoming parameters!
|
// write lock neccessary for follwing erase()!
|
||||||
// b) Warn programmer at non existing elements in container.
|
|
||||||
LOG_ASSERT2( implcp_remove( xFrame ) , "FrameContainer::remove()", "Invalid parameter detected!" )
|
|
||||||
LOG_ASSERT2( exist(xFrame)==sal_False , "FrameContainer::remove()", "Frame to remove not exist in container!" )
|
|
||||||
|
|
||||||
// Register transaction. Reject wrong calls.
|
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
|
||||||
WriteGuard aWriteLock( m_aLock );
|
WriteGuard aWriteLock( m_aLock );
|
||||||
|
|
||||||
// Search frame and remove it from container if he exist.
|
TFrameIterator aSearchedItem = ::std::find( m_aContainer.begin(), m_aContainer.end(), xFrame );
|
||||||
TFrameIterator aSearchedItem = find( m_aContainer.begin(), m_aContainer.end(), xFrame );
|
if (aSearchedItem!=m_aContainer.end())
|
||||||
if( aSearchedItem != m_aContainer.end() )
|
|
||||||
{
|
{
|
||||||
m_aContainer.erase( aSearchedItem );
|
m_aContainer.erase( aSearchedItem );
|
||||||
|
|
||||||
// If removed frame the current active frame - reset state variable.
|
// If removed frame was the current active frame - reset state variable.
|
||||||
if( m_xActiveFrame == xFrame )
|
if (m_xActiveFrame==xFrame)
|
||||||
{
|
m_xActiveFrame = css::uno::Reference< css::frame::XFrame >();
|
||||||
m_xActiveFrame = Reference< XFrame >();
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't need the write lock any longer ...
|
// We don't need the write lock any longer ...
|
||||||
// downgrade to read access.
|
// downgrade to read access.
|
||||||
@ -213,84 +199,110 @@ void FrameContainer::remove( const Reference< XFrame >& xFrame )
|
|||||||
|
|
||||||
// If last frame was removed and special quit timer is enabled by the desktop
|
// If last frame was removed and special quit timer is enabled by the desktop
|
||||||
// we must terminate the desktop by using this timer!
|
// we must terminate the desktop by using this timer!
|
||||||
if (
|
if (m_aContainer.size()<1 && m_rQuitTimer.isValid())
|
||||||
( m_aContainer.size() < 1 ) &&
|
|
||||||
( m_rQuitTimer.isValid() == sal_True )
|
|
||||||
)
|
|
||||||
{
|
|
||||||
m_rQuitTimer->start();
|
m_rQuitTimer->start();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aWriteLock.unlock();
|
||||||
|
/* } SAFE */
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short check if the given frame currently exist inside the container
|
||||||
//*****************************************************************************************************************
|
@descr -
|
||||||
sal_Bool FrameContainer::exist( const Reference< XFrame >& xFrame ) const
|
|
||||||
|
@param xFrame
|
||||||
|
reference to the queried frame
|
||||||
|
|
||||||
|
@return <TRUE/> if frame is oart of this container
|
||||||
|
<FALSE/> otherwhise
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 14:55,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
|
sal_Bool FrameContainer::exist( const css::uno::Reference< css::frame::XFrame >& xFrame ) const
|
||||||
{
|
{
|
||||||
// Safe impossible cases
|
/* SAFE { */
|
||||||
// This method is not defined for ALL incoming parameters!
|
|
||||||
LOG_ASSERT2( implcp_exist( xFrame ), "FrameContainer::exist()", "Invalid parameter detected!" )
|
|
||||||
|
|
||||||
// Register transaction. Reject wrong calls.
|
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
|
||||||
ReadGuard aReadLock( m_aLock );
|
ReadGuard aReadLock( m_aLock );
|
||||||
|
return( ::std::find( m_aContainer.begin(), m_aContainer.end(), xFrame ) != m_aContainer.end() );
|
||||||
// Search for given frame.
|
/* } SAFE */
|
||||||
return( find( m_aContainer.begin(), m_aContainer.end(), xFrame ) != m_aContainer.end() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short delete all existing items of the container
|
||||||
//*****************************************************************************************************************
|
@descr -
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 15:00,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
void FrameContainer::clear()
|
void FrameContainer::clear()
|
||||||
{
|
{
|
||||||
// Register transaction. Reject wrong calls.
|
/* SAFE { */
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
|
||||||
WriteGuard aWriteLock( m_aLock );
|
WriteGuard aWriteLock( m_aLock );
|
||||||
|
|
||||||
impl_clear();
|
// Clear the container ...
|
||||||
|
m_aContainer.clear();
|
||||||
|
// ... and don't forget to reset the active frame.
|
||||||
|
// Its an reference to a valid container-item.
|
||||||
|
// But no container item => no active frame!
|
||||||
|
m_xActiveFrame = css::uno::Reference< css::frame::XFrame >();
|
||||||
|
// If special quit timer is used - we must terminate the desktop.
|
||||||
|
// He is the owner of this container and can't work without any visible tasks/frames!
|
||||||
|
if (m_rQuitTimer.isValid())
|
||||||
|
m_rQuitTimer->start();
|
||||||
|
|
||||||
|
aWriteLock.unlock();
|
||||||
|
/* } SAFE */
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short returns count of all current existing frames
|
||||||
//*****************************************************************************************************************
|
@descr -
|
||||||
|
|
||||||
|
@deprecated This value can't be guaranteed for multithreading environments.
|
||||||
|
So it will be marked as deprecated and should be replaced by "getAllElements()".
|
||||||
|
|
||||||
|
@return the count of existing container items
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 15:00,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
sal_uInt32 FrameContainer::getCount() const
|
sal_uInt32 FrameContainer::getCount() const
|
||||||
{
|
{
|
||||||
// Register transaction. Reject wrong calls.
|
/* SAFE { */
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
|
||||||
ReadGuard aReadLock( m_aLock );
|
ReadGuard aReadLock( m_aLock );
|
||||||
|
|
||||||
return( (sal_uInt32)m_aContainer.size() );
|
return( (sal_uInt32)m_aContainer.size() );
|
||||||
|
/* } SAFE */
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short returns one item of this container
|
||||||
//*****************************************************************************************************************
|
@descr -
|
||||||
Reference< XFrame > FrameContainer::operator[]( sal_uInt32 nIndex ) const
|
|
||||||
|
@deprecated This value can't be guaranteed for multithreading environments.
|
||||||
|
So it will be marked as deprecated and should be replaced by "getAllElements()".
|
||||||
|
|
||||||
|
@param nIndex
|
||||||
|
a valud between 0 and (getCount()-1) to adress one container item
|
||||||
|
|
||||||
|
@return a reference to a frame inside the container, which match with given index
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 15:03,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
|
css::uno::Reference< css::frame::XFrame > FrameContainer::operator[]( sal_uInt32 nIndex ) const
|
||||||
{
|
{
|
||||||
// Safe impossible cases
|
|
||||||
// a) This method is not defined for ALL incoming parameters!
|
|
||||||
LOG_ASSERT2( implcp_IndexOperator( nIndex, getCount() ), "FrameContainer::operator[]()", "Invalid parameter detected!" )
|
|
||||||
|
|
||||||
// Register transaction. Reject wrong calls.
|
css::uno::Reference< css::frame::XFrame > xFrame;
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
|
||||||
ReadGuard aReadLock( m_aLock );
|
|
||||||
|
|
||||||
Reference< XFrame > xFrame;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Get element form container WITH automatic test of ranges!
|
// Get element form container WITH automatic test of ranges!
|
||||||
// If index not valid, a out_of_range exception is thrown.
|
// If index not valid, a out_of_range exception is thrown.
|
||||||
|
/* SAFE { */
|
||||||
|
ReadGuard aReadLock( m_aLock );
|
||||||
xFrame = m_aContainer.at( nIndex );
|
xFrame = m_aContainer.at( nIndex );
|
||||||
|
aReadLock.unlock();
|
||||||
|
/* } SAFE */
|
||||||
}
|
}
|
||||||
catch( std::out_of_range& )
|
catch( std::out_of_range& )
|
||||||
{
|
{
|
||||||
@ -301,249 +313,254 @@ Reference< XFrame > FrameContainer::operator[]( sal_uInt32 nIndex ) const
|
|||||||
return xFrame;
|
return xFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short returns a snapshot of all currently existing frames inside this container
|
||||||
//*****************************************************************************************************************
|
@descr Should be used to replace the deprecated functions getCount()/operator[]!
|
||||||
Sequence< Reference< XFrame > > FrameContainer::getAllElements() const
|
|
||||||
{
|
|
||||||
// Register transaction. Reject wrong calls.
|
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
@return a list of all frame refrences inside this container
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 15:09,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
|
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > FrameContainer::getAllElements() const
|
||||||
|
{
|
||||||
|
/* SAFE { */
|
||||||
ReadGuard aReadLock( m_aLock );
|
ReadGuard aReadLock( m_aLock );
|
||||||
|
|
||||||
sal_uInt32 nCount = (sal_uInt32)m_aContainer.size();
|
sal_Int32 nPosition = 0;
|
||||||
Sequence< Reference< XFrame > > lElements ( nCount );
|
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > lElements ( (sal_uInt32)m_aContainer.size() );
|
||||||
|
for (TConstFrameIterator pItem=m_aContainer.begin(); pItem!=m_aContainer.end(); ++pItem)
|
||||||
|
lElements[nPosition++] = *pItem;
|
||||||
|
|
||||||
for( sal_uInt32 nPosition=0; nPosition<nCount; ++nPosition )
|
aReadLock.unlock();
|
||||||
{
|
/* } SAFE */
|
||||||
lElements[nPosition] = m_aContainer[nPosition];
|
|
||||||
}
|
|
||||||
|
|
||||||
return lElements;
|
return lElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short return state information, if container is empty or not
|
||||||
//*****************************************************************************************************************
|
@descr -
|
||||||
|
|
||||||
|
@return <TRUE/> if container is filled or <FALSE/> if he is empty.
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 15:09,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
sal_Bool FrameContainer::hasElements() const
|
sal_Bool FrameContainer::hasElements() const
|
||||||
{
|
{
|
||||||
// Register transaction. Reject wrong calls.
|
/* SAFE { */
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
|
||||||
ReadGuard aReadLock( m_aLock );
|
ReadGuard aReadLock( m_aLock );
|
||||||
|
|
||||||
return( m_aContainer.size()>0 );
|
return( m_aContainer.size()>0 );
|
||||||
|
/* } SAFE */
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short set the given frame as the new active one inside this container
|
||||||
//*****************************************************************************************************************
|
@descr We accept this frame only, if it's already a part of this container.
|
||||||
void FrameContainer::setActive( const Reference< XFrame >& xFrame )
|
|
||||||
|
@param xFrame
|
||||||
|
reference to the new active frame
|
||||||
|
Must be a valid reference and already part of this container.
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 15:11,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
|
void FrameContainer::setActive( const css::uno::Reference< css::frame::XFrame >& xFrame )
|
||||||
{
|
{
|
||||||
// Safe impossible cases
|
if (xFrame.is() && exist(xFrame))
|
||||||
// a) This method is not defined for ALL incoming parameters!
|
{
|
||||||
// b) The new active frame MUST exist in container.
|
/* SAFE { */
|
||||||
LOG_ASSERT2( implcp_setActive( xFrame ) , "FrameContainer::setActive()", "Invalid parameter detected!" )
|
WriteGuard aWriteLock( m_aLock );
|
||||||
LOG_ASSERT2( xFrame.is()==sal_True && exist(xFrame)==sal_False , "FrameContainer::setActive()", "The new active frame is not a member of current container!You cant activate it." )
|
m_xActiveFrame = xFrame;
|
||||||
|
aWriteLock.unlock();
|
||||||
// Register transaction. Reject wrong calls.
|
/* } SAFE */
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
}
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
|
||||||
WriteGuard aWriteLock( m_aLock );
|
|
||||||
|
|
||||||
m_xActiveFrame = xFrame;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short return sthe current active frame of this container
|
||||||
//*****************************************************************************************************************
|
@descr Value can be null in case the frame was removed from the container and nobody
|
||||||
Reference< XFrame > FrameContainer::getActive() const
|
from outside decide which of all others should be the new one ...
|
||||||
{
|
|
||||||
// Register transaction. Reject wrong calls.
|
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
@return a reference to the current active frame
|
||||||
|
Value can be NULL!
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 15:11,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
|
css::uno::Reference< css::frame::XFrame > FrameContainer::getActive() const
|
||||||
|
{
|
||||||
|
/* SAFE { */
|
||||||
ReadGuard aReadLock( m_aLock );
|
ReadGuard aReadLock( m_aLock );
|
||||||
|
|
||||||
return m_xActiveFrame;
|
return m_xActiveFrame;
|
||||||
|
/* } SAFE */
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short enables the async quit timer, which terminates the office if last task will be closed
|
||||||
//*****************************************************************************************************************
|
@descr If the last visible task will gone, nobody shows any UI then. But without any UI the user
|
||||||
void FrameContainer::enableQuitTimer( const Reference< XDesktop >& xDesktop )
|
has no chance to quit the application realy. So we must shutdown by ourself.
|
||||||
{
|
We do that by an async quit timer, which will be initialized and check after hi times out,
|
||||||
// Register transaction. Reject wrong calls.
|
if any new task was opened. In case it wasn't ... it calls Desktop::terminate().
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
But note: It's not neccessary to start this timer if using the office doesn't require it.
|
||||||
|
e.g. the command line parameters "-invisible", -headless" starts the office in a server mode.
|
||||||
|
In this case the outside user controls the lifetime of it and must terminate it manually.
|
||||||
|
|
||||||
|
@param xDesktop
|
||||||
|
only the child frame container of the desktop instance can use this special quit timer
|
||||||
|
Because only top level frames are used for cehcking.
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 14:30,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
|
void FrameContainer::enableQuitTimer( const css::uno::Reference< css::frame::XDesktop >& xDesktop )
|
||||||
|
{
|
||||||
|
/* SAFE { */
|
||||||
WriteGuard aWriteLock( m_aLock );
|
WriteGuard aWriteLock( m_aLock );
|
||||||
|
|
||||||
// If no current timer exist - create a new one.
|
// If no current timer exist - create a new one.
|
||||||
if( m_rQuitTimer.isEmpty() == sal_True )
|
if( m_rQuitTimer.isEmpty() == sal_True )
|
||||||
{
|
{
|
||||||
m_rQuitTimer.bind( new AsyncQuit( xDesktop ) );
|
// How can we distinguish between the different office modes?
|
||||||
|
// a) Office is plugged if command argument "-plugin" could be detected. => timeout = 2 min
|
||||||
|
// b) Office runs in special "server" mode if "-headless", "-invisible" or "-server" could be detected. => timout disabled!
|
||||||
|
// c) Otherwise office runs in normal mode. => timeout = 5 sec
|
||||||
|
|
||||||
|
// Parse command line for right parameter.
|
||||||
|
if( c_existCommand( COMMAND_PLUGIN ) == sal_True )
|
||||||
|
{
|
||||||
|
m_rQuitTimer.bind( new AsyncQuit( xDesktop, E_PLUGIN ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if(
|
||||||
|
! c_existCommand( COMMAND_HEADLESS ) &&
|
||||||
|
! c_existCommand( COMMAND_INVISIBLE ) &&
|
||||||
|
! c_existCommand( COMMAND_SERVER )
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_rQuitTimer.bind( new AsyncQuit( xDesktop, E_FATOFFICE ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
/* } SAFE */
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short disable the async quit timer again
|
||||||
//*****************************************************************************************************************
|
@descr Delete current quit timer.
|
||||||
|
If user wish to create it again he must do it with "enableQuitTimer()".
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 14:37,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
void FrameContainer::disableQuitTimer()
|
void FrameContainer::disableQuitTimer()
|
||||||
{
|
{
|
||||||
// Register transaction. Reject wrong calls.
|
/* SAFE { */
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
|
||||||
WriteGuard aWriteLock( m_aLock );
|
WriteGuard aWriteLock( m_aLock );
|
||||||
|
|
||||||
// Delete current quit timer.
|
if (m_rQuitTimer.isValid())
|
||||||
// If user wish to create it again he must do it with "enableQuitTimer()".
|
m_rQuitTimer.unbind();
|
||||||
impl_disableQuitTimer();
|
/* } SAFE */
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short implements a simple search based on current container items
|
||||||
//*****************************************************************************************************************
|
@descr It can be used for findFrame() and implements a deep down search.
|
||||||
Reference< XFrame > FrameContainer::searchOnAllChildrens( const OUString& sName ) const
|
|
||||||
|
@param sName
|
||||||
|
target name, which is searched
|
||||||
|
|
||||||
|
@return reference to the found frame or NULL if not.
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 15:22,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
|
css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnAllChildrens( const ::rtl::OUString& sName ) const
|
||||||
{
|
{
|
||||||
// Check incoming parameter.
|
/* SAFE { */
|
||||||
LOG_ASSERT2( implcp_searchDeepDown( sName ), "FrameContainer::searchDeepDown()", "Invalid parameter detected!" )
|
|
||||||
|
|
||||||
// Register transaction. Reject wrong calls.
|
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
|
||||||
ReadGuard aReadLock( m_aLock );
|
ReadGuard aReadLock( m_aLock );
|
||||||
|
|
||||||
// Step over all child frames. But if direct child isn't the right one search on his children first - before
|
// Step over all child frames. But if direct child isn't the right one search on his children first - before
|
||||||
// you go to next direct child of this container!
|
// you go to next direct child of this container!
|
||||||
Reference< XFrame > xSearchedFrame;
|
css::uno::Reference< css::frame::XFrame > xSearchedFrame;
|
||||||
for( TConstFrameIterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
|
for( TConstFrameIterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
|
||||||
{
|
{
|
||||||
if( (*pIterator)->getName() == sName )
|
if ((*pIterator)->getName()==sName)
|
||||||
{
|
{
|
||||||
xSearchedFrame = *pIterator;
|
xSearchedFrame = *pIterator;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xSearchedFrame = (*pIterator)->findFrame( sName, FrameSearchFlag::CHILDREN );
|
xSearchedFrame = (*pIterator)->findFrame( sName, css::frame::FrameSearchFlag::CHILDREN );
|
||||||
if( xSearchedFrame.is() == sal_True )
|
if (xSearchedFrame.is())
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
aReadLock.unlock();
|
||||||
|
/* } SAFE */
|
||||||
return xSearchedFrame;
|
return xSearchedFrame;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
//*****************************************************************************************************************
|
/**-***************************************************************************************************************
|
||||||
// public method
|
@short implements a simple search based on current container items
|
||||||
//*****************************************************************************************************************
|
@descr It can be used for findFrame() and search on members of this container only!
|
||||||
Reference< XFrame > FrameContainer::searchFlatDown( const OUString& sName ) const
|
|
||||||
|
@param sName
|
||||||
|
target name, which is searched
|
||||||
|
|
||||||
|
@return reference to the found frame or NULL if not.
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 15:22,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
|
css::uno::Reference< css::frame::XFrame > FrameContainer::searchOnDirectChildrens( const ::rtl::OUString& sName ) const
|
||||||
{
|
{
|
||||||
// Check incoming parameter.
|
/* SAFE { */
|
||||||
LOG_ASSERT2( implcp_searchFlatDown( sName ), "FrameContainer::searchFlatDown()", "Invalid parameter detected!" )
|
|
||||||
|
|
||||||
// Register transaction. Reject wrong calls.
|
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
ReadGuard aReadLock( m_aLock );
|
ReadGuard aReadLock( m_aLock );
|
||||||
|
|
||||||
// Step over all direct child frames first.
|
css::uno::Reference< css::frame::XFrame > xSearchedFrame;
|
||||||
// Even right frame wasn't found, start search at children of direct children.
|
|
||||||
Reference< XFrame > xSearchedFrame;
|
|
||||||
for( TConstFrameIterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
|
for( TConstFrameIterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
|
||||||
{
|
{
|
||||||
if( (*pIterator)->getName() == sName )
|
if ((*pIterator)->getName()==sName)
|
||||||
{
|
{
|
||||||
xSearchedFrame = *pIterator;
|
xSearchedFrame = *pIterator;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
aReadLock.unlock();
|
||||||
if( xSearchedFrame.is() == sal_False )
|
/* } SAFE */
|
||||||
{
|
|
||||||
for( pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
|
|
||||||
{
|
|
||||||
xSearchedFrame = (*pIterator)->findFrame( sName, FrameSearchFlag::CHILDREN | FrameSearchFlag::SIBLINGS );
|
|
||||||
if( xSearchedFrame.is() == sal_True )
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return xSearchedFrame;
|
return xSearchedFrame;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
//*****************************************************************************************************************
|
|
||||||
// public method
|
/**-***************************************************************************************************************
|
||||||
//*****************************************************************************************************************
|
@short special debug mode!
|
||||||
Reference< XFrame > FrameContainer::searchOnDirectChildrens( const OUString& sName ) const
|
@descr Sometimes frames will be inserted in this container which hold no component inside!
|
||||||
|
Or they will be empty after inserting. ALLOWED FOR DEBUG ONLY!
|
||||||
|
We show assertion then.
|
||||||
|
|
||||||
|
@threadsafe yes
|
||||||
|
@modified 01.07.2002 15:39,as96863
|
||||||
|
*****************************************************************************************************************/
|
||||||
|
|
||||||
|
#ifdef ENABLE_ASSERTIONS
|
||||||
|
void FrameContainer::impldbg_checkForZombie() const
|
||||||
{
|
{
|
||||||
// Check incoming parameter.
|
/* SAFE { */
|
||||||
LOG_ASSERT2( implcp_searchDirectChildren( sName ), "FrameContainer::searchDirectChildren()", "Invalid parameter detected!" )
|
ReadGuard aReadLock(m_aLock);
|
||||||
|
for (TConstFrameIterator pItem=m_aContainer.begin(); pItem!=m_aContainer.end(); ++pItem)
|
||||||
// Register transaction. Reject wrong calls.
|
|
||||||
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
|
|
||||||
|
|
||||||
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
|
|
||||||
ReadGuard aReadLock( m_aLock );
|
|
||||||
|
|
||||||
// Step over all current container items and search for right target.
|
|
||||||
Reference< XFrame > xSearchedFrame;
|
|
||||||
for( TConstFrameIterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
|
|
||||||
{
|
{
|
||||||
if( (*pIterator)->getName() == sName )
|
if ((*pItem)->getComponentWindow().is())
|
||||||
{
|
{
|
||||||
xSearchedFrame = *pIterator;
|
LOG_WARNING("FrameContainer::impldbg_checkForZombie()", "Zombie found! Please check your frame tree ...")
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return xSearchedFrame;
|
aReadLock.unlock();
|
||||||
|
/* } SAFE */
|
||||||
}
|
}
|
||||||
|
#endif // #ifdef ENABLE_ASSERTIONS
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
} // namespace framework
|
||||||
// private method
|
|
||||||
//*****************************************************************************************************************
|
|
||||||
void FrameContainer::impl_clear()
|
|
||||||
{
|
|
||||||
/*ATTENTION:
|
|
||||||
Don't use any lock here ... because our "owner" should make it threadsafe!
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Clear the container ...
|
|
||||||
m_aContainer.erase( m_aContainer.begin(), m_aContainer.end() );
|
|
||||||
m_aContainer.clear();
|
|
||||||
// ... and don't forget to reset the active frame.
|
|
||||||
// Its an reference to a valid container-item.
|
|
||||||
// But no container item => no active frame!
|
|
||||||
m_xActiveFrame = Reference< XFrame >();
|
|
||||||
// If special quit timer is used - we must terminate the desktop.
|
|
||||||
// He is the owner of this container and can't work without any visible tasks/frames!
|
|
||||||
if( m_rQuitTimer.isValid() == sal_True )
|
|
||||||
{
|
|
||||||
m_rQuitTimer->start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//*****************************************************************************************************************
|
|
||||||
// private method
|
|
||||||
//*****************************************************************************************************************
|
|
||||||
void FrameContainer::impl_disableQuitTimer()
|
|
||||||
{
|
|
||||||
/*ATTENTION:
|
|
||||||
Don't use any lock here ... because our "owner" should make it threadsafe!
|
|
||||||
*/
|
|
||||||
|
|
||||||
if( m_rQuitTimer.isValid() == sal_True )
|
|
||||||
{
|
|
||||||
m_rQuitTimer.unbind();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace framework
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user