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 | |
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
25 files changed, 170 insertions, 164 deletions
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index a972bf5c5fa2..baef4799806a 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -45,7 +45,7 @@ #include <sot/storage.hxx> #include <com/sun/star/io/Pipe.hpp> #include <com/sun/star/ui/dialogs/XFilePicker.hpp> -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/script/XLibraryContainer2.hpp> @@ -1386,30 +1386,26 @@ void LibPage::ExportAsBasic( const String& aLibName ) // Folder picker Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() ); Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - Reference< XFolderPicker > xFolderPicker( xMSF->createInstance( - "com.sun.star.ui.dialogs.FolderPicker" ), UNO_QUERY ); + Reference< XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext); Reference< task::XInteractionHandler2 > xHandler( task::InteractionHandler::createWithParent(xContext, 0) ); - if( xFolderPicker.is() ) - { - xFolderPicker->setTitle( String( IDEResId( RID_STR_EXPORTBASIC ) ) ); - - // set display directory and filter - String aPath =GetExtraData()->GetAddLibPath(); - if( !aPath.Len() ) - aPath = SvtPathOptions().GetWorkPath(); + xFolderPicker->setTitle( String( IDEResId( RID_STR_EXPORTBASIC ) ) ); - // INetURLObject aURL(m_sSavePath, INET_PROT_FILE); - xFolderPicker->setDisplayDirectory( aPath ); - short nRet = xFolderPicker->execute(); - if( nRet == RET_OK ) - { - String aTargetURL = xFolderPicker->getDirectory(); - GetExtraData()->SetAddLibPath(aTargetURL); + // set display directory and filter + String aPath =GetExtraData()->GetAddLibPath(); + if( !aPath.Len() ) + aPath = SvtPathOptions().GetWorkPath(); + + // INetURLObject aURL(m_sSavePath, INET_PROT_FILE); + xFolderPicker->setDisplayDirectory( aPath ); + short nRet = xFolderPicker->execute(); + if( nRet == RET_OK ) + { + String aTargetURL = xFolderPicker->getDirectory(); + GetExtraData()->SetAddLibPath(aTargetURL); - Reference< task::XInteractionHandler > xDummyHandler( new DummyInteractionHandler( xHandler ) ); - implExportLib( aLibName, aTargetURL, xDummyHandler ); - } + Reference< task::XInteractionHandler > xDummyHandler( new DummyInteractionHandler( xHandler ) ); + implExportLib( aLibName, aTargetURL, xDummyHandler ); } } 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) ) diff --git a/dbaccess/source/inc/stringconstants.inc b/dbaccess/source/inc/stringconstants.inc index 133a06038360..9d6e79e872cb 100644 --- a/dbaccess/source/inc/stringconstants.inc +++ b/dbaccess/source/inc/stringconstants.inc @@ -212,7 +212,6 @@ IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBC_CONNECTIONPOOL, "com.sun.star.sdbc.Con IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_INDEXCOLUMN, "com.sun.star.sdbcx.IndexColumn"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_KEYCOLUMN, "com.sun.star.sdbcx.KeyColumn"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_FRAME_DESKTOP, "com.sun.star.frame.Desktop"); -IMPLEMENT_CONSTASCII_USTRING(SERVICE_UI_FOLDERPICKER, "com.sun.star.ui.dialogs.FolderPicker"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_I18N_COLLATOR, "com.sun.star.i18n.Collator"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_TABLEDEFINITION, "com.sun.star.sdb.TableDefinition"); IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_COMMAND_DEFINITION, "com.sun.star.sdb.CommandDefinition"); diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index ac7e55f21a55..c33685de305a 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -45,7 +45,7 @@ #include "dsselect.hxx" #include <svl/filenotation.hxx> #include "dbustrings.hrc" -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/awt/XWindow.hpp> @@ -172,13 +172,7 @@ DBG_NAME(OConnectionHelper) { try { - ::rtl::OUString sFolderPickerService(SERVICE_UI_FOLDERPICKER); - Reference< XFolderPicker > xFolderPicker(m_xORB->createInstance(sFolderPickerService), UNO_QUERY); - if (!xFolderPicker.is()) - { - ShowServiceNotAvailableError(GetParent(), sFolderPickerService, sal_True); - break; - } + Reference< XFolderPicker2 > xFolderPicker = FolderPicker::create(comphelper::getComponentContext(m_xORB)); sal_Bool bDoBrowse = sal_False; String sOldPath = getURLNoPrefix(); diff --git a/fpicker/source/win32/folderpicker/FolderPicker.hxx b/fpicker/source/win32/folderpicker/FolderPicker.hxx index a795f5fbfd71..ec95c267e97e 100644 --- a/fpicker/source/win32/folderpicker/FolderPicker.hxx +++ b/fpicker/source/win32/folderpicker/FolderPicker.hxx @@ -20,7 +20,7 @@ #ifndef _FOLDERPICKER_HXX_ #define _FOLDERPICKER_HXX_ -#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase2.hxx> #include <osl/mutex.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -36,10 +36,9 @@ //---------------------------------------------------------- class CFolderPicker : - public cppu::WeakImplHelper3< - com::sun::star::ui::dialogs::XFolderPicker, - com::sun::star::lang::XServiceInfo, - com::sun::star::util::XCancellable > + public cppu::WeakImplHelper2< + com::sun::star::ui::dialogs::XFolderPicker2, + com::sun::star::lang::XServiceInfo > { public: diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index b5d3fb28bd4a..8f63748f5b59 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -300,6 +300,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\ WindowContentFactory \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui/dialogs,\ + FolderPicker \ Wizard \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\ @@ -1477,7 +1478,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ui,\ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ui/dialogs,\ FilePicker \ FilterOptionsDialog \ - FolderPicker \ )) $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/util,\ NumberFormatProperties \ @@ -3984,6 +3984,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/ui/dialogs,\ XFilterGroupManager \ XFilterManager \ XFolderPicker \ + XFolderPicker2 \ XWizard \ XWizardController \ XWizardPage \ diff --git a/offapi/com/sun/star/ui/dialogs/FolderPicker.idl b/offapi/com/sun/star/ui/dialogs/FolderPicker.idl index 16187c3c7ee0..a283c6085113 100644 --- a/offapi/com/sun/star/ui/dialogs/FolderPicker.idl +++ b/offapi/com/sun/star/ui/dialogs/FolderPicker.idl @@ -20,30 +20,15 @@ #ifndef __com_sun_star_ui_dialogs_FolderPicker_idl__ #define __com_sun_star_ui_dialogs_FolderPicker_idl__ -#include <com/sun/star/lang/XComponent.idl> -#include <com/sun/star/util/XCancellable.idl> +#include <com/sun/star/ui/dialogs/XFolderPicker2.idl> module com { module sun { module star { module ui { module dialogs { - -published interface XFolderPicker; - /** A FolderPicker service. */ -published service FolderPicker -{ - /** Provides the ability to execute a FolderPicker dialog and - browse for and select folders. - */ - interface XFolderPicker; - - /** For canceling a running dialog instance. - <p>This may be useful for automatic test tools for instance.</p> - */ - [optional] interface com::sun::star::util::XCancellable; -}; +published service FolderPicker : XFolderPicker2; }; }; }; }; }; diff --git a/offapi/com/sun/star/ui/dialogs/XFolderPicker2.idl b/offapi/com/sun/star/ui/dialogs/XFolderPicker2.idl new file mode 100644 index 000000000000..4dfec0a5a332 --- /dev/null +++ b/offapi/com/sun/star/ui/dialogs/XFolderPicker2.idl @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __com_sun_star_ui_dialogs_XFolderPicker2_idl__ +#define __com_sun_star_ui_dialogs_XFolderPicker2_idl__ + +#include <com/sun/star/ui/dialogs/XFolderPicker.idl> +#include <com/sun/star/util/XCancellable.idl> + + +module com { module sun { module star { module ui { module dialogs { + + +/** + Provides a unified interface for the new-style FolderPicker service to implement. + + @since LibreOffice 3.7 +*/ +published interface XFolderPicker2 +{ + /** Provides the ability to execute a FolderPicker dialog and + browse for and select folders. + */ + interface XFolderPicker; + + /** For canceling a running dialog instance. + <p>This may be useful for automatic test tools for instance.</p> + */ + interface com::sun::star::util::XCancellable; +}; + + +}; }; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex 8a14c1485672..34d7172536e8 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx index 3b1892c664fd..2be65266d5a8 100644 --- a/padmin/source/helper.cxx +++ b/padmin/source/helper.cxx @@ -26,7 +26,7 @@ #include <vcl/msgbox.hxx> #include <tools/config.hxx> #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 <com/sun/star/ui/dialogs/XControlAccess.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> @@ -275,42 +275,36 @@ void padmin::freePadminRC() bool padmin::chooseDirectory( String& rInOutPath ) { bool bRet = false; - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + Reference< XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);; + Reference< XControlAccess > xCA( xFolderPicker, UNO_QUERY ); + if( xCA.is() ) { - Reference< XFolderPicker > xFolderPicker( xFactory->createInstance( OUString( "com.sun.star.ui.dialogs.FolderPicker" ) ), UNO_QUERY ); - if( xFolderPicker.is() ) + try { - Reference< XControlAccess > xCA( xFolderPicker, UNO_QUERY ); - if( xCA.is() ) - { - try - { - Any aState; - aState <<= sal_False; - xCA->setControlProperty( OUString( "HelpButton" ), - OUString( "Visible" ), - aState ); + Any aState; + aState <<= sal_False; + xCA->setControlProperty( OUString( "HelpButton" ), + OUString( "Visible" ), + aState ); - } - catch( ... ) - { - } - } - INetURLObject aObj( rInOutPath, INET_PROT_FILE, INetURLObject::ENCODE_ALL ); - xFolderPicker->setDisplayDirectory( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) ); - if( xFolderPicker->execute() == ExecutableDialogResults::OK ) - { - aObj = INetURLObject( xFolderPicker->getDirectory() ); - rInOutPath = aObj.PathToFileName(); - bRet = true; - } } + catch( ... ) + { + } + } + INetURLObject aObj( rInOutPath, INET_PROT_FILE, INetURLObject::ENCODE_ALL ); + xFolderPicker->setDisplayDirectory( aObj.GetMainURL(INetURLObject::DECODE_TO_IURI) ); + if( xFolderPicker->execute() == ExecutableDialogResults::OK ) + { + aObj = INetURLObject( xFolderPicker->getDirectory() ); + rInOutPath = aObj.PathToFileName(); + bRet = true; + } #if OSL_DEBUG_LEVEL > 1 - else - fprintf( stderr, "could not get FolderPicker service\n" ); + else + fprintf( stderr, "could not get FolderPicker service\n" ); #endif - } return bRet; } diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx index 98c55b192f08..738f8e1e1338 100644 --- a/sfx2/inc/sfx2/filedlghelper.hxx +++ b/sfx2/inc/sfx2/filedlghelper.hxx @@ -70,7 +70,6 @@ class Window; #define FILEDIALOG_FILTER_ALL "*.*" #define FILE_OPEN_SERVICE_NAME "com.sun.star.ui.dialogs.FilePicker" -#define FOLDER_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.FolderPicker" #define FILE_OPEN_SERVICE_NAME_OOO "com.sun.star.ui.dialogs.OfficeFilePicker" namespace sfx2 { diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index ca5e0b31cd69..01a9a8a47508 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -46,7 +46,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include "doc.hrc" #include "templatedlg.hrc" @@ -62,6 +62,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::embed; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ui::dialogs; static bool lcl_getServiceName (const OUString &rFileURL, OUString &rName ); @@ -838,8 +839,8 @@ void SfxTemplateManagerDlg::OnTemplateImport () void SfxTemplateManagerDlg::OnTemplateExport() { - uno::Reference<XMultiServiceFactory> xFactory(comphelper::getProcessServiceFactory()); - uno::Reference<XFolderPicker> xFolderPicker(xFactory->createInstance(FOLDER_PICKER_SERVICE_NAME),uno::UNO_QUERY); + uno::Reference<XComponentContext> xContext(comphelper::getProcessComponentContext()); + uno::Reference<XFolderPicker2> xFolderPicker = FolderPicker::create(xContext); xFolderPicker->setDisplayDirectory(SvtPathOptions().GetWorkPath()); diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index aa68971d2ea4..7abb0fb33d9b 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -55,7 +55,7 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/awt/XWindow.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/util/URLTransformer.hpp> #include <osl/file.hxx> @@ -1548,8 +1548,8 @@ IMPL_LINK_NOARG(BrokenRecoveryDialog, SaveButtonHdl) //=============================================== void BrokenRecoveryDialog::impl_askForSavePath() { - css::uno::Reference< css::ui::dialogs::XFolderPicker > xFolderPicker( - m_pCore->getSMGR()->createInstance(SERVICENAME_FOLDERPICKER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker = + css::ui::dialogs::FolderPicker::create(::comphelper::getComponentContext(m_pCore->getSMGR())); INetURLObject aURL(m_sSavePath, INET_PROT_FILE); xFolderPicker->setDisplayDirectory(aURL.GetMainURL(INetURLObject::NO_DECODE)); diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx index 3fcd9ca8ab9e..e037ea4fecfc 100644 --- a/svx/source/inc/docrecovery.hxx +++ b/svx/source/inc/docrecovery.hxx @@ -61,7 +61,6 @@ #define SERVICENAME_PROGRESSFACTORY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.StatusIndicatorFactory")) #define SERVICENAME_RECOVERYCORE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.AutoRecovery" )) -#define SERVICENAME_FOLDERPICKER rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" )) #define SERVICENAME_DESKTOP rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) #define PROP_PARENTWINDOW rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Window" )) diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 1367afc64f54..4b6040676d2a 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -51,7 +51,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> #include <comphelper/sequenceashashmap.hxx> -#include <com/sun/star/ui/dialogs/XFolderPicker.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/sdbcx/XRowLocate.hpp> @@ -782,15 +782,8 @@ IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl) sPath = aPathOpt.GetWorkPath(); } - uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - uno::Reference < XFolderPicker > xFP; - if( xMgr.is() ) - { - xFP = uno::Reference< XFolderPicker >( - xMgr->createInstance( - C2U( "com.sun.star.ui.dialogs.FolderPicker" ) ), - UNO_QUERY ); - } + uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + uno::Reference < XFolderPicker2 > xFP = FolderPicker::create(xContext); xFP->setDisplayDirectory(sPath); if( xFP->execute() == RET_OK ) { diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx index a86fca3fc7c1..3f5b37dc1d5c 100644 --- a/xmlsecurity/source/dialogs/macrosecurity.cxx +++ b/xmlsecurity/source/dialogs/macrosecurity.cxx @@ -34,7 +34,7 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/uno/Exception.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 <tools/urlobj.hxx> @@ -228,9 +228,8 @@ IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, AddLocPBHdl) { try { - rtl::OUString aService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) ); - uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - uno::Reference < ui::dialogs::XFolderPicker > xFolderPicker( xFactory->createInstance( aService ), uno::UNO_QUERY ); + uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = ui::dialogs::FolderPicker::create(xContext); short nRet = xFolderPicker->execute(); |