avmedia/source/viewer/mediawindow.cxx | 1 basctl/source/basicide/moduldl2.cxx | 23 cui/source/customize/acccfg.cxx | 1 cui/source/customize/cfg.cxx | 1 cui/source/dialogs/SignSignatureLineDialog.cxx | 6 cui/source/dialogs/insdlg.cxx | 1 cui/source/dialogs/screenshotannotationdlg.cxx | 1 cui/source/options/optjava.cxx | 6 cui/source/tabpages/numpages.cxx | 1 dbaccess/source/ui/app/AppController.cxx | 6 dbaccess/source/ui/dlg/dbwizsetup.cxx | 5 dbaccess/source/ui/dlg/generalpage.cxx | 1 desktop/source/deployment/gui/dp_gui_dialog2.cxx | 5 desktop/source/deployment/gui/dp_gui_dialog2.hxx | 1 extensions/source/propctrlr/formcomponenthandler.cxx | 2 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 2 forms/source/component/ImageControl.cxx | 1 include/sfx2/filedlghelper.hxx | 64 ++ officecfg/registry/data/org/openoffice/Office/Impress.xcu | 5 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu | 2 officecfg/registry/schema/org/openoffice/Office/Common.xcs | 15 officecfg/registry/schema/org/openoffice/Office/Impress.xcs | 14 reportdesign/source/ui/report/ReportController.cxx | 1 sc/source/ui/miscdlgs/datastreamdlg.cxx | 1 sc/source/ui/xmlsource/xmlsourcedlg.cxx | 19 sd/source/ui/dlg/PhotoAlbumDialog.cxx | 30 - sd/source/ui/dlg/filedlg.cxx | 11 sd/source/ui/dlg/tpaction.cxx | 6 sd/source/ui/func/fuinsfil.cxx | 1 sfx2/source/appl/fileobj.cxx | 2 sfx2/source/appl/opengrf.cxx | 2 sfx2/source/dialog/filedlghelper.cxx | 248 ++++++++-- sfx2/source/dialog/filedlgimpl.hxx | 2 sfx2/source/doc/autoredactdialog.cxx | 1 sfx2/source/doc/docinsert.cxx | 1 sfx2/source/doc/guisaveas.cxx | 33 - sfx2/source/doc/templatedlg.cxx | 1 svx/source/core/graphichelper.cxx | 2 svx/source/dialog/imapdlg.cxx | 4 svx/source/form/datanavi.cxx | 3 sw/source/ui/chrdlg/chardlg.cxx | 1 sw/source/ui/dbui/createaddresslistdialog.cxx | 4 sw/source/ui/dbui/mmdocselectpage.cxx | 3 sw/source/ui/fldui/javaedit.cxx | 2 sw/source/ui/misc/glossary.cxx | 4 sw/source/uibase/app/docsh2.cxx | 6 sw/source/uibase/dbui/dbmgr.cxx | 4 sw/source/uibase/dbui/mailmergehelper.cxx | 1 sw/source/uibase/uiview/srcview.cxx | 2 sw/source/uibase/uiview/view2.cxx | 3 50 files changed, 382 insertions(+), 180 deletions(-)
New commits: commit e935a98fd40aecb5b24da2eeb3c61ba19a3c6a87 Author: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> AuthorDate: Tue Jul 13 14:03:44 2021 +0200 Commit: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> CommitDate: Tue Jul 13 14:14:43 2021 +0200 Related tdf#tdf#126665 Fix image select dialog Use proper default (work dir, not internal gallery folder) Change-Id: I3a7a3558274ea066219e2c9f362890d2ab12212e diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx index 71e46fd3181b..59bf0e13c261 100644 --- a/sfx2/source/appl/opengrf.cxx +++ b/sfx2/source/appl/opengrf.cxx @@ -84,6 +84,7 @@ SvxOpenGraphicDialog::SvxOpenGraphicDialog(const OUString& rTitle, weld::Window* : mpImpl(new SvxOpenGrf_Impl(pPreferredParent, ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW)) { mpImpl->aFileDlg.SetTitle(rTitle); + mpImpl->aFileDlg.SetContext(sfx2::FileDialogHelper::InsertImage); } SvxOpenGraphicDialog::SvxOpenGraphicDialog(const OUString& rTitle, weld::Window* pPreferredParent, diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 39c082473866..50d6503fa2fe 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -2204,7 +2204,7 @@ void FileDialogHelper_Impl::loadConfig() } if ( maPath.isEmpty() ) - displayFolder( SvtPathOptions().GetGraphicPath() ); + displayFolder( SvtPathOptions().GetWorkPath() ); } else { commit 64a1e1220f359b1848e5336c7b045c8b1cec19fb Author: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> AuthorDate: Tue Jan 12 13:22:37 2021 +0100 Commit: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> CommitDate: Tue Jul 13 10:20:50 2021 +0200 Make uno:RefreshView redo the whole document layout This is useful when encountering layout problems, to refresh the doc layout from an extension. Change-Id: Ie2472f061ebea203a9d876782b3bb953477de7c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109169 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> (cherry picked from commit 51ef3a3af573287b03262e96bf8298bdbe06c44d) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index 9ca5e132d534..206a3a47f4f6 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -2548,7 +2548,7 @@ </node> <node oor:name=".uno:RefreshView" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">Restore View</value> + <value xml:lang="en-US">Refresh document layout</value> </prop> </node> <node oor:name=".uno:JumpToEndOfDoc" oor:op="replace"> diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 5d67b43dee74..6e9bd6c8066d 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -547,6 +547,7 @@ void SwView::Execute(SfxRequest &rReq) break; case FN_REFRESH_VIEW: GetEditWin().Invalidate(); + m_pWrtShell->Reformat(); break; case FN_PAGEUP: case FN_PAGEUP_SEL: commit 30546bf6dc9bb62ba21e39da3078c254e058df52 Author: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> AuthorDate: Thu Jul 8 05:50:25 2021 +0200 Commit: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> CommitDate: Tue Jul 13 10:18:57 2021 +0200 tdf#126665 Remember last used file picker directory This introduces internal tracking of last used directories. Each caller of the file picker can pass a "context". The selected directory will then be saved & restored when opening the file picker with the same context again. After ffa636ba74b04b3258ec9a696bc4eac33581fa24 , the Windows file picker no longer tracks the last used directory itself. This is a replacement and an improvement at the same time, since there is not one global last used directory, but one per context. Change-Id: I10650cfb9359922690954fa65c89b4e47477e2c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118597 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> (cherry picked from commit d157c1bd70d630a58db33910d550bb8dee9fe62e) diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index e823c2e8dac5..e99ead571040 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -215,6 +215,7 @@ bool MediaWindow::executeMediaURLDialog(weld::Window* pParent, OUString& rURL, b static const char aSeparator[] = ";"; OUStringBuffer aAllTypes; + aDlg.SetContext(sfx2::FileDialogHelper::InsertMedia); aDlg.SetTitle( AvmResId( o_pbLink != nullptr ? AVMEDIA_STR_INSERTMEDIA_DLG : AVMEDIA_STR_OPENMEDIA_DLG ) ); diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index c4402089979a..a20c252dc7fb 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -548,6 +548,7 @@ void LibPage::InsertLib() Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); // file open dialog sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_pDialog->getDialog()); + aDlg.SetContext(sfx2::FileDialogHelper::BasicInsertLib); const Reference <XFilePicker3>& xFP = aDlg.GetFilePicker(); xFP->setTitle(IDEResId(RID_STR_APPENDLIBS)); @@ -568,16 +569,6 @@ void LibPage::InsertLib() ";*.sxm;*.odf"; // formula xFP->appendFilter( aTitle, aFilter ); - // set display directory and filter - OUString aPath(GetExtraData()->GetAddLibPath()); - if ( !aPath.isEmpty() ) - xFP->setDisplayDirectory( aPath ); - else - { - // macro path from configuration management - xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() ); - } - OUString aLastFilter(GetExtraData()->GetAddLibFilter()); if ( !aLastFilter.isEmpty() ) xFP->setCurrentFilter( aLastFilter ); @@ -1005,6 +996,7 @@ void LibPage::ExportAsPackage( const OUString& aLibName ) { // file open dialog sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, FileDialogFlags::NONE, m_pDialog->getDialog()); + aDlg.SetContext(sfx2::FileDialogHelper::BasicExportPackage); const Reference <XFilePicker3>& xFP = aDlg.GetFilePicker(); Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); @@ -1018,17 +1010,6 @@ void LibPage::ExportAsPackage( const OUString& aLibName ) OUString aFilter = "*.oxt" ; // library files xFP->appendFilter( aTitle, aFilter ); - // set display directory and filter - OUString aPath = GetExtraData()->GetAddLibPath(); - if ( !aPath.isEmpty() ) - { - xFP->setDisplayDirectory( aPath ); - } - else - { - // macro path from configuration management - xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() ); - } xFP->setCurrentFilter( aTitle ); if ( xFP->execute() != RET_OK ) diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index 2ae4f950120e..ddb8be382a0f 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -1455,6 +1455,7 @@ void SfxAcceleratorConfigPage::StartFileDialog(StartFileDialogType nType, const m_pFileDlg->AddFilter(aFilterAllStr, FILEDIALOG_FILTER_ALL); m_pFileDlg->AddFilter(aFilterCfgStr, "*.cfg"); m_pFileDlg->SetCurrentFilter(aFilterCfgStr); + m_pFileDlg->SetContext(sfx2::FileDialogHelper::AcceleratorConfig); Link<sfx2::FileDialogHelper*, void> aDlgClosedLink = bSave ? LINK(this, SfxAcceleratorConfigPage, SaveHdl) diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 04664d511b2b..60a5994ddbbe 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -2827,6 +2827,7 @@ IMPL_LINK_NOARG(SvxIconSelectorDialog, ImportHdl, weld::Button&, void) sfx2::FileDialogHelper aImportDialog( css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, FileDialogFlags::Graphic | FileDialogFlags::MultiSelection, m_xDialog.get()); + aImportDialog.SetContext(sfx2::FileDialogHelper::IconImport); // disable the link checkbox in the dialog uno::Reference< css::ui::dialogs::XFilePickerControlAccess > diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx index 10f80f72983d..da31418a7161 100644 --- a/cui/source/dialogs/SignSignatureLineDialog.cxx +++ b/cui/source/dialogs/SignSignatureLineDialog.cxx @@ -131,8 +131,10 @@ SignSignatureLineDialog::SignSignatureLineDialog(weld::Widget* pParent, Referenc IMPL_LINK_NOARG(SignSignatureLineDialog, loadImage, weld::Button&, void) { Reference<XComponentContext> xContext = comphelper::getProcessComponentContext(); - Reference<XFilePicker3> xFilePicker - = FilePicker::createWithMode(xContext, TemplateDescription::FILEOPEN_PREVIEW); + sfx2::FileDialogHelper aHelper(TemplateDescription::FILEOPEN_PREVIEW, FileDialogFlags::NONE, + m_xDialog.get()); + aHelper.SetContext(sfx2::FileDialogHelper::SignatureLine); + Reference<XFilePicker3> xFilePicker = aHelper.GetFilePicker(); if (!xFilePicker->execute()) return; diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx index 4f34b461eba5..ceab6249d5b2 100644 --- a/cui/source/dialogs/insdlg.cxx +++ b/cui/source/dialogs/insdlg.cxx @@ -85,6 +85,7 @@ IMPL_LINK_NOARG(SvInsertOleDlg, DoubleClickHdl, weld::TreeView&, bool) IMPL_LINK_NOARG(SvInsertOleDlg, BrowseHdl, weld::Button&, void) { sfx2::FileDialogHelper aHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get()); + aHelper.SetContext(sfx2::FileDialogHelper::InsertOLE); const Reference< XFilePicker3 >& xFilePicker = aHelper.GetFilePicker(); // add filter diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx index 4054fa57336f..518368696fb9 100644 --- a/cui/source/dialogs/screenshotannotationdlg.cxx +++ b/cui/source/dialogs/screenshotannotationdlg.cxx @@ -282,6 +282,7 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, weld::Button&, auto xFileDlg = std::make_unique<sfx2::FileDialogHelper>(ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, FileDialogFlags::NONE, mpParentWindow); + xFileDlg->SetContext(sfx2::FileDialogHelper::ScreenshotAnnotation); const uno::Reference< ui::dialogs::XFilePicker3 > xFilePicker = xFileDlg->GetFilePicker(); diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index f3c9dcfee4a8..cfe32ee9ce71 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -773,15 +773,15 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, weld::Button&, void) sfx2::FileDialogHelper aDlg(TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get()); aDlg.SetTitle( CuiResId( RID_SVXSTR_ARCHIVE_TITLE ) ); aDlg.AddFilter( CuiResId( RID_SVXSTR_ARCHIVE_HEADLINE ), "*.jar;*.zip" ); + aDlg.SetContext(sfx2::FileDialogHelper::JavaClassPath); OUString sFolder; if (m_xPathList->count_selected_rows() > 0) { osl::FileBase::getFileURLFromSystemPath(m_xPathList->get_selected_text(), sFolder); // best effort } - if (sFolder.isEmpty()) - sFolder = SvtPathOptions().GetWorkPath(); - aDlg.SetDisplayDirectory( sFolder ); + if (!sFolder.isEmpty()) + aDlg.SetDisplayDirectory( sFolder ); if ( aDlg.Execute() == ERRCODE_NONE ) { OUString sURL = aDlg.GetPath(); diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index b921e6cde953..eaaf52d615d6 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -914,6 +914,7 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, DoubleClickHdl_Impl, ValueSet*, void) IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, void) { sfx2::FileDialogHelper aFileDialog(0, FileDialogFlags::NONE, GetFrameWeld()); + aFileDialog.SetContext(sfx2::FileDialogHelper::BulletsAddImage); aFileDialog.SetTitle(CuiResId(RID_SVXSTR_ADD_IMAGE)); if ( aFileDialog.Execute() != ERRCODE_NONE ) return; diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 402880eedb0c..6236a8879cd0 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -1082,13 +1082,13 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa OUString sUrl; if ( m_xModel.is() ) sUrl = m_xModel->getURL(); - if ( sUrl.isEmpty() ) - sUrl = SvtPathOptions().GetWorkPath(); ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, FileDialogFlags::NONE, getFrameWeld()); - aFileDlg.SetDisplayDirectory( sUrl ); + aFileDlg.SetContext(sfx2::FileDialogHelper::BaseSaveAs); + if (!sUrl.isEmpty()) + aFileDlg.SetDisplayDirectory( sUrl ); std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter(); if ( pFilter ) diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index 1dd342c12401..7aecabd653ca 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -773,15 +773,14 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument() ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, FileDialogFlags::NONE, m_xAssistant.get()); + aFileDlg.SetContext(sfx2::FileDialogHelper::BaseSaveAs); std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter(); if ( pFilter ) { - INetURLObject aWorkURL( m_sWorkPath ); - aFileDlg.SetDisplayFolder( aWorkURL.GetMainURL( INetURLObject::DecodeMechanism::NONE )); - OUString sDefaultName = DBA_RES( STR_DATABASEDEFAULTNAME ); OUString sExtension = pFilter->GetDefaultExtension(); sDefaultName += sExtension.replaceAt( 0, 1, OUString() ); + INetURLObject aWorkURL( m_sWorkPath ); aWorkURL.Append( sDefaultName ); sDefaultName = createUniqueFileName( aWorkURL ); aFileDlg.SetFileName( sDefaultName ); diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index 5361fc2d0907..073dcbd8dee8 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -651,6 +651,7 @@ namespace dbaui ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, FileDialogFlags::NONE, "sdatabase", SfxFilterFlags::NONE, SfxFilterFlags::NONE, GetFrameWeld()); + aFileDlg.SetContext(sfx2::FileDialogHelper::BaseDataSource); std::shared_ptr<const SfxFilter> pFilter = getStandardDatabaseFilter(); if ( pFilter ) { diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index d018edad0109..c1ad36ff2b0c 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -625,12 +625,10 @@ bool ExtMgrDialog::acceptLicense( const uno::Reference< deployment::XPackage > & uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker() { sfx2::FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get()); + aDlgHelper.SetContext(sfx2::FileDialogHelper::ExtensionManager); const uno::Reference<ui::dialogs::XFilePicker3>& xFilePicker = aDlgHelper.GetFilePicker(); xFilePicker->setTitle( m_sAddPackages ); - if ( !m_sLastFolderURL.isEmpty() ) - xFilePicker->setDisplayDirectory( m_sLastFolderURL ); - // collect and set filter list: typedef std::map< OUString, OUString > t_string2string; t_string2string title2filter; @@ -679,7 +677,6 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker() if ( xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK ) return uno::Sequence<OUString>(); // cancelled - m_sLastFolderURL = xFilePicker->getDisplayDirectory(); uno::Sequence< OUString > files( xFilePicker->getSelectedFiles() ); OSL_ASSERT( files.hasElements() ); return files; diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index b3d348c840f3..5d1dd82d1956 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -91,7 +91,6 @@ class ExtMgrDialog : public weld::GenericDialogController { const OUString m_sAddPackages; OUString m_sProgressText; - OUString m_sLastFolderURL; ::osl::Mutex m_aMutex; bool m_bHasProgress; bool m_bProgressChanged; diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 8487df2e39a0..40330351bb8e 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -2757,7 +2757,7 @@ namespace pcr ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, FileDialogFlags::Graphic, pWin); - + aFileDlg.SetContext(sfx2::FileDialogHelper::FormsInsertImage); aFileDlg.SetTitle(aStrTrans); // non-linked images ( e.g. those located in the document // stream ) only if document is available diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 18bdb585a160..3f11458f3a7c 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -846,6 +846,7 @@ void XMLFilterSettingsDialog::onSave() ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, FileDialogFlags::NONE, m_xDialog.get()); + aDlg.SetContext(sfx2::FileDialogHelper::XMLFilterSettings); OUString aExtensions( "*.jar" ); OUString aFilterName = XsltResId(STR_FILTER_PACKAGE) + @@ -891,6 +892,7 @@ void XMLFilterSettingsDialog::onOpen() ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get()); + aDlg.SetContext(sfx2::FileDialogHelper::XMLFilterSettings); OUString aExtensions( "*.jar" ); OUString aFilterName = XsltResId(STR_FILTER_PACKAGE) + diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx index 97928cff6fa9..47e6f5613982 100644 --- a/forms/source/component/ImageControl.cxx +++ b/forms/source/component/ImageControl.cxx @@ -774,6 +774,7 @@ bool OImageControlControl::implInsertGraphics() Reference< XWindow > xWindow( static_cast< ::cppu::OWeakObject* >( this ), UNO_QUERY ); ::sfx2::FileDialogHelper aDialog(TemplateDescription::FILEOPEN_LINK_PREVIEW, FileDialogFlags::Graphic, Application::GetFrameWeld(xWindow)); + aDialog.SetContext(sfx2::FileDialogHelper::FormsInsertImage); aDialog.SetTitle( sTitle ); Reference< XFilePickerControlAccess > xController( aDialog.GetFilePicker(), UNO_QUERY_THROW ); diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx index 42d6b53c0cfb..9041fd5679e0 100644 --- a/include/sfx2/filedlghelper.hxx +++ b/include/sfx2/filedlghelper.hxx @@ -85,14 +85,64 @@ class FileDialogHelper_Impl; class SFX2_DLLPUBLIC FileDialogHelper { public: - enum Context // context where the FileDialogHelper is used + // context where the FileDialogHelper is used + enum Context { - UNKNOWN_CONTEXT, // unknown context - SW_INSERT_GRAPHIC, // insert graphic in writer - SD_EXPORT, // export in draw - SI_EXPORT, // export in impress - SW_EXPORT // export in writer + UnknownContext, + AcceleratorConfig, + AutoRedact, + BaseDataSource, + BaseSaveAs, + BasicExportPackage, + BasicInsertLib, + BulletsAddImage, + ExtensionManager, + CalcDataProvider, + CalcDataStream, + CalcExport, + CalcSaveAs, + CalcXMLSource, + DrawExport, + DrawImpressInsertFile, + DrawImpressOpenSound, + DrawSaveAs, + ExportImage, + FormsAddInstance, + FormsInsertImage, + IconImport, + ImpressClickAction, + ImpressExport, + ImpressPhotoDialog, + ImpressSaveAs, + LinkClientOLE, + LinkClientFile, + ImageMap, + InsertDoc, + InsertImage, + InsertMedia, + InsertOLE, + JavaClassPath, + ReportInsertImage, + ScreenshotAnnotation, + SignatureLine, + TemplateImport, + WriterCreateAddressList, + WriterInsertDoc, + WriterInsertImage, + WriterInsertScript, + WriterExport, + WriterImportAutotext, + WriterInsertHyperlink, + WriterLoadTemplate, + WriterMailMerge, + WriterMailMergeSaveAs, + WriterNewHTMLGlobalDoc, + WriterRegisterDataSource, + WriterSaveAs, + WriterSaveHTML, + XMLFilterSettings }; + static OUString contextToString(Context context); private: Link<FileDialogHelper*,void> m_aDialogClosedLink; @@ -224,6 +274,8 @@ public: void CreateMatcher( const OUString& rName ); /** sets the context of the dialog and trigger necessary actions e.g. loading config, setting help id + This will also store the last used directory for this context, so that the last directory + gets preselected on next filepicker launch (with the same context) @param _eNewContext New context for the dialog. */ diff --git a/officecfg/registry/data/org/openoffice/Office/Impress.xcu b/officecfg/registry/data/org/openoffice/Office/Impress.xcu index b8323973c891..112a89e8521f 100644 --- a/officecfg/registry/data/org/openoffice/Office/Impress.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Impress.xcu @@ -200,9 +200,4 @@ <value>$(work)</value> </prop> </node> - <node oor:name="Sound" oor:op="fuse"> - <prop oor:name="Path"> - <value>$(work)</value> - </prop> - </node> </oor:component-data> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index f0427d18d161..a4b875951ed2 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -844,6 +844,16 @@ <value/> </prop> </group> + <group oor:name="LastDirectory"> + <info> + <desc>Stores the last selected directory for the filepicker for different contexts.</desc> + </info> + <prop oor:name="LastPath" oor:type="xs:string" oor:nillable="false"> + <info> + <desc>The last used path for this context (context is the name of the parent node)</desc> + </info> + </prop> + </group> </templates> <component> <group oor:name="VCL"> @@ -5825,6 +5835,11 @@ <desc>URL of the last used service in the remote file picker.</desc> </info> </prop> + <set oor:name="FilePickerLastDirectory" oor:node-type="LastDirectory"> + <info> + <desc>Contains the last used directory for the filepicker for various contexts</desc> + </info> + </set> <prop oor:name="CmisServersUrls" oor:type="oor:string-list" oor:nillable="false"> <info> <desc>List of sample URLs of the CMIS servers in the place edition dialog.</desc> diff --git a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs index d8edf33b8c12..83d43c360a83 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs @@ -1644,19 +1644,5 @@ <value>$(work)</value> </prop> </group> - <group oor:name="Sound"> - <info> - <desc>Contains configuration items for Sound related functions.</desc> - </info> - <prop oor:name="Path" oor:type="xs:string" oor:nillable="false"> - <info> - <desc> - Access path, where sounds were loaded last time. - The default is work directory. - </desc> - </info> - <value>$(work)</value> - </prop> - </group> </component> </oor:component-schema> diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index 3bf9e9e072f7..05b089df6fba 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -2991,6 +2991,7 @@ void OReportController::insertGraphic() { uno::Reference< report::XSection> xSection = getDesignView()->getCurrentSection(); ::sfx2::FileDialogHelper aDialog(ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, FileDialogFlags::Graphic, getFrameWeld()); + aDialog.SetContext(sfx2::FileDialogHelper::ReportInsertImage); aDialog.SetTitle( sTitle ); uno::Reference< ui::dialogs::XFilePickerControlAccess > xController(aDialog.GetFilePicker(), UNO_QUERY_THROW); diff --git a/sc/source/ui/miscdlgs/datastreamdlg.cxx b/sc/source/ui/miscdlgs/datastreamdlg.cxx index bdc42cdd5be8..2090dc50f998 100644 --- a/sc/source/ui/miscdlgs/datastreamdlg.cxx +++ b/sc/source/ui/miscdlgs/datastreamdlg.cxx @@ -53,6 +53,7 @@ DataStreamDlg::~DataStreamDlg() IMPL_LINK_NOARG(DataStreamDlg, BrowseHdl, weld::Button&, void) { sfx2::FileDialogHelper aFileDialog(0, FileDialogFlags::NONE, m_xDialog.get()); + aFileDialog.SetContext(sfx2::FileDialogHelper::CalcDataStream); if ( aFileDialog.Execute() != ERRCODE_NONE ) return; diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx index 1eb2e4b06077..46c18e56f406 100644 --- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx +++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx @@ -159,21 +159,16 @@ void ScXMLSourceDlg::SelectSourceFile() { sfx2::FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get()); + aDlgHelper.SetContext(sfx2::FileDialogHelper::CalcXMLSource); uno::Reference<ui::dialogs::XFilePicker3> xFilePicker = aDlgHelper.GetFilePicker(); - if (maSrcPath.isEmpty()) - // Use default path. - xFilePicker->setDisplayDirectory(SvtPathOptions().GetWorkPath()); - else - { - // Use the directory of current source file. - INetURLObject aURL(maSrcPath); - aURL.removeSegment(); - aURL.removeFinalSlash(); - OUString aPath = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); - xFilePicker->setDisplayDirectory(aPath); - } + // Use the directory of current source file. + INetURLObject aURL(maSrcPath); + aURL.removeSegment(); + aURL.removeFinalSlash(); + OUString aPath = aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE); + xFilePicker->setDisplayDirectory(aPath); if (xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK) // File picker dialog cancelled. diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx index 14e43dd75229..9c00afe4cdc4 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -20,7 +20,6 @@ #include <unotools/pathoptions.hxx> #include <unotools/ucbstreamhelper.hxx> -#include <officecfg/Office/Impress.hxx> #include <vcl/graphicfilter.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -500,35 +499,16 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, FileHdl, weld::Button&, void) ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILEOPEN_PREVIEW, FileDialogFlags::Graphic | FileDialogFlags::MultiSelection, m_xDialog.get()); - // Read configuration - OUString sUrl(officecfg::Office::Impress::Pictures::Path::get()); - - INetURLObject aFile( SvtPathOptions().GetUserConfigPath() ); - if (!sUrl.isEmpty()) - aDlg.SetDisplayDirectory(sUrl); - else - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); + aDlg.SetContext(sfx2::FileDialogHelper::ImpressPhotoDialog); if ( aDlg.Execute() == ERRCODE_NONE ) { const Sequence< OUString > aFilesArr = aDlg.GetSelectedFiles(); - if( aFilesArr.hasElements() ) + for ( const auto& rFile : aFilesArr ) { - sUrl = aDlg.GetDisplayDirectory(); - // Write out configuration - { - std::shared_ptr< comphelper::ConfigurationChanges > batch( - comphelper::ConfigurationChanges::create()); - officecfg::Office::Impress::Pictures::Path::set(sUrl, batch); - batch->commit(); - } - - for ( const auto& rFile : aFilesArr ) - { - // Store full path, show filename only. Use INetURLObject to display spaces in filename correctly - INetURLObject aUrl(rFile); - m_xImagesLst->append(aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE), aUrl.GetLastName(INetURLObject::DecodeMechanism::WithCharset), ""); - } + // Store full path, show filename only. Use INetURLObject to display spaces in filename correctly + INetURLObject aUrl(rFile); + m_xImagesLst->append(aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE), aUrl.GetLastName(INetURLObject::DecodeMechanism::WithCharset), ""); } } EnableDisableButtons(); diff --git a/sd/source/ui/dlg/filedlg.cxx b/sd/source/ui/dlg/filedlg.cxx index 05c4243dc539..a545f6dc946f 100644 --- a/sd/source/ui/dlg/filedlg.cxx +++ b/sd/source/ui/dlg/filedlg.cxx @@ -34,7 +34,6 @@ #include <filedlg.hxx> #include <sdresid.hxx> #include <strings.hrc> -#include <officecfg/Office/Impress.hxx> // ----------- SdFileDialog_Imp --------------------------- @@ -214,6 +213,7 @@ SdOpenSoundFileDialog::SdOpenSoundFileDialog(weld::Window *pParent) { OUString aDescr = SdResId(STR_ALL_FILES); mpImpl->AddFilter( aDescr, "*.*"); + mpImpl->SetContext(sfx2::FileDialogHelper::DrawImpressOpenSound); // setup filter #if defined UNX @@ -233,9 +233,6 @@ SdOpenSoundFileDialog::SdOpenSoundFileDialog(weld::Window *pParent) aDescr = SdResId(STR_MIDI_FILE); mpImpl->AddFilter( aDescr, "*.mid" ); #endif - - // Restore last selected path - mpImpl->SetDisplayDirectory(officecfg::Office::Impress::Sound::Path::get()); } SdOpenSoundFileDialog::~SdOpenSoundFileDialog() @@ -249,12 +246,6 @@ ErrCode SdOpenSoundFileDialog::Execute() OUString SdOpenSoundFileDialog::GetPath() const { - // Save last selected path - std::shared_ptr<comphelper::ConfigurationChanges> batch( - comphelper::ConfigurationChanges::create()); - officecfg::Office::Impress::Sound::Path::set(mpImpl->GetPath(), batch); - batch->commit(); - return mpImpl->GetPath(); } diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index 891e21b0d418..66ed0615948b 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -401,11 +401,7 @@ void SdTPAction::OpenFileDialog() sfx2::FileDialogHelper aFileDialog( ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, FileDialogFlags::NONE, GetFrameWeld()); - - if (bDocument && aFile.isEmpty()) - aFile = SvtPathOptions().GetWorkPath(); - - aFileDialog.SetDisplayDirectory( aFile ); + aFileDialog.SetContext(sfx2::FileDialogHelper::ImpressClickAction); // The following is a workaround for #i4306#: // The addition of the implicitly existing "all files" diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx index a916ab0dad28..c3231cfd35db 100644 --- a/sd/source/ui/func/fuinsfil.cxx +++ b/sd/source/ui/func/fuinsfil.cxx @@ -133,6 +133,7 @@ void FuInsertFile::DoExecute( SfxRequest& rReq ) sfx2::FileDialogHelper aFileDialog( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::Insert, mpWindow ? mpWindow->GetFrameWeld() : nullptr); + aFileDialog.SetContext(sfx2::FileDialogHelper::DrawImpressInsertFile); Reference< XFilePicker > xFilePicker( aFileDialog.GetFilePicker() ); Reference< XFilterManager > xFilterManager( xFilePicker, UNO_QUERY ); OUString aOwnCont; diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx index ebfe57edf2a3..f58ffe086770 100644 --- a/sfx2/source/appl/fileobj.cxx +++ b/sfx2/source/appl/fileobj.cxx @@ -292,6 +292,7 @@ void SvFileObject::Edit(weld::Window* pParent, sfx2::SvBaseLink* pLink, const Li ::sfx2::FileDialogHelper & rFileDlg = pLink->GetInsertFileDialog( OUString() ); + rFileDlg.SetContext(sfx2::FileDialogHelper::LinkClientOLE); rFileDlg.StartExecuteModal( LINK( this, SvFileObject, DialogClosedHdl ) ); } @@ -308,6 +309,7 @@ void SvFileObject::Edit(weld::Window* pParent, sfx2::SvBaseLink* pLink, const Li ::sfx2::FileDialogHelper & rFileDlg = pLink->GetInsertFileDialog(sFactory); + rFileDlg.SetContext(sfx2::FileDialogHelper::LinkClientFile); rFileDlg.StartExecuteModal( LINK( this, SvFileObject, DialogClosedHdl ) ); } diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx index fd547986d0da..71e46fd3181b 100644 --- a/sfx2/source/appl/opengrf.cxx +++ b/sfx2/source/appl/opengrf.cxx @@ -91,6 +91,7 @@ SvxOpenGraphicDialog::SvxOpenGraphicDialog(const OUString& rTitle, weld::Window* : mpImpl(new SvxOpenGrf_Impl(pPreferredParent, nDialogType)) { mpImpl->aFileDlg.SetTitle(rTitle); + mpImpl->aFileDlg.SetContext(sfx2::FileDialogHelper::InsertImage); } SvxOpenGraphicDialog::~SvxOpenGraphicDialog() diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 1400bf71e17b..39c082473866 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -34,12 +34,16 @@ #include <com/sun/star/ui/dialogs/XFilePicker3.hpp> #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/container/XContainerQuery.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/XInteractionRequest.hpp> #include <com/sun/star/util/RevisionTag.hpp> @@ -84,6 +88,7 @@ #include <sal/log.hxx> #include <comphelper/sequence.hxx> #include <tools/diagnose_ex.h> +#include <officecfg/Office/Common.hxx> #ifdef UNX #include <errno.h> @@ -131,9 +136,9 @@ static const OUString* GetLastFilterConfigId( FileDialogHelper::Context _eContex switch( _eContext ) { - case FileDialogHelper::SD_EXPORT: pRet = &aSD_EXPORT_IDENTIFIER; break; - case FileDialogHelper::SI_EXPORT: pRet = &aSI_EXPORT_IDENTIFIER; break; - case FileDialogHelper::SW_EXPORT: pRet = &aSW_EXPORT_IDENTIFIER; break; + case FileDialogHelper::DrawExport: pRet = &aSD_EXPORT_IDENTIFIER; break; + case FileDialogHelper::ImpressExport: pRet = &aSI_EXPORT_IDENTIFIER; break; + case FileDialogHelper::WriterExport: pRet = &aSW_EXPORT_IDENTIFIER; break; default: break; } @@ -849,7 +854,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( const css::uno::Sequence< OUString >& rBlackList ) :m_nDialogType ( nDialogType ) - ,meContext ( FileDialogHelper::UNKNOWN_CONTEXT ) + ,meContext ( FileDialogHelper::UnknownContext ) { const char* pServiceName=nullptr; switch (nDialog) @@ -1954,6 +1959,46 @@ static void SetToken( OUString& rOrigStr, sal_Int32 nToken, sal_Unicode cTok, co rOrigStr = rOrigStr.replaceAt( nFirstChar, i-nFirstChar, rStr ); } +namespace +{ +void SaveLastDirectory(OUString const& sContext, OUString const& sDirectory) +{ + if (sContext.isEmpty()) + return; + + std::shared_ptr<comphelper::ConfigurationChanges> batch( + comphelper::ConfigurationChanges::create()); + Reference<container::XNameContainer> set( + officecfg::Office::Common::Misc::FilePickerLastDirectory::get(batch)); + + bool found; + Any v; + try + { + v = set->getByName(sContext); + found = true; + } + catch (container::NoSuchElementException&) + { + found = false; + } + if (found) + { + Reference<XPropertySet> el(v.get<Reference<XPropertySet>>(), UNO_SET_THROW); + el->setPropertyValue("LastPath", makeAny(sDirectory)); + } + else + { + Reference<XPropertySet> el( + (Reference<lang::XSingleServiceFactory>(set, UNO_QUERY_THROW)->createInstance()), + UNO_QUERY_THROW); + el->setPropertyValue("LastPath", makeAny(sDirectory)); + Any v2(makeAny(el)); + set->insertByName(sContext, v2); + } + batch->commit(); +} +} void FileDialogHelper_Impl::saveConfig() { @@ -2044,43 +2089,67 @@ void FileDialogHelper_Impl::saveConfig() aDlgOpt.SetUserItem( USERITEM_NAME, makeAny( aUserData ) ); } - SfxApplication *pSfxApp = SfxGetpApp(); - pSfxApp->SetLastDir_Impl( getPath() ); + // Store to config, if explicit context is set. Otherwise store in (global) runtime var. + if (meContext != FileDialogHelper::UnknownContext) + { + SaveLastDirectory(FileDialogHelper::contextToString(meContext), getPath()); + } + else + { + SfxApplication *pSfxApp = SfxGetpApp(); + pSfxApp->SetLastDir_Impl( getPath() ); + } } -namespace +OUString FileDialogHelper_Impl::getInitPath(const OUString& _rFallback, + const sal_Int32 _nFallbackToken) { - OUString getInitPath( const OUString& _rFallback, const sal_Int32 _nFallbackToken ) + OUString sPath; + // Load from config, if explicit context is set. Otherwise load from (global) runtime var. + if (meContext != FileDialogHelper::UnknownContext) + { + OUString sContext = FileDialogHelper::contextToString(meContext); + Reference<XNameAccess> set(officecfg::Office::Common::Misc::FilePickerLastDirectory::get()); + Any v; + try + { + v = set->getByName(sContext); + Reference<XPropertySet> el(v.get<Reference<XPropertySet>>(), UNO_SET_THROW); + sPath = el->getPropertyValue("LastPath").get<OUString>(); + } + catch (NoSuchElementException&) + { + } + } + else { SfxApplication *pSfxApp = SfxGetpApp(); - OUString sPath = pSfxApp->GetLastDir_Impl(); + sPath = pSfxApp->GetLastDir_Impl(); + } - if ( sPath.isEmpty() ) - sPath = _rFallback.getToken( _nFallbackToken, ' ' ); + if ( sPath.isEmpty() ) + sPath = _rFallback.getToken( _nFallbackToken, ' ' ); - // check if the path points to a valid (accessible) directory - bool bValid = false; - if ( !sPath.isEmpty() ) + // check if the path points to a valid (accessible) directory + bool bValid = false; + if ( !sPath.isEmpty() ) + { + OUString sPathCheck( sPath ); + if ( sPathCheck[ sPathCheck.getLength() - 1 ] != '/' ) + sPathCheck += "/"; + sPathCheck += "."; + try { - OUString sPathCheck( sPath ); - if ( sPathCheck[ sPathCheck.getLength() - 1 ] != '/' ) - sPathCheck += "/"; - sPathCheck += "."; - try - { - ::ucbhelper::Content aContent( sPathCheck, - utl::UCBContentHelper::getDefaultCommandEnvironment(), - comphelper::getProcessComponentContext() ); - bValid = aContent.isFolder(); - } - catch( const Exception& ) {} + ::ucbhelper::Content aContent( sPathCheck, + utl::UCBContentHelper::getDefaultCommandEnvironment(), + comphelper::getProcessComponentContext() ); + bValid = aContent.isFolder(); } - - if ( !bValid ) - sPath.clear(); - - return sPath; + catch( const Exception& ) {} } + if ( !bValid ) + sPath.clear(); + return sPath; } void FileDialogHelper_Impl::loadConfig() @@ -2350,6 +2419,121 @@ void FileDialogHelper::SetContext( Context _eNewContext ) mpImpl->SetContext( _eNewContext ); } +OUString FileDialogHelper::contextToString(Context context) +{ + // These strings are used in the configuration, to store the last used directory for each context. + // Please don't change them. + switch(context) { + case AcceleratorConfig: + return "AcceleratorConfig"; + case AutoRedact: + return "AutoRedact"; + case BaseDataSource: + return "BaseDataSource"; + case BaseSaveAs: + return "BaseSaveAs"; + case BasicExportPackage: + return "BasicExportPackage"; + case BasicInsertLib: + return "BasicInsertLib"; + case BulletsAddImage: + return "BulletsAddImage"; + case CalcDataProvider: + return "CalcDataProvider"; + case CalcDataStream: + return "CalcDataStream"; + case CalcExport: + return "CalcExport"; + case CalcSaveAs: + return "CalcSaveAs"; + case CalcXMLSource: + return "CalcXMLSource"; + case ExportImage: + return "ExportImage"; + case ExtensionManager: + return "ExtensionManager"; + case FormsAddInstance: + return "FormsAddInstance"; + case FormsInsertImage: + return "FormsInsertImage"; + case LinkClientOLE: + return "LinkClientOLE"; + case LinkClientFile: + return "LinkClientFile"; + case DrawImpressInsertFile: + return "DrawImpressInsertFile"; + case DrawImpressOpenSound: + return "DrawImpressOpenSound"; + case DrawExport: + return "DrawExport"; + case DrawSaveAs: + return "DrawSaveAs"; + case IconImport: + return "IconImport"; + case ImpressClickAction: + return "ImpressClickAction"; + case ImpressExport: + return "ImpressExport"; + case ImpressPhotoDialog: + return "ImpressPhotoDialog"; + case ImpressSaveAs: + return "ImpressSaveAs"; + case ImageMap: + return "ImageMap"; + case InsertDoc: + return "InsertDoc"; + case InsertImage: + return "InsertImage"; + case InsertOLE: + return "InsertOLE"; + case InsertMedia: + return "InsertMedia"; + case JavaClassPath: + return "JavaClassPath"; + case ReportInsertImage: + return "ReportInsertImage"; + case ScreenshotAnnotation: + return "ScreenshotAnnotation"; + case SignatureLine: + return "SignatureLine"; + case TemplateImport: + return "TemplateImport"; + case WriterCreateAddressList: + return "WriterCreateAddressList"; + case WriterExport: + return "WriterExport"; + case WriterImportAutotext: + return "WriterImportAutotext"; + case WriterInsertDoc: + return "WriterInsertDoc"; + case WriterInsertHyperlink: + return "WriterInsertHyperlink"; + case WriterInsertImage: + return "WriterInsertImage"; + case WriterInsertScript: + return "WriterInsertScript"; + case WriterLoadTemplate: + return "WriterLoadTemplate"; + case WriterMailMerge: + return "WriterMailMerge"; + case WriterMailMergeSaveAs: + return "WriterMailMergeSaveAs"; + case WriterNewHTMLGlobalDoc: + return "WriterNewHTMLGlobalDoc"; + case WriterRegisterDataSource: + return "WriterRegisterDataSource"; + case WriterSaveAs: + return "WriterSaveAs"; + case WriterSaveHTML: + return "WriterSaveHTML"; + case XMLFilterSettings: + return "XMLFilterSettings"; + case UnknownContext: + default: + return ""; + } +} + IMPL_LINK_NOARG(FileDialogHelper, ExecuteSystemFilePicker, void*, void) { m_nError = mpImpl->execute(); diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index c0ddb5545381..006a3142489a 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -57,6 +57,7 @@ namespace sfx2 ::std::vector< OUString > mlLastURLs; OUString maPath; + OUString maLastPath; OUString maFileName; OUString maCurFilter; OUString maSelectFilter; @@ -205,6 +206,7 @@ namespace sfx2 OUString getFilterWithExtension( const OUString& rFilter ) const; void SetContext( FileDialogHelper::Context _eNewContext ); + OUString getInitPath( const OUString& _rFallback, const sal_Int32 _nFallbackToken ); bool isSystemFilePicker() const { return mbSystemPicker; } bool isPasswordEnabled() const { return mbIsPwdEnabled; } diff --git a/sfx2/source/doc/autoredactdialog.cxx b/sfx2/source/doc/autoredactdialog.cxx index 19d1923b21ac..fe1955cb63ca 100644 --- a/sfx2/source/doc/autoredactdialog.cxx +++ b/sfx2/source/doc/autoredactdialog.cxx @@ -501,6 +501,7 @@ void SfxAutoRedactDialog::StartFileDialog(StartFileDialogType nType, const OUStr Link<sfx2::FileDialogHelper*, void> aDlgClosedLink = bSave ? LINK(this, SfxAutoRedactDialog, SaveHdl) : LINK(this, SfxAutoRedactDialog, LoadHdl); + m_pFileDlg->SetContext(sfx2::FileDialogHelper::AutoRedact); m_pFileDlg->StartExecuteModal(aDlgClosedLink); } diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx index 19649cc26ff9..d732a8e72f56 100644 --- a/sfx2/source/doc/docinsert.cxx +++ b/sfx2/source/doc/docinsert.cxx @@ -96,6 +96,7 @@ void DocumentInserter::StartExecuteModal( const Link<sfx2::FileDialogHelper*,voi ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, m_nDlgFlags, m_sDocFactory, SfxFilterFlags::NONE, SfxFilterFlags::NONE, m_pParent ) ); } + m_pFileDlg->SetContext(FileDialogHelper::InsertDoc); m_pFileDlg->StartExecuteModal( LINK( this, DocumentInserter, DialogClosedHdl ) ); } diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index bb4b0fb7f838..950e330af009 100755 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -881,15 +881,17 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, pFileDlg.reset(new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir, rBlackList, pFrameWin )); } - sfx2::FileDialogHelper::Context eCtxt = sfx2::FileDialogHelper::UNKNOWN_CONTEXT; + sfx2::FileDialogHelper::Context eCtxt = sfx2::FileDialogHelper::UnknownContext; if ( aDocServiceName == "com.sun.star.drawing.DrawingDocument" ) - eCtxt = sfx2::FileDialogHelper::SD_EXPORT; + eCtxt = sfx2::FileDialogHelper::DrawExport; else if ( aDocServiceName == "com.sun.star.presentation.PresentationDocument" ) - eCtxt = sfx2::FileDialogHelper::SI_EXPORT; + eCtxt = sfx2::FileDialogHelper::ImpressExport; else if ( aDocServiceName == "com.sun.star.text.TextDocument" ) - eCtxt = sfx2::FileDialogHelper::SW_EXPORT; + eCtxt = sfx2::FileDialogHelper::WriterExport; + else if ( aDocServiceName == "com.sun.star.sheet.SpreadsheetDocument" ) + eCtxt = sfx2::FileDialogHelper::CalcExport; - if ( eCtxt != sfx2::FileDialogHelper::UNKNOWN_CONTEXT ) + if ( eCtxt != sfx2::FileDialogHelper::UnknownContext ) pFileDlg->SetContext( eCtxt ); pFileDlg->CreateMatcher( aDocServiceName ); @@ -905,10 +907,23 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 nStoreMode, } else { - // This is the normal dialog + // This is the normal save as dialog pFileDlg.reset(new sfx2::FileDialogHelper( aDialogMode, aDialogFlags, aDocServiceName, nDialog, nMust, nDont, rStandardDir, rBlackList, pFrameWin )); pFileDlg->CreateMatcher( aDocServiceName ); + + sfx2::FileDialogHelper::Context eCtxt = sfx2::FileDialogHelper::UnknownContext; + if ( aDocServiceName == "com.sun.star.drawing.DrawingDocument" ) + eCtxt = sfx2::FileDialogHelper::DrawSaveAs; + else if ( aDocServiceName == "com.sun.star.presentation.PresentationDocument" ) + eCtxt = sfx2::FileDialogHelper::ImpressSaveAs; + else if ( aDocServiceName == "com.sun.star.text.TextDocument" ) + eCtxt = sfx2::FileDialogHelper::WriterSaveAs; + else if ( aDocServiceName == "com.sun.star.sheet.SpreadsheetDocument" ) + eCtxt = sfx2::FileDialogHelper::CalcSaveAs; + + if ( eCtxt != sfx2::FileDialogHelper::UnknownContext ) + pFileDlg->SetContext( eCtxt ); } OUString aAdjustToType; @@ -1173,7 +1188,7 @@ OUString ModelData_Impl::GetRecommendedDir( const OUString& aSuggestedDir ) } if ( aLocation.HasError() ) - aLocation = INetURLObject( SvtPathOptions().GetWorkPath() ); + aLocation = INetURLObject(); } OUString sLocationURL( aLocation.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); @@ -1196,7 +1211,7 @@ OUString ModelData_Impl::GetRecommendedDir( const OUString& aSuggestedDir ) #endif // Suggest somewhere other than the system's temp directory if( bIsInTempPath ) - aLocation = INetURLObject( SvtPathOptions().GetWorkPath() ); + aLocation = INetURLObject(); aLocation.setFinalSlash(); if ( !aLocation.HasError() ) @@ -1205,7 +1220,7 @@ OUString ModelData_Impl::GetRecommendedDir( const OUString& aSuggestedDir ) return OUString(); } - return INetURLObject( SvtPathOptions().GetWorkPath() ).GetMainURL( INetURLObject::DecodeMechanism::NONE ); + return OUString(); } diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 6ccff8f7a655..d129776a8d35 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -843,6 +843,7 @@ void SfxTemplateManagerDlg::OnTemplateImportCategory(const OUString& sCategory) { sfx2::FileDialogHelper aFileDlg(css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::MultiSelection, m_xDialog.get()); + aFileDlg.SetContext(sfx2::FileDialogHelper::TemplateImport); // add "All" filter aFileDlg.AddFilter( SfxResId(STR_SFX_FILTERNAME_ALL), diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index c4755ff10863..53100e8e45a9 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -187,7 +187,7 @@ OUString GraphicHelper::ExportGraphic(weld::Window* pParent, const Graphic& rGra aPath.SetSmartURL( sGraphicsPath ); // fish out the graphic's name - + aDialogHelper.SetContext(FileDialogHelper::ExportImage); aDialogHelper.SetTitle( SvxResId(RID_SVXSTR_EXPORT_GRAPHIC_TITLE)); aDialogHelper.SetDisplayDirectory( aPath.GetMainURL(INetURLObject::DecodeMechanism::ToIUri) ); INetURLObject aURL; diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index e015b3716351..5ce26e1b6ac5 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -372,7 +372,7 @@ void SvxIMapDlg::DoOpen() aDlg.AddFilter( IMAP_BINARY_FILTER, IMAP_BINARY_TYPE ); aDlg.SetCurrentFilter( aFilter ); - aDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() ); + aDlg.SetContext(sfx2::FileDialogHelper::ImageMap); if( aDlg.Execute() == ERRCODE_NONE ) { @@ -415,7 +415,7 @@ bool SvxIMapDlg::DoSave() aDlg.AddFilter( aBinFilter, IMAP_BINARY_TYPE ); aDlg.SetCurrentFilter( aCERNFilter ); - aDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() ); + aDlg.SetContext(sfx2::FileDialogHelper::ImageMap); if( aDlg.Execute() == ERRCODE_NONE ) { diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index acf51c0ad4ef..e87a63a960ce 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -3206,13 +3206,12 @@ namespace svxform ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get()); - INetURLObject aFile( SvtPathOptions().GetWorkPath() ); + aDlg.SetContext(sfx2::FileDialogHelper::FormsAddInstance); aDlg.AddFilter( m_sAllFilterName, FILEDIALOG_FILTER_ALL ); OUString sFilterName( "XML" ); aDlg.AddFilter( sFilterName, "*.xml" ); aDlg.SetCurrentFilter( sFilterName ); - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); if (aDlg.Execute() == ERRCODE_NONE) m_xURLED->set_entry_text(aDlg.GetPath()); diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index 5e89cfdaa3e4..14c068c0b1a4 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -293,6 +293,7 @@ IMPL_LINK_NOARG(SwCharURLPage, InsertFileHdl, weld::Button&, void) { FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, GetFrameWeld()); + aDlgHelper.SetContext(FileDialogHelper::WriterInsertHyperlink); if( aDlgHelper.Execute() == ERRCODE_NONE ) { const Reference<XFilePicker3>& xFP = aDlgHelper.GetFilePicker(); diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 4f0a49acd88c..6214c53b053f 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -421,10 +421,8 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, OkHdl_Impl, weld::Button&, void) { sfx2::FileDialogHelper aDlgHelper(TemplateDescription::FILESAVE_SIMPLE, FileDialogFlags::NONE, m_xDialog.get()); + aDlgHelper.SetContext(sfx2::FileDialogHelper::WriterCreateAddressList); uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker(); - - const OUString sPath( SvtPathOptions().SubstituteVariable("$(userurl)/database") ); - aDlgHelper.SetDisplayDirectory( sPath ); xFP->appendFilter( m_sAddressListFilterName, "*.csv" ); xFP->setCurrentFilter( m_sAddressListFilterName ) ; diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx index f19089126a03..5f81cc576442 100644 --- a/sw/source/ui/dbui/mmdocselectpage.cxx +++ b/sw/source/ui/dbui/mmdocselectpage.cxx @@ -110,10 +110,9 @@ IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, weld::Button&, rButton, void) { sfx2::FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_pWizard->getDialog()); + aDlgHelper.SetContext(sfx2::FileDialogHelper::WriterMailMerge); Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker(); - xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() ); - SfxObjectFactory &rFact = m_pWizard->GetSwView()->GetDocShell()->GetFactory(); SfxFilterMatcher aMatcher( rFact.GetFactoryName() ); SfxFilterMatcherIter aIter( aMatcher ); diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx index bfec3202309c..fc98421c57a2 100644 --- a/sw/source/ui/fldui/javaedit.cxx +++ b/sw/source/ui/fldui/javaedit.cxx @@ -224,7 +224,7 @@ IMPL_LINK_NOARG( SwJavaEditDialog, InsertFileHdl, weld::Button&, void ) ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::Insert, "swriter", SfxFilterFlags::NONE, SfxFilterFlags::NONE, m_xDialog.get())); } - + m_pFileDlg->SetContext(sfx2::FileDialogHelper::WriterInsertScript); m_pFileDlg->StartExecuteModal( LINK( this, SwJavaEditDialog, DlgClosedHdl ) ); } diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 916ade14f4b2..28a5474557ea 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -563,11 +563,9 @@ IMPL_LINK(SwGlossaryDlg, MenuHdl, const OString&, rItemIdent, void) // call the FileOpenDialog do find WinWord - Files with templates FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get()); + aDlgHelper.SetContext(FileDialogHelper::WriterImportAutotext); uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker(); - SvtPathOptions aPathOpt; - xFP->setDisplayDirectory(aPathOpt.GetWorkPath() ); - SfxFilterMatcher aMatcher( SwDocShell::Factory().GetFactoryName() ); SfxFilterMatcherIter aIter( aMatcher ); std::shared_ptr<const SfxFilter> pFilter = aIter.First(); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index e70129d99c6e..fd8f3c0e5397 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -545,7 +545,6 @@ void SwDocShell::Execute(SfxRequest& rReq) if ( aFileName.isEmpty() ) { - SvtPathOptions aPathOpt; SfxNewFileDialog aNewFileDlg(GetView()->GetFrameWeld(), SfxNewFileDialogMode::LoadTemplate); aNewFileDlg.SetTemplateFlags(nFlags); @@ -554,10 +553,9 @@ void SwDocShell::Execute(SfxRequest& rReq) { FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, GetView()->GetFrameWeld()); + aDlgHelper.SetContext(FileDialogHelper::WriterLoadTemplate); uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker(); - xFP->setDisplayDirectory( aPathOpt.GetWorkPath() ); - SfxObjectFactory &rFact = GetFactory(); SfxFilterMatcher aMatcher( rFact.GetFactoryName() ); SfxFilterMatcherIter aIter( aMatcher ); @@ -670,6 +668,7 @@ void SwDocShell::Execute(SfxRequest& rReq) FileDialogHelper aDlgHelper(TemplateDescription::FILESAVE_AUTOEXTENSION, FileDialogFlags::NONE, GetView()->GetFrameWeld()); + aDlgHelper.SetContext(FileDialogHelper::WriterSaveHTML); aDlgHelper.AddFilter( pHtmlFlt->GetFilterName(), pHtmlFlt->GetDefaultExtension() ); aDlgHelper.SetCurrentFilter( pHtmlFlt->GetFilterName() ); if( ERRCODE_NONE != aDlgHelper.Execute()) @@ -925,6 +924,7 @@ void SwDocShell::Execute(SfxRequest& rReq) FileDialogHelper aDlgHelper(TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE, FileDialogFlags::NONE, GetView()->GetFrameWeld()); + aDlgHelper.SetContext(FileDialogHelper::WriterNewHTMLGlobalDoc); const sal_Int16 nControlIds[] = { CommonFilePickerElementIds::PUSHBUTTON_OK, diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 309d74ae8073..4b8f0bb001ab 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -2859,11 +2859,9 @@ OUString ConstructVndSunStarPkgUrl(const OUString& rMainURL, const OUString& rSt OUString SwDBManager::LoadAndRegisterDataSource(weld::Window* pParent, SwDocShell* pDocShell) { sfx2::FileDialogHelper aDlgHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, pParent); + aDlgHelper.SetContext(sfx2::FileDialogHelper::WriterRegisterDataSource); uno::Reference < ui::dialogs::XFilePicker3 > xFP = aDlgHelper.GetFilePicker(); - OUString sHomePath(SvtPathOptions().GetWorkPath()); - aDlgHelper.SetDisplayDirectory( sHomePath ); - OUString sFilterAll(SwResId(STR_FILTER_ALL)); OUString sFilterAllData(SwResId(STR_FILTER_ALL_DATA)); OUString sFilterSXB(SwResId(STR_FILTER_SXB)); diff --git a/sw/source/uibase/dbui/mailmergehelper.cxx b/sw/source/uibase/dbui/mailmergehelper.cxx index 0981bce7fdaa..246ec9fe04e7 100644 --- a/sw/source/uibase/dbui/mailmergehelper.cxx +++ b/sw/source/uibase/dbui/mailmergehelper.cxx @@ -57,6 +57,7 @@ OUString CallSaveAsDialog(weld::Window* pParent, OUString& rFilter) ::sfx2::FileDialogHelper aDialog( ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, FileDialogFlags::NONE, SwDocShell::Factory().GetFactoryName(), SfxFilterFlags::NONE, SfxFilterFlags::NONE, pParent); + aDialog.SetContext(sfx2::FileDialogHelper::WriterMailMergeSaveAs); if (aDialog.Execute()!=ERRCODE_NONE) { diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index 0c3aaa4a3acc..d436e95da26b 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -269,7 +269,6 @@ void SwSrcView::Execute(SfxRequest& rReq) case SID_SAVEACOPY: case SID_SAVEASDOC: { - SvtPathOptions aPathOpt; // filesave dialog with autoextension FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION, @@ -296,7 +295,6 @@ void SwSrcView::Execute(SfxRequest& rReq) xFP->setCurrentFilter( sHtml ) ; } - xFP->setDisplayDirectory( aPathOpt.GetWorkPath() ); if( aDlgHelper.Execute() == ERRCODE_NONE) { SfxMedium aMedium( xFP->getSelectedFiles().getConstArray()[0], diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 6245bf7f4782..5d67b43dee74 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -301,7 +301,7 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE, FileDialogFlags::Graphic, GetFrameWeld())); pFileDlg->SetTitle(SwResId(STR_INSERT_GRAPHIC )); - pFileDlg->SetContext( FileDialogHelper::SW_INSERT_GRAPHIC ); + pFileDlg->SetContext( FileDialogHelper::WriterInsertImage ); uno::Reference < XFilePicker3 > xFP = pFileDlg->GetFilePicker(); uno::Reference < XFilePickerControlAccess > xCtrlAcc(xFP, UNO_QUERY); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits