diff options
author | Daniel Boelzle <dbo@openoffice.org> | 2001-05-10 13:52:37 +0000 |
---|---|---|
committer | Daniel Boelzle <dbo@openoffice.org> | 2001-05-10 13:52:37 +0000 |
commit | f99590caa48864380581238eb2df13d11c405cdd (patch) | |
tree | c4b3dcece14ae7081a5e9a7bd90cf449850c5530 /toolkit/workben | |
parent | 69bd861512256b59bedbecdd32913611a39d0f5e (diff) |
adopted to new bootstrapping functions
Diffstat (limited to 'toolkit/workben')
-rw-r--r-- | toolkit/workben/unodialog.cxx | 78 |
1 files changed, 30 insertions, 48 deletions
diff --git a/toolkit/workben/unodialog.cxx b/toolkit/workben/unodialog.cxx index ebeb36e5b5ae..6614f66efa8d 100644 --- a/toolkit/workben/unodialog.cxx +++ b/toolkit/workben/unodialog.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unodialog.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: mt $ $Date: 2001-03-15 11:44:20 $ + * last change: $Author: dbo $ $Date: 2001-05-10 14:52:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,7 +102,7 @@ #endif #include <cppuhelper/servicefactory.hxx> -#include <cppuhelper/servicefactory.hxx> +#include <cppuhelper/bootstrap.hxx> #include <comphelper/regpathhelper.hxx> #include <com/sun/star/lang/XInitialization.hpp> @@ -121,67 +121,49 @@ using namespace ::com::sun::star::lang; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > createApplicationServiceManager() { - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xReturn = ::cppu::createServiceFactory(); - try { + ::rtl::OUString localRegistry = ::comphelper::getPathToUserRegistry(); + ::rtl::OUString systemRegistry = ::comphelper::getPathToSystemRegistry(); - if ( xReturn.is() ) - { - Reference< XInitialization > xInit ( xReturn, UNO_QUERY ) ; - if ( xInit.is() ) + Reference< XSimpleRegistry > xLocalRegistry( ::cppu::createSimpleRegistry() ); + Reference< XSimpleRegistry > xSystemRegistry( ::cppu::createSimpleRegistry() ); + if ( xLocalRegistry.is() && (localRegistry.getLength() > 0) ) { - ::rtl::OUString localRegistry = ::comphelper::getPathToUserRegistry(); - ::rtl::OUString systemRegistry = ::comphelper::getPathToSystemRegistry(); - - Reference< XSimpleRegistry > xLocalRegistry ( xReturn->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.registry.SimpleRegistry") ) ), UNO_QUERY ); - Reference< XSimpleRegistry > xSystemRegistry ( xReturn->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry") ) ), UNO_QUERY ); - if ( xLocalRegistry.is() && (localRegistry.getLength() > 0) ) + try { - try - { - xLocalRegistry->open( localRegistry, sal_False, sal_True); - } - catch ( InvalidRegistryException& ) - { - } - - if ( !xLocalRegistry->isValid() ) - xLocalRegistry->open(localRegistry, sal_True, sal_True); + xLocalRegistry->open( localRegistry, sal_False, sal_True); } - - if ( xSystemRegistry.is() && (systemRegistry.getLength() > 0) ) - xSystemRegistry->open( systemRegistry, sal_True, sal_False); - - if ( (xLocalRegistry.is() && xLocalRegistry->isValid()) && - (xSystemRegistry.is() && xSystemRegistry->isValid()) ) + catch ( InvalidRegistryException& ) { - Sequence< Any > seqAnys(2); - seqAnys[0] <<= xLocalRegistry ; - seqAnys[1] <<= xSystemRegistry ; - - Reference < XSimpleRegistry > xReg( - xReturn->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.NestedRegistry")), seqAnys ), UNO_QUERY ); - - seqAnys = Sequence< Any >( 1 ); - seqAnys[0] <<= xReg; - if ( xReg.is() ) - xInit->initialize( seqAnys ); } + + if ( !xLocalRegistry->isValid() ) + xLocalRegistry->open(localRegistry, sal_True, sal_True); } - else + + if ( xSystemRegistry.is() && (systemRegistry.getLength() > 0) ) + xSystemRegistry->open( systemRegistry, sal_True, sal_False); + + if ( (xLocalRegistry.is() && xLocalRegistry->isValid()) && + (xSystemRegistry.is() && xSystemRegistry->isValid()) ) { - xReturn = ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >(); + 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 ); } } - } - catch( ::com::sun::star::uno::Exception& ) { } - return xReturn ; + return ::cppu::createServiceFactory(); } |