summaryrefslogtreecommitdiff
path: root/ucb/source/ucp
diff options
context:
space:
mode:
authorAndreas Bille <abi@openoffice.org>2001-04-24 12:50:50 +0000
committerAndreas Bille <abi@openoffice.org>2001-04-24 12:50:50 +0000
commitaf0a882672447e337c1d074d590bf0f6e35255ea (patch)
treefd58713b0bf8ef5df9344737c6afe06831c30a74 /ucb/source/ucp
parent1b4c662dc2ebbedd24ac7a09d87bef0c79eaa41f (diff)
#84316#
Now asking for XInteractionHandler and XProgressHandler only if used. Added necessary methods to fileaccess::TaskManager and ( therefore to fileaccess::shell by implementation inheritance ), to retrieve the XInterfactionHandler/XProgressHandler if only the CommandId is given.
Diffstat (limited to 'ucb/source/ucp')
-rw-r--r--ucb/source/ucp/file/bc.cxx15
-rw-r--r--ucb/source/ucp/file/filtask.cxx35
-rw-r--r--ucb/source/ucp/file/filtask.hxx56
3 files changed, 81 insertions, 25 deletions
diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx
index 104352b59c8e..e2f82939e369 100644
--- a/ucb/source/ucp/file/bc.cxx
+++ b/ucb/source/ucp/file/bc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: bc.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: kso $ $Date: 2001-04-05 09:49:09 $
+ * last change: $Author: abi $ $Date: 2001-04-24 13:50:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -368,17 +368,8 @@ BaseContent::execute( const Command& aCommand,
{
if( CommandId )
{
- uno::Reference< task::XInteractionHandler > xIH( 0 );
- uno::Reference< ucb::XProgressHandler > xPH( 0 );
-
- if( Environment.is() )
- {
- xIH = Environment->getInteractionHandler();
- xPH = Environment->getProgressHandler();
- }
m_pMyShell->startTask( CommandId,
- xIH,
- xPH );
+ Environment );
}
uno::Any aAny;
diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index 21e81121a6f9..bab4589468be 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: filtask.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: kso $ $Date: 2000-10-16 14:53:36 $
+ * last change: $Author: abi $ $Date: 2001-04-24 13:50:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -89,8 +89,7 @@ TaskManager::~TaskManager()
void SAL_CALL
TaskManager::startTask(
sal_Int32 CommandId,
- const uno::Reference< task::XInteractionHandler >& xIH,
- const uno::Reference< XProgressHandler >& xPH )
+ const uno::Reference< XCommandEnvironment >& xCommandEnv )
throw( CommandAbortedException )
{
vos::OGuard aGuard( m_aMutex );
@@ -99,7 +98,7 @@ TaskManager::startTask(
{
throw CommandAbortedException();
}
- m_aTaskMap[ CommandId ] = TaskHandling( xIH,xPH );
+ m_aTaskMap[ CommandId ] = TaskHandling( xCommandEnv );
}
@@ -136,3 +135,29 @@ TaskManager::getCommandId( void )
vos::OGuard aGuard( m_aMutex );
return ++m_nCommandId;
}
+
+
+
+uno::Reference< task::XInteractionHandler > SAL_CALL
+TaskManager::getInteractionHandler( sal_Int32 CommandId )
+{
+ vos::OGuard aGuard( m_aMutex );
+ TaskMap::iterator it = m_aTaskMap.find( CommandId );
+ if( it == m_aTaskMap.end() )
+ return uno::Reference< task::XInteractionHandler >( 0 );
+ else
+ return it->second.getInteractionHandler();
+}
+
+
+
+uno::Reference< XProgressHandler > SAL_CALL
+TaskManager::getProgressHandler( sal_Int32 CommandId )
+{
+ vos::OGuard aGuard( m_aMutex );
+ TaskMap::iterator it = m_aTaskMap.find( CommandId );
+ if( it == m_aTaskMap.end() )
+ return uno::Reference< XProgressHandler >( 0 );
+ else
+ return it->second.getProgressHandler();
+}
diff --git a/ucb/source/ucp/file/filtask.hxx b/ucb/source/ucp/file/filtask.hxx
index c01606b807b1..91ff15122644 100644
--- a/ucb/source/ucp/file/filtask.hxx
+++ b/ucb/source/ucp/file/filtask.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: filtask.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: armin $ $Date: 2001-03-08 09:56:39 $
+ * last change: $Author: abi $ $Date: 2001-04-24 13:50:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,6 +71,9 @@
#ifndef _COM_SUN_STAR_UCB_COMMANDABORTEDEXCEPTION_HPP_
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#endif
+#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP_
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#endif
#ifndef _COM_SUN_STAR_UCB_XPROGRESSHANDLER_HPP_
#include <com/sun/star/ucb/XProgressHandler.hpp>
#endif
@@ -80,6 +83,17 @@
namespace fileaccess
{
+ /*
+ * This implementation is inherited by class fileaccess::shell.
+ * The relevant methods in this class all have as first argument the CommandId,
+ * so if necessary, every method has acess to its relevant XInteractionHandler and
+ * XProgressHandler, simply by calling directly the method
+ * getInteractionHandler( CommandId )
+ * and
+ * getProgressHandler();
+ */
+
+
class TaskManager
{
protected:
@@ -99,20 +113,23 @@ namespace fileaccess
sal_Bool m_bAbort;
com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInteractionHandler;
com::sun::star::uno::Reference< com::sun::star::ucb::XProgressHandler > m_xProgressHandler;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment > m_xCommandEnvironment;
public:
TaskHandling()
: m_xInteractionHandler( 0 ),
m_xProgressHandler( 0 ),
+ m_xCommandEnvironment( 0 ),
m_bAbort( false )
{
}
+
TaskHandling(
- const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& m_xIH,
- const com::sun::star::uno::Reference< com::sun::star::ucb::XProgressHandler >& m_xPH )
- : m_xInteractionHandler( m_xIH ),
- m_xProgressHandler( m_xPH ),
+ const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xCommandEnv )
+ : m_xInteractionHandler( 0 ),
+ m_xProgressHandler( 0 ),
+ m_xCommandEnvironment( xCommandEnv ),
m_bAbort( false )
{
}
@@ -122,6 +139,24 @@ namespace fileaccess
m_bAbort = true;
}
+ com::sun::star::uno::Reference< com::sun::star::ucb::XProgressHandler > SAL_CALL
+ getProgressHandler()
+ {
+ if( ! m_xProgressHandler.is() && m_xCommandEnvironment.is() )
+ m_xProgressHandler = m_xCommandEnvironment->getProgressHandler();
+
+ return m_xProgressHandler;
+ }
+
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > SAL_CALL
+ getInteractionHandler()
+ {
+ if( ! m_xInteractionHandler.is() && m_xCommandEnvironment.is() )
+ m_xInteractionHandler = m_xCommandEnvironment->getInteractionHandler();
+
+ return m_xInteractionHandler;
+ }
+
};
typedef std::hash_map< sal_Int32,TaskHandling,std::hash< sal_Int32 >, equal_sal_Int32 > TaskMap;
@@ -138,13 +173,18 @@ namespace fileaccess
void SAL_CALL startTask(
sal_Int32 CommandId,
- const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xIH,
- const com::sun::star::uno::Reference< com::sun::star::ucb::XProgressHandler >& xPH )
+ const com::sun::star::uno::Reference< com::sun::star::ucb::XCommandEnvironment >& xCommandEnv )
throw( com::sun::star::ucb::CommandAbortedException );
void SAL_CALL endTask( sal_Int32 CommandId );
sal_Int32 SAL_CALL getCommandId( void );
void SAL_CALL abort( sal_Int32 CommandId );
+
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > SAL_CALL
+ getInteractionHandler( sal_Int32 CommandId );
+
+ com::sun::star::uno::Reference< com::sun::star::ucb::XProgressHandler > SAL_CALL
+ getProgressHandler( sal_Int32 CommandId );
};
} // end namespace TaskHandling