diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-11 15:43:08 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-23 10:26:40 +0200 |
commit | c988da288ec473a28f61ebb53aa3ff82bab11ef4 (patch) | |
tree | 284f184384dba369c40e0caff533a2d683e9d478 /cui/source/dialogs/cuigaldlg.cxx | |
parent | eb016138e817d686795e1902a7a295d93639da27 (diff) |
fdo#46808, Adapt ui::dialogs::FolderPicker UNO service to new style
Create a merged XFolderPicker2 interface for this service to implement.
Which is backwards-compatible, but does not require creating a new service.
Change-Id: I4a2c2a8d491a8d5633c19ddcea547f0efe75b91d
Diffstat (limited to 'cui/source/dialogs/cuigaldlg.cxx')
-rw-r--r-- | cui/source/dialogs/cuigaldlg.cxx | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index fb1bbdf7897b..4e50bb363932 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> #include <sfx2/sfxuno.hxx> #include "dialmgr.hxx" @@ -1035,34 +1036,27 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickSearchHdl) try { // setup folder picker - ::com::sun::star::uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - if( xMgr.is() ) - { - xFolderPicker = ::com::sun::star::uno::Reference< XFolderPicker >( - xMgr->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ))), UNO_QUERY ); - - if ( xFolderPicker.is() ) - { - String aDlgPathName( SvtPathOptions().GetGraphicPath() ); - xFolderPicker->setDisplayDirectory(aDlgPathName); + com::sun::star::uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + xFolderPicker = FolderPicker::create(xContext); - aPreviewTimer.Stop(); + String aDlgPathName( SvtPathOptions().GetGraphicPath() ); + xFolderPicker->setDisplayDirectory(aDlgPathName); - ::com::sun::star::uno::Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY ); - if ( xAsyncDlg.is() ) - xAsyncDlg->startExecuteModal( xDialogListener.get() ); - else - { - if( xFolderPicker->execute() == RET_OK ) - { - aURL = INetURLObject( xFolderPicker->getDirectory() ); - bSearchRecursive = sal_True; // UI choice no longer possible, windows file picker allows no user controls - SearchFiles(); - } + aPreviewTimer.Stop(); - nCurFilterPos = aCbbFileType.GetEntryPos( aCbbFileType.GetText() ); - } + com::sun::star::uno::Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY ); + if ( xAsyncDlg.is() ) + xAsyncDlg->startExecuteModal( xDialogListener.get() ); + else + { + if( xFolderPicker->execute() == RET_OK ) + { + aURL = INetURLObject( xFolderPicker->getDirectory() ); + bSearchRecursive = sal_True; // UI choice no longer possible, windows file picker allows no user controls + SearchFiles(); } + + nCurFilterPos = aCbbFileType.GetEntryPos( aCbbFileType.GetText() ); } } catch (const IllegalArgumentException&) |