summaryrefslogtreecommitdiff
path: root/sc/source/ui/miscdlgs
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/miscdlgs')
-rw-r--r--sc/source/ui/miscdlgs/dataproviderdlg.cxx23
1 files changed, 19 insertions, 4 deletions
diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx b/sc/source/ui/miscdlgs/dataproviderdlg.cxx
index a94a5d4d41e1..a867b419aa7e 100644
--- a/sc/source/ui/miscdlgs/dataproviderdlg.cxx
+++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx
@@ -437,15 +437,23 @@ std::shared_ptr<sc::DataTransformation> ScMergeColumnTransformationControl::getT
}
-ScDataProviderDlg::ScDataProviderDlg(vcl::Window* pParent, std::shared_ptr<ScDocument> pDoc):
+ScDataProviderDlg::ScDataProviderDlg(vcl::Window* pParent, std::shared_ptr<ScDocument> pDoc, ScDocument* pDocument):
ModalDialog(pParent, "dataproviderdlg", "modules/scalc/ui/dataproviderdlg.ui", true),
mpDoc(pDoc),
mpBar(VclPtr<MenuBar>::Create())
{
get(mpTable, "data_table");
get(mpList, "operation_ctrl");
+ get(mpDBRanges, "select_db_range");
mpTable->Init(mpDoc);
+ ScDBCollection* pDBCollection = pDocument->GetDBCollection();
+ auto& rNamedDBs = pDBCollection->getNamedDBs();
+ for (auto& rNamedDB : rNamedDBs)
+ {
+ mpDBRanges->InsertEntry(rNamedDB->GetName());
+ }
+
mpDataProviderCtrl = VclPtr<ScDataProviderBaseControl>::Create(mpList, LINK(this, ScDataProviderDlg, ImportHdl));
mpList->addEntry(mpDataProviderCtrl);
@@ -466,6 +474,7 @@ void ScDataProviderDlg::dispose()
mpDataProviderCtrl.clear();
mpTable.clear();
mpList.clear();
+ mpDBRanges.clear();
mpBar.disposeAndClear();
ModalDialog::dispose();
@@ -534,7 +543,7 @@ IMPL_LINK(ScDataProviderDlg, ImportHdl, Window*, pCtrl, void)
{
if (pCtrl == mpDataProviderCtrl.get())
{
- import(mpDoc.get());
+ import(mpDoc.get(), true);
}
}
@@ -572,7 +581,7 @@ void ScDataProviderDlg::mergeColumns()
mpList->addEntry(pMergeColumnEntry);
}
-void ScDataProviderDlg::import(ScDocument* pDoc)
+void ScDataProviderDlg::import(ScDocument* pDoc, bool bInternal)
{
sc::ExternalDataSource aSource = mpDataProviderCtrl->getDataSource(pDoc);
std::vector<VclPtr<vcl::Window>> aListEntries = mpList->getEntries();
@@ -586,7 +595,13 @@ void ScDataProviderDlg::import(ScDocument* pDoc)
}
aSource.AddDataTransformation(pTransformationCtrl->getTransformation());
}
- aSource.setDBData(pDBData);
+ if (bInternal)
+ aSource.setDBData(pDBData->GetName());
+ else
+ {
+ aSource.setDBData(mpDBRanges->GetSelectedEntry());
+ pDoc->GetExternalDataMapper().insertDataSource(aSource);
+ }
aSource.refresh(pDoc, true);
mpTable->Invalidate();
}