summaryrefslogtreecommitdiff
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
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.
-rw-r--r--basctl/source/basicide/baside3.cxx9
-rw-r--r--basctl/source/basicide/moduldl2.cxx47
-rw-r--r--basic/source/inc/dlgcont.hxx4
-rw-r--r--basic/source/inc/namecont.hxx16
-rw-r--r--basic/source/inc/scriptcont.hxx6
-rw-r--r--basic/source/runtime/iosys.cxx63
-rw-r--r--basic/source/uno/dlgcont.cxx6
-rw-r--r--basic/source/uno/namecont.cxx35
-rw-r--r--basic/source/uno/scriptcont.cxx12
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx6
-rw-r--r--dbaccess/source/ui/dlg/dbwizsetup.cxx10
-rw-r--r--desktop/source/deployment/dp_log.cxx8
-rw-r--r--desktop/source/deployment/registry/help/dp_help.cxx18
-rw-r--r--desktop/source/migration/services/oo3extensionmigration.cxx5
-rw-r--r--desktop/source/migration/services/oo3extensionmigration.hxx5
-rw-r--r--embeddedobj/source/msole/oleembed.cxx10
-rw-r--r--embeddedobj/source/msole/olepersist.cxx42
-rw-r--r--embeddedobj/source/msole/ownview.cxx10
-rw-r--r--framework/inc/services.h1
-rw-r--r--linguistic/source/convdic.cxx9
-rw-r--r--linguistic/source/dicimp.cxx13
-rw-r--r--linguistic/source/dlistimp.cxx8
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx8
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx14
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx12
-rw-r--r--oox/source/dump/dumperbase.cxx12
-rw-r--r--package/source/xstor/owriteablestream.cxx67
-rw-r--r--package/source/xstor/selfterminatefilestream.cxx8
-rw-r--r--package/source/xstor/selfterminatefilestream.hxx4
-rw-r--r--package/source/xstor/xfactory.cxx14
-rw-r--r--package/source/xstor/xstorage.cxx9
-rw-r--r--package/source/zippackage/ZipPackage.cxx9
-rw-r--r--sc/source/ui/vba/testvba/testvba.cxx7
-rw-r--r--scripting/source/dlgprov/DialogModelProvider.cxx8
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx7
-rw-r--r--scripting/source/inc/util/MiscUtils.hxx13
-rw-r--r--scripting/source/provider/URIHelper.cxx6
-rw-r--r--scripting/source/provider/URIHelper.hxx5
-rw-r--r--scripting/source/runtimemgr/ScriptNameResolverImpl.cxx13
-rw-r--r--scripting/source/stringresource/stringresource.cxx25
-rw-r--r--scripting/source/stringresource/stringresource.hxx12
-rw-r--r--sd/source/filter/html/htmlex.cxx7
-rw-r--r--sd/source/filter/html/htmlex.hxx4
-rw-r--r--sd/source/ui/dlg/dlgass.cxx7
-rw-r--r--sfx2/source/doc/docfac.cxx9
-rw-r--r--sfx2/source/doc/objmisc.cxx7
-rw-r--r--svl/source/fsstor/fsstorage.cxx18
-rw-r--r--svl/source/misc/sharecontrolfile.cxx8
-rw-r--r--sw/source/filter/ww8/ww8par.cxx5
-rw-r--r--sw/source/ui/vba/vbaaddins.cxx5
-rw-r--r--writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx16
-rw-r--r--writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx8
-rw-r--r--writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx18
-rw-r--r--writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx9
-rw-r--r--writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.cxx5
-rw-r--r--writerfilter/unocomponent/debugservices/rtftok/XMLScanner.cxx8
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx10
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.hxx6
-rw-r--r--xmlhelp/source/cxxhelp/provider/db.hxx6
-rw-r--r--xmlhelp/source/treeview/tvread.cxx17
-rw-r--r--xmlhelp/source/treeview/tvread.hxx4
61 files changed, 326 insertions, 447 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index a1a0bf144700..72f783738d78 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -53,7 +53,8 @@
#include "propbrw.hxx"
#include <com/sun/star/resource/StringResourceWithLocation.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/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
@@ -751,8 +752,7 @@ sal_Bool DialogWindow::SaveDialog()
Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
Reference< XInputStream > xInput( xISP->createInputStream() );
- Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
- ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY );
+ Reference< XSimpleFileAccess2 > xSFI( SimpleFileAccess::create(comphelper::getProcessComponentContext()) );
Reference< XOutputStream > xOutput;
try
@@ -1016,8 +1016,7 @@ sal_Bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const
Reference< container::XNameContainer > xDialogModel( xMSF->createInstance
( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY_THROW );
- Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
- ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY_THROW );
+ Reference< XSimpleFileAccess2 > xSFI( SimpleFileAccess::create(comphelper::getProcessComponentContext()) );
Reference< XInputStream > xInput;
if( xSFI->exists( aCurPath ) )
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index f63a26882963..9608f7bf5322 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -56,7 +56,8 @@
#include <com/sun/star/script/XLibraryContainer2.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/script/XLibraryContainerExport.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/XCommandEnvironment.hpp"
#include <com/sun/star/ucb/NameClash.hpp>
#include "com/sun/star/packages/manifest/XManifestWriter.hpp"
@@ -857,28 +858,24 @@ void LibPage::InsertLib()
if ( xMSF.is() )
{
- Reference< XSimpleFileAccess > xSFA( xMSF->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), UNO_QUERY );
+ Reference< XSimpleFileAccess2 > xSFA( SimpleFileAccess::create(comphelper::getProcessComponentContext()) );
- if ( xSFA.is() )
+ ::rtl::OUString aModURL( aModURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ if ( xSFA->exists( aModURL ) )
{
- ::rtl::OUString aModURL( aModURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
- if ( xSFA->exists( aModURL ) )
- {
- Sequence <Any> aSeqModURL(1);
- aSeqModURL[0] <<= aModURL;
- xModLibContImport = Reference< script::XLibraryContainer2 >( xMSF->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.DocumentScriptLibraryContainer" ) ), aSeqModURL ), UNO_QUERY );
- }
+ Sequence <Any> aSeqModURL(1);
+ aSeqModURL[0] <<= aModURL;
+ xModLibContImport = Reference< script::XLibraryContainer2 >( xMSF->createInstanceWithArguments(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.DocumentScriptLibraryContainer" ) ), aSeqModURL ), UNO_QUERY );
+ }
- ::rtl::OUString aDlgURL( aDlgURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
- if ( xSFA->exists( aDlgURL ) )
- {
- Sequence <Any> aSeqDlgURL(1);
- aSeqDlgURL[0] <<= aDlgURL;
- xDlgLibContImport = Reference< script::XLibraryContainer2 >( xMSF->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.DocumentDialogLibraryContainer" ) ), aSeqDlgURL ), UNO_QUERY );
- }
+ ::rtl::OUString aDlgURL( aDlgURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
+ if ( xSFA->exists( aDlgURL ) )
+ {
+ Sequence <Any> aSeqDlgURL(1);
+ aSeqDlgURL[0] <<= aDlgURL;
+ xDlgLibContImport = Reference< script::XLibraryContainer2 >( xMSF->createInstanceWithArguments(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.DocumentDialogLibraryContainer" ) ), aSeqDlgURL ), UNO_QUERY );
}
}
@@ -1264,20 +1261,14 @@ void LibPage::ExportAsPackage( const String& aLibName )
// file open dialog
Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
Reference< task::XInteractionHandler > xHandler;
- Reference< XSimpleFileAccess > xSFA;
+ Reference< XSimpleFileAccess2 > xSFA;
Reference < XFilePicker > xFP;
if( xMSF.is() )
{
xHandler = Reference< task::XInteractionHandler >( xMSF->createInstance
( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), UNO_QUERY );
- xSFA = Reference< XSimpleFileAccess > ( xMSF->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), UNO_QUERY );
- if( !xSFA.is() )
- {
- OSL_FAIL( "No simpleFileAccess" );
- return;
- }
+ xSFA = SimpleFileAccess::create(comphelper::getProcessComponentContext());
Sequence <Any> aServiceType(1);
aServiceType[0] <<= TemplateDescription::FILESAVE_SIMPLE;
diff --git a/basic/source/inc/dlgcont.hxx b/basic/source/inc/dlgcont.hxx
index 94c10ca86b2e..b5151bacaa0f 100644
--- a/basic/source/inc/dlgcont.hxx
+++ b/basic/source/inc/dlgcont.hxx
@@ -134,7 +134,7 @@ public:
ModifiableHelper& _rModifiable,
const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xSFI,
SfxDialogLibraryContainer* pParent
);
@@ -143,7 +143,7 @@ public:
ModifiableHelper& _rModifiable,
const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xSFI,
const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly,
SfxDialogLibraryContainer* pParent
);
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index bf7b3bfd2f34..0c4b109d8a1d 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -40,7 +40,7 @@
#include <com/sun/star/script/XLibraryContainer3.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
@@ -233,7 +233,7 @@ class SfxLibraryContainer : public SfxLibraryContainer_BASE, public ::utl::OEven
rtl::OUString msProjectName;
protected:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > mxSFI;
::com::sun::star::uno::Reference< ::com::sun::star::util::XMacroExpander > mxMacroExpander;
::com::sun::star::uno::Reference< ::com::sun::star::util::XStringSubstitution > mxStringSubstitution;
::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > mxOwnerDocument;
@@ -274,7 +274,7 @@ protected:
const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
const ::rtl::OUString& aTargetURL,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > xToUseSFI,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
@@ -284,7 +284,7 @@ protected:
void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
const ::rtl::OUString& aTargetURL,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > xToUseSFI );
sal_Bool implLoadLibraryIndexFile( SfxLibrary* pLib,
::xmlscript::LibDescriptor& rLib,
@@ -324,7 +324,7 @@ protected:
virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
const ::rtl::OUString& aTargetURL,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
virtual sal_Bool implLoadPasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& Name,
sal_Bool bVerifyPasswordOnly=false )
@@ -574,7 +574,7 @@ class SfxLibrary
friend class SfxScriptLibraryContainer;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > mxSFI;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > mxSFI;
ModifiableHelper& mrModifiable;
NameContainer maNameContainer;
@@ -635,13 +635,13 @@ public:
ModifiableHelper& _rModifiable,
const ::com::sun::star::uno::Type& aType,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xSFI
);
SfxLibrary(
ModifiableHelper& _rModifiable,
const ::com::sun::star::uno::Type& aType,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xSFI,
const ::rtl::OUString& aLibInfoFileURL,
const ::rtl::OUString&
aStorageURL,
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 89e4f7f648df..54c05559c5a1 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -81,7 +81,7 @@ class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPas
virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
const ::rtl::OUString& aTargetURL,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
virtual sal_Bool implLoadPasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& Name,
sal_Bool bVerifyPasswordOnly=false )
@@ -171,14 +171,14 @@ public:
(
ModifiableHelper& _rModifiable,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xSFI
);
SfxScriptLibrary
(
ModifiableHelper& _rModifiable,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSF,
- const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xSFI,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xSFI,
const ::rtl::OUString& aLibInfoFileURL, const ::rtl::OUString& aStorageURL, sal_Bool ReadOnly
);
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 44d87cdc0356..d3aab0bbc825 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -46,12 +46,14 @@
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.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/XContentProvider.hpp>
#include <com/sun/star/ucb/XContentProviderManager.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -559,41 +561,38 @@ SbError SbiStream::Open
Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
if( xSMgr.is() )
{
- Reference< XSimpleFileAccess >
- xSFI( xSMgr->createInstance( ::rtl::OUString("com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
- if( xSFI.is() )
+ Reference< XSimpleFileAccess2 >
+ xSFI( SimpleFileAccess::create( comphelper::ComponentContext(xSMgr).getUNOContext() ) );
+ try
{
- try
- {
- // #??? For write access delete file if it already exists (not for appending)
- if( (nStrmMode & STREAM_WRITE) != 0 && !IsAppend() && !IsBinary() &&
- xSFI->exists( aNameStr ) && !xSFI->isFolder( aNameStr ) )
- {
- xSFI->kill( aNameStr );
- }
+ // #??? For write access delete file if it already exists (not for appending)
+ if( (nStrmMode & STREAM_WRITE) != 0 && !IsAppend() && !IsBinary() &&
+ xSFI->exists( aNameStr ) && !xSFI->isFolder( aNameStr ) )
+ {
+ xSFI->kill( aNameStr );
+ }
- if( (nStrmMode & (STREAM_READ | STREAM_WRITE)) == (STREAM_READ | STREAM_WRITE) )
- {
- Reference< XStream > xIS = xSFI->openFileReadWrite( aNameStr );
- pStrm = new UCBStream( xIS );
- }
- else if( nStrmMode & STREAM_WRITE )
- {
- Reference< XStream > xIS = xSFI->openFileReadWrite( aNameStr );
- pStrm = new UCBStream( xIS );
- }
- else //if( nStrmMode & STREAM_READ )
- {
- Reference< XInputStream > xIS = xSFI->openFileRead( aNameStr );
- pStrm = new UCBStream( xIS );
- }
+ if( (nStrmMode & (STREAM_READ | STREAM_WRITE)) == (STREAM_READ | STREAM_WRITE) )
+ {
+ Reference< XStream > xIS = xSFI->openFileReadWrite( aNameStr );
+ pStrm = new UCBStream( xIS );
+ }
+ else if( nStrmMode & STREAM_WRITE )
+ {
+ Reference< XStream > xIS = xSFI->openFileReadWrite( aNameStr );
+ pStrm = new UCBStream( xIS );
+ }
+ else //if( nStrmMode & STREAM_READ )
+ {
+ Reference< XInputStream > xIS = xSFI->openFileRead( aNameStr );
+ pStrm = new UCBStream( xIS );
+ }
- }
- catch(const Exception & )
- {
- nError = ERRCODE_IO_GENERAL;
- }
+ }
+ catch(const Exception & )
+ {
+ nError = ERRCODE_IO_GENERAL;
}
}
}
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 10765756a9ae..c2a65ace4cc8 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -32,7 +32,7 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
@@ -584,7 +584,7 @@ Reference< XInterface > SAL_CALL SfxDialogLibraryContainer::Create( const Refere
SfxDialogLibrary::SfxDialogLibrary( ModifiableHelper& _rModifiable,
const ::rtl::OUString& aName,
const Reference< XMultiServiceFactory >& xMSF,
- const Reference< XSimpleFileAccess >& xSFI,
+ const Reference< XSimpleFileAccess2 >& xSFI,
SfxDialogLibraryContainer* pParent )
: SfxLibrary( _rModifiable, getCppuType( (const Reference< XInputStreamProvider > *)0 ), xMSF, xSFI )
, m_pParent( pParent )
@@ -595,7 +595,7 @@ SfxDialogLibrary::SfxDialogLibrary( ModifiableHelper& _rModifiable,
SfxDialogLibrary::SfxDialogLibrary( ModifiableHelper& _rModifiable,
const ::rtl::OUString& aName,
const Reference< XMultiServiceFactory >& xMSF,
- const Reference< XSimpleFileAccess >& xSFI,
+ const Reference< XSimpleFileAccess2 >& xSFI,
const OUString& aLibInfoFileURL,
const OUString& aStorageURL,
sal_Bool ReadOnly,
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 384b19c2661b..7a954000d239 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -61,7 +61,9 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/script/LibraryNotLoadedException.hpp>
#include <com/sun/star/script/vba/VBAScriptEventId.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/deployment/ExtensionManager.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/storagehelper.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <basic/sbmod.hxx>
@@ -384,10 +386,7 @@ SfxLibraryContainer::SfxLibraryContainer( void )
mxMSF = comphelper::getProcessServiceFactory();
SAL_WARN_IF(!mxMSF.is(), "basic", "couldn't get ProcessServiceFactory");
- mxSFI = Reference< XSimpleFileAccess >( mxMSF->createInstance
- ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ), UNO_QUERY );
- SAL_WARN_IF(
- !mxSFI.is(), "basic", "couldn't create SimpleFileAccess component");
+ mxSFI = ucb::SimpleFileAccess::create( comphelper::ComponentContext(mxMSF).getUNOContext() );
mxStringSubstitution = Reference< XStringSubstitution >( mxMSF->createInstance
( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.PathSubstitution")) ), UNO_QUERY );
@@ -555,7 +554,7 @@ static void checkAndCopyFileImpl( const INetURLObject& rSourceFolderInetObj,
const INetURLObject& rTargetFolderInetObj,
const OUString& rCheckFileName,
const OUString& rCheckExtension,
- Reference< XSimpleFileAccess > xSFI )
+ Reference< XSimpleFileAccess2 > xSFI )
{
INetURLObject aTargetFolderInetObj( rTargetFolderInetObj );
aTargetFolderInetObj.insertName( rCheckFileName, sal_True, INetURLObject::LAST_SEGMENT,
@@ -1306,7 +1305,7 @@ sal_Bool SfxLibraryContainer::implStorePasswordLibrary(
const ::rtl::OUString& /*aName*/,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& /*xStorage*/,
const ::rtl::OUString& /*aTargetURL*/,
- const Reference< XSimpleFileAccess > /*xToUseSFI*/,
+ const Reference< XSimpleFileAccess2 > /*xToUseSFI*/,
const uno::Reference< task::XInteractionHandler >& )
{
return sal_False;
@@ -1357,7 +1356,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
const OUString& aName, const uno::Reference< embed::XStorage >& xStorage )
{
OUString aDummyLocation;
- Reference< XSimpleFileAccess > xDummySFA;
+ Reference< XSimpleFileAccess2 > xDummySFA;
Reference< XInteractionHandler > xDummyHandler;
implStoreLibrary( pLib, aName, xStorage, aDummyLocation, xDummySFA, xDummyHandler );
}
@@ -1365,7 +1364,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
// New variant for library export
void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
const OUString& aName, const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL, Reference< XSimpleFileAccess > xToUseSFI,
+ const ::rtl::OUString& aTargetURL, Reference< XSimpleFileAccess2 > xToUseSFI,
const Reference< XInteractionHandler >& xHandler )
{
sal_Bool bLink = pLib->mbLink;
@@ -1434,7 +1433,7 @@ void SfxLibraryContainer::implStoreLibrary( SfxLibrary* pLib,
bool bExport = !aTargetURL.isEmpty();
try
{
- Reference< XSimpleFileAccess > xSFI = mxSFI;
+ Reference< XSimpleFileAccess2 > xSFI = mxSFI;
if( xToUseSFI.is() )
xSFI = xToUseSFI;
@@ -1507,14 +1506,14 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
const ::xmlscript::LibDescriptor& rLib, const uno::Reference< embed::XStorage >& xStorage )
{
OUString aDummyLocation;
- Reference< XSimpleFileAccess > xDummySFA;
+ Reference< XSimpleFileAccess2 > xDummySFA;
implStoreLibraryIndexFile( pLib, rLib, xStorage, aDummyLocation, xDummySFA );
}
// New variant for library export
void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
const ::xmlscript::LibDescriptor& rLib, const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL, Reference< XSimpleFileAccess > xToUseSFI )
+ const ::rtl::OUString& aTargetURL, Reference< XSimpleFileAccess2 > xToUseSFI )
{
// Create sax writer
Reference< XExtendedDocumentHandler > xHandler(
@@ -1566,7 +1565,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
{
// Export?
bool bExport = !aTargetURL.isEmpty();
- Reference< XSimpleFileAccess > xSFI = mxSFI;
+ Reference< XSimpleFileAccess2 > xSFI = mxSFI;
if( xToUseSFI.is() )
xSFI = xToUseSFI;
@@ -2711,13 +2710,11 @@ void SAL_CALL SfxLibraryContainer::exportLibrary( const OUString& Name, const OU
LibraryContainerMethodGuard aGuard( *this );
SfxLibrary* pImplLib = getImplLib( Name );
- Reference< XSimpleFileAccess > xToUseSFI;
+ Reference< XSimpleFileAccess2 > xToUseSFI;
if( Handler.is() )
{
- xToUseSFI = Reference< XSimpleFileAccess >( mxMSF->createInstance
- ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ), UNO_QUERY );
- if( xToUseSFI.is() )
- xToUseSFI->setInteractionHandler( Handler );
+ xToUseSFI = ucb::SimpleFileAccess::create( comphelper::ComponentContext(mxMSF).getUNOContext() );
+ xToUseSFI->setInteractionHandler( Handler );
}
// Maybe lib is not loaded?!
@@ -2918,7 +2915,7 @@ void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifie
// Ctor
SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
- const Reference< XMultiServiceFactory >& xMSF, const Reference< XSimpleFileAccess >& xSFI )
+ const Reference< XMultiServiceFactory >& xMSF, const Reference< XSimpleFileAccess2 >& xSFI )
: OComponentHelper( m_aMutex )
, mxMSF( xMSF )
, mxSFI( xSFI )
@@ -2940,7 +2937,7 @@ SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
}
SfxLibrary::SfxLibrary( ModifiableHelper& _rModifiable, const Type& aType,
- const Reference< XMultiServiceFactory >& xMSF, const Reference< XSimpleFileAccess >& xSFI,
+ const Reference< XMultiServiceFactory >& xMSF, const Reference< XSimpleFileAccess2 >& xSFI,
const OUString& aLibInfoFileURL, const OUString& aStorageURL, sal_Bool ReadOnly )
: OComponentHelper( m_aMutex )
, mxMSF( xMSF )
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 7e3aee2a37a6..30e4328c812b 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -34,7 +34,7 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XEncryptionProtectedSource.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -580,13 +580,13 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
const ::rtl::OUString& aName, const uno::Reference< embed::XStorage >& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler )
{
OUString aDummyLocation;
- Reference< XSimpleFileAccess > xDummySFA;
+ Reference< XSimpleFileAccess2 > xDummySFA;
return implStorePasswordLibrary( pLib, aName, xStorage, aDummyLocation, xDummySFA, xHandler );
}
sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL, const Reference< XSimpleFileAccess > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler )
+ const ::rtl::OUString& aTargetURL, const Reference< XSimpleFileAccess2 > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler )
{
bool bExport = !aTargetURL.isEmpty();
@@ -719,7 +719,7 @@ sal_Bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib,
{
try
{
- Reference< XSimpleFileAccess > xSFI = mxSFI;
+ Reference< XSimpleFileAccess2 > xSFI = mxSFI;
if( xToUseSFI.is() )
xSFI = xToUseSFI;
@@ -1200,7 +1200,7 @@ Reference< XInterface > SAL_CALL SfxScriptLibraryContainer::Create
// Ctor
SfxScriptLibrary::SfxScriptLibrary( ModifiableHelper& _rModifiable,
const Reference< XMultiServiceFactory >& xMSF,
- const Reference< XSimpleFileAccess >& xSFI )
+ const Reference< XSimpleFileAccess2 >& xSFI )
: SfxLibrary( _rModifiable, getCppuType( (const OUString *)0 ), xMSF, xSFI )
, mbLoadedSource( sal_False )
, mbLoadedBinary( sal_False )
@@ -1209,7 +1209,7 @@ SfxScriptLibrary::SfxScriptLibrary( ModifiableHelper& _rModifiable,
SfxScriptLibrary::SfxScriptLibrary( ModifiableHelper& _rModifiable,
const Reference< XMultiServiceFactory >& xMSF,
- const Reference< XSimpleFileAccess >& xSFI,
+ const Reference< XSimpleFileAccess2 >& xSFI,
const OUString& aLibInfoFileURL,
const OUString& aStorageURL,
sal_Bool ReadOnly )
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index f533642e158f..87e703226247 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -56,7 +56,8 @@
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XStatusIndicatorFactory.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/ui/XUIConfigurationStorage.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
@@ -1135,8 +1136,7 @@ void ODatabaseDocument::impl_storeAs_throw( const ::rtl::OUString& _rURL, const
Reference< XStorage > ODatabaseDocument::impl_createStorageFor_throw( const ::rtl::OUString& _rURL ) const
{
- Reference < ::com::sun::star::ucb::XSimpleFileAccess > xTempAccess;
- m_pImpl->m_aContext.createComponent( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ,xTempAccess);
+ Reference< ucb::XSimpleFileAccess2 > xTempAccess(ucb::SimpleFileAccess::create(m_pImpl->m_aContext.getUNOContext()));
Reference< io::XStream > xStream = xTempAccess->openFileReadWrite( _rURL );
Reference< io::XTruncate > xTruncate(xStream,UNO_QUERY);
if ( xTruncate.is() )
diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx
index b318d3586e2f..358283037da2 100644
--- a/dbaccess/source/ui/dlg/dbwizsetup.cxx
+++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx
@@ -68,7 +68,8 @@
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XModel.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/task/XJobExecutor.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
@@ -86,6 +87,7 @@
/** === end UNO includes === **/
#include <svl/filenotation.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/interaction.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/sequenceashashmap.hxx>
@@ -850,7 +852,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
}
else if ( m_pCollection->isFileSystemBased(eType) )
{
- Reference< XSimpleFileAccess > xSimpleFileAccess(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), UNO_QUERY);
+ Reference< XSimpleFileAccess2 > xSimpleFileAccess(ucb::SimpleFileAccess::create(comphelper::ComponentContext(getORB()).getUNOContext()));
INetURLObject aDBPathURL(m_sWorkPath);
aDBPathURL.Append(m_aDocURL.getBase());
createUniqueFolderName(&aDBPathURL);
@@ -918,7 +920,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
//-------------------------------------------------------------------------
void ODbTypeWizDialogSetup::createUniqueFolderName(INetURLObject* pURL)
{
- Reference< XSimpleFileAccess > xSimpleFileAccess(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), UNO_QUERY);
+ Reference< XSimpleFileAccess2 > xSimpleFileAccess(ucb::SimpleFileAccess::create(comphelper::ComponentContext(getORB()).getUNOContext()));
:: rtl::OUString sLastSegmentName = pURL->getName();
sal_Bool bFolderExists = sal_True;
sal_Int32 i = 1;
@@ -936,7 +938,7 @@ sal_Bool ODbTypeWizDialogSetup::SaveDatabaseDocument()
//-------------------------------------------------------------------------
String ODbTypeWizDialogSetup::createUniqueFileName(const INetURLObject& _rURL)
{
- Reference< XSimpleFileAccess > xSimpleFileAccess(getORB()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))), UNO_QUERY);
+ Reference< XSimpleFileAccess2 > xSimpleFileAccess(ucb::SimpleFileAccess::create(comphelper::ComponentContext(getORB()).getUNOContext()));
:: rtl::OUString sFilename = _rURL.getName();
::rtl::OUString BaseName = _rURL.getBase();
::rtl::OUString sExtension = _rURL.getExtension();
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 <stdio.h>
@@ -103,10 +104,7 @@ ProgressLogImpl::ProgressLogImpl(
boost::optional< Reference<task::XInteractionHandler> > interactionHandler;
comphelper::unwrapArgs( args, log_file, interactionHandler );
- Reference<ucb::XSimpleFileAccess> xSimpleFileAccess(
- xContext->getServiceManager()->createInstanceWithContext(
- OUSTR("com.sun.star.ucb.SimpleFileAccess"),
- xContext ), UNO_QUERY_THROW );
+ Reference<ucb::XSimpleFileAccess2> 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 <l10ntools/compilehelp.hxx>
#include <l10ntools/HelpIndexer.hxx>
#endif
-#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/util/XMacroExpander.hpp>
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarExpandUrl.hpp>
@@ -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<deployment::XPackageTypeInfo> m_xHelpTypeInfo;
Sequence< Reference<deployment::XPackageTypeInfo> > 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<XComponentContext> 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 <com/sun/star/task/XJob.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/xml/dom/XDocumentBuilder.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/deployment/XExtensionManager.hpp>
#include <osl/mutex.hxx>
@@ -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;
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index b44d789cbc77..087fb2a328d5 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -44,13 +44,15 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/document/XStorageBasedDocument.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/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/system/XSystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <rtl/logfile.hxx>
+#include <comphelper/componentcontext.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <comphelper/mimeconfighelper.hxx>
#include <comphelper/storagehelper.hxx>
@@ -736,10 +738,8 @@ namespace
xNativeTempFile = uno::Reference<beans::XPropertySet>();
- uno::Reference<ucb::XSimpleFileAccess> xSimpleFileAccess(
- xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))),
- uno::UNO_QUERY_THROW);
+ uno::Reference < ucb::XSimpleFileAccess2 > xSimpleFileAccess(
+ ucb::SimpleFileAccess::create( comphelper::ComponentContext(xFactory).getUNOContext() ) );
xSimpleFileAccess->setReadOnly(sUrl, sal_True);
}
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
index efb51d39ff33..7765043af0c5 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -43,10 +43,12 @@
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XTruncate.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 <rtl/logfile.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/mimeconfighelper.hxx>
#include <comphelper/classids.hxx>
@@ -68,16 +70,11 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang:
try
{
- uno::Reference < ucb::XSimpleFileAccess > xAccess(
- xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )),
- uno::UNO_QUERY );
+ uno::Reference < ucb::XSimpleFileAccess2 > xAccess(
+ ucb::SimpleFileAccess::create( comphelper::ComponentContext(xFactory).getUNOContext() ) );
- if ( xAccess.is() )
- {
- xAccess->kill( aURL );
- bRet = sal_True;
- }
+ xAccess->kill( aURL );
+ bRet = sal_True;
}
catch( const uno::Exception& )
{
@@ -128,13 +125,8 @@ sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang:
if ( !aResult.isEmpty() )
{
try {
- uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
- xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempAccess.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess(
+ ucb::SimpleFileAccess::create( comphelper::ComponentContext(xFactory).getUNOContext() ) );
uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( aResult );
if ( xTempOutStream.is() )
@@ -596,13 +588,8 @@ sal_Bool OleEmbeddedObject::HasVisReplInStream()
try
{
// open temporary file for reading
- uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
- m_xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempAccess.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess(
+ ucb::SimpleFileAccess::create( comphelper::ComponentContext(m_xFactory).getUNOContext() ) );
xStream = xTempAccess->openFileRead( m_aTempURL );
}
@@ -1068,12 +1055,7 @@ void OleEmbeddedObject::StoreObjectToStream( uno::Reference< io::XOutputStream >
// open temporary file for reading
uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
- m_xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempAccess.is() )
- throw uno::RuntimeException(); // TODO:
+ ucb::SimpleFileAccess::create( comphelper::ComponentContext(m_xFactory).getUNOContext() ) );
uno::Reference< io::XInputStream > xTempInStream = xTempAccess->openFileRead( m_aTempURL );
OSL_ENSURE( xTempInStream.is(), "The object's temporary file can not be reopened for reading!\n" );
diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx
index 063bb0d5a572..354ff11e3ece 100644
--- a/embeddedobj/source/msole/ownview.cxx
+++ b/embeddedobj/source/msole/ownview.cxx
@@ -36,7 +36,8 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/task/XInteractionHandler.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/util/XCloseable.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -45,6 +46,7 @@
#include <com/sun/star/document/XTypeDetection.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <cppuhelper/implbase1.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/mimeconfighelper.hxx>
@@ -420,10 +422,8 @@ void OwnView_Impl::CreateNative()
try
{
- uno::Reference < ucb::XSimpleFileAccess > xAccess(
- m_xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )),
- uno::UNO_QUERY_THROW );
+ uno::Reference < ucb::XSimpleFileAccess2 > xAccess(
+ ucb::SimpleFileAccess::create( comphelper::ComponentContext(m_xFactory).getUNOContext() ) );
uno::Reference< io::XInputStream > xInStream = xAccess->openFileRead( m_aTempFileURL );
if ( !xInStream.is() )
diff --git a/framework/inc/services.h b/framework/inc/services.h
index 982fcd078f11..ef14a96c1959 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -101,7 +101,6 @@ namespace framework{
#define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration")
#define SERVICENAME_SAXPARSER DECLARE_ASCII("com.sun.star.xml.sax.Parser" )
#define SERVICENAME_SAXWRITER DECLARE_ASCII("com.sun.star.xml.sax.Writer" )
-#define SERVICENAME_SIMPLEFILEACCESS DECLARE_ASCII("com.sun.star.ucb.SimpleFileAccess" )
#define SERVICENAME_STORAGEFACTORY DECLARE_ASCII("com.sun.star.embed.StorageFactory" )
#define SERVICENAME_FILESYSTEMSTORAGEFACTORY DECLARE_ASCII("com.sun.star.embed.FileSystemStorageFactory" )
#define SERVICENAME_TEMPFILE DECLARE_ASCII("com.sun.star.io.TempFile" )
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index 5827d1f88985..71dd0167b43a 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -48,7 +48,8 @@
#include <com/sun/star/util/XFlushable.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/EventObject.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/uno/Reference.h>
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/util/XFlushListener.hpp>
@@ -90,12 +91,13 @@ void ReadThroughDic( const String &rMainURL, ConvDicXMLImport &rImport )
DBG_ASSERT(!INetURLObject( rMainURL ).HasError(), "invalid URL");
uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
+ uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
// get xInputStream stream
uno::Reference< io::XInputStream > xIn;
try
{
- uno::Reference< ucb::XSimpleFileAccess > xAccess( xServiceFactory->createInstance( "com.sun.star.ucb.SimpleFileAccess" ), uno::UNO_QUERY_THROW );
+ uno::Reference< ucb::XSimpleFileAccess2 > xAccess( ucb::SimpleFileAccess::create(xContext) );
xIn = xAccess->openFileRead( rMainURL );
}
catch (const uno::Exception &)
@@ -261,13 +263,14 @@ void ConvDic::Save()
return;
DBG_ASSERT(!INetURLObject( aMainURL ).HasError(), "invalid URL");
+ uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
// get XOutputStream stream
uno::Reference< io::XStream > xStream;
try
{
- uno::Reference< ucb::XSimpleFileAccess > xAccess( xServiceFactory->createInstance( "com.sun.star.ucb.SimpleFileAccess" ), uno::UNO_QUERY_THROW );
+ uno::Reference< ucb::XSimpleFileAccess2 > xAccess( ucb::SimpleFileAccess::create(xContext) );
xStream = xAccess->openFileReadWrite( aMainURL );
}
catch (const uno::Exception &)
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 85a25afa5ddb..42941cdbeda7 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -42,7 +42,8 @@
#include <comphelper/string.hxx>
#include <unotools/ucbstreamhelper.hxx>
-#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/linguistic2/DictionaryType.hpp>
#include <com/sun/star/linguistic2/DictionaryEventFlags.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
@@ -275,14 +276,13 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL)
if (rMainURL.isEmpty())
return 0;
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
+ uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
// get XInputStream stream
uno::Reference< io::XInputStream > xStream;
try
{
- uno::Reference< ucb::XSimpleFileAccess > xAccess( xServiceFactory->createInstance(
- A2OU( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< ucb::XSimpleFileAccess2 > xAccess( ucb::SimpleFileAccess::create(xContext) );
xStream = xAccess->openFileRead( rMainURL );
}
catch (const uno::Exception &)
@@ -416,14 +416,13 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL)
return 0;
DBG_ASSERT(!INetURLObject( rURL ).HasError(), "lng : invalid URL");
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
+ uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
// get XOutputStream stream
uno::Reference< io::XStream > xStream;
try
{
- uno::Reference< ucb::XSimpleFileAccess > xAccess( xServiceFactory->createInstance(
- A2OU( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< ucb::XSimpleFileAccess2 > xAccess( ucb::SimpleFileAccess::create(xContext) );
xStream = xAccess->openFileReadWrite( rURL );
}
catch (const uno::Exception &)
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 316d86ddcc92..f5ac64054e0d 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -46,7 +46,8 @@
#include <com/sun/star/linguistic2/DictionaryEventFlags.hpp>
#include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include "defs.hxx"
#include "dlistimp.hxx"
@@ -899,14 +900,13 @@ static sal_Bool IsVers2OrNewer( const String& rFileURL, sal_uInt16& nLng, sal_Bo
return sal_False;
// get stream to be used
- uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
+ uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
// get XInputStream stream
uno::Reference< io::XInputStream > xStream;
try
{
- uno::Reference< ucb::XSimpleFileAccess > xAccess( xServiceFactory->createInstance(
- A2OU( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< ucb::XSimpleFileAccess2 > xAccess( ucb::SimpleFileAccess::create(xContext) );
xStream = xAccess->openFileRead( rFileURL );
}
catch (const uno::Exception &)
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx
index 1bb950952392..e6b78850c65d 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/fdcomp.cxx
@@ -38,7 +38,7 @@
#include <osl/mutex.hxx>
#include <osl/thread.h>
#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include "filterdetect.hxx"
@@ -58,10 +58,10 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
OUString implName = OUString::createFromAscii( pImplName );
if ( pServiceManager && implName.equals(FilterDetect_getImplementationName()) )
{
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ Reference< XSingleComponentFactory > xFactory( createSingleComponentFactory(
+ FilterDetect_createInstance,
OUString::createFromAscii( pImplName ),
- FilterDetect_createInstance, FilterDetect_getSupportedServiceNames() ) );
+ FilterDetect_getSupportedServiceNames() ) );
if (xFactory.is())
{
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx
index e26d7f6f5869..63c32c041aa0 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.cxx
@@ -35,7 +35,6 @@
#include "filterdetect.hxx"
#include <osl/diagnose.h>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -54,7 +53,9 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/document/XExtendedFilterDetection.hpp>
#include <com/sun/star/beans/PropertyState.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/uno/XComponentContext.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -97,9 +98,8 @@ OUString SAL_CALL FilterDetect::detect(Sequence< PropertyValue >& aArguments )
if (!xInStream.is())
{
// open the stream if it was not suplied by the framework
- Reference< XSimpleFileAccess > xSFI(mxMSF->createInstance(
- OUString("com.sun.star.ucb.SimpleFileAccess")), UNO_QUERY);
- if (sURL.getLength() > 0 && xSFI.is())
+ Reference< XSimpleFileAccess2 > xSFI(SimpleFileAccess::create(mxContext));
+ if (sURL.getLength() > 0)
{
try
{
@@ -231,10 +231,10 @@ Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames( )
#undef SERVICE_NAME1
#undef SERVICE_NAME2
-Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< XComponentContext > & rContext)
throw( Exception )
{
- return (cppu::OWeakObject*) new FilterDetect( rSMgr );
+ return (cppu::OWeakObject*) new FilterDetect( rContext );
}
// XServiceInfo
diff --git a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx
index 210d59cf56e5..f3b0382c781f 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx
+++ b/odk/examples/DevelopersGuide/OfficeDev/FilterDevelopment/FlatXmlFilterDetection/filterdetect.hxx
@@ -47,6 +47,10 @@
#include <cppuhelper/implbase3.hxx>
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+} } } }
+
enum FilterType
{
FILTER_IMPORT,
@@ -61,7 +65,7 @@ class FilterDetect : public cppu::WeakImplHelper3 <com::sun::star::document::XEx
com::sun::star::lang::XServiceInfo>
{
protected:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
::rtl::OUString msFilterName;
::com::sun::star::uno::Sequence< ::rtl::OUString > msUserData;
@@ -74,8 +78,8 @@ protected:
throw (::com::sun::star::uno::RuntimeException);
public:
- FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
- : mxMSF( rxMSF ) {}
+ FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext)
+ : mxContext( rxContext ) {}
virtual ~FilterDetect() {}
@@ -110,7 +114,7 @@ sal_Bool SAL_CALL FilterDetect_supportsService( const ::rtl::OUString& ServiceNa
throw ( ::com::sun::star::uno::RuntimeException );
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-SAL_CALL FilterDetect_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+SAL_CALL FilterDetect_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rContext)
throw ( ::com::sun::star::uno::Exception );
#endif
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index 5ad2f6a4c9b1..3eaf7ad5adb4 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -32,7 +32,8 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XTextOutputStream.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <comphelper/docpasswordhelper.hxx>
#include <osl/file.hxx>
#include <rtl/math.hxx>
@@ -118,8 +119,7 @@ Reference< XInputStream > InputOutputHelper::openInputStream(
Reference< XInputStream > xInStrm;
if( rxContext.is() ) try
{
- Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW );
- Reference< XSimpleFileAccess > xFileAccess( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
+ Reference<XSimpleFileAccess2> xFileAccess(SimpleFileAccess::create(rxContext));
xInStrm = xFileAccess->openFileRead( rFileName );
}
catch( Exception& )
@@ -136,8 +136,7 @@ Reference< XOutputStream > InputOutputHelper::openOutputStream(
Reference< XOutputStream > xOutStrm;
if( rxContext.is() ) try
{
- Reference< XMultiServiceFactory > xFactory( rxContext->getServiceManager(), UNO_QUERY_THROW );
- Reference< XSimpleFileAccess > xFileAccess( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
+ Reference<XSimpleFileAccess2> xFileAccess(SimpleFileAccess::create(rxContext));
xOutStrm = xFileAccess->openFileWrite( rFileName );
}
catch( Exception& )
@@ -1898,8 +1897,7 @@ void StorageObjectBase::implDump()
if( bIsRoot ) try
{
aSysOutPath += OOX_DUMP_DUMPEXT;
- Reference< XMultiServiceFactory > xFactory( getContext()->getServiceManager(), UNO_QUERY_THROW );
- Reference< XSimpleFileAccess > xFileAccess( xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
+ Reference<XSimpleFileAccess2> xFileAccess(SimpleFileAccess::create(getContext()));
xFileAccess->kill( aSysOutPath );
}
catch( Exception& )
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index 114a2ff2226a..f5fb01224287 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -26,7 +26,9 @@
*
************************************************************************/
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -212,25 +214,19 @@ bool SequencesEqual( const uno::Sequence< beans::NamedValue >& aSequence1, const
}
//-----------------------------------------------
-sal_Bool KillFile( const ::rtl::OUString& aURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+sal_Bool KillFile( const ::rtl::OUString& aURL, const uno::Reference< uno::XComponentContext >& xContext )
{
- if ( !xFactory.is() )
+ if ( !xContext.is() )
return sal_False;
sal_Bool bRet = sal_False;
try
{
- uno::Reference < ucb::XSimpleFileAccess > xAccess(
- xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess" ) ) ),
- uno::UNO_QUERY );
+ uno::Reference < ucb::XSimpleFileAccess2 > xAccess( ucb::SimpleFileAccess::create( xContext ) );
- if ( xAccess.is() )
- {
- xAccess->kill( aURL );
- bRet = sal_True;
- }
+ xAccess->kill( aURL );
+ bRet = sal_True;
}
catch( const uno::Exception& rException )
{
@@ -325,7 +321,7 @@ OWriteStream_Impl::~OWriteStream_Impl()
if ( !m_aTempURL.isEmpty() )
{
- KillFile( m_aTempURL, GetServiceFactory() );
+ KillFile( m_aTempURL, comphelper::getProcessComponentContext() );
m_aTempURL = ::rtl::OUString();
}
@@ -570,13 +566,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
try {
if ( !aTempURL.isEmpty() && xStream.is() )
{
- uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
- GetServiceFactory()->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess") ) ),
- uno::UNO_QUERY );
-
- if ( !xTempAccess.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess( ucb::SimpleFileAccess::create( ::comphelper::getProcessComponentContext() ) );
uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( aTempURL );
if ( xTempOutStream.is() )
@@ -595,7 +585,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
AddLog( rWrongPasswordException.Message );
AddLog( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow") ) );
- KillFile( aTempURL, GetServiceFactory() );
+ KillFile( aTempURL, comphelper::getProcessComponentContext() );
throw;
}
catch( const uno::Exception& rException )
@@ -603,7 +593,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
AddLog( rException.Message );
AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Rethrow") ) );
- KillFile( aTempURL, GetServiceFactory() );
+ KillFile( aTempURL, comphelper::getProcessComponentContext() );
throw;
}
@@ -660,14 +650,7 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
try {
if ( !m_aTempURL.isEmpty() )
{
- uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
- GetServiceFactory()->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess") ) ),
- uno::UNO_QUERY );
-
- if ( !xTempAccess.is() )
- throw uno::RuntimeException(); // TODO:
-
+ uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess( ucb::SimpleFileAccess::create( ::comphelper::getProcessComponentContext() ) );
uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( m_aTempURL );
if ( xTempOutStream.is() )
@@ -686,14 +669,14 @@ uno::Reference< lang::XMultiServiceFactory > OWriteStream_Impl::GetServiceFactor
}
catch( const packages::WrongPasswordException& )
{
- KillFile( m_aTempURL, GetServiceFactory() );
+ KillFile( m_aTempURL, comphelper::getProcessComponentContext() );
m_aTempURL = ::rtl::OUString();
throw;
}
catch( const uno::Exception& )
{
- KillFile( m_aTempURL, GetServiceFactory() );
+ KillFile( m_aTempURL, comphelper::getProcessComponentContext() );
m_aTempURL = ::rtl::OUString();
}
}
@@ -716,13 +699,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetTempFileAsStream()
if ( !m_aTempURL.isEmpty() )
{
// the temporary file is not used if the cache is used
- uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
- GetServiceFactory()->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess") ) ),
- uno::UNO_QUERY );
-
- if ( !xTempAccess.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess( ucb::SimpleFileAccess::create( ::comphelper::getProcessComponentContext() ) );
try
{
@@ -761,13 +738,7 @@ uno::Reference< io::XInputStream > OWriteStream_Impl::GetTempFileAsInputStream()
if ( !m_aTempURL.isEmpty() )
{
// the temporary file is not used if the cache is used
- uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
- GetServiceFactory()->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess") ) ),
- uno::UNO_QUERY );
-
- if ( !xTempAccess.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess( ucb::SimpleFileAccess::create( ::comphelper::getProcessComponentContext() ) );
try
{
@@ -1009,7 +980,7 @@ void OWriteStream_Impl::Revert()
if ( !m_aTempURL.isEmpty() )
{
- KillFile( m_aTempURL, GetServiceFactory() );
+ KillFile( m_aTempURL, comphelper::getProcessComponentContext() );
m_aTempURL = ::rtl::OUString();
}
@@ -1445,7 +1416,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre
{
if ( !m_aTempURL.isEmpty() )
{
- KillFile( m_aTempURL, GetServiceFactory() );
+ KillFile( m_aTempURL, comphelper::getProcessComponentContext() );
m_aTempURL = ::rtl::OUString();
}
if ( m_xCacheStream.is() )
diff --git a/package/source/xstor/selfterminatefilestream.cxx b/package/source/xstor/selfterminatefilestream.cxx
index 62ff69b14caa..b0c55157f344 100644
--- a/package/source/xstor/selfterminatefilestream.cxx
+++ b/package/source/xstor/selfterminatefilestream.cxx
@@ -27,9 +27,10 @@
************************************************************************/
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include "selfterminatefilestream.hxx"
+#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
using namespace ::com::sun::star;
@@ -45,9 +46,8 @@ OSelfTerminateFileStream::OSelfTerminateFileStream( const uno::Reference< lang::
// IMPORTANT: The implementation is based on idea that m_xFileAccess, m_xInputStream and m_xSeekable are always set
// otherwise an exception is thrown in constructor
- m_xFileAccess.set( xOwnFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess") ) ),
- uno::UNO_QUERY_THROW );
+ m_xFileAccess.set( ucb::SimpleFileAccess::create(
+ comphelper::ComponentContext(xOwnFactory).getUNOContext() ) );
m_xInputStream.set( m_xFileAccess->openFileRead( aURL ), uno::UNO_SET_THROW );
m_xSeekable.set( m_xInputStream, uno::UNO_QUERY_THROW );
diff --git a/package/source/xstor/selfterminatefilestream.hxx b/package/source/xstor/selfterminatefilestream.hxx
index 16bc65c5d6cd..5a569d0204a2 100644
--- a/package/source/xstor/selfterminatefilestream.hxx
+++ b/package/source/xstor/selfterminatefilestream.hxx
@@ -31,7 +31,7 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <cppuhelper/implbase2.hxx>
struct OWriteStream_Impl;
@@ -40,7 +40,7 @@ class OSelfTerminateFileStream : public cppu::WeakImplHelper2< ::com::sun::star:
::com::sun::star::io::XSeekable >
{
protected:
- ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > m_xFileAccess;
+ ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > m_xFileAccess;
::rtl::OUString m_aURL;
diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx
index 3a0011c3fb4c..150c72a45a81 100644
--- a/package/source/xstor/xfactory.cxx
+++ b/package/source/xstor/xfactory.cxx
@@ -26,12 +26,14 @@
*
************************************************************************/
-#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/embed/ElementModes.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/io/XSeekable.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/storagehelper.hxx>
#include "xfactory.hxx"
@@ -162,13 +164,9 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
throw lang::IllegalArgumentException(); // TODO:
}
- uno::Reference < ::com::sun::star::ucb::XSimpleFileAccess > xTempAccess(
- m_xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess") ) ),
- uno::UNO_QUERY );
-
- if ( !xTempAccess.is() )
- throw uno::RuntimeException(); // TODO:
+ uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess(
+ ucb::SimpleFileAccess::create(
+ comphelper::ComponentContext(m_xFactory).getUNOContext() ) );
if ( nStorageMode & embed::ElementModes::WRITE )
xStream = xTempAccess->openFileReadWrite( aURL );
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 0950ec491fe4..84c9400467f1 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -31,6 +31,8 @@
#include <com/sun/star/embed/UseBackupException.hpp>
#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/ucb/XProgressHandler.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XNamed.hpp>
@@ -5954,10 +5956,9 @@ void SAL_CALL OStorage::attachToURL( const ::rtl::OUString& sURL,
if ( !m_pImpl->m_pSwitchStream )
throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() );
- uno::Reference < ucb::XSimpleFileAccess > xAccess(
- m_pImpl->m_xFactory->createInstance (
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ),
- uno::UNO_QUERY_THROW );
+ uno::Reference < ucb::XSimpleFileAccess2 > xAccess(
+ ucb::SimpleFileAccess::create(
+ comphelper::ComponentContext(m_pImpl->m_xFactory).getUNOContext() ) );
try
{
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index 799f2bf00002..eab1a6e1cd14 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -56,7 +56,8 @@
#include <com/sun/star/ucb/OpenCommandArgument2.hpp>
#include <com/sun/star/ucb/OpenMode.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/XActiveDataStreamer.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/embed/UseBackupException.hpp>
@@ -80,6 +81,7 @@
#include <ucbhelper/contentbroker.hxx>
#include <ucbhelper/fileidentifierconverter.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/seekableinput.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/ofopxmlhelper.hxx>
@@ -1476,9 +1478,8 @@ void SAL_CALL ZipPackage::commitChanges()
if( isLocalFile_Impl( m_aURL ) )
{
// write directly in case of local file
- uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleAccess(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess") ) ),
- uno::UNO_QUERY );
+ uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 > xSimpleAccess(
+ SimpleFileAccess::create( comphelper::ComponentContext(m_xFactory).getUNOContext() ) );
OSL_ENSURE( xSimpleAccess.is(), "Can't instatiate SimpleFileAccess service!\n" );
uno::Reference< io::XTruncate > xOrigTruncate;
if ( xSimpleAccess.is() )
diff --git a/sc/source/ui/vba/testvba/testvba.cxx b/sc/source/ui/vba/testvba/testvba.cxx
index 4a318098684e..9f58d30643e9 100644
--- a/sc/source/ui/vba/testvba/testvba.cxx
+++ b/sc/source/ui/vba/testvba/testvba.cxx
@@ -12,7 +12,8 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/uno/XComponentContext.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/script/provider/XScriptProviderSupplier.hpp>
#include <com/sun/star/document/XTypeDetection.hpp>
@@ -88,7 +89,7 @@ private:
Reference< XComponentContext > mxContext;
Reference< XMultiComponentFactory > mxMCF;
Reference< XComponentLoader > mxCompLoader;
- Reference< XSimpleFileAccess > mxSFA;
+ Reference< XSimpleFileAccess2 > mxSFA;
rtl::OUString msOutDirPath;
protected:
public:
@@ -98,7 +99,7 @@ public:
const rtl::OUString& _outDirPath ) : mxContext( _xContext ), mxMCF( _xMCF ),
mxCompLoader( _xCompLoader ), msOutDirPath( convertToURL( _outDirPath ) )
{
- mxSFA.set( mxMCF->createInstanceWithContext( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )), mxContext), uno::UNO_QUERY_THROW );
+ mxSFA.set( ucb::SimpleFileAccess::create(_xContext) );
}
rtl::OUString getLogLocation() throw ( beans::UnknownPropertyException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::Exception )
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 );
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index cc4573a64819..42c48d3e7815 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <rtl/uri.hxx>
#include <comphelper/processfactory.hxx>
@@ -3107,7 +3108,7 @@ bool HtmlExport::CopyFile( const String& rSourceFile, const String& rDestPath )
// =====================================================================
-bool HtmlExport::checkFileExists( Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess, String const & aFileName )
+bool HtmlExport::checkFileExists( Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess, String const & aFileName )
{
try
{
@@ -3132,8 +3133,8 @@ bool HtmlExport::checkForExistingFiles()
try
{
- Reference< XMultiServiceFactory > xMsf( ::comphelper::getProcessServiceFactory() );
- Reference< ::com::sun::star::ucb::XSimpleFileAccess > xFA( xMsf->createInstance( "com.sun.star.ucb.SimpleFileAccess" ), UNO_QUERY_THROW );
+ Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ uno::Reference<ucb::XSimpleFileAccess2> xFA(ucb::SimpleFileAccess::create(xContext));
sal_uInt16 nSdPage;
for( nSdPage = 0; !bFound && (nSdPage < mnSdPageCount); nSdPage++)
diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx
index b9aa250a4a80..084cd5fa7280 100644
--- a/sd/source/filter/html/htmlex.hxx
+++ b/sd/source/filter/html/htmlex.hxx
@@ -30,7 +30,7 @@
#define _SD_HTMLEX_HXX
#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <vcl/gdimtf.hxx>
#include <svl/itemset.hxx>
#include "resltn.hxx" // enum PublishingResolution
@@ -186,7 +186,7 @@ class HtmlExport
bool CreateImageNumberFile();
bool checkForExistingFiles();
- bool checkFileExists( ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess >& xFileAccess, String const & aFileName );
+ bool checkFileExists( ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess, String const & aFileName );
String getDocumentTitle();
bool SavePresentation();
diff --git a/sd/source/ui/dlg/dlgass.cxx b/sd/source/ui/dlg/dlgass.cxx
index 8d0009cadadc..9b780fe833d3 100644
--- a/sd/source/ui/dlg/dlgass.cxx
+++ b/sd/source/ui/dlg/dlgass.cxx
@@ -59,7 +59,8 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/frame/XModuleManager.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/ui/XModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XImageManager.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
@@ -790,9 +791,7 @@ void AssistentDlgImpl::ScanDocmenu (void)
uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
uno::Reference< container::XNameAccess > xFilterFactory( xFactory->createInstance( "com.sun.star.document.FilterFactory" ), uno::UNO_QUERY );
- Reference< ::com::sun::star::ucb::XSimpleFileAccess > xFileAccess(
- xFactory->createInstance("com.sun.star.ucb.SimpleFileAccess"),
- UNO_QUERY_THROW);
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(::comphelper::getProcessComponentContext()));
sal_uInt32 nCount = aHistory.getLength();
for (sal_uInt32 nItem=0; nItem<nCount; ++nItem)
diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx
index de87ca6db8fc..570a1aa21f2e 100644
--- a/sfx2/source/doc/docfac.cxx
+++ b/sfx2/source/doc/docfac.cxx
@@ -29,7 +29,8 @@
#include <com/sun/star/registry/MergeConflictException.hpp>
#include <com/sun/star/registry/XSimpleRegistry.hpp>
#include <com/sun/star/container/XNameAccess.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/document/XTypeDetection.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/frame/XStorable.hpp>
@@ -38,6 +39,7 @@
#include <unotools/moduleoptions.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/localfilehelper.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/configurationhelper.hxx>
@@ -213,7 +215,6 @@ void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const Stri
static const int nMaxPathSize = 16000;
static ::rtl::OUString SERVICE_FILTER_FACTORY("com.sun.star.document.FilterFactory");
static ::rtl::OUString SERVICE_TYPE_DECTECTION("com.sun.star.document.TypeDetection");
- static ::rtl::OUString SERVICE_SIMPLE_ACCESS("com.sun.star.ucb.SimpleFileAccess");
static ::rtl::OUString CONF_ROOT("/org.openoffice.Setup");
static ::rtl::OUString CONF_PATH = ::rtl::OUString("Office/Factories/" ) + ::rtl::OUString( rServiceName );
@@ -263,8 +264,8 @@ void SfxObjectFactory::SetSystemTemplate( const String& rServiceName, const Stri
aUserTemplateURL += DEF_TPL_STR;
aUserTemplateURL += aExt;
- uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess(
- xFactory->createInstance( SERVICE_SIMPLE_ACCESS ), uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xSimpleFileAccess(
+ ucb::SimpleFileAccess::create( ::comphelper::ComponentContext(xFactory).getUNOContext() ) );
::rtl::OUString aBackupURL;
::osl::Security().getConfigDir(aBackupURL);
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 3bcc77e5ced3..3b44ed30cfdc 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -57,7 +57,8 @@
#include <com/sun/star/embed/XEmbedPersist.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/container/XChild.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/script/provider/XScript.hpp>
#include <com/sun/star/script/provider/XScriptProvider.hpp>
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
@@ -2140,8 +2141,8 @@ void SfxObjectShell::StoreLog()
aFileURL += ::rtl::OUString( "/user/temp/document_io_logring.txt" );
try
{
- uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
- uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess( xFactory->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ uno::Reference< ucb::XSimpleFileAccess2 > xSimpleFileAccess(ucb::SimpleFileAccess::create(xContext));
uno::Reference< io::XStream > xStream( xSimpleFileAccess->openFileReadWrite( aFileURL ), uno::UNO_SET_THROW );
uno::Reference< io::XOutputStream > xOutStream( xStream->getOutputStream(), uno::UNO_SET_THROW );
uno::Reference< io::XTruncate > xTruncate( xOutStream, uno::UNO_QUERY_THROW );
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index bfc6bdd41a92..147d6dad548f 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -32,7 +32,8 @@
#include <com/sun/star/ucb/NameClash.hpp>
#include <com/sun/star/ucb/XProgressHandler.hpp>
#include <com/sun/star/ucb/XContentAccess.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/InteractiveIOException.hpp>
#include <com/sun/star/ucb/IOErrorCode.hpp>
@@ -52,6 +53,7 @@
#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/storagehelper.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -481,10 +483,9 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement(
{
if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
{
- uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess(
- m_pImpl->m_xFactory->createInstance(
- ::rtl::OUString( "com.sun.star.ucb.SimpleFileAccess" ) ),
- uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xSimpleFileAccess(
+ ucb::SimpleFileAccess::create(
+ comphelper::ComponentContext(m_pImpl->m_xFactory).getUNOContext() ) );
xResult = xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) );
}
else
@@ -1472,10 +1473,9 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
{
if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
{
- uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess(
- m_pImpl->m_xFactory->createInstance(
- ::rtl::OUString( "com.sun.star.ucb.SimpleFileAccess" ) ),
- uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xSimpleFileAccess(
+ ucb::SimpleFileAccess::create(
+ comphelper::ComponentContext(m_pImpl->m_xFactory).getUNOContext() ) );
uno::Reference< io::XStream > xStream =
xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) );
diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx
index 34d8b4a441b8..10e21f14a3ae 100644
--- a/svl/source/misc/sharecontrolfile.cxx
+++ b/svl/source/misc/sharecontrolfile.cxx
@@ -29,7 +29,8 @@
#include <stdio.h>
-#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/XCommandEnvironment.hpp>
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/ucb/InsertCommandArgument.hpp>
@@ -360,10 +361,7 @@ void ShareControlFile::RemoveFile()
Close();
- uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
- uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess(
- xFactory->createInstance( ::rtl::OUString("com.sun.star.ucb.SimpleFileAccess") ),
- uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xSimpleFileAccess(ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext()));
xSimpleFileAccess->kill( m_aURL );
}
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 1d245c293bb4..b07404e47d96 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -166,7 +166,8 @@ using namespace nsHdFtFlags;
#include <com/sun/star/frame/XModel.hpp>
#include <filter/msfilter/msvbahelper.hxx>
#include <unotools/pathoptions.hxx>
-#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/document/XFilter.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
@@ -4303,7 +4304,7 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings( const rtl::OUString& sCreatedF
uno::Sequence< rtl::OUString > sGlobalTemplates;
// first get the autoload addins in the directory STARTUP
- uno::Reference< ucb::XSimpleFileAccess > xSFA( ::comphelper::getProcessServiceFactory()->createInstance( "com.sun.star.ucb.SimpleFileAccess" ), uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xSFA(ucb::SimpleFileAccess::create(::comphelper::getProcessComponentContext()));
if( xSFA->isFolder( aAddinPath ) )
sGlobalTemplates = xSFA->getFolderContents( aAddinPath, sal_False );
diff --git a/sw/source/ui/vba/vbaaddins.cxx b/sw/source/ui/vba/vbaaddins.cxx
index b0bb6aa9e5d0..964405549817 100644
--- a/sw/source/ui/vba/vbaaddins.cxx
+++ b/sw/source/ui/vba/vbaaddins.cxx
@@ -30,7 +30,8 @@
#include <cppuhelper/implbase3.hxx>
#include <unotools/pathoptions.hxx>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
using namespace ::ooo::vba;
using namespace ::com::sun::star;
@@ -41,7 +42,7 @@ uno::Reference< container::XIndexAccess > lcl_getAddinCollection( const uno::Ref
// first get the autoload addins in the directory STARTUP
uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- uno::Reference< ucb::XSimpleFileAccess > xSFA( xMCF->createInstanceWithContext( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")), xContext), uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xSFA(ucb::SimpleFileAccess::create(xContext));
SvtPathOptions aPathOpt;
// FIXME: temporary the STARTUP path is located in $OO/basic3.1/program/addin
String aAddinPath = aPathOpt.GetAddinPath();
diff --git a/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx b/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx
index 7fb1b94b328f..1293bb2cdb2f 100644
--- a/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx
+++ b/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx
@@ -36,7 +36,8 @@
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <ucbhelper/contentbroker.hxx>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <osl/process.h>
#include <rtl/string.hxx>
#include <boost/unordered_set.hpp>
@@ -86,13 +87,9 @@ class URLLister
public:
URLLister(uno::Reference<com::sun::star::uno::XComponentContext> xContext,
- uno::Reference<lang::XMultiComponentFactory> xFactory,
rtl::OUString absFileUrl)
{
- uno::Reference<com::sun::star::ucb::XSimpleFileAccess> xFileAccess
- (xFactory->createInstanceWithContext
- (::rtl::OUString( "com.sun.star.ucb.SimpleFileAccess"),
- xContext), uno::UNO_QUERY_THROW);
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
xInputStream = xFileAccess->openFileRead(absFileUrl) ;
mLF = rtl::OUString("\n");
@@ -171,7 +168,7 @@ sal_Int32 SAL_CALL AnalyzeService::run
rtl::OUString absFileUrlUrls;
osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrlUrls.pData);
- URLLister aLister(xContext, xFactory, absFileUrlUrls);
+ URLLister aLister(xContext, absFileUrlUrls);
fprintf(stdout, "<analyze>\n");
@@ -179,10 +176,7 @@ sal_Int32 SAL_CALL AnalyzeService::run
while (!aURL.isEmpty())
{
- uno::Reference<com::sun::star::ucb::XSimpleFileAccess> xFileAccess
- (xFactory->createInstanceWithContext
- (::rtl::OUString("com.sun.star.ucb.SimpleFileAccess"),
- xContext), uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
rtl::OString aStr;
aURL.convertToString(&aStr, RTL_TEXTENCODING_ASCII_US,
diff --git a/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx b/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx
index 6bb3ff34b799..37444b524c04 100644
--- a/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx
+++ b/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx
@@ -36,7 +36,8 @@
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <ucbhelper/contentbroker.hxx>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <osl/process.h>
#include <rtl/string.hxx>
#include <boost/unordered_set.hpp>
@@ -84,10 +85,7 @@ sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< rtl::OUString >
{
rtl::OUString arg=aArguments[0];
- uno::Reference<com::sun::star::ucb::XSimpleFileAccess> xFileAccess(
- xFactory->createInstanceWithContext(
- ::rtl::OUString("com.sun.star.ucb.SimpleFileAccess"),
- xContext), uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
rtl_uString *dir=NULL;
osl_getProcessWorkingDir(&dir);
diff --git a/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx b/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx
index 44c106bc6b5a..616c78486ee6 100644
--- a/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx
+++ b/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx
@@ -38,7 +38,8 @@
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <ucbhelper/contentbroker.hxx>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <osl/process.h>
#include <rtl/string.hxx>
#include <boost/unordered_set.hpp>
@@ -87,14 +88,9 @@ class URLLister
public:
URLLister(uno::Reference<com::sun::star::uno::XComponentContext> xContext,
- uno::Reference<lang::XMultiComponentFactory> xFactory,
rtl::OUString absFileUrl)
{
- uno::Reference<com::sun::star::ucb::XSimpleFileAccess> xFileAccess
- (xFactory->createInstanceWithContext
- (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM
- ("com.sun.star.ucb.SimpleFileAccess")),
- xContext), uno::UNO_QUERY_THROW);
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
xInputStream = xFileAccess->openFileRead(absFileUrl) ;
mLF = rtl::OUString("\n");
@@ -174,7 +170,7 @@ sal_Int32 SAL_CALL AnalyzeService::run
rtl::OUString absFileUrlUrls;
osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrlUrls.pData);
- URLLister aLister(xContext, xFactory, absFileUrlUrls);
+ URLLister aLister(xContext, absFileUrlUrls);
fprintf(stdout, "<analyze>\n");
@@ -184,11 +180,7 @@ sal_Int32 SAL_CALL AnalyzeService::run
while (!aURL.isEmpty())
{
- uno::Reference<com::sun::star::ucb::XSimpleFileAccess> xFileAccess
- (xFactory->createInstanceWithContext
- (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM
- ("com.sun.star.ucb.SimpleFileAccess")),
- xContext), uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
rtl::OString aStr;
aURL.convertToString(&aStr, RTL_TEXTENCODING_ASCII_US,
diff --git a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx b/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx
index 3681549fe1af..c2d0e510405e 100644
--- a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx
+++ b/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx
@@ -41,7 +41,8 @@
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <ucbhelper/contentbroker.hxx>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <osl/process.h>
#include <rtl/string.hxx>
#include <boost/unordered_set.hpp>
@@ -99,11 +100,7 @@ sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< rtl::OUString >
::comphelper::setProcessServiceFactory(xServiceFactory);
- uno::Reference<com::sun::star::ucb::XSimpleFileAccess> xFileAccess
- (xFactory->createInstanceWithContext
- (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM
- ("com.sun.star.ucb.SimpleFileAccess")),
- xContext), uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
rtl_uString *dir=NULL;
osl_getProcessWorkingDir(&dir);
diff --git a/writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.cxx b/writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.cxx
index 9b2569a5f1d3..e9e16bcc62fa 100644
--- a/writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.cxx
+++ b/writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.cxx
@@ -345,10 +345,7 @@ sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< rtl::OUString >
printf("C\n");
rtl::OUString arg=aArguments[0];
- uno::Reference<com::sun::star::ucb::XSimpleFileAccess> xFileAccess(
- xFactory->createInstanceWithContext(
- ::rtl::OUString("com.sun.star.ucb.SimpleFileAccess"),
- xContext), uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
rtl_uString *dir=NULL;
osl_getProcessWorkingDir(&dir);
diff --git a/writerfilter/unocomponent/debugservices/rtftok/XMLScanner.cxx b/writerfilter/unocomponent/debugservices/rtftok/XMLScanner.cxx
index 916e42f9a4fc..42f7da815570 100644
--- a/writerfilter/unocomponent/debugservices/rtftok/XMLScanner.cxx
+++ b/writerfilter/unocomponent/debugservices/rtftok/XMLScanner.cxx
@@ -248,19 +248,15 @@ xContext( xContext_ )
sal_Int32 SAL_CALL XMLScanner::run( const uno::Sequence< rtl::OUString >& aArguments ) throw (uno::RuntimeException)
{
- uno::Sequence<uno::Any> aUcbInitSequence(2);
+ uno::Sequence<uno::Any> aUcbInitSequence(2);
aUcbInitSequence[0] <<= rtl::OUString("Local");
aUcbInitSequence[1] <<= rtl::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))
{
rtl::OUString arg=aArguments[0];
- uno::Reference<com::sun::star::ucb::XSimpleFileAccess> xFileAccess(
- xFactory->createInstanceWithContext(
- ::rtl::OUString("com.sun.star.ucb.SimpleFileAccess"),
- xContext), uno::UNO_QUERY_THROW );
+ uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
rtl_uString *dir=NULL;
osl_getProcessWorkingDir(&dir);
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 7d9c7e50334f..2abd91bb77f2 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -52,6 +52,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/frame/XConfigManager.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarExpandUrl.hpp>
@@ -181,9 +182,7 @@ Databases::Databases( sal_Bool showBasic,
setInstallPath( instPath );
- m_xSFA = Reference< ucb::XSimpleFileAccess >(
- m_xSMgr->createInstanceWithContext( rtl::OUString( "com.sun.star.ucb.SimpleFileAccess" ),
- m_xContext ), UNO_QUERY_THROW );
+ m_xSFA = ucb::SimpleFileAccess::create(m_xContext);
}
Databases::~Databases()
@@ -1449,10 +1448,7 @@ void ExtensionIteratorBase::init()
Reference< XInterface >() );
}
- Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager(), UNO_QUERY );
- m_xSFA = Reference< ucb::XSimpleFileAccess >(
- xSMgr->createInstanceWithContext( rtl::OUString( "com.sun.star.ucb.SimpleFileAccess" ),
- m_xContext ), UNO_QUERY_THROW );
+ m_xSFA = ucb::SimpleFileAccess::create(m_xContext);
m_bUserPackagesLoaded = false;
m_bSharedPackagesLoaded = false;
diff --git a/xmlhelp/source/cxxhelp/provider/databases.hxx b/xmlhelp/source/cxxhelp/provider/databases.hxx
index 028fad1931bf..f3153283e136 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.hxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.hxx
@@ -44,7 +44,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/i18n/XCollator.hpp>
#include <com/sun/star/deployment/XPackage.hpp>
-#include "com/sun/star/ucb/XSimpleFileAccess.hpp"
+#include "com/sun/star/ucb/XSimpleFileAccess2.hpp"
// Forward declaration
@@ -293,7 +293,7 @@ namespace chelp {
osl::Mutex m_aMutex;
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
com::sun::star::uno::Reference< com::sun::star::lang::XMultiComponentFactory > m_xSMgr;
- com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess > m_xSFA;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess2 > m_xSFA;
sal_Bool m_bShowBasic;
int m_nErrorDocLength;
@@ -436,7 +436,7 @@ namespace chelp {
com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > xPackage );
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
- com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess > m_xSFA;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess2 > m_xSFA;
Databases& m_rDatabases;
IteratorState m_eState;
diff --git a/xmlhelp/source/cxxhelp/provider/db.hxx b/xmlhelp/source/cxxhelp/provider/db.hxx
index 402a734fc7d9..f961f96ae161 100644
--- a/xmlhelp/source/cxxhelp/provider/db.hxx
+++ b/xmlhelp/source/cxxhelp/provider/db.hxx
@@ -34,7 +34,7 @@
#include <berkeleydb/db.h>
#endif
-#include "com/sun/star/ucb/XSimpleFileAccess.hpp"
+#include "com/sun/star/ucb/XSimpleFileAccess2.hpp"
#include <boost/unordered_map.hpp>
#include <rtl/string.hxx>
@@ -120,7 +120,7 @@ namespace berkeleydbproxy {
rtl::OUString m_aFileURL;
StringToDataMap* m_pStringToDataMap;
StringToValPosMap* m_pStringToValPosMap;
- com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess >
+ com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess2 >
m_xSFA;
com::sun::star::uno::Sequence< sal_Int8 >
@@ -136,7 +136,7 @@ namespace berkeleydbproxy {
//SimpleFileAccess requires file URLs as arguments. Passing file path may work but fails
//for example when using long file paths on Windows, which start with "\\?\"
DBHelp( const rtl::OUString& rFileURL,
- com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess > xSFA )
+ com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess2 > xSFA )
: m_aFileURL( rFileURL )
, m_pStringToDataMap( NULL )
, m_pStringToValPosMap( NULL )
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 8679fa520abe..c61b41226651 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -35,11 +35,11 @@
#include <expat.h>
#include <osl/file.hxx>
#include <unotools/configmgr.hxx>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/frame/XConfigManager.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <comphelper/processfactory.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
#include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
@@ -966,15 +966,7 @@ ExtensionIteratorBase::ExtensionIteratorBase( const rtl::OUString& aLanguage )
void ExtensionIteratorBase::init()
{
- Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
- Reference< XPropertySet > xProps( xFactory, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- if (xProps.is())
- {
- xProps->getPropertyValue(
- ::rtl::OUString( "DefaultContext" ) ) >>= m_xContext;
- OSL_ASSERT( m_xContext.is() );
- }
+ m_xContext = ::comphelper::getProcessComponentContext();
if( !m_xContext.is() )
{
throw RuntimeException(
@@ -982,10 +974,7 @@ void ExtensionIteratorBase::init()
Reference< XInterface >() );
}
- Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager(), UNO_QUERY );
- m_xSFA = Reference< ucb::XSimpleFileAccess >(
- xSMgr->createInstanceWithContext( rtl::OUString( "com.sun.star.ucb.SimpleFileAccess" ),
- m_xContext ), UNO_QUERY_THROW );
+ m_xSFA = ucb::SimpleFileAccess::create(m_xContext);
m_bUserPackagesLoaded = false;
m_bSharedPackagesLoaded = false;
diff --git a/xmlhelp/source/treeview/tvread.hxx b/xmlhelp/source/treeview/tvread.hxx
index a6bd75135c71..48e22b22fe30 100644
--- a/xmlhelp/source/treeview/tvread.hxx
+++ b/xmlhelp/source/treeview/tvread.hxx
@@ -43,7 +43,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/deployment/XPackage.hpp>
-#include "com/sun/star/ucb/XSimpleFileAccess.hpp"
+#include "com/sun/star/ucb/XSimpleFileAccess2.hpp"
namespace treeview {
@@ -354,7 +354,7 @@ namespace treeview {
osl::Mutex m_aMutex;
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
- com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess > m_xSFA;
+ com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess2 > m_xSFA;
IteratorState m_eState;
rtl::OUString m_aLanguage;