diff --git a/framework/inc/classes/framecontainer.hxx b/framework/inc/classes/framecontainer.hxx
index 696843218cb3..10b60ec32a39 100644
--- a/framework/inc/classes/framecontainer.hxx
+++ b/framework/inc/classes/framecontainer.hxx
@@ -2,9 +2,9 @@
*
* $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
* 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
container-items.
- @implements -
@base ThreadHelpBase
- TransactionBase
+ guarantee right initialized lock member during boostrap!
@devstatus ready to use
@threadsafe yes
+ @modified 01.07.2002 14:39, as96863
*//*-*************************************************************************************************************/
-
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:
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @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 -
- *//*-*****************************************************************************************************/
-
+ /// constructor / destructor
+ FrameContainer();
virtual ~FrameContainer();
- /*-****************************************************************************************************//**
- @short append a new frame to the end of container
- @descr The reference must be valid! If it's not, 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!)
+ /// 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;
- @seealso -
-
- @param "xFrame" is the frame to add in container.
- @return -
-
- @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
- 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
- NULL, other way.
-
- @onerror We return NULL!
- *//*-*****************************************************************************************************/
+ /// checks and free memory
+ sal_Bool exist ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const;
+ sal_Bool hasElements( ) const;
+ void clear ( );
+ /// deprecated IndexAccess!
+ sal_uInt32 getCount ( ) const;
css::uno::Reference< css::frame::XFrame > operator[]( sal_uInt32 nIndex ) const;
- /*-****************************************************************************************************//**
- @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 -
- *//*-*****************************************************************************************************/
-
+ /// replacement for deprectaed index access
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > getAllElements() const;
- /*-****************************************************************************************************//**
- @short ask it to get information about existing elements
- @descr No lock must set. We use current container items only.
-
- @seealso -
-
- @param -
- @return sal_True , if one or more elements exist
- 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.
- *//*-*****************************************************************************************************/
+ /// for special feature "async quit timer" of desktop only!
+ void enableQuitTimer ( const css::uno::Reference< css::frame::XDesktop >& xDesktop );
+ void disableQuitTimer( );
+ /// 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;
- //-------------------------------------------------------------------------------------------------------------
- // protected methods
- //-------------------------------------------------------------------------------------------------------------
-
- 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
- sal_True otherway
-
- @onerror -
- *//*-*****************************************************************************************************/
+ //_______________________________________
+ // debug!
#ifdef ENABLE_ASSERTIONS
- private:
+ public:
- //*********************************************************************************************************
- // - 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 )
- );
- }
+ void impldbg_checkForZombie() const;
- //*********************************************************************************************************
- // - 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
- //-------------------------------------------------------------------------------------------------------------
- // private variables
- // (should be private everyway!)
- //-------------------------------------------------------------------------------------------------------------
+}; // class FrameContainer
- private:
+} // namespace framework
- TFrameContainer m_aContainer ; /// list to hold all frames
- 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_
+#endif // #ifndef __FRAMEWORK_CLASSES_FRAMECONTAINER_HXX_
diff --git a/framework/inc/commands.h b/framework/inc/commands.h
index 514f8ac5fe86..f76f5a657fba 100644
--- a/framework/inc/commands.h
+++ b/framework/inc/commands.h
@@ -2,9 +2,9 @@
*
* $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
* 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_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.
diff --git a/framework/source/classes/framecontainer.cxx b/framework/source/classes/framecontainer.cxx
index 1f76835e062c..ce3badcf0d17 100644
--- a/framework/source/classes/framecontainer.cxx
+++ b/framework/source/classes/framecontainer.cxx
@@ -2,9 +2,9 @@
*
* $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
* either of the following licenses
@@ -67,10 +67,6 @@
#include
#endif
-#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONGUARD_HXX_
-#include
-#endif
-
#ifndef __FRAMEWORK_THREADHELP_WRITEGUARD_HXX_
#include
#endif
@@ -79,6 +75,10 @@
#include
#endif
+#ifndef __FRAMEWORK_COMMANDS_HXX_
+#include
+#endif
+
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
@@ -101,11 +101,6 @@
namespace framework{
-using namespace ::std ;
-using namespace ::rtl ;
-using namespace ::com::sun::star::uno ;
-using namespace ::com::sun::star::frame ;
-
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
@@ -118,94 +113,85 @@ using namespace ::com::sun::star::frame ;
// 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()
// 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() )
- , 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()
{
- // 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!
// He can be active for owner=desktop only.
- impl_disableQuitTimer();
+ disableQuitTimer();
// Don't forget to free memory!
- impl_clear();
-
- m_aTransactionManager.setWorkingMode( E_CLOSE );
+ clear();
}
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void FrameContainer::append( const Reference< XFrame >& xFrame )
+/**-***************************************************************************************************************
+ @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.
+
+ @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
- // a) This method is not defined for ALL incoming parameters!
- // b) Warn programmer at already existing elements in container.
- // c) Warn programmer if an already existing frame has no component inside!
- // These frames are created (e.g. by dispatch()) but not used ...
- LOG_ASSERT2( implcp_append( xFrame ), "FrameContainer::append()", "Invalid parameter detected!" )
- LOG_ASSERT2( exist(xFrame)==sal_True, "FrameContainer::append()", "New frame already exist in container!" )
-
- // 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 );
+ if (xFrame.is() && ! exist(xFrame))
+ {
+ /* SAFE { */
+ WriteGuard aWriteLock( m_aLock );
+ m_aContainer.push_back( xFrame );
+ aWriteLock.unlock();
+ /* } SAFE */
+ }
}
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void FrameContainer::remove( const Reference< XFrame >& xFrame )
+/**-***************************************************************************************************************
+ @short remove a frame from the container
+ @descr In case we remove the last frame and our internal special feature (the async quit timer)
+ 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
- // a) This method is not defined for ALL incoming parameters!
- // 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 ----------------------------------------------------------------------------------------------- */
+ /* SAFE { */
+ // write lock neccessary for follwing erase()!
WriteGuard aWriteLock( m_aLock );
- // Search frame and remove it from container if he exist.
- TFrameIterator aSearchedItem = find( m_aContainer.begin(), m_aContainer.end(), xFrame );
- if( aSearchedItem != m_aContainer.end() )
+ TFrameIterator aSearchedItem = ::std::find( m_aContainer.begin(), m_aContainer.end(), xFrame );
+ if (aSearchedItem!=m_aContainer.end())
{
m_aContainer.erase( aSearchedItem );
- // If removed frame the current active frame - reset state variable.
- if( m_xActiveFrame == xFrame )
- {
- m_xActiveFrame = Reference< XFrame >();
- }
+ // If removed frame was the current active frame - reset state variable.
+ if (m_xActiveFrame==xFrame)
+ m_xActiveFrame = css::uno::Reference< css::frame::XFrame >();
// We don't need the write lock any longer ...
// 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
// we must terminate the desktop by using this timer!
- if (
- ( m_aContainer.size() < 1 ) &&
- ( m_rQuitTimer.isValid() == sal_True )
- )
- {
+ if (m_aContainer.size()<1 && m_rQuitTimer.isValid())
m_rQuitTimer->start();
- }
}
+
+ aWriteLock.unlock();
+ /* } SAFE */
}
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool FrameContainer::exist( const Reference< XFrame >& xFrame ) const
+/**-***************************************************************************************************************
+ @short check if the given frame currently exist inside the container
+ @descr -
+
+ @param xFrame
+ reference to the queried frame
+
+ @return if frame is oart of this container
+ 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
- // 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 ----------------------------------------------------------------------------------------------- */
+ /* SAFE { */
ReadGuard aReadLock( m_aLock );
-
- // Search for given frame.
- return( find( m_aContainer.begin(), m_aContainer.end(), xFrame ) != m_aContainer.end() );
+ return( ::std::find( m_aContainer.begin(), m_aContainer.end(), xFrame ) != m_aContainer.end() );
+ /* } SAFE */
}
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
+/**-***************************************************************************************************************
+ @short delete all existing items of the container
+ @descr -
+
+ @threadsafe yes
+ @modified 01.07.2002 15:00,as96863
+ *****************************************************************************************************************/
void FrameContainer::clear()
{
- // Register transaction. Reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ /* SAFE { */
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
{
- // Register transaction. Reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ /* SAFE { */
ReadGuard aReadLock( m_aLock );
-
return( (sal_uInt32)m_aContainer.size() );
+ /* } SAFE */
}
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Reference< XFrame > FrameContainer::operator[]( sal_uInt32 nIndex ) const
+/**-***************************************************************************************************************
+ @short returns one item of this container
+ @descr -
+
+ @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.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- ReadGuard aReadLock( m_aLock );
-
- Reference< XFrame > xFrame;
+ css::uno::Reference< css::frame::XFrame > xFrame;
try
{
// Get element form container WITH automatic test of ranges!
// If index not valid, a out_of_range exception is thrown.
+ /* SAFE { */
+ ReadGuard aReadLock( m_aLock );
xFrame = m_aContainer.at( nIndex );
+ aReadLock.unlock();
+ /* } SAFE */
}
catch( std::out_of_range& )
{
@@ -301,249 +313,254 @@ Reference< XFrame > FrameContainer::operator[]( sal_uInt32 nIndex ) const
return xFrame;
}
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Sequence< Reference< XFrame > > FrameContainer::getAllElements() const
-{
- // Register transaction. Reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+/**-***************************************************************************************************************
+ @short returns a snapshot of all currently existing frames inside this container
+ @descr Should be used to replace the deprecated functions getCount()/operator[]!
- /* 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 );
- sal_uInt32 nCount = (sal_uInt32)m_aContainer.size();
- Sequence< Reference< XFrame > > lElements ( nCount );
+ sal_Int32 nPosition = 0;
+ 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 if container is filled or if he is empty.
+
+ @threadsafe yes
+ @modified 01.07.2002 15:09,as96863
+ *****************************************************************************************************************/
sal_Bool FrameContainer::hasElements() const
{
- // Register transaction. Reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ /* SAFE { */
ReadGuard aReadLock( m_aLock );
-
return( m_aContainer.size()>0 );
+ /* } SAFE */
}
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void FrameContainer::setActive( const Reference< XFrame >& xFrame )
+/**-***************************************************************************************************************
+ @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.
+
+ @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
- // a) This method is not defined for ALL incoming parameters!
- // b) The new active frame MUST exist in container.
- LOG_ASSERT2( implcp_setActive( xFrame ) , "FrameContainer::setActive()", "Invalid parameter detected!" )
- 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." )
-
- // Register transaction. Reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- WriteGuard aWriteLock( m_aLock );
-
- m_xActiveFrame = xFrame;
+ if (xFrame.is() && exist(xFrame))
+ {
+ /* SAFE { */
+ WriteGuard aWriteLock( m_aLock );
+ m_xActiveFrame = xFrame;
+ aWriteLock.unlock();
+ /* } SAFE */
+ }
}
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Reference< XFrame > FrameContainer::getActive() const
-{
- // Register transaction. Reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+/**-***************************************************************************************************************
+ @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
+ from outside decide which of all others should be the new one ...
- /* 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 );
-
return m_xActiveFrame;
+ /* } SAFE */
}
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void FrameContainer::enableQuitTimer( const Reference< XDesktop >& xDesktop )
-{
- // Register transaction. Reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+/**-***************************************************************************************************************
+ @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
+ 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,
+ if any new task was opened. In case it wasn't ... it calls Desktop::terminate().
- /* 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 );
// If no current timer exist - create a new one.
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()
{
- // Register transaction. Reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ /* SAFE { */
WriteGuard aWriteLock( m_aLock );
- // Delete current quit timer.
- // If user wish to create it again he must do it with "enableQuitTimer()".
- impl_disableQuitTimer();
+ if (m_rQuitTimer.isValid())
+ m_rQuitTimer.unbind();
+ /* } SAFE */
}
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Reference< XFrame > FrameContainer::searchOnAllChildrens( const OUString& sName ) const
+/**-***************************************************************************************************************
+ @short implements a simple search based on current container items
+ @descr It can be used for findFrame() and implements a deep down search.
+
+ @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.
- LOG_ASSERT2( implcp_searchDeepDown( sName ), "FrameContainer::searchDeepDown()", "Invalid parameter detected!" )
-
- // Register transaction. Reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ /* SAFE { */
ReadGuard aReadLock( m_aLock );
// 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!
- Reference< XFrame > xSearchedFrame;
+ css::uno::Reference< css::frame::XFrame > xSearchedFrame;
for( TConstFrameIterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
{
- if( (*pIterator)->getName() == sName )
+ if ((*pIterator)->getName()==sName)
{
xSearchedFrame = *pIterator;
break;
}
else
{
- xSearchedFrame = (*pIterator)->findFrame( sName, FrameSearchFlag::CHILDREN );
- if( xSearchedFrame.is() == sal_True )
- {
+ xSearchedFrame = (*pIterator)->findFrame( sName, css::frame::FrameSearchFlag::CHILDREN );
+ if (xSearchedFrame.is())
break;
- }
}
}
+ aReadLock.unlock();
+ /* } SAFE */
return xSearchedFrame;
}
-/*
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Reference< XFrame > FrameContainer::searchFlatDown( const OUString& sName ) const
+
+/**-***************************************************************************************************************
+ @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!
+
+ @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.
- LOG_ASSERT2( implcp_searchFlatDown( sName ), "FrameContainer::searchFlatDown()", "Invalid parameter detected!" )
-
- // Register transaction. Reject wrong calls.
- TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
-
+ /* SAFE { */
ReadGuard aReadLock( m_aLock );
- // Step over all direct child frames first.
- // Even right frame wasn't found, start search at children of direct children.
- Reference< XFrame > xSearchedFrame;
+ css::uno::Reference< css::frame::XFrame > xSearchedFrame;
for( TConstFrameIterator pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
{
- if( (*pIterator)->getName() == sName )
+ if ((*pIterator)->getName()==sName)
{
xSearchedFrame = *pIterator;
break;
}
}
-
- if( xSearchedFrame.is() == sal_False )
- {
- for( pIterator=m_aContainer.begin(); pIterator!=m_aContainer.end(); ++pIterator )
- {
- xSearchedFrame = (*pIterator)->findFrame( sName, FrameSearchFlag::CHILDREN | FrameSearchFlag::SIBLINGS );
- if( xSearchedFrame.is() == sal_True )
- {
- break;
- }
- }
- }
+ aReadLock.unlock();
+ /* } SAFE */
return xSearchedFrame;
}
-*/
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Reference< XFrame > FrameContainer::searchOnDirectChildrens( const OUString& sName ) const
+
+
+/**-***************************************************************************************************************
+ @short special debug mode!
+ @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.
- LOG_ASSERT2( implcp_searchDirectChildren( sName ), "FrameContainer::searchDirectChildren()", "Invalid parameter detected!" )
-
- // 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 )
+ /* SAFE { */
+ ReadGuard aReadLock(m_aLock);
+ for (TConstFrameIterator pItem=m_aContainer.begin(); pItem!=m_aContainer.end(); ++pItem)
{
- if( (*pIterator)->getName() == sName )
+ if ((*pItem)->getComponentWindow().is())
{
- xSearchedFrame = *pIterator;
+ LOG_WARNING("FrameContainer::impldbg_checkForZombie()", "Zombie found! Please check your frame tree ...")
break;
}
}
- return xSearchedFrame;
+ aReadLock.unlock();
+ /* } SAFE */
}
+#endif // #ifdef ENABLE_ASSERTIONS
-//*****************************************************************************************************************
-// 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
+} // namespace framework