diff options
author | Jörg Budischewski <jbu@openoffice.org> | 2002-01-15 13:04:13 +0000 |
---|---|---|
committer | Jörg Budischewski <jbu@openoffice.org> | 2002-01-15 13:04:13 +0000 |
commit | 11c63360cb41eb3d9ab9ff7fc9bf5653ebba8899 (patch) | |
tree | 34d8b7a8ab70bc068b2feaf90c36abc2d4785037 /toolkit/workben/unodialog.cxx | |
parent | b4bbc92015b501a04e0e9c1e5ff9496b24320974 (diff) |
simplified uno bootstrapping, an appropriate applicat.rdb is now created within the output tree
Diffstat (limited to 'toolkit/workben/unodialog.cxx')
-rw-r--r-- | toolkit/workben/unodialog.cxx | 69 |
1 files changed, 16 insertions, 53 deletions
diff --git a/toolkit/workben/unodialog.cxx b/toolkit/workben/unodialog.cxx index 1e296edae28a..9583d59b5b5c 100644 --- a/toolkit/workben/unodialog.cxx +++ b/toolkit/workben/unodialog.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unodialog.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: dbo $ $Date: 2001-05-11 10:45:43 $ + * last change: $Author: jbu $ $Date: 2002-01-15 14:04:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -58,6 +58,7 @@ * * ************************************************************************/ +#include <stdio.h> #define NOOLDSV #ifndef _SVWIN_H @@ -117,65 +118,27 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::registry; using namespace ::com::sun::star::lang; +// ----------------------------------------------------------------------- +void Main( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & ); - -::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > createApplicationServiceManager() +SAL_IMPLEMENT_MAIN() { try { - ::rtl::OUString localRegistry = ::comphelper::getPathToUserRegistry(); - ::rtl::OUString systemRegistry = ::comphelper::getPathToSystemRegistry(); - - Reference< XSimpleRegistry > xLocalRegistry( ::cppu::createSimpleRegistry() ); - Reference< XSimpleRegistry > xSystemRegistry( ::cppu::createSimpleRegistry() ); - if ( xLocalRegistry.is() && (localRegistry.getLength() > 0) ) - { - try - { - xLocalRegistry->open( localRegistry, sal_False, sal_True); - } - catch ( InvalidRegistryException& ) - { - } - - if ( !xLocalRegistry->isValid() ) - xLocalRegistry->open(localRegistry, sal_True, sal_True); - } - - if ( xSystemRegistry.is() && (systemRegistry.getLength() > 0) ) - xSystemRegistry->open( systemRegistry, sal_True, sal_False); + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + xMSF = cppu::createRegistryServiceFactory( + OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True ); - if ( (xLocalRegistry.is() && xLocalRegistry->isValid()) && - (xSystemRegistry.is() && xSystemRegistry->isValid()) ) - { - Reference < XSimpleRegistry > xReg( ::cppu::createNestedRegistry() ); - Sequence< Any > seqAnys(2); - seqAnys[0] <<= xLocalRegistry ; - seqAnys[1] <<= xSystemRegistry ; - Reference< XInitialization > xInit( xReg, UNO_QUERY ); - xInit->initialize( seqAnys ); - - Reference< XComponentContext > xContext( ::cppu::bootstrap_InitialComponentContext( xReg ) ); - return Reference< XMultiServiceFactory >( xContext->getServiceManager(), UNO_QUERY ); - } + //SVInit( xMSF ); + ::Main( xMSF ); + //SVDeinit(); } - catch( ::com::sun::star::uno::Exception& ) + catch ( Exception & e ) { + fprintf( stderr, "Error during bootstrapping servicemanager: %s\n" , + OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); + return 1; } - - return ::cppu::createServiceFactory(); -} - - -// ----------------------------------------------------------------------- -void Main( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & ); - -SAL_IMPLEMENT_MAIN() -{ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = createApplicationServiceManager(); - //SVInit( xMSF ); - ::Main( xMSF ); - //SVDeinit(); return NULL; } |