From 5837402fb1daa437d9a1a37edc9ede57319944f1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 2 Nov 2012 17:46:30 +0200 Subject: fdo#46808, use service constructor for ucb::SimpleFileAccess I upgraded the service to return XSimpleFileAccess3, since it already implemented that interface, and it's backwards compatible. Change-Id: I40001a46048bd21a23b6a2f58a95376f06fc634b --- scripting/source/dlgprov/DialogModelProvider.cxx | 3 +-- scripting/source/dlgprov/dlgprov.cxx | 3 +-- scripting/source/inc/util/MiscUtils.hxx | 8 ++------ scripting/source/provider/URIHelper.cxx | 2 +- scripting/source/provider/URIHelper.hxx | 3 +-- scripting/source/stringresource/stringresource.cxx | 16 ++++++++-------- scripting/source/stringresource/stringresource.hxx | 12 ++++++------ 7 files changed, 20 insertions(+), 27 deletions(-) (limited to 'scripting') diff --git a/scripting/source/dlgprov/DialogModelProvider.cxx b/scripting/source/dlgprov/DialogModelProvider.cxx index 9fb6bb27f905..176ed1452745 100644 --- a/scripting/source/dlgprov/DialogModelProvider.cxx +++ b/scripting/source/dlgprov/DialogModelProvider.cxx @@ -21,7 +21,6 @@ #include "dlgprov.hxx" #include #include -#include // component helper namespace @@ -70,7 +69,7 @@ void SAL_CALL DialogModelProvider::initialize(const css::uno::Sequence< uno::Any if ( !( aArguments[ 0 ] >>= sURL )) throw css::lang::IllegalArgumentException(); // Try any other URL with SimpleFileAccess - Reference< ucb::XSimpleFileAccess2 > xSFI = ucb::SimpleFileAccess::create(m_xContext); + Reference< ucb::XSimpleFileAccess3 > xSFI = ucb::SimpleFileAccess::create(m_xContext); try { diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 4392c99cb37d..61e60d951ebe 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -325,7 +324,7 @@ static ::rtl::OUString aResourceResolverPropName("ResourceResolver"); bSingleDialog = true; // Try any other URL with SimpleFileAccess - Reference< ucb::XSimpleFileAccess2 > xSFI = ucb::SimpleFileAccess::create(m_xContext); + Reference< ucb::XSimpleFileAccess3 > xSFI = ucb::SimpleFileAccess::create(m_xContext); try { diff --git a/scripting/source/inc/util/MiscUtils.hxx b/scripting/source/inc/util/MiscUtils.hxx index 8ad4f8f505de..41a57fe5d9ef 100644 --- a/scripting/source/inc/util/MiscUtils.hxx +++ b/scripting/source/inc/util/MiscUtils.hxx @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -57,11 +56,8 @@ public: { return result; } - css::uno::Reference < css::ucb::XSimpleFileAccess2 > xSFA( css::ucb::SimpleFileAccess::create(xCtx) ); - if ( xSFA.is() ) - { - result = xSFA->getFolderContents( OUSTR("vnd.sun.star.tdoc:/"), true ); - } + css::uno::Reference < css::ucb::XSimpleFileAccess3 > xSFA( css::ucb::SimpleFileAccess::create(xCtx) ); + result = xSFA->getFolderContents( OUSTR("vnd.sun.star.tdoc:/"), true ); } catch ( css::uno::Exception& ) { diff --git a/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx index ec7ba77551ac..13677d1f24be 100644 --- a/scripting/source/provider/URIHelper.cxx +++ b/scripting/source/provider/URIHelper.cxx @@ -59,7 +59,7 @@ ScriptingFrameworkURIHelper::ScriptingFrameworkURIHelper( { try { - m_xSimpleFileAccess = uno::Reference< ucb::XSimpleFileAccess2 >( ucb::SimpleFileAccess::create(xContext) ); + m_xSimpleFileAccess = ucb::SimpleFileAccess::create(xContext); } catch (uno::Exception&) { diff --git a/scripting/source/provider/URIHelper.hxx b/scripting/source/provider/URIHelper.hxx index aae68be61efe..ddf65c04db0c 100644 --- a/scripting/source/provider/URIHelper.hxx +++ b/scripting/source/provider/URIHelper.hxx @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -45,7 +44,7 @@ class ScriptingFrameworkURIHelper : { private: - css::uno::Reference< css::ucb::XSimpleFileAccess2 > m_xSimpleFileAccess; + css::uno::Reference< css::ucb::XSimpleFileAccess3 > m_xSimpleFileAccess; css::uno::Reference m_xUriReferenceFactory; ::rtl::OUString m_sLanguage; diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 338883dbf7e5..0086ea9d9a5e 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -1140,7 +1140,7 @@ void StringResourcePersistenceImpl::storeToURL( const ::rtl::OUString& URL, bool bUsedForStore = false; bool bStoreAll = true; - Reference< ucb::XSimpleFileAccess2 > xFileAccess = ucb::SimpleFileAccess::create(m_xContext); + Reference< ucb::XSimpleFileAccess3 > xFileAccess = ucb::SimpleFileAccess::create(m_xContext); if( xFileAccess.is() && Handler.is() ) xFileAccess->setInteractionHandler( Handler ); @@ -1151,7 +1151,7 @@ void StringResourcePersistenceImpl::implKillRemovedLocaleFiles ( const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess ) throw (Exception, RuntimeException) { @@ -1177,7 +1177,7 @@ void StringResourcePersistenceImpl::implKillChangedDefaultFiles ( const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess ) throw (Exception, RuntimeException) { @@ -1204,7 +1204,7 @@ void StringResourcePersistenceImpl::implStoreAtLocation const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, const ::rtl::OUString& aComment, - const Reference< ucb::XSimpleFileAccess2 >& xFileAccess, + const Reference< ucb::XSimpleFileAccess3 >& xFileAccess, bool bUsedForStore, bool bStoreAll, bool bKillAll @@ -2874,7 +2874,7 @@ void StringResourceWithLocationImpl::store() if( !m_bModified && !bStoreAll ) return; - Reference< ucb::XSimpleFileAccess2 > xFileAccess = getFileAccess(); + Reference< ucb::XSimpleFileAccess3 > xFileAccess = getFileAccess(); implStoreAtLocation( m_aLocation, m_aNameBase, m_aComment, xFileAccess, bUsedForStore, bStoreAll ); m_bModified = false; @@ -2960,7 +2960,7 @@ void StringResourceWithLocationImpl::setURL( const ::rtl::OUString& URL ) // Scan locale properties files void StringResourceWithLocationImpl::implScanLocales( void ) { - const Reference< ucb::XSimpleFileAccess2 > xFileAccess = getFileAccess(); + const Reference< ucb::XSimpleFileAccess3 > xFileAccess = getFileAccess(); if( xFileAccess.is() && xFileAccess->isFolder( m_aLocation ) ) { Sequence< ::rtl::OUString > aContentSeq = xFileAccess->getFolderContents( m_aLocation, false ); @@ -2973,7 +2973,7 @@ bool StringResourceWithLocationImpl::implLoadLocale( LocaleItem* pLocaleItem ) { bool bSuccess = false; - const Reference< ucb::XSimpleFileAccess2 > xFileAccess = getFileAccess(); + const Reference< ucb::XSimpleFileAccess3 > xFileAccess = getFileAccess(); if( xFileAccess.is() ) { ::rtl::OUString aCompleteFileName = @@ -2996,7 +2996,7 @@ bool StringResourceWithLocationImpl::implLoadLocale( LocaleItem* pLocaleItem ) return bSuccess; } -const Reference< ucb::XSimpleFileAccess2 > StringResourceWithLocationImpl::getFileAccess( void ) +const Reference< ucb::XSimpleFileAccess3 > StringResourceWithLocationImpl::getFileAccess( void ) { ::osl::MutexGuard aGuard( getMutex() ); diff --git a/scripting/source/stringresource/stringresource.hxx b/scripting/source/stringresource/stringresource.hxx index 6697eb8aa1ac..90f9a8dc8a9b 100644 --- a/scripting/source/stringresource/stringresource.hxx +++ b/scripting/source/stringresource/stringresource.hxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -305,7 +305,7 @@ protected: ( const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); @@ -313,7 +313,7 @@ protected: ( const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); @@ -322,7 +322,7 @@ protected: const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, const ::rtl::OUString& aComment, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess, + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess, bool bUsedForStore, bool bStoreAll, bool bKillAll = false @@ -557,10 +557,10 @@ class StringResourceWithLocationImpl : public StringResourceWithLocationImpl_BAS { ::rtl::OUString m_aLocation; bool m_bLocationChanged; - com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess2 > m_xSFI; + com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess3 > m_xSFI; com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInteractionHandler; - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > getFileAccess( void ); + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 > getFileAccess( void ); virtual void implScanLocales( void ); virtual bool implLoadLocale( LocaleItem* pLocaleItem ); -- cgit v1.2.3