summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-08-17 14:55:54 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-08-23 09:58:25 +0200
commit3e7990faa4dda6022c63aebb2ac8f12b2bbc0731 (patch)
treeb2daf5fcd8ffeb4ffc9b4c0183da590501d9d79c
parent8b34ad6204ee35b7dca10d2b1c9761dfa72684a7 (diff)
fdo#46808, Shiny UNO, Use factory to create XSimpleFileAccess instances
Change-Id: I86e2a8873e5646abd340015f500bf9e872e8e6c5 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--comphelper/source/misc/storagehelper.cxx7
-rw-r--r--extensions/source/nsplugin/source/so_instance.cxx8
-rw-r--r--package/source/zipapi/XUnbufferedStream.cxx8
3 files changed, 12 insertions, 11 deletions
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index d43e68943855..ebe8c4146459 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/embed/XEncryptionProtectedSource2.hpp>
#include <com/sun/star/embed/XTransactedObject.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
@@ -34,6 +35,7 @@
#include <ucbhelper/content.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/fileformat.h>
#include <comphelper/processfactory.hxx>
#include <comphelper/documentconstants.hxx>
@@ -229,9 +231,8 @@ uno::Reference< io::XInputStream > OStorageHelper::GetInputStreamFromURL(
if ( !xFactory.is() )
throw uno::RuntimeException();
- uno::Reference < ::com::sun::star::ucb::XSimpleFileAccess > xTempAccess(
- xFactory->createInstance ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ),
- uno::UNO_QUERY );
+ uno::Reference < ucb::XSimpleFileAccess2 > xTempAccess(
+ ucb::SimpleFileAccess::create(comphelper::ComponentContext(xFactory).getUNOContext()) );
if ( !xTempAccess.is() )
throw uno::RuntimeException();
diff --git a/extensions/source/nsplugin/source/so_instance.cxx b/extensions/source/nsplugin/source/so_instance.cxx
index 8b243ae1d8d7..80bc51dc1dd8 100644
--- a/extensions/source/nsplugin/source/so_instance.cxx
+++ b/extensions/source/nsplugin/source/so_instance.cxx
@@ -34,7 +34,7 @@
#include <com/sun/star/awt/XVclWindowPeer.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/presentation/XPresentation.hpp>
#include <com/sun/star/presentation/XPresentationSupplier.hpp>
#include <vcl/window.hxx>
@@ -238,9 +238,9 @@ sal_Bool SoPluginInstance::LoadDocument(NSP_HWND hParent)
}
//create stream for the document
- Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess(
- mxRemoteMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")) ),
- uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xFactoryProperties( mxRemoteMSF, uno::UNO_QUERY );
+ Reference< uno::XComponentContext > xContext( xFactoryProperties->getPropertyValue( "DefaultContext" ), UNO_QUERY );
+ Reference< ucb::XSimpleFileAccess2 > xSimpleFileAccess( ucb::SimpleFileAccess::create(xContext) );
if(!xSimpleFileAccess.is())
{
debug_fprintf(NSP_LOG_APPEND, "can not create SimpleFileAccess to load URL\n");
diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx
index 7ef9b09e505e..0688b5c9d557 100644
--- a/package/source/zipapi/XUnbufferedStream.cxx
+++ b/package/source/zipapi/XUnbufferedStream.cxx
@@ -34,8 +34,8 @@
#if 0
// for debugging purposes here
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <comphelper/processfactory.hxx>
+#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <comphelper/componentcontext.hxx>
using namespace ::com::sun::star;
#endif
@@ -305,8 +305,8 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
{
if ( 0 )
{
- uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
- uno::Reference< ucb::XSimpleFileAccess > xAccess( xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess") ) ), uno::UNO_QUERY );
+ uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+ uno::Reference< ucb::XSimpleFileAccess2 > xAccess( SimpleFileAccess::create(xContext) );
uno::Reference< io::XOutputStream > xOut = xAccess->openFileWrite(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "file:///d:/777/Encrypted/picture") ) );
xOut->writeBytes( aData );
xOut->closeOutput();