summaryrefslogtreecommitdiff
path: root/uui
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2006-12-13 14:10:22 +0000
committerKurt Zenker <kz@openoffice.org>2006-12-13 14:10:22 +0000
commit2741a158b8fd6453734a91d8cedfa69b4eaec716 (patch)
treef266b300a3032f99943146d207429da4cfa51618 /uui
parente085eb10a95a0e37d66cf1ac0f76862efec51843 (diff)
INTEGRATION: CWS updatefeed (1.6.84); FILE MERGED
2006/12/04 16:59:29 kso 1.6.84.1: #i72238# - New service: css.task.InteractionRequestStringResolver - refactored service css.task.InteractionHandler: base class UUIInteractionHelper that is used now by both implementation of service css.task.InteractionHandler and new service css.task.InteractionRequestStringResolver.
Diffstat (limited to 'uui')
-rw-r--r--uui/source/services.cxx185
1 files changed, 123 insertions, 62 deletions
diff --git a/uui/source/services.cxx b/uui/source/services.cxx
index 31c7e467eb23..6980a2d436dd 100644
--- a/uui/source/services.cxx
+++ b/uui/source/services.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: services.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: rt $ $Date: 2005-09-09 10:27:53 $
+ * last change: $Author: kz $ $Date: 2006-12-13 15:10:22 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -52,11 +52,56 @@
#include <uno/environment.h>
#endif
-#ifndef UUI_IAHNDL_HXX
-#include <iahndl.hxx>
-#endif
+#include "interactionhandler.hxx"
+#include "requeststringresolver.hxx"
+
+using namespace rtl;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::registry;
+
+namespace {
+
+sal_Bool writeInfo( void * pRegistryKey,
+ const char * pImplementationName,
+ Sequence< OUString > const & rServiceNames )
+{
+ OUString aKeyName( OUString::createFromAscii( "/" ) );
+ aKeyName += OUString::createFromAscii( pImplementationName );
+ aKeyName += OUString::createFromAscii( "/UNO/SERVICES" );
+
+ Reference< XRegistryKey > xKey;
+ try
+ {
+ xKey = static_cast< XRegistryKey * >(
+ pRegistryKey )->createKey( aKeyName );
+ }
+ catch ( InvalidRegistryException const & )
+ {
+ }
-using namespace com::sun::star;
+ if ( !xKey.is() )
+ {
+ return sal_False;
+ }
+ sal_Bool bSuccess = sal_True;
+
+ for ( sal_Int32 n = 0; n < rServiceNames.getLength(); ++n )
+ {
+ try
+ {
+ xKey->createKey( rServiceNames[ n ] );
+ }
+ catch ( InvalidRegistryException const & )
+ {
+ bSuccess = sal_False;
+ break;
+ }
+ }
+ return bSuccess;
+}
+
+} // namespace
//============================================================================
//
@@ -66,7 +111,7 @@ using namespace com::sun::star;
extern "C" void SAL_CALL
component_getImplementationEnvironment(sal_Char const ** pEnvTypeName,
- uno_Environment **)
+ uno_Environment **)
{
*pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
@@ -79,39 +124,23 @@ component_getImplementationEnvironment(sal_Char const ** pEnvTypeName,
extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * pRegistryKey)
{
- bool bSuccess = pRegistryKey != 0;
- uno::Reference< registry::XRegistryKey > xKey;
- if (bSuccess)
- {
- rtl::OUString aKeyName(rtl::OUString::createFromAscii("/"));
- aKeyName += rtl::OUString::createFromAscii(
- UUIInteractionHandler::m_aImplementationName);
- aKeyName += rtl::OUString::createFromAscii("/UNO/SERVICES");
- try
- {
- xKey = static_cast< registry::XRegistryKey * >(pRegistryKey)->
- createKey(aKeyName);
- }
- catch (registry::InvalidRegistryException &) {}
- bSuccess = xKey.is() != false;
- }
- if (bSuccess)
- {
- uno::Sequence< rtl::OUString >
- aServiceNames(
- UUIInteractionHandler::getSupportedServiceNames_static());
- for (sal_Int32 i = 0; i < aServiceNames.getLength(); ++i)
- try
- {
- xKey->createKey(aServiceNames[i]);
- }
- catch (registry::InvalidRegistryException &)
- {
- bSuccess = false;
- break;
- }
- }
- return bSuccess;
+ return pRegistryKey &&
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Interaction Handler.
+ //////////////////////////////////////////////////////////////////////
+
+ writeInfo( pRegistryKey,
+ UUIInteractionHandler::m_aImplementationName,
+ UUIInteractionHandler::getSupportedServiceNames_static() ) &&
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Interaction Request String Resolver.
+ //////////////////////////////////////////////////////////////////////
+
+ writeInfo( pRegistryKey,
+ UUIInteractionRequestStringResolver::m_aImplementationName,
+ UUIInteractionRequestStringResolver::getSupportedServiceNames_static() );
}
//============================================================================
@@ -121,29 +150,61 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(void *, void * pRegistryKey)
//============================================================================
extern "C" void * SAL_CALL component_getFactory(sal_Char const * pImplName,
- void * pServiceManager,
- void *)
+ void * pServiceManager,
+ void *)
{
- void * pFactory = 0;
- if (pServiceManager
- && rtl_str_compare(pImplName,
- UUIInteractionHandler::m_aImplementationName)
- == 0)
+ if (!pImplName)
+ return 0;
+
+ void * pRet = 0;
+
+ Reference< XMultiServiceFactory > xSMgr(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
+ Reference< XSingleServiceFactory > xFactory;
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Interaction Handler.
+ //////////////////////////////////////////////////////////////////////
+
+ if ( rtl_str_compare(pImplName,
+ UUIInteractionHandler::m_aImplementationName)
+ == 0)
+ {
+ xFactory =
+ cppu::createSingleFactory(
+ static_cast< XMultiServiceFactory * >(
+ pServiceManager),
+ OUString::createFromAscii(
+ UUIInteractionHandler::m_aImplementationName),
+ &UUIInteractionHandler::createInstance,
+ UUIInteractionHandler::getSupportedServiceNames_static());
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // UUI Interaction Request String Resolver.
+ //////////////////////////////////////////////////////////////////////
+
+ else if ( rtl_str_compare(pImplName,
+ UUIInteractionRequestStringResolver::m_aImplementationName)
+ == 0)
{
- uno::Reference< lang::XSingleServiceFactory >
- xTheFactory(
- cppu::createSingleFactory(
- static_cast< lang::XMultiServiceFactory * >(
- pServiceManager),
- rtl::OUString::createFromAscii(
- UUIInteractionHandler::m_aImplementationName),
- &UUIInteractionHandler::createInstance,
- UUIInteractionHandler::getSupportedServiceNames_static()));
- if (xTheFactory.is())
- {
- xTheFactory->acquire();
- pFactory = xTheFactory.get();
- }
+ xFactory =
+ cppu::createSingleFactory(
+ static_cast< XMultiServiceFactory * >(
+ pServiceManager),
+ OUString::createFromAscii(
+ UUIInteractionRequestStringResolver::m_aImplementationName),
+ &UUIInteractionRequestStringResolver::createInstance,
+ UUIInteractionRequestStringResolver::getSupportedServiceNames_static());
}
- return pFactory;
+
+ //////////////////////////////////////////////////////////////////////
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
}