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 --- framework/inc/services.h | 1 - framework/inc/services/autorecovery.hxx | 4 ++-- framework/source/loadenv/loadenv.cxx | 4 ++-- framework/source/services/autorecovery.cxx | 6 +++--- 4 files changed, 7 insertions(+), 8 deletions(-) (limited to 'framework') diff --git a/framework/inc/services.h b/framework/inc/services.h index 1e2dcce488b2..dbdd10183b9f 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -51,7 +51,6 @@ namespace framework{ #define SERVICENAME_CFGREADACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationAccess" ) // provides readonly access to the configuration #define SERVICENAME_CONTENTHANDLER DECLARE_ASCII("com.sun.star.frame.ContentHandler" ) #define SERVICENAME_CONTENTHANDLERFACTORY DECLARE_ASCII("com.sun.star.frame.ContentHandlerFactory" ) -#define SERVICENAME_UCBCONTENTBROKER DECLARE_ASCII("com.sun.star.ucb.UniversalContentBroker" ) #define SERVICENAME_STATUSINDICATORFACTORY DECLARE_ASCII("com.sun.star.task.StatusIndicatorFactory" ) #define SERVICENAME_UIINTERACTIONHANDLER DECLARE_ASCII("com.sun.star.task.InteractionHandler" ) #define SERVICENAME_JOBEXECUTOR DECLARE_ASCII("com.sun.star.task.JobExecutor" ) diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx index 4a9495dc506b..9f7c61c681c8 100644 --- a/framework/inc/services/autorecovery.hxx +++ b/framework/inc/services/autorecovery.hxx @@ -1031,7 +1031,7 @@ class AutoRecovery : public css::lang::XTypeProvider @param sURL the url of the file, which should be removed. */ - static void st_impl_removeFile(const ::rtl::OUString& sURL); + void st_impl_removeFile(const ::rtl::OUString& sURL); //--------------------------------------- /** try to remove ".lock" file from disc if office will be terminated @@ -1040,7 +1040,7 @@ class AutoRecovery : public css::lang::XTypeProvider This method has to be handled "optional". So every error inside has to be ignored ! This method CANT FAIL ... it can forget something only .-) */ - static void st_impl_removeLockFile(); + void st_impl_removeLockFile(); }; } // namespace framework diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 1b6c35aef734..6a0eb041f964 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include @@ -703,7 +703,7 @@ LoadEnv::EContentType LoadEnv::classifyContent(const ::rtl::OUString& // (v) Last but not least the UCB is used inside office to // load contents. He has a special configuration to know // which URL schemata can be used inside office. - css::uno::Reference< css::ucb::XContentProviderManager > xUCB(xSMGR->createInstance(SERVICENAME_UCBCONTENTBROKER), css::uno::UNO_QUERY); + css::uno::Reference< css::ucb::XUniversalContentBroker > xUCB(css::ucb::UniversalContentBroker::create(comphelper::ComponentContext(xSMGR).getUNOContext())); if (xUCB->queryContentProvider(sURL).is()) return E_CAN_BE_LOADED; diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 6131fb5ce573..529060d6ec98 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -3227,7 +3227,7 @@ AutoRecovery::EFailureSafeResult AutoRecovery::implts_copyFile(const ::rtl::OUSt try { - aTargetContent = ::ucbhelper::Content(sTargetPath, xEnvironment); + aTargetContent = ::ucbhelper::Content(sTargetPath, xEnvironment, comphelper::ComponentContext(m_xSMGR).getUNOContext()); } catch(const css::uno::Exception&) { @@ -3239,7 +3239,7 @@ AutoRecovery::EFailureSafeResult AutoRecovery::implts_copyFile(const ::rtl::OUSt try { - ::ucbhelper::Content::create(sSource, xEnvironment, aSourceContent); + ::ucbhelper::Content::create(sSource, xEnvironment, comphelper::ComponentContext(m_xSMGR).getUNOContext(), aSourceContent); aTargetContent.transferContent(aSourceContent, ::ucbhelper::InsertOperation_COPY, sTargetName, nNameClash); } catch(const css::uno::Exception&) @@ -3627,7 +3627,7 @@ void AutoRecovery::st_impl_removeFile(const ::rtl::OUString& sURL) try { - ::ucbhelper::Content aContent = ::ucbhelper::Content(sURL, css::uno::Reference< css::ucb::XCommandEnvironment >()); + ::ucbhelper::Content aContent = ::ucbhelper::Content(sURL, css::uno::Reference< css::ucb::XCommandEnvironment >(), comphelper::ComponentContext(m_xSMGR).getUNOContext()); aContent.executeCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("delete")), css::uno::makeAny(sal_True)); } catch(const css::uno::Exception&) -- cgit v1.2.3