basctl/source/basicide/moduldl2.cxx | 2 +- cui/source/dialogs/cuigaldlg.cxx | 3 ++- cui/source/dialogs/hldocntp.cxx | 3 ++- cui/source/dialogs/linkdlg.cxx | 4 +++- cui/source/dialogs/multipat.cxx | 5 +++-- cui/source/options/certpath.cxx | 4 +++- cui/source/options/optjava.cxx | 4 ++-- cui/source/options/optpath.cxx | 2 +- cui/source/options/optupdt.cxx | 3 ++- dbaccess/source/ui/dlg/ConnectionHelper.cxx | 2 +- include/sfx2/filedlghelper.hxx | 4 ++++ sfx2/source/dialog/filedlghelper.cxx | 8 +++++++- sfx2/source/doc/templatedlg.cxx | 2 +- svx/source/dialog/docrecovery.cxx | 3 ++- sw/source/ui/envelp/mailmrge.cxx | 3 ++- vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx | 1 + writerperfect/source/writer/EPUBExportDialog.cxx | 5 +++-- xmlsecurity/source/dialogs/macrosecurity.cxx | 3 ++- 18 files changed, 42 insertions(+), 19 deletions(-)
New commits: commit a8f97e5fca148804056295db2e3910aaa5c68ce8 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Jun 21 12:30:34 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Jun 21 15:29:59 2021 +0200 bundle the FolderPicker instantiations behind a single call in prep to add parent support Change-Id: I2aa4b9343f895ae866f600dd3260b7fdc4e1efec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117579 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index cd6587dc800d..44796f0cdcef 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -1117,7 +1117,7 @@ void LibPage::ExportAsBasic( const OUString& aLibName ) { // Folder picker Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - Reference< XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext); + Reference< XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_pDialog->getDialog()); Reference< task::XInteractionHandler2 > xHandler( task::InteractionHandler::createWithParent(xContext, nullptr) ); xFolderPicker->setTitle(IDEResId(RID_STR_EXPORTBASIC)); diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index aa764baff52d..3a0dcb8a69c9 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -30,6 +30,7 @@ #include <vcl/weld.hxx> #include <avmedia/mediawindow.hxx> #include <unotools/pathoptions.hxx> +#include <sfx2/filedlghelper.hxx> #include <sfx2/opengrf.hxx> #include <vcl/graphicfilter.hxx> #include <svx/gallery1.hxx> @@ -817,7 +818,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickSearchHdl, weld::Button&, void) { // setup folder picker css::uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - xFolderPicker = FolderPicker::create(xContext); + xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld()); OUString aDlgPathName( SvtPathOptions().GetGraphicPath() ); xFolderPicker->setDisplayDirectory(aDlgPathName); diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx index 3a582764f40e..31b3ba2d5de4 100644 --- a/cui/source/dialogs/hldocntp.cxx +++ b/cui/source/dialogs/hldocntp.cxx @@ -19,6 +19,7 @@ #include <hldocntp.hxx> #include <osl/file.hxx> +#include <sfx2/filedlghelper.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/docfilt.hxx> #include <svl/stritem.hxx> @@ -405,7 +406,7 @@ IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, weld::Button&, void) { DisableClose( true ); uno::Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - uno::Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext); + uno::Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, mpDialog->getDialog()); OUString aStrURL; OUString aTempStrURL( m_xCbbPath->get_active_text() ); diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx index dedac54049d7..b4a494a20886 100644 --- a/cui/source/dialogs/linkdlg.cxx +++ b/cui/source/dialogs/linkdlg.cxx @@ -29,6 +29,7 @@ #include <vcl/weldutils.hxx> #include <strings.hrc> +#include <sfx2/filedlghelper.hxx> #include <sfx2/linkmgr.hxx> #include <sfx2/linksrc.hxx> #include <sfx2/lnkbase.hxx> @@ -297,7 +298,8 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, ChangeSourceClickHdl, weld::Button&, void) { try { - uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = ui::dialogs::FolderPicker::create(comphelper::getProcessComponentContext()); + uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = sfx2::createFolderPicker( + comphelper::getProcessComponentContext(), m_xDialog.get()); OUString sType, sFile, sLinkName; OUString sFilter; diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx index 249a116b1d5e..aba063eb7b13 100644 --- a/cui/source/dialogs/multipat.cxx +++ b/cui/source/dialogs/multipat.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <osl/file.hxx> +#include <sfx2/filedlghelper.hxx> #include <tools/urlobj.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -87,7 +88,7 @@ void SvxMultiPathDialog::AppendEntry(const OUString& rText, const OUString& rId) IMPL_LINK_NOARG(SvxMultiPathDialog, AddHdl_Impl, weld::Button&, void) { Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext); + Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_xDialog.get()); if ( xFolderPicker->execute() != ExecutableDialogResults::OK ) return; @@ -117,7 +118,7 @@ IMPL_LINK_NOARG(SvxMultiPathDialog, AddHdl_Impl, weld::Button&, void) IMPL_LINK_NOARG(SvxPathSelectDialog, AddHdl_Impl, weld::Button&, void) { Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext); + Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_xDialog.get()); if ( xFolderPicker->execute() != ExecutableDialogResults::OK ) return; diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx index b82065868f09..0932ac2e7a84 100644 --- a/cui/source/options/certpath.cxx +++ b/cui/source/options/certpath.cxx @@ -10,6 +10,7 @@ #include <officecfg/Office/Common.hxx> #include <osl/file.hxx> #include <osl/security.hxx> +#include <sfx2/filedlghelper.hxx> #include <tools/diagnose_ex.h> #include "certpath.hxx" @@ -208,7 +209,8 @@ IMPL_LINK_NOARG(CertPathDialog, ManualHdl_Impl, weld::Button&, void) { try { - uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = ui::dialogs::FolderPicker::create(comphelper::getProcessComponentContext()); + uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker = sfx2::createFolderPicker( + comphelper::getProcessComponentContext(), m_xDialog.get()); OUString sURL; if (!m_sManualPath.isEmpty()) diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index c074c9cf1ccb..a21c5b2b0bf8 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -153,7 +153,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, AddHdl_Impl, weld::Button&, void) try { Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - xFolderPicker = FolderPicker::create(xContext); + xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld()); OUString sWorkFolder = SvtPathOptions().GetWorkPath(); xFolderPicker->setDisplayDirectory( sWorkFolder ); @@ -825,7 +825,7 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, weld::Button&, void) IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl, weld::Button&, void) { Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext); + Reference < XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_xDialog.get()); OUString sOldFolder; if (m_xPathList->count_selected_rows() > 0) diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index e0f940219016..0fe2ec033973 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -540,7 +540,7 @@ IMPL_LINK_NOARG(SvxPathTabPage, PathHdl_Impl, weld::Button&, void) try { Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - xFolderPicker = FolderPicker::create(xContext); + xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld()); INetURLObject aURL( sWritable, INetProtocol::File ); xFolderPicker->setDisplayDirectory( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index c9ad541e8005..19ea53f44d23 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/configuration/ReadWriteAccess.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <sfx2/filedlghelper.hxx> #include <officecfg/Office/Common.hxx> #include <osl/file.hxx> #include <osl/security.hxx> @@ -336,7 +337,7 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, ExtrasCheckHdl_Impl, weld::Toggleable&, IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, FileDialogHdl_Impl, weld::Button&, void) { uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = ui::dialogs::FolderPicker::create(xContext); + uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld()); OUString aURL; if( osl::FileBase::E_None != osl::FileBase::getFileURLFromSystemPath(m_xDestPath->get_label(), aURL) ) diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index 722ee44a87ca..184f49046a90 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -151,7 +151,7 @@ namespace dbaui { try { - Reference< XFolderPicker2 > xFolderPicker = FolderPicker::create(m_xORB); + Reference< XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(m_xORB, GetFrameWeld()); bool bDoBrowse = false; OUString sOldPath = getURLNoPrefix(); diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx index 4700d9c8173d..356beb49c4ff 100644 --- a/include/sfx2/filedlghelper.hxx +++ b/include/sfx2/filedlghelper.hxx @@ -23,6 +23,7 @@ #include <sfx2/dllapi.h> #include <sal/types.h> #include <com/sun/star/uno/Sequence.hxx> + #include <rtl/ref.hxx> #include <rtl/ustring.hxx> #include <comphelper/documentconstants.hxx> @@ -36,11 +37,13 @@ namespace com::sun::star::ui::dialogs { class XFilePicker3; + class XFolderPicker2; struct FilePickerEvent; struct DialogClosedEvent; } namespace com::sun::star::awt { class XWindow; } namespace com::sun::star::uno { template <typename > class Reference; } +namespace com::sun::star::uno { class XComponentContext; } namespace weld { class Window; } class Graphic; @@ -242,6 +245,7 @@ ErrCode FileOpenDialog_Impl( weld::Window* pParent, const OUString& rStandardDir, const css::uno::Sequence< OUString >& rDenyList = css::uno::Sequence< OUString >()); +css::uno::Reference<css::ui::dialogs::XFolderPicker2> SFX2_DLLPUBLIC createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>& rContext, weld::Window* pPreferredParent); ErrCode RequestPassword(const std::shared_ptr<const SfxFilter>& pCurrentFilter, OUString const & aURL, SfxItemSet* pSet, const css::uno::Reference<css::awt::XWindow>& rParent); } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index f70ecec1146a..482b2146afdf 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -25,10 +25,11 @@ #include <sal/types.h> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/ControlActions.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp> -#include <com/sun/star/ui/dialogs/ControlActions.hpp> +#include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/ui/dialogs/XControlInformation.hpp> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> @@ -1131,6 +1132,11 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( mxFileDlg->addFilePickerListener( this ); } +css::uno::Reference<css::ui::dialogs::XFolderPicker2> createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>& rContext, weld::Window* /*pPreferredParent*/) +{ + return css::ui::dialogs::FolderPicker::create(rContext); +} + FileDialogHelper_Impl::~FileDialogHelper_Impl() { // Remove user event if we haven't received it yet diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 033f3d24df4a..1a7129386329 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -1053,7 +1053,7 @@ void SfxTemplateManagerDlg::OnTemplateImportCategory(std::u16string_view sCatego void SfxTemplateManagerDlg::OnTemplateExport() { uno::Reference<XComponentContext> xContext(comphelper::getProcessComponentContext()); - uno::Reference<XFolderPicker2> xFolderPicker = FolderPicker::create(xContext); + uno::Reference<XFolderPicker2> xFolderPicker = sfx2::createFolderPicker(xContext, m_xDialog.get()); xFolderPicker->setDisplayDirectory(SvtPathOptions().GetWorkPath()); diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 596ba262c1d3..1eab1accf726 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -25,6 +25,7 @@ #include <comphelper/sequenceashashmap.hxx> #include <comphelper/string.hxx> #include <svtools/imagemgr.hxx> +#include <sfx2/filedlghelper.hxx> #include <tools/urlobj.hxx> #include <vcl/weld.hxx> #include <vcl/svapp.hxx> @@ -1078,7 +1079,7 @@ IMPL_LINK_NOARG(BrokenRecoveryDialog, SaveButtonHdl, weld::Button&, void) void BrokenRecoveryDialog::impl_askForSavePath() { css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker = - css::ui::dialogs::FolderPicker::create( m_pCore->getComponentContext() ); + sfx2::createFolderPicker(m_pCore->getComponentContext(), m_xDialog.get()); INetURLObject aURL(m_sSavePath, INetProtocol::File); xFolderPicker->setDisplayDirectory(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE)); diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index acd73a741757..27621d74e0ef 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -34,6 +34,7 @@ #include <mailmergehelper.hxx> #include <mailmrge.hxx> #include <sfx2/docfile.hxx> +#include <sfx2/filedlghelper.hxx> #include <comphelper/documentconstants.hxx> #include <comphelper/sequenceashashmap.hxx> #include <com/sun/star/container/XContainerQuery.hpp> @@ -570,7 +571,7 @@ OUString SwMailMergeDlg::GetTargetURL() const IMPL_LINK_NOARG(SwMailMergeDlg, InsertPathHdl, weld::Button&, void) { uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - uno::Reference < XFolderPicker2 > xFP = FolderPicker::create(xContext); + uno::Reference < XFolderPicker2 > xFP = sfx2::createFolderPicker(xContext, m_xDialog.get()); xFP->setDisplayDirectory( GetURLfromPath() ); if( xFP->execute() == RET_OK ) { INetURLObject aURL(xFP->getDirectory()); diff --git a/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx b/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx index 4297d9bcfd19..21ac1b533d9b 100644 --- a/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx +++ b/vcl/unx/gtk3/fpicker/SalGtkFolderPicker.cxx @@ -157,6 +157,7 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() uno::Reference<frame::XDesktop> xDesktop = frame::Desktop::create(m_xContext); GtkWindow *pParent = RunDialog::GetTransientFor(); + fprintf(stderr, "transient is %p\n", pParent); if (pParent) gtk_window_set_transient_for(GTK_WINDOW(m_pDialog), pParent); rtl::Reference<RunDialog> pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop); diff --git a/writerperfect/source/writer/EPUBExportDialog.cxx b/writerperfect/source/writer/EPUBExportDialog.cxx index c26516d6310c..ed86df8f3683 100644 --- a/writerperfect/source/writer/EPUBExportDialog.cxx +++ b/writerperfect/source/writer/EPUBExportDialog.cxx @@ -11,10 +11,11 @@ #include <libepubgen/libepubgen.h> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/FolderPicker.hpp> -#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <comphelper/sequenceashashmap.hxx> +#include <sfx2/filedlghelper.hxx> #include <sfx2/opengrf.hxx> #include <sax/tools/converter.hxx> #include <i18nlangtag/languagetag.hxx> @@ -186,7 +187,7 @@ IMPL_LINK_NOARG(EPUBExportDialog, CoverClickHdl, weld::Button&, void) IMPL_LINK_NOARG(EPUBExportDialog, MediaClickHdl, weld::Button&, void) { uno::Reference<ui::dialogs::XFolderPicker2> xFolderPicker - = ui::dialogs::FolderPicker::create(m_xContext); + = sfx2::createFolderPicker(m_xContext, m_xDialog.get()); if (xFolderPicker->execute() != ui::dialogs::ExecutableDialogResults::OK) return; diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx index 7cae32bf3905..2cb08df9cd9f 100644 --- a/xmlsecurity/source/dialogs/macrosecurity.cxx +++ b/xmlsecurity/source/dialogs/macrosecurity.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#include <sfx2/filedlghelper.hxx> #include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <unotools/datetime.hxx> @@ -264,7 +265,7 @@ IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, AddLocPBHdl, weld::Button&, void) try { uno::Reference < uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = ui::dialogs::FolderPicker::create(xContext); + uno::Reference < ui::dialogs::XFolderPicker2 > xFolderPicker = sfx2::createFolderPicker(xContext, m_pDlg->getDialog()); short nRet = xFolderPicker->execute(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits