From d08578912f2c9ef42d4349079422e25b951e544e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 29 May 2012 17:17:28 +0200 Subject: fdo#46808, Adapt UNO services to new style, Part 7, updating ::create Update calls to factories to use new SimpleFileAccess::create method Change-Id: Ie5b0696fe2228a9033b19969245a53c21a61aa14 Signed-off-by: Stephan Bergmann , added some tweaks. --- desktop/source/deployment/dp_log.cxx | 8 +++----- desktop/source/deployment/registry/help/dp_help.cxx | 18 ++++++++---------- .../migration/services/oo3extensionmigration.cxx | 5 +---- .../migration/services/oo3extensionmigration.hxx | 5 +++-- 4 files changed, 15 insertions(+), 21 deletions(-) (limited to 'desktop/source') diff --git a/desktop/source/deployment/dp_log.cxx b/desktop/source/deployment/dp_log.cxx index 63ab7cb7cefe..18e648d3d103 100644 --- a/desktop/source/deployment/dp_log.cxx +++ b/desktop/source/deployment/dp_log.cxx @@ -37,7 +37,8 @@ #include "comphelper/unwrapargs.hxx" #include "com/sun/star/deployment/DeploymentException.hpp" #include "com/sun/star/ucb/XProgressHandler.hpp" -#include "com/sun/star/ucb/XSimpleFileAccess.hpp" +#include "com/sun/star/ucb/SimpleFileAccess.hpp" +#include "com/sun/star/ucb/XSimpleFileAccess2.hpp" #include "com/sun/star/io/XSeekable.hpp" #include @@ -103,10 +104,7 @@ ProgressLogImpl::ProgressLogImpl( boost::optional< Reference > interactionHandler; comphelper::unwrapArgs( args, log_file, interactionHandler ); - Reference xSimpleFileAccess( - xContext->getServiceManager()->createInstanceWithContext( - OUSTR("com.sun.star.ucb.SimpleFileAccess"), - xContext ), UNO_QUERY_THROW ); + Reference xSimpleFileAccess( ucb::SimpleFileAccess::create(xContext) ); // optional ia handler: if (interactionHandler) xSimpleFileAccess->setInteractionHandler( *interactionHandler ); diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index e7add39b3d13..ba3b785b3673 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -45,7 +45,8 @@ #include #include #endif -#include +#include +#include #include #include #include @@ -115,8 +116,8 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend void revokeEntryFromDb(OUString const & url); bool activateEntry(OUString const & url); - Reference< ucb::XSimpleFileAccess > getFileAccess( void ); - Reference< ucb::XSimpleFileAccess > m_xSFA; + Reference< ucb::XSimpleFileAccess2 > getFileAccess( void ); + Reference< ucb::XSimpleFileAccess2 > m_xSFA; const Reference m_xHelpTypeInfo; Sequence< Reference > m_typeInfos; @@ -402,7 +403,7 @@ void BackendImpl::implProcessHelp( const OUString sHelpFolder = createFolder(OUString(), xCmdEnv); data.dataUrl = sHelpFolder; - Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); + Reference< ucb::XSimpleFileAccess2 > xSFA = getFileAccess(); rtl::OUString aHelpURL = xPackage->getURL(); rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL ); rtl::OUString aName = xPackage->getName(); @@ -585,7 +586,7 @@ void BackendImpl::implProcessHelp( void BackendImpl::implCollectXhpFiles( const rtl::OUString& aDir, std::vector< rtl::OUString >& o_rXhpFileVector ) { - Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); + Reference< ucb::XSimpleFileAccess2 > xSFA = getFileAccess(); // Scan xhp files recursively Sequence< rtl::OUString > aSeq = xSFA->getFolderContents( aDir, true ); @@ -611,17 +612,14 @@ void BackendImpl::implCollectXhpFiles( const rtl::OUString& aDir, } } -Reference< ucb::XSimpleFileAccess > BackendImpl::getFileAccess( void ) +Reference< ucb::XSimpleFileAccess2 > BackendImpl::getFileAccess( void ) { if( !m_xSFA.is() ) { Reference const & xContext = getComponentContext(); if( xContext.is() ) { - m_xSFA = Reference< ucb::XSimpleFileAccess >( - xContext->getServiceManager()->createInstanceWithContext( - rtl::OUString("com.sun.star.ucb.SimpleFileAccess" ), - xContext ), UNO_QUERY ); + m_xSFA = ucb::SimpleFileAccess::create(xContext); } if( !m_xSFA.is() ) { diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 12f4ec49aab3..726f6a5c85cc 100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -219,10 +219,7 @@ bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescript if ( !m_xSimpleFileAccess.is() ) { - m_xSimpleFileAccess = uno::Reference< ucb::XSimpleFileAccess >( - m_ctx->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")), - m_ctx ), uno::UNO_QUERY ); + m_xSimpleFileAccess = ucb::SimpleFileAccess::create(m_ctx); } ::rtl::OUString aExtIdentifier; diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx index adadb3b293e6..d16a15b88376 100644 --- a/desktop/source/migration/services/oo3extensionmigration.hxx +++ b/desktop/source/migration/services/oo3extensionmigration.hxx @@ -34,7 +34,8 @@ #include #include #include -#include +#include +#include #include #include @@ -80,7 +81,7 @@ namespace migration private: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_ctx; ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XDocumentBuilder > m_xDocBuilder; - ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > m_xSimpleFileAccess; + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > m_xSimpleFileAccess; ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; ::osl::Mutex m_aMutex; ::rtl::OUString m_sSourceDir; -- cgit