diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-29 17:17:28 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-06-06 10:01:22 +0200 |
commit | d08578912f2c9ef42d4349079422e25b951e544e (patch) | |
tree | d029b5a9110bcdc255e72ef9c98887f3f8521ea6 /basctl | |
parent | Make setsdkenv_unix executable instead of configure.pl (diff) | |
download | core-d08578912f2c9ef42d4349079422e25b951e544e.tar.gz core-d08578912f2c9ef42d4349079422e25b951e544e.zip |
fdo#46808, Adapt UNO services to new style, Part 7, updating ::create
Update calls to factories to use new SimpleFileAccess::create method
Change-Id: Ie5b0696fe2228a9033b19969245a53c21a61aa14
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, added some tweaks.
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside3.cxx | 9 | ||||
-rw-r--r-- | basctl/source/basicide/moduldl2.cxx | 47 |
2 files changed, 23 insertions, 33 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; |