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 | |
parent | Apple's Clang 4.1 does not have -Wself-assign-field (diff) | |
download | core-c988da288ec473a28f61ebb53aa3ff82bab11ef4.tar.gz core-c988da288ec473a28f61ebb53aa3ff82bab11ef4.zip |
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')
-rw-r--r-- | cui/source/dialogs/cuigaldlg.cxx | 42 | ||||
-rw-r--r-- | cui/source/dialogs/hldocntp.cxx | 7 | ||||
-rw-r--r-- | cui/source/dialogs/multipat.cxx | 7 | ||||
-rw-r--r-- | cui/source/inc/cuigaldlg.hxx | 4 | ||||
-rw-r--r-- | cui/source/inc/optpath.hxx | 4 | ||||
-rw-r--r-- | cui/source/options/certpath.cxx | 7 | ||||
-rw-r--r-- | cui/source/options/optjava.cxx | 11 | ||||
-rw-r--r-- | cui/source/options/optjava.hxx | 4 | ||||
-rw-r--r-- | cui/source/options/optpath.cxx | 7 | ||||
-rw-r--r-- | cui/source/options/optupdt.cxx | 8 |
10 files changed, 43 insertions, 58 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&) diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx index 1f4157dc4271..6e1a971750a1 100644 --- a/cui/source/dialogs/hldocntp.cxx +++ b/cui/source/dialogs/hldocntp.cxx @@ -36,7 +36,7 @@ #include "hyperdlg.hrc" #include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> using namespace ::com::sun::star::lang; @@ -399,9 +399,8 @@ void SvxHyperlinkNewDocTp::DoApply () IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl) { - rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ); - uno::Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - uno::Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( aService ), UNO_QUERY ); + uno::Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + uno::Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext); String aStrURL; String aTempStrURL( maCbbPath.GetText() ); diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx index da177364a5d2..c185887919d5 100644 --- a/cui/source/dialogs/multipat.cxx +++ b/cui/source/dialogs/multipat.cxx @@ -29,7 +29,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <unotools/localfilehelper.hxx> @@ -79,9 +79,8 @@ IMPL_LINK( SvxMultiPathDialog, CheckHdl_Impl, svx::SvxRadioButtonListBox *, pBox IMPL_LINK_NOARG(SvxMultiPathDialog, AddHdl_Impl) { - rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ); - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( aService ), UNO_QUERY ); + Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext); if ( xFolderPicker->execute() == ExecutableDialogResults::OK ) { diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx index 21f4cb76f07f..6c7e489929fd 100644 --- a/cui/source/inc/cuigaldlg.hxx +++ b/cui/source/inc/cuigaldlg.hxx @@ -38,7 +38,7 @@ #include <svx/galctrl.hxx> #include <svx/galmisc.hxx> #include <com/sun/star/media/XPlayer.hpp> -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp> #include <svtools/dialogclosedlistener.hxx> #include <vector> @@ -335,7 +335,7 @@ class TPGalleryThemeProperties : public SfxTabPage ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener; ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > xMediaPlayer; - ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker2 > xFolderPicker; virtual void Reset( const SfxItemSet& /*rSet*/ ) {} virtual sal_Bool FillItemSet( SfxItemSet& /*rSet*/ ) { return sal_True; } diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx index db237f0344a4..4a25dfe424a5 100644 --- a/cui/source/inc/optpath.hxx +++ b/cui/source/inc/optpath.hxx @@ -30,7 +30,7 @@ class HeaderBar; #endif #include "ControlFocusHelper.hxx" -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp> #include <svtools/dialogclosedlistener.hxx> // forward --------------------------------------------------------------- @@ -59,7 +59,7 @@ private: OptPath_Impl* pImpl; ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener; - ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker2 > xFolderPicker; #ifdef _SVX_OPTPATH_CXX void ChangeCurrentEntry( const String& _rFolder ); diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx index d7a0b83f7e68..0e7f6a488783 100644 --- a/cui/source/options/certpath.cxx +++ b/cui/source/options/certpath.cxx @@ -39,7 +39,7 @@ #include <com/sun/star/mozilla/XMozillaBootstrap.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <comphelper/processfactory.hxx> using namespace ::com::sun::star; @@ -237,10 +237,7 @@ IMPL_LINK_NOARG(CertPathDialog, AddHdl_Impl) { try { - uno::Reference<uno::XInterface> xInstance = comphelper::getProcessServiceFactory()->createInstance( - "com.sun.star.ui.dialogs.FolderPicker"); - - uno::Reference<ui::dialogs::XFolderPicker> xFolderPicker(xInstance, uno::UNO_QUERY_THROW); + uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = ui::dialogs::FolderPicker::create(comphelper::getProcessComponentContext()); rtl::OUString sURL; osl::Security().getHomeDir(sURL); diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index 5157dae4cdc3..6c38810b92d3 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ucb/XContentProvider.hpp> #include <jvmfwk/framework.h> @@ -236,9 +237,8 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, AddHdl_Impl) { try { - Reference < XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - xFolderPicker = Reference< XFolderPicker >( - xMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.FolderPicker") ) ), UNO_QUERY ); + Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + xFolderPicker = FolderPicker::create(xContext); String sWorkFolder = SvtPathOptions().GetWorkPath(); xFolderPicker->setDisplayDirectory( sWorkFolder ); @@ -965,9 +965,8 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl) IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl) { - rtl::OUString sService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) ); - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - Reference < XFolderPicker > xFolderPicker( xFactory->createInstance( sService ), UNO_QUERY ); + Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);; String sOldFolder; if ( m_aPathList.GetSelectEntryCount() > 0 ) diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx index aed4aef70269..7e7d9f5a8ec2 100644 --- a/cui/source/options/optjava.hxx +++ b/cui/source/options/optjava.hxx @@ -26,7 +26,7 @@ #include <vcl/timer.hxx> #include <sfx2/tabdlg.hxx> #include <svx/simptabl.hxx> -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp> #include <svtools/dialogclosedlistener.hxx> #include "radiobtnbox.hxx" @@ -73,7 +73,7 @@ private: m_aAddedInfos; ::com::sun::star::uno::Reference< ::svt::DialogClosedListener > xDialogListener; - ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker > xFolderPicker; + ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFolderPicker2 > xFolderPicker; DECL_LINK(EnableHdl_Impl, void *); DECL_LINK( CheckHdl_Impl, SvxSimpleTable * ); diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index 6a8b4b4c0334..f1612b5e4922 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -48,6 +48,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <officecfg/Office/Common.hxx> #include "optHeaderTabListbox.hxx" #include <readonlyimage.hxx> @@ -610,10 +611,8 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl) { try { - rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ); - Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - xFolderPicker = ::com::sun::star::uno::Reference< XFolderPicker >( - xFactory->createInstance( aService ), UNO_QUERY ); + Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + xFolderPicker = FolderPicker::create(xContext);; INetURLObject aURL( sWritable, INET_PROT_FILE ); xFolderPicker->setDisplayDirectory( aURL.GetMainURL( INetURLObject::NO_DECODE ) ); diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index 0e81360bc4f5..b0f255f80ffe 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -28,7 +28,7 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -300,10 +300,8 @@ IMPL_LINK( SvxOnlineUpdateTabPage, AutoCheckHdl_Impl, CheckBox *, pBox ) IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, FileDialogHdl_Impl) { - uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - uno::Reference < dialogs::XFolderPicker > xFolderPicker( - xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ) ), - uno::UNO_QUERY ); + uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + uno::Reference < dialogs::XFolderPicker2 > xFolderPicker = dialogs::FolderPicker::create(xContext); rtl::OUString aURL; if( osl::FileBase::E_None != osl::FileBase::getFileURLFromSystemPath(m_aDestPath.GetText(), aURL) ) |