diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-02 15:03:12 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-04 14:42:52 +0200 |
commit | c25cb8a641723ab098980bb842caf75c0dc9b059 (patch) | |
tree | e264e2727309789e06147a7275b91abd05f9fcff /basctl/source | |
parent | 0f3f9cb63056715845d9c3565bde69470c73efb2 (diff) |
fdo#46808, Adapt task::InteractionHandler UNO service to new style
Since we don't need to expose XInitialisation, we can make the new-style
service implement XInteractionHandler2.
Change-Id: Ib27beed1c12df17592c6472d6f58c233d2c41558
Diffstat (limited to 'basctl/source')
-rw-r--r-- | basctl/source/basicide/moduldl2.cxx | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 20b4bcd99105..f14611836c2d 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -50,6 +50,7 @@ #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/task/InteractionHandler.hpp> #include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/ucb/XSimpleFileAccess2.hpp> #include "com/sun/star/ucb/XCommandEnvironment.hpp" @@ -1253,21 +1254,16 @@ void LibPage::ExportAsPackage( const String& aLibName ) { // file open dialog Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference< task::XInteractionHandler > xHandler; - 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 ); + Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createDefault(xContext), UNO_QUERY ); + Reference< XSimpleFileAccess2 > xSFA = SimpleFileAccess::create(xContext); - xSFA = SimpleFileAccess::create(comphelper::getProcessComponentContext()); + Reference < XFilePicker > xFP; + Sequence <Any> aServiceType(1); + aServiceType[0] <<= TemplateDescription::FILESAVE_SIMPLE; + xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY ); - Sequence <Any> aServiceType(1); - aServiceType[0] <<= TemplateDescription::FILESAVE_SIMPLE; - xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY ); - } xFP->setTitle( String( IDEResId( RID_STR_EXPORTPACKAGE ) ) ); // filter @@ -1387,16 +1383,10 @@ void LibPage::ExportAsBasic( const String& aLibName ) { // Folder picker Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); - Reference< XFolderPicker > xFolderPicker; - Reference< task::XInteractionHandler > xHandler; - if( xMSF.is() ) - { - xFolderPicker = Reference< XFolderPicker >( xMSF->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) ) ), UNO_QUERY ); - - xHandler = Reference< task::XInteractionHandler >( xMSF->createInstance - ( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), UNO_QUERY ); - } + Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< XFolderPicker > xFolderPicker( xMSF->createInstance( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) ) ), UNO_QUERY ); + Reference< task::XInteractionHandler > xHandler( task::InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); if( xFolderPicker.is() ) { |