diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-14 18:08:57 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-14 18:24:49 +0200 |
commit | 9ac86f484b0c278aafbce685ed19d3ea005ee8f8 (patch) | |
tree | cf2fe16d76992bcbd1bd89a8693c5f4996cd55f2 /svl/source/misc | |
parent | 2e284203da7f9882842111265f5f68ea0a145065 (diff) |
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
Diffstat (limited to 'svl/source/misc')
-rw-r--r-- | svl/source/misc/documentlockfile.cxx | 8 | ||||
-rw-r--r-- | svl/source/misc/fstathelper.cxx | 10 | ||||
-rw-r--r-- | svl/source/misc/sharecontrolfile.cxx | 2 | ||||
-rw-r--r-- | svl/source/misc/urihelper.cxx | 37 |
4 files changed, 19 insertions, 38 deletions
diff --git a/svl/source/misc/documentlockfile.cxx b/svl/source/misc/documentlockfile.cxx index 17d9e7ca239e..119ebcdd6a1c 100644 --- a/svl/source/misc/documentlockfile.cxx +++ b/svl/source/misc/documentlockfile.cxx @@ -110,7 +110,7 @@ sal_Bool DocumentLockFile::CreateOwnLockFile() xSeekable->seek( 0 ); uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; - ::ucbhelper::Content aTargetContent( m_aURL, xEnv ); + ::ucbhelper::Content aTargetContent( m_aURL, xEnv, comphelper::getProcessComponentContext() ); ucb::InsertCommandArgument aInsertArg; aInsertArg.Data = xInput; @@ -162,7 +162,7 @@ uno::Reference< io::XInputStream > DocumentLockFile::OpenStream() ::osl::MutexGuard aGuard( m_aMutex ); uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; - ::ucbhelper::Content aSourceContent( m_aURL, xEnv ); + ::ucbhelper::Content aSourceContent( m_aURL, xEnv, comphelper::getProcessComponentContext() ); // the file can be opened readonly, no locking will be done return aSourceContent.openStream(); @@ -175,7 +175,7 @@ sal_Bool DocumentLockFile::OverwriteOwnLockFile() try { uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; - ::ucbhelper::Content aTargetContent( m_aURL, xEnv ); + ::ucbhelper::Content aTargetContent( m_aURL, xEnv, comphelper::getProcessComponentContext() ); uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry(); @@ -213,7 +213,7 @@ void DocumentLockFile::RemoveFile() throw io::IOException(); // not the owner, access denied uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv; - ::ucbhelper::Content aCnt(m_aURL, xEnv); + ::ucbhelper::Content aCnt(m_aURL, xEnv, comphelper::getProcessComponentContext()); aCnt.executeCommand(rtl::OUString("delete"), uno::makeAny(sal_Bool(sal_True))); } diff --git a/svl/source/misc/fstathelper.cxx b/svl/source/misc/fstathelper.cxx index 94e13c81a5c5..3e0a08001ef8 100644 --- a/svl/source/misc/fstathelper.cxx +++ b/svl/source/misc/fstathelper.cxx @@ -22,6 +22,7 @@ #include <tools/string.hxx> #include <ucbhelper/content.hxx> #include <com/sun/star/util/DateTime.hpp> +#include <comphelper/processfactory.hxx> #include <svl/fstathelper.hxx> using namespace ::com::sun::star; @@ -36,7 +37,8 @@ sal_Bool FStatHelper::GetModifiedDateTimeOfFile( const rtl::OUString& rURL, try { ::ucbhelper::Content aTestContent( rURL, - uno::Reference< XCommandEnvironment > ()); + uno::Reference< XCommandEnvironment > (), + comphelper::getProcessComponentContext()); uno::Any aAny = aTestContent.getPropertyValue( OUString("DateModified") ); if( aAny.hasValue() ) @@ -63,7 +65,8 @@ sal_Bool FStatHelper::IsDocument( const rtl::OUString& rURL ) try { ::ucbhelper::Content aTestContent( rURL, - uno::Reference< XCommandEnvironment > ()); + uno::Reference< XCommandEnvironment > (), + comphelper::getProcessComponentContext()); bExist = aTestContent.isDocument(); } catch(...) @@ -78,7 +81,8 @@ sal_Bool FStatHelper::IsFolder( const rtl::OUString& rURL ) try { ::ucbhelper::Content aTestContent( rURL, - uno::Reference< XCommandEnvironment > ()); + uno::Reference< XCommandEnvironment > (), + comphelper::getProcessComponentContext()); bExist = aTestContent.isFolder(); } catch(...) diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx index 95abae227dc2..2d2a4d93b418 100644 --- a/svl/source/misc/sharecontrolfile.cxx +++ b/svl/source/misc/sharecontrolfile.cxx @@ -81,7 +81,7 @@ void ShareControlFile::OpenStream() if ( !m_xStream.is() && !m_aURL.isEmpty() ) { uno::Reference< ucb::XCommandEnvironment > xDummyEnv; - ::ucbhelper::Content aContent = ::ucbhelper::Content( m_aURL, xDummyEnv ); + ::ucbhelper::Content aContent = ::ucbhelper::Content( m_aURL, xDummyEnv, comphelper::getProcessComponentContext() ); uno::Reference< ucb::XContentIdentifier > xContId( aContent.get().is() ? aContent.get()->getIdentifier() : 0 ); if ( !xContId.is() || xContId->getContentProviderScheme() != "file" ) diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx index 23340841999c..ed96a698f48c 100644 --- a/svl/source/misc/urihelper.cxx +++ b/svl/source/misc/urihelper.cxx @@ -19,30 +19,23 @@ #include <svl/urihelper.hxx> #include <com/sun/star/beans/XPropertySet.hpp> -#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" #include "com/sun/star/lang/XMultiComponentFactory.hpp" -#include "com/sun/star/ucb/UniversalContentBroker.hpp" #include "com/sun/star/ucb/Command.hpp" -#include <com/sun/star/ucb/FileSystemNotation.hpp> #include "com/sun/star/ucb/IllegalIdentifierException.hpp" +#include "com/sun/star/ucb/UniversalContentBroker.hpp" #include "com/sun/star/ucb/UnsupportedCommandException.hpp" #include "com/sun/star/ucb/XCommandEnvironment.hpp" #include "com/sun/star/ucb/XCommandProcessor.hpp" #include "com/sun/star/ucb/XContent.hpp" -#include "com/sun/star/ucb/XContentIdentifierFactory.hpp" -#include "com/sun/star/ucb/XContentProvider.hpp" -#include <com/sun/star/ucb/XContentProviderManager.hpp> +#include "com/sun/star/ucb/XUniversalContentBroker.hpp" #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/XComponentContext.hpp" -#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uri/UriReferenceFactory.hpp" #include "com/sun/star/uri/XUriReference.hpp" #include "com/sun/star/uri/XUriReferenceFactory.hpp" -#include "cppuhelper/exc_hlp.hxx" #include "comphelper/processfactory.hxx" #include "osl/diagnose.h" #include "rtl/ustrbuf.hxx" @@ -50,7 +43,6 @@ #include "rtl/ustring.hxx" #include "sal/types.h" #include <tools/inetmime.hxx> -#include <ucbhelper/contentbroker.hxx> #include <unotools/charclass.hxx> #include "rtl/instance.hxx" @@ -159,16 +151,13 @@ bool isAbsoluteHierarchicalUriReference( enum Result { Success, GeneralFailure, SpecificFailure }; Result normalizePrefix( - css::uno::Reference< css::ucb::XContentProvider > const & broker, + css::uno::Reference< css::ucb::XUniversalContentBroker > const & broker, rtl::OUString const & uri, rtl::OUString * normalized) { OSL_ASSERT(broker.is() && normalized != 0); css::uno::Reference< css::ucb::XContent > content; try { - content = broker->queryContent( - css::uno::Reference< css::ucb::XContentIdentifierFactory >( - broker, css::uno::UNO_QUERY_THROW)->createContentIdentifier( - uri)); + content = broker->queryContent(broker->createContentIdentifier(uri)); } catch (css::ucb::IllegalIdentifierException &) {} if (!content.is()) { return GeneralFailure; @@ -196,7 +185,7 @@ Result normalizePrefix( } rtl::OUString normalize( - css::uno::Reference< css::ucb::XContentProvider > const & broker, + css::uno::Reference< css::ucb::XUniversalContentBroker > const & broker, css::uno::Reference< css::uri::XUriReferenceFactory > const & uriFactory, rtl::OUString const & uriReference) { @@ -287,20 +276,8 @@ URIHelper::normalizedMakeRelative( rtl::OUString const & baseUriReference, rtl::OUString const & uriReference) { OSL_ASSERT(context.is()); - css::uno::Reference< css::ucb::XContentProvider > broker; - try { - broker = css::uno::Reference< css::ucb::XContentProvider >( - css::ucb::UniversalContentBroker::createWithKeys(context, "Local", "Office"), - css::uno::UNO_QUERY_THROW); - } catch (css::uno::RuntimeException &) { - throw; - } catch (css::uno::Exception &) { - css::uno::Any exception(cppu::getCaughtException()); - throw css::lang::WrappedTargetRuntimeException( - "creating com.sun.star.ucb.UniversalContentBroker failed", - css::uno::Reference< css::uno::XInterface >(), - exception); - } + css::uno::Reference< css::ucb::XUniversalContentBroker > broker( + css::ucb::UniversalContentBroker::create(context)); css::uno::Reference< css::uri::XUriReferenceFactory > uriFactory( css::uri::UriReferenceFactory::create(context)); return uriFactory->makeRelative( |