From 9ac86f484b0c278aafbce685ed19d3ea005ee8f8 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 14 Sep 2012 18:08:57 +0200 Subject: Improvement on previous commit, UCB clean up * As UCB is only ever initialized with "Local"/"Office", remove this configuration vector completely. The "create" ctor creates an instance internally initialized with those "Local"/"Office" keys. Special (test) code can still instantiate an uninitialized one via plain createInstance. And for backwards compatilibity process startup still ensures to create an initialized instance early, in case there is still code out there (in extensions) that later calls plain createInstance and expects to get the already-initialized (single) instance. * XInitialization is an "implementation detail" of the UniversalContentBroker service, do not expose in XUniversalContentBroker. * ucbhelper/configurationkeys.hxx is no longer needed and is removed. * ucbhelper/contentbroker.hxx is an empty wrapper and is removed; however, that requires ucbhelper::Content constructors to take explicit XComponentContext arguments now. * The only remaining code in ucbhelper/source/client/contentbroker.cxx is Android-only InitUCBHelper. Is that relevant still? Change-Id: I3f7bddd0456bffbcd13590c66d9011915c760f28 --- desktop/source/pkgchk/unopkg/unopkg_misc.cxx | 14 ++++---------- desktop/source/pkgchk/unopkg/unopkg_shared.h | 14 +------------- 2 files changed, 5 insertions(+), 23 deletions(-) (limited to 'desktop/source/pkgchk') diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index 52b4ab884a1b..a034828646be 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -41,11 +41,10 @@ #include "osl/file.hxx" #include "osl/thread.hxx" #include "tools/getprocessworkingdir.hxx" -#include "ucbhelper/contentbroker.hxx" -#include "ucbhelper/configurationkeys.hxx" #include "comphelper/processfactory.hxx" #include "unotools/configmgr.hxx" #include "com/sun/star/lang/XMultiServiceFactory.hpp" +#include "com/sun/star/ucb/UniversalContentBroker.hpp" #include "cppuhelper/bootstrap.hxx" #include "comphelper/sequence.hxx" #include @@ -384,15 +383,10 @@ Reference bootstrapStandAlone( // set global process service factory used by unotools config helpers ::comphelper::setProcessServiceFactory( xServiceManager ); - // initialize the ucbhelper ucb, - // because the package implementation uses it - Sequence ucb_args( 2 ); - ucb_args[ 0 ] <<= OUSTR(UCB_CONFIGURATION_KEY1_LOCAL); - ucb_args[ 1 ] <<= OUSTR(UCB_CONFIGURATION_KEY2_OFFICE); - if (! ::ucbhelper::ContentBroker::initialize( xServiceManager, ucb_args )) - throw RuntimeException( OUSTR("cannot initialize UCB!"), 0 ); + // Initialize the UCB (for backwards compatibility, in case some code still + // uses plain createInstance w/o args directly to obtain an instance): + UniversalContentBroker::create( xContext ); - disposeGuard.setDeinitUCB(); return xContext; } diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h index 400e2835199e..c8cdc3c51a78 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_shared.h +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -35,8 +35,6 @@ #include "tools/resmgr.hxx" #include "rtl/ustring.hxx" #include "unotools/configmgr.hxx" -#include "ucbhelper/contentbroker.hxx" - #define APP_NAME "unopkg" @@ -126,14 +124,10 @@ bool isBootstrapVariable(sal_uInt32 * pIndex); class DisposeGuard { css::uno::Reference m_xComp; - bool m_bDeinitUCB; + public: - DisposeGuard(): m_bDeinitUCB(false) {} inline ~DisposeGuard() { - if (m_bDeinitUCB) - ::ucbhelper::ContentBroker::deinitialize(); - if (m_xComp.is()) m_xComp->dispose(); } @@ -143,12 +137,6 @@ public: { m_xComp = xComp; } - - inline void setDeinitUCB() - { - m_bDeinitUCB = true; - } - }; //============================================================================== -- cgit