summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schlüns <as@openoffice.org>2000-10-16 10:52:06 +0000
committerAndreas Schlüns <as@openoffice.org>2000-10-16 10:52:06 +0000
commitb9e4d925df9bbc8a4b91187b55b0cc2c3d79fb1b (patch)
tree092167a43451d64f50514015321b93ad91a4ea2d
parent8fc48af7b5dad8f10e1db984b0bfc2779bc0fa58 (diff)
add quit timer for desktop termination after closing last document
-rw-r--r--framework/inc/classes/framecontainer.hxx26
-rw-r--r--framework/source/classes/framecontainer.cxx52
2 files changed, 73 insertions, 5 deletions
diff --git a/framework/inc/classes/framecontainer.hxx b/framework/inc/classes/framecontainer.hxx
index 1f6c6c01b024..6edda95385ed 100644
--- a/framework/inc/classes/framecontainer.hxx
+++ b/framework/inc/classes/framecontainer.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: framecontainer.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:29:22 $
+ * last change: $Author: as $ $Date: 2000-10-16 11:51:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,6 +66,10 @@
// my own includes
//_________________________________________________________________________________________________________________
+#ifndef __FRAMEWORK_CLASSES_ASYNCQUIT_HXX_
+#include <classes/asyncquit.hxx>
+#endif
+
#ifndef __FRAMEWORK_MACROS_DEBUG_HXX_
#include <macros/debug.hxx>
#endif
@@ -356,6 +360,23 @@ class FrameContainer
REFERENCE< 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 "aMode", with these mode you can set default time values for different shutdown scenes at timer
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void enableQuitTimer( const REFERENCE< XDESKTOP >& xDesktop ,
+ const TAsyncQuitMode& aMode );
+ void disableQuitTimer();
+
//-------------------------------------------------------------------------------------------------------------
// protected methods
//-------------------------------------------------------------------------------------------------------------
@@ -409,6 +430,7 @@ class FrameContainer
sal_Bool m_bLock ; /// lock to block append()-, remove()- or clear()-calls
STLVECTOR< REFERENCE< XFRAME > > m_aContainer ; /// list to hold all frames
REFERENCE< XFRAME > m_xActiveFrame ; /// one container item can be the current active frame. Its neccessary for Desktop or Frame implementation.
+ AsyncQuit* m_pQuitTimer ; /// if an instance of these class used by desktop and last frame will be removed we must terminate the desktop
}; // class FrameContainer
diff --git a/framework/source/classes/framecontainer.cxx b/framework/source/classes/framecontainer.cxx
index f5fac6b9ff6e..cca5f4eb26f1 100644
--- a/framework/source/classes/framecontainer.cxx
+++ b/framework/source/classes/framecontainer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: framecontainer.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:29:24 $
+ * last change: $Author: as $ $Date: 2000-10-16 11:52:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -104,7 +104,8 @@ using namespace ::com::sun::star::frame ;
// constructor
//*****************************************************************************************************************
FrameContainer::FrameContainer()
- : m_bLock ( LOCK_OFF )
+ : m_bLock ( LOCK_OFF )
+ , m_pQuitTimer ( NULL )
{
}
@@ -115,6 +116,7 @@ FrameContainer::~FrameContainer()
{
// Don't forget to free memory!
clear();
+ disableQuitTimer();
}
//*****************************************************************************************************************
@@ -163,6 +165,15 @@ void FrameContainer::remove( const Reference< XFrame >& xFrame )
{
m_xActiveFrame = Reference< 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 (
+ ( getCount() < 1 ) &&
+ ( m_pQuitTimer != NULL )
+ )
+ {
+ m_pQuitTimer->start();
+ }
}
}
// Else; Warn programmer.
@@ -210,6 +221,12 @@ void FrameContainer::clear()
// 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_pQuitTimer != NULL )
+ {
+ m_pQuitTimer->start();
+ }
}
}
@@ -346,6 +363,35 @@ Reference< XFrame > FrameContainer::getActive() const
return m_xActiveFrame;
}
+//*****************************************************************************************************************
+// public method
+//*****************************************************************************************************************
+void FrameContainer::enableQuitTimer( const Reference< XDesktop >& xDesktop ,
+ const TAsyncQuitMode& aMode )
+{
+ // If no current timer exist - create a new one.
+ if( m_pQuitTimer == NULL )
+ {
+ m_pQuitTimer = new AsyncQuit( xDesktop );
+ }
+ // Set given mode on existing or created timer member!
+ m_pQuitTimer->setMode( aMode );
+}
+
+//*****************************************************************************************************************
+// public method
+//*****************************************************************************************************************
+void FrameContainer::disableQuitTimer()
+{
+ // Delete current quit timer.
+ // If user wish to create it again he must do it with "enableQuitTimer()".
+ if( m_pQuitTimer != NULL )
+ {
+ delete m_pQuitTimer;
+ m_pQuitTimer = NULL;
+ }
+}
+
//_________________________________________________________________________________________________________________
// debug methods
//_________________________________________________________________________________________________________________