diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-29 17:17:28 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-06-06 10:01:22 +0200 |
commit | d08578912f2c9ef42d4349079422e25b951e544e (patch) | |
tree | d029b5a9110bcdc255e72ef9c98887f3f8521ea6 /scripting/source | |
parent | 7d2a5b5114987f1ab415e32ebb5bb9a46b98dc17 (diff) |
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 <sbergman@redhat.com>, added some tweaks.
Diffstat (limited to 'scripting/source')
-rw-r--r-- | scripting/source/dlgprov/DialogModelProvider.cxx | 8 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.cxx | 7 | ||||
-rw-r--r-- | scripting/source/inc/util/MiscUtils.hxx | 13 | ||||
-rw-r--r-- | scripting/source/provider/URIHelper.cxx | 6 | ||||
-rw-r--r-- | scripting/source/provider/URIHelper.hxx | 5 | ||||
-rw-r--r-- | scripting/source/runtimemgr/ScriptNameResolverImpl.cxx | 13 | ||||
-rw-r--r-- | scripting/source/stringresource/stringresource.cxx | 25 | ||||
-rw-r--r-- | scripting/source/stringresource/stringresource.hxx | 12 |
8 files changed, 34 insertions, 55 deletions
diff --git a/scripting/source/dlgprov/DialogModelProvider.cxx b/scripting/source/dlgprov/DialogModelProvider.cxx index d304e8afd964..ec604545ed94 100644 --- a/scripting/source/dlgprov/DialogModelProvider.cxx +++ b/scripting/source/dlgprov/DialogModelProvider.cxx @@ -29,7 +29,8 @@ #include "DialogModelProvider.hxx" #include "dlgprov.hxx" #include <com/sun/star/resource/XStringResourceManager.hpp> -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/ucb/SimpleFileAccess.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess2.hpp> // component helper namespace @@ -78,10 +79,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< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager(), UNO_QUERY_THROW ); - Reference< ucb::XSimpleFileAccess > xSFI = - Reference< ucb::XSimpleFileAccess >( xSMgr->createInstanceWithContext - ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")), m_xContext ), UNO_QUERY ); + Reference< ucb::XSimpleFileAccess2 > xSFI = ucb::SimpleFileAccess::create(m_xContext); try { diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index bc75db17bff9..6ba6a29e96f1 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -42,7 +42,8 @@ #include <com/sun/star/resource/XStringResourceSupplier.hpp> #include <com/sun/star/resource/XStringResourceManager.hpp> #include <com/sun/star/beans/XPropertySet.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/resource/XStringResourceWithLocation.hpp> #include <com/sun/star/document/XEmbeddedScripts.hpp> #include <sfx2/app.hxx> @@ -349,9 +350,7 @@ static ::rtl::OUString aResourceResolverPropName("ResourceResolver"); bSingleDialog = true; // Try any other URL with SimpleFileAccess - Reference< ucb::XSimpleFileAccess > xSFI = - Reference< ucb::XSimpleFileAccess >( xSMgr->createInstanceWithContext - ( ::rtl::OUString("com.sun.star.ucb.SimpleFileAccess"), m_xContext ), UNO_QUERY ); + Reference< ucb::XSimpleFileAccess2 > xSFI = ucb::SimpleFileAccess::create(m_xContext); try { diff --git a/scripting/source/inc/util/MiscUtils.hxx b/scripting/source/inc/util/MiscUtils.hxx index 5a8554b24294..a72e629caba2 100644 --- a/scripting/source/inc/util/MiscUtils.hxx +++ b/scripting/source/inc/util/MiscUtils.hxx @@ -39,7 +39,8 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XContentEnumerationAccess.hpp> #include <com/sun/star/ucb/XCommandEnvironment.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/ucb/XContentAccess.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> @@ -65,14 +66,10 @@ public: { return result; } - css::uno::Reference < css::lang::XMultiComponentFactory > xFac( xCtx->getServiceManager(), css::uno::UNO_QUERY ); - if ( xFac.is() ) + css::uno::Reference < css::ucb::XSimpleFileAccess2 > xSFA( css::ucb::SimpleFileAccess::create(xCtx) ); + if ( xSFA.is() ) { - css::uno::Reference < com::sun::star::ucb::XSimpleFileAccess > xSFA( xFac->createInstanceWithContext( OUSTR("com.sun.star.ucb.SimpleFileAccess"), xCtx ), css::uno::UNO_QUERY ); - if ( xSFA.is() ) - { - result = xSFA->getFolderContents( OUSTR("vnd.sun.star.tdoc:/"), true ); - } + 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 5fcfd5d6c03d..f04d869d8fd2 100644 --- a/scripting/source/provider/URIHelper.cxx +++ b/scripting/source/provider/URIHelper.cxx @@ -67,11 +67,7 @@ ScriptingFrameworkURIHelper::ScriptingFrameworkURIHelper( { try { - m_xSimpleFileAccess = uno::Reference< ucb::XSimpleFileAccess >( - xContext->getServiceManager()->createInstanceWithContext( - OUString( - "com.sun.star.ucb.SimpleFileAccess"), - xContext), uno::UNO_QUERY_THROW); + m_xSimpleFileAccess = uno::Reference< ucb::XSimpleFileAccess2 >( ucb::SimpleFileAccess::create(xContext) ); } catch (uno::Exception&) { diff --git a/scripting/source/provider/URIHelper.hxx b/scripting/source/provider/URIHelper.hxx index b1e89469b0c8..86542e1eccb7 100644 --- a/scripting/source/provider/URIHelper.hxx +++ b/scripting/source/provider/URIHelper.hxx @@ -34,7 +34,8 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/RuntimeException.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/uri/XUriReferenceFactory.hpp> #include <rtl/ustring.hxx> @@ -53,7 +54,7 @@ class ScriptingFrameworkURIHelper : { private: - css::uno::Reference< css::ucb::XSimpleFileAccess > m_xSimpleFileAccess; + css::uno::Reference< css::ucb::XSimpleFileAccess2 > m_xSimpleFileAccess; css::uno::Reference<css::uri::XUriReferenceFactory> m_xUriReferenceFactory; ::rtl::OUString m_sLanguage; diff --git a/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx b/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx index c4b7e7c7f53b..0106d429d418 100644 --- a/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx +++ b/scripting/source/runtimemgr/ScriptNameResolverImpl.cxx @@ -33,6 +33,8 @@ #include <cppuhelper/implementationentry.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/security/AccessControlException.hpp> +#include <com/sun/star/ucb/SimpleFileAccess.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess2.hpp> #include <util/util.hxx> #include <util/scriptingconstants.hxx> @@ -217,16 +219,7 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException, RuntimeE OUString temp = OUSTR( "ScriptNameResolverImpl::resolve: " ); throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() ); } - Reference< XInterface > xInterface( - m_xMultiComFac->createInstanceWithContext( - ::rtl::OUString( - "com.sun.star.ucb.SimpleFileAccess" ), - m_xContext - ), - UNO_SET_THROW - ); - Reference < ucb::XSimpleFileAccess > xSimpleFileAccess = Reference < - ucb::XSimpleFileAccess > ( xInterface, UNO_QUERY_THROW ); + Reference < ucb::XSimpleFileAccess2 > xSimpleFileAccess = ucb::SimpleFileAccess::create(m_xContext); // do we need to encode this? hope not. OSL_TRACE( ">>>> About to create storage for %s", diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 35b1fa9ed21e..0b1e04df1112 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -38,6 +38,7 @@ #include <cppuhelper/implementationentry.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <rtl/ustrbuf.hxx> @@ -1147,11 +1148,7 @@ void StringResourcePersistenceImpl::storeToURL( const ::rtl::OUString& URL, bool bUsedForStore = false; bool bStoreAll = true; - Reference< XMultiComponentFactory > xMCF = getMultiComponentFactory(); - Reference< ucb::XSimpleFileAccess > xFileAccess; - xFileAccess = Reference< ucb::XSimpleFileAccess >( xMCF->createInstanceWithContext - ( ::rtl::OUString("com.sun.star.ucb.SimpleFileAccess"), - m_xContext ), UNO_QUERY ); + Reference< ucb::XSimpleFileAccess2 > xFileAccess = ucb::SimpleFileAccess::create(m_xContext); if( xFileAccess.is() && Handler.is() ) xFileAccess->setInteractionHandler( Handler ); @@ -1162,7 +1159,7 @@ void StringResourcePersistenceImpl::implKillRemovedLocaleFiles ( const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess ) throw (Exception, RuntimeException) { @@ -1188,7 +1185,7 @@ void StringResourcePersistenceImpl::implKillChangedDefaultFiles ( const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess ) throw (Exception, RuntimeException) { @@ -1215,7 +1212,7 @@ void StringResourcePersistenceImpl::implStoreAtLocation const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, const ::rtl::OUString& aComment, - const Reference< ucb::XSimpleFileAccess >& xFileAccess, + const Reference< ucb::XSimpleFileAccess2 >& xFileAccess, bool bUsedForStore, bool bStoreAll, bool bKillAll @@ -2891,7 +2888,7 @@ void StringResourceWithLocationImpl::store() if( !m_bModified && !bStoreAll ) return; - Reference< ucb::XSimpleFileAccess > xFileAccess = getFileAccess(); + Reference< ucb::XSimpleFileAccess2 > xFileAccess = getFileAccess(); implStoreAtLocation( m_aLocation, m_aNameBase, m_aComment, xFileAccess, bUsedForStore, bStoreAll ); m_bModified = false; @@ -2977,7 +2974,7 @@ void StringResourceWithLocationImpl::setURL( const ::rtl::OUString& URL ) // Scan locale properties files void StringResourceWithLocationImpl::implScanLocales( void ) { - const Reference< ucb::XSimpleFileAccess > xFileAccess = getFileAccess(); + const Reference< ucb::XSimpleFileAccess2 > xFileAccess = getFileAccess(); if( xFileAccess.is() && xFileAccess->isFolder( m_aLocation ) ) { Sequence< ::rtl::OUString > aContentSeq = xFileAccess->getFolderContents( m_aLocation, false ); @@ -2990,7 +2987,7 @@ bool StringResourceWithLocationImpl::implLoadLocale( LocaleItem* pLocaleItem ) { bool bSuccess = false; - const Reference< ucb::XSimpleFileAccess > xFileAccess = getFileAccess(); + const Reference< ucb::XSimpleFileAccess2 > xFileAccess = getFileAccess(); if( xFileAccess.is() ) { ::rtl::OUString aCompleteFileName = @@ -3013,15 +3010,13 @@ bool StringResourceWithLocationImpl::implLoadLocale( LocaleItem* pLocaleItem ) return bSuccess; } -const Reference< ucb::XSimpleFileAccess > StringResourceWithLocationImpl::getFileAccess( void ) +const Reference< ucb::XSimpleFileAccess2 > StringResourceWithLocationImpl::getFileAccess( void ) { ::osl::MutexGuard aGuard( getMutex() ); if( !m_xSFI.is() ) { - Reference< XMultiComponentFactory > xMCF = getMultiComponentFactory(); - m_xSFI = Reference< ucb::XSimpleFileAccess >( xMCF->createInstanceWithContext - ( ::rtl::OUString("com.sun.star.ucb.SimpleFileAccess"), m_xContext ), UNO_QUERY ); + m_xSFI = ucb::SimpleFileAccess::create(m_xContext); if( m_xSFI.is() && m_xInteractionHandler.is() ) m_xSFI->setInteractionHandler( m_xInteractionHandler ); diff --git a/scripting/source/stringresource/stringresource.hxx b/scripting/source/stringresource/stringresource.hxx index 972d28dbdf5d..f36c5a20339e 100644 --- a/scripting/source/stringresource/stringresource.hxx +++ b/scripting/source/stringresource/stringresource.hxx @@ -34,7 +34,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess2.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <cppuhelper/implbase1.hxx> @@ -315,7 +315,7 @@ protected: ( const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); @@ -323,7 +323,7 @@ protected: ( const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); @@ -332,7 +332,7 @@ protected: const ::rtl::OUString& Location, const ::rtl::OUString& aNameBase, const ::rtl::OUString& aComment, - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess, + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess, bool bUsedForStore, bool bStoreAll, bool bKillAll = false @@ -567,10 +567,10 @@ class StringResourceWithLocationImpl : public StringResourceWithLocationImpl_BAS { ::rtl::OUString m_aLocation; bool m_bLocationChanged; - com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess > m_xSFI; + com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess2 > m_xSFI; com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInteractionHandler; - const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > getFileAccess( void ); + const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > getFileAccess( void ); virtual void implScanLocales( void ); virtual bool implLoadLocale( LocaleItem* pLocaleItem ); |