diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-08-13 15:37:49 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-08-13 18:31:11 +0200 |
commit | f966b9e8bb2b5e7e563807d16088a9f3784f01fe (patch) | |
tree | 54fb9125060f4f36b062444bc29757039f1c308d /extensions | |
parent | c69aadfec031535c5b6266dcb97d40225f40eb9b (diff) |
bibliography, local URL: better starting directory when picking a new file
Improve the case when we have no old file, so we can't take its old
parent directory as a starting point in the file picker, opened by the
browse button.
It turns out both places that open that file picker have access to the
base URL of the current document, so can open the directory of that
instead.
Change-Id: I4db84b6036771f48962d49ae5e4c46a99c306def
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120455
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/bibliography/general.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx index 3992f55e5ebc..08880534eea6 100644 --- a/extensions/source/bibliography/general.cxx +++ b/extensions/source/bibliography/general.cxx @@ -46,6 +46,7 @@ #include <algorithm> #include <tools/urlobj.hxx> #include <sfx2/filedlghelper.hxx> +#include <sfx2/objsh.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -363,6 +364,19 @@ IMPL_LINK_NOARG(BibGeneralPage, BrowseHdl, weld::Button&, void) { aFileDlg.SetDisplayDirectory(aPath); } + else + { + SfxObjectShell* pShell = SfxObjectShell::Current(); + OUString aBaseURL; + if (pShell) + { + aBaseURL = pShell->getDocumentBaseURL(); + } + if (!aBaseURL.isEmpty()) + { + aFileDlg.SetDisplayDirectory(aBaseURL); + } + } if (aFileDlg.Execute() != ERRCODE_NONE) { |