diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-10-19 21:58:18 -0600 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2018-11-18 05:35:31 +0100 |
commit | 14f83b8a8ec8f2fe1570db285f4527b9fd5d86ea (patch) | |
tree | 5260bb23e277838d9dc110257828b956c6fec758 /sc/source | |
parent | dddcfa0089bc84965d7a2c94f5f738a325cfae78 (diff) |
tdf#113916, don't import if no DB range is selected
Change-Id: I6562ded076f53c44b5eeab7027058baf6c71f48f
Reviewed-on: https://gerrit.libreoffice.org/63509
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/miscdlgs/dataproviderdlg.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx b/sc/source/ui/miscdlgs/dataproviderdlg.cxx index 75a7880e42ff..cb58ad0c42ff 100644 --- a/sc/source/ui/miscdlgs/dataproviderdlg.cxx +++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx @@ -18,6 +18,7 @@ #include <comphelper/string.hxx> #include <sal/log.hxx> +#include <unotools/charclass.hxx> #include <utility> #include <vcl/lstbox.hxx> @@ -1137,9 +1138,22 @@ void ScDataProviderDlg::dateTimeTransformation() mpList->addEntry(pDateTimeTransformationEntry); } +namespace { + +bool hasDBName(const OUString& rName, ScDBCollection* pDBCollection) +{ + if (pDBCollection->getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(rName))) + return true; + + return false; +} + +} + void ScDataProviderDlg::import(ScDocument* pDoc, bool bInternal) { sc::ExternalDataSource aSource = mpDataProviderCtrl->getDataSource(pDoc); + std::vector<VclPtr<vcl::Window>> aListEntries = mpList->getEntries(); for (size_t i = 1; i < aListEntries.size(); ++i) { @@ -1156,6 +1170,8 @@ void ScDataProviderDlg::import(ScDocument* pDoc, bool bInternal) else { aSource.setDBData(mpDBRanges->GetSelectedEntry()); + if (!hasDBName(aSource.getDBName(), pDoc->GetDBCollection())) + return; pDoc->GetExternalDataMapper().insertDataSource(aSource); } aSource.refresh(pDoc, true); |