summaryrefslogtreecommitdiff
path: root/framework/source/helper/statusindicator.cxx
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2005-02-02 12:53:13 +0000
committerRüdiger Timm <rt@openoffice.org>2005-02-02 12:53:13 +0000
commit072e5121bfb2f366c3967dcfb46963a756bb800c (patch)
treecc02bbef74f7fb6890dde57f0bd68e80614b287c /framework/source/helper/statusindicator.cxx
parent41576405c994b83f6cba32145f41a24e5b92967f (diff)
INTEGRATION: CWS imprec01 (1.1.408); FILE MERGED
2004/12/15 06:51:20 as 1.1.408.1: #i35842# implement intelligent reschedule
Diffstat (limited to 'framework/source/helper/statusindicator.cxx')
-rw-r--r--framework/source/helper/statusindicator.cxx304
1 files changed, 89 insertions, 215 deletions
diff --git a/framework/source/helper/statusindicator.cxx b/framework/source/helper/statusindicator.cxx
index 96fe69ea098d..c887b385c772 100644
--- a/framework/source/helper/statusindicator.cxx
+++ b/framework/source/helper/statusindicator.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: statusindicator.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: as $ $Date: 2001-08-10 11:54:14 $
+ * last change: $Author: rt $ $Date: 2005-02-02 13:53:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,260 +59,134 @@
*
************************************************************************/
-//_________________________________________________________________________________________________________________
-// my own includes
-//_________________________________________________________________________________________________________________
+//_______________________________________________
+// include files of own module
#ifndef __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_
#include <helper/statusindicator.hxx>
#endif
-#ifndef __FRAMEWORK_THREADHELP_RESETABLEGUARD_HXX_
-#include <threadhelp/resetableguard.hxx>
+#ifndef __FRAMEWORK_THREADHELP_READGUARD_HXX_
+#include <threadhelp/readguard.hxx>
#endif
-//_________________________________________________________________________________________________________________
-// interface includes
-//_________________________________________________________________________________________________________________
-
-//_________________________________________________________________________________________________________________
-// includes of other projects
-//_________________________________________________________________________________________________________________
-
-#ifndef _SV_SVAPP_HXX
-#include <vcl/svapp.hxx>
+#ifndef __FRAMEWORK_THREADHELP_WRITEGUARD_HXX_
+#include <threadhelp/writeguard.hxx>
#endif
-//_________________________________________________________________________________________________________________
-// namespace
-//_________________________________________________________________________________________________________________
+//_______________________________________________
+// namespace
namespace framework{
-//_________________________________________________________________________________________________________________
-// non exported const
-//_________________________________________________________________________________________________________________
-
-//_________________________________________________________________________________________________________________
-// non exported definitions
-//_________________________________________________________________________________________________________________
-
-//_________________________________________________________________________________________________________________
-// declarations
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// XInterface, XTypeProvider
-//*****************************************************************************************************************
-DEFINE_XINTERFACE_2 ( StatusIndicator ,
- OWeakObject ,
- DIRECT_INTERFACE(css::lang::XTypeProvider ),
- DIRECT_INTERFACE(css::task::XStatusIndicator)
- )
-
-DEFINE_XTYPEPROVIDER_2 ( StatusIndicator ,
- css::lang::XTypeProvider ,
- css::task::XStatusIndicator
- )
-
-/*-************************************************************************************************************//**
- @short standard ctor
- @descr These initialize a new instance of this class with all needed informations for work.
-
- @seealso -
-
- @param "pFactory", pointer to factory, which has created this instance (XStatusIndicatorFactory!)
- @return -
-
- @onerror -
- @threadsafe yes
-*//*-*************************************************************************************************************/
-StatusIndicator::StatusIndicator( StatusIndicatorFactory* pFactory )
- // Init baseclasses first
- : ThreadHelpBase ( &Application::GetSolarMutex() )
- , ::cppu::OWeakObject ( )
- // Init member
- , m_pFactory ( pFactory )
- , m_xFactoryWeak ( pFactory )
+//_______________________________________________
+// declarations
+
+//***********************************************
+// XInterface
+DEFINE_XINTERFACE_2(StatusIndicator ,
+ OWeakObject ,
+ DIRECT_INTERFACE(css::lang::XTypeProvider ),
+ DIRECT_INTERFACE(css::task::XStatusIndicator))
+
+//***********************************************
+// XInterface
+DEFINE_XTYPEPROVIDER_2(StatusIndicator ,
+ css::lang::XTypeProvider ,
+ css::task::XStatusIndicator)
+
+//***********************************************
+StatusIndicator::StatusIndicator(StatusIndicatorFactory* pFactory)
+ : ThreadHelpBase ( )
+ , ::cppu::OWeakObject( )
+ , m_xFactory (pFactory)
{
- // Safe impossible cases
- // Method not defined for all incoming parameter.
- LOG_ASSERT2( implcp_StatusIndicator( pFactory ), "StatusIndicator::StatusIndicator()", "Invalid parameter detected!" )
}
-/*-************************************************************************************************************//**
- @short standard dtor
- @descr Forget all references and pointer ... let they die.
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- @threadsafe yes
-*//*-*************************************************************************************************************/
+//***********************************************
StatusIndicator::~StatusIndicator()
{
- m_pFactory = NULL ;
- m_xFactoryWeak = css::uno::WeakReference< css::task::XStatusIndicatorFactory >();
}
-/*-************************************************************************************************************//**
- @interface XStatusIndicator
- @short These methods implement the functionality of this interface.
- @descr But instances of this class are wrapper only. They try to get a right references from saved weak reference
- to her StatusIndicatorFactory. If it was successfully - they forward her calls to this factory only.
- These factory decide, which of the caller objects is the most active one and can show his informations.
- Other calls are ignored.
-
- @seealso class StatusIndicatorFactory
-
- @param "sText" , new text to show it in dialog
- @param "nRange", new range for progress
- @param "nValue", new value to show the progress
- @return -
-
- @onerror We do nothing!
- @threadsafe yes
-*//*-*************************************************************************************************************/
-void SAL_CALL StatusIndicator::start( const ::rtl::OUString& sText ,
- sal_Int32 nRange ) throw( css::uno::RuntimeException )
+//***********************************************
+void SAL_CALL StatusIndicator::start(const ::rtl::OUString& sText ,
+ sal_Int32 nRange)
+ throw(css::uno::RuntimeException)
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Safe impossible cases
- // Method not defined for all incoming parameter.
- LOG_ASSERT2( implcp_start( sText, nRange ), "StatusIndicator::start()", "Invalid parameter detected!" )
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- // Ready for multithreading
- ResetableGuard aLock( m_aLock );
-
- css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory( m_xFactoryWeak.get(), css::uno::UNO_QUERY );
- if( xFactory.is() == sal_True )
+ // SAFE ->
+ ReadGuard aReadLock(m_aLock);
+ css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
+ aReadLock.unlock();
+ // <- SAFE
+ if (xFactory.is())
{
- m_pFactory->start( this, sText, nRange );
+ StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
+ pFactory->start(this, sText, nRange);
}
}
-//*****************************************************************************************************************
-void SAL_CALL StatusIndicator::end() throw( css::uno::RuntimeException )
+//***********************************************
+void SAL_CALL StatusIndicator::end()
+ throw(css::uno::RuntimeException)
{
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- // Ready for multithreading
- ResetableGuard aLock( m_aLock );
-
- // Attention: Our factory forget our reference after calling "end()". So we must protect us against
- // dieing during this operation!
- css::uno::Reference< css::uno::XInterface > xThis( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
-
- css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory( m_xFactoryWeak.get(), css::uno::UNO_QUERY );
- if( xFactory.is() == sal_True )
+ // SAFE ->
+ ReadGuard aReadLock(m_aLock);
+ css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
+ aReadLock.unlock();
+ // <- SAFE
+ if (xFactory.is())
{
- m_pFactory->end( this );
+ StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
+ pFactory->end(this);
}
}
-//*****************************************************************************************************************
-void SAL_CALL StatusIndicator::reset() throw( css::uno::RuntimeException )
+//***********************************************
+void SAL_CALL StatusIndicator::reset()
+ throw(css::uno::RuntimeException)
{
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- // Ready for multithreading
- ResetableGuard aLock( m_aLock );
-
- css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory( m_xFactoryWeak.get(), css::uno::UNO_QUERY );
- if( xFactory.is() == sal_True )
+ // SAFE ->
+ ReadGuard aReadLock(m_aLock);
+ css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
+ aReadLock.unlock();
+ // <- SAFE
+ if (xFactory.is())
{
- m_pFactory->reset( this );
+ StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
+ pFactory->reset(this);
}
}
-//*****************************************************************************************************************
-void SAL_CALL StatusIndicator::setText( const ::rtl::OUString& sText ) throw( css::uno::RuntimeException )
+//***********************************************
+void SAL_CALL StatusIndicator::setText(const ::rtl::OUString& sText)
+ throw(css::uno::RuntimeException)
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Safe impossible cases
- // Method not defined for all incoming parameter.
- LOG_ASSERT2( implcp_setText( sText ), "StatusIndicator::setText()", "Invalid parameter detected!" )
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- // Ready for multithreading
- ResetableGuard aLock( m_aLock );
-
- css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory( m_xFactoryWeak.get(), css::uno::UNO_QUERY );
- if( xFactory.is() == sal_True )
+ // SAFE ->
+ ReadGuard aReadLock(m_aLock);
+ css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
+ aReadLock.unlock();
+ // <- SAFE
+ if (xFactory.is())
{
- m_pFactory->setText( this, sText );
+ StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
+ pFactory->setText(this, sText);
}
}
-//*****************************************************************************************************************
-void SAL_CALL StatusIndicator::setValue( sal_Int32 nValue ) throw( css::uno::RuntimeException )
+//***********************************************
+void SAL_CALL StatusIndicator::setValue(sal_Int32 nValue)
+ throw(css::uno::RuntimeException)
{
- /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
- // Safe impossible cases
- // Method not defined for all incoming parameter.
- LOG_ASSERT2( implcp_setValue( nValue ), "StatusIndicator::setValue()", "Invalid parameter detected!" )
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- // Ready for multithreading
- ResetableGuard aLock( m_aLock );
-
- css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory( m_xFactoryWeak.get(), css::uno::UNO_QUERY );
- if( xFactory.is() == sal_True )
+ // SAFE ->
+ ReadGuard aReadLock(m_aLock);
+ css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory.get(), css::uno::UNO_QUERY);
+ aReadLock.unlock();
+ // <- SAFE
+ if (xFactory.is())
{
- m_pFactory->setValue( this, nValue );
+ StatusIndicatorFactory* pFactory = (StatusIndicatorFactory*)xFactory.get();
+ pFactory->setValue(this, nValue);
}
}
-//_________________________________________________________________________________________________________________
-// debug methods
-//_________________________________________________________________________________________________________________
-
-/*-************************************************************************************************************//**
- @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(...).
-
- @seealso ASSERTs in implementation!
-
- @param references to checking variables
- @return sal_False ,on invalid parameter
- @return sal_True ,otherwise
-
- @onerror -
-*//*-*************************************************************************************************************/
-#ifdef ENABLE_ASSERTIONS
-
-//*****************************************************************************************************************
-sal_Bool StatusIndicator::implcp_StatusIndicator( StatusIndicatorFactory* pFactory )
-{
- return( pFactory == NULL );
-}
-
-//*****************************************************************************************************************
-sal_Bool StatusIndicator::implcp_start( const ::rtl::OUString& sText ,
- sal_Int32 nRange )
-{
- return(
- ( &sText == NULL ) ||
- ( &nRange == NULL ) ||
- ( nRange < 1 ) // We count from 0 to range ... and range should be greater then 0 ...!
- );
-}
-
-//*****************************************************************************************************************
-sal_Bool StatusIndicator::implcp_setText( const ::rtl::OUString& sText )
-{
- return( &sText == NULL );
-}
-
-//*****************************************************************************************************************
-sal_Bool StatusIndicator::implcp_setValue( sal_Int32 nValue )
-{
- return( nValue < 0 );
-}
-
-#endif // #ifdef ENABLE_ASSERTIONS
-
-} // namespace framework
+} // namespace framework