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 /writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx | |
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 'writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx')
-rw-r--r-- | writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx | 56 |
1 files changed, 18 insertions, 38 deletions
diff --git a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx b/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx index 92d0144aa518..b6423f0cc4b7 100644 --- a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx +++ b/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx @@ -20,7 +20,6 @@ #include <cppuhelper/implbase1.hxx> #include <com/sun/star/lang/XMain.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <comphelper/processfactory.hxx> #include "OOXMLTestService.hxx" #include <stdio.h> @@ -31,7 +30,6 @@ #include <com/sun/star/io/XTruncate.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/container/XNameContainer.hpp> -#include <ucbhelper/contentbroker.hxx> #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/ucb/XSimpleFileAccess2.hpp> #include <osl/process.h> @@ -47,9 +45,6 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <comphelper/seqstream.hxx> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/uno/Any.hxx> #include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <ooxml/OOXMLDocument.hxx> @@ -74,52 +69,37 @@ xContext( xContext_ ) sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< OUString >& aArguments ) throw (uno::RuntimeException) { - uno::Sequence<uno::Any> aUcbInitSequence(2); - aUcbInitSequence[0] <<= OUString("Local"); - aUcbInitSequence[1] <<= OUString("Office"); - uno::Reference<lang::XMultiServiceFactory> xServiceFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW); - uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - if (::ucbhelper::ContentBroker::initialize(xServiceFactory, aUcbInitSequence)) - { #ifdef DEBUG_ELEMENT - writerfilter::TagLogger::Pointer_t debugLogger + writerfilter::TagLogger::Pointer_t debugLogger (writerfilter::TagLogger::getInstance("DEBUG")); - debugLogger->startDocument(); + debugLogger->startDocument(); #endif - OUString arg=aArguments[0]; + OUString arg=aArguments[0]; - ::comphelper::setProcessServiceFactory(xServiceFactory); + uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext)); - uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext)); + rtl_uString *dir=NULL; + osl_getProcessWorkingDir(&dir); + OUString absFileUrl; + osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrl.pData); + rtl_uString_release(dir); - rtl_uString *dir=NULL; - osl_getProcessWorkingDir(&dir); - OUString absFileUrl; - osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrl.pData); - rtl_uString_release(dir); + uno::Reference<io::XInputStream> xInputStream = + xFileAccess->openFileRead(absFileUrl); + ooxml::OOXMLStream::Pointer_t pDocStream = + ooxml::OOXMLDocumentFactory::createStream(xContext, xInputStream); - uno::Reference<io::XInputStream> xInputStream = - xFileAccess->openFileRead(absFileUrl); - ooxml::OOXMLStream::Pointer_t pDocStream = - ooxml::OOXMLDocumentFactory::createStream(xContext, xInputStream); + ooxml::OOXMLDocument::Pointer_t pDocument + (ooxml::OOXMLDocumentFactory::createDocument(pDocStream)); - ooxml::OOXMLDocument::Pointer_t pDocument - (ooxml::OOXMLDocumentFactory::createDocument(pDocStream)); - - Stream::Pointer_t pStream = createStreamHandler(); - pDocument->resolve(*pStream); + Stream::Pointer_t pStream = createStreamHandler(); + pDocument->resolve(*pStream); #ifdef DEBUG_ELEMENT - debugLogger->endDocument(); + debugLogger->endDocument(); #endif - ::ucbhelper::ContentBroker::deinitialize(); - } - else - { - fprintf(stderr, "can't initialize UCB"); - } return 0; } |