Kaydet (Commit) 14f83b8a authored tarafından Markus Mohrhard's avatar Markus Mohrhard

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: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst dddcfa00
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment