summaryrefslogtreecommitdiff
path: root/scripting/source/stringresource
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-05-29 17:17:28 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-06-06 10:01:22 +0200
commitd08578912f2c9ef42d4349079422e25b951e544e (patch)
treed029b5a9110bcdc255e72ef9c98887f3f8521ea6 /scripting/source/stringresource
parent7d2a5b5114987f1ab415e32ebb5bb9a46b98dc17 (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/stringresource')
-rw-r--r--scripting/source/stringresource/stringresource.cxx25
-rw-r--r--scripting/source/stringresource/stringresource.hxx12
2 files changed, 16 insertions, 21 deletions
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 );