diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-19 21:21:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-20 21:15:27 +0200 |
commit | 7b4a3cefdd1137ce2e42616b2fb1dcf77d01db7b (patch) | |
tree | ec6f4ac3eece4dc1aaa95199c84e609f6ce5f4c1 | |
parent | ef200af8976087216d6c8ddeac7b2fcaba7ebaa1 (diff) |
weld ScDataPilotDatabaseDlg
Change-Id: Ie8e9914bb8042e33a2ab2a1e07bb0203a54d5422
Reviewed-on: https://gerrit.libreoffice.org/54584
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/inc/scabstdlg.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/screenshots/screenshots.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 13 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 10 | ||||
-rw-r--r-- | sc/source/ui/dbgui/dapidata.cxx | 49 | ||||
-rw-r--r-- | sc/source/ui/inc/dapidata.hxx | 18 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 9 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/selectdatasource.ui | 26 |
8 files changed, 57 insertions, 72 deletions
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 7032ab97c8c7..b1b33b94b162 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -414,7 +414,7 @@ public: virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) = 0; - virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(vcl::Window* pParent) = 0; + virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(weld::Window* pParent) = 0; virtual VclPtr<AbstractScDataPilotSourceTypeDlg> CreateScDataPilotSourceTypeDlg(weld::Window* pParent, bool bEnableExternal) = 0; diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index 5438f738db7b..59a10ef21dd9 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -178,7 +178,7 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID) case 4: // "modules/scalc/ui/selectdatasource.ui" { - pReturnDialog = mpFact->CreateScDataPilotDatabaseDlg(mpViewShell->GetDialogParent()); + pReturnDialog = mpFact->CreateScDataPilotDatabaseDlg(mpViewShell->GetFrameWeld()); break; } case 5: // "modules/scalc/ui/selectsource.ui" diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index dfedd10a54a2..2d00bc0ed0a7 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -84,7 +84,11 @@ short AbstractScColRowLabelDlg_Impl::Execute() } IMPL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl); -IMPL_ABSTDLG_BASE(AbstractScDataPilotDatabaseDlg_Impl); + +short AbstractScDataPilotDatabaseDlg_Impl::Execute() +{ + return m_xDlg->run(); +} short AbstractScDataPilotSourceTypeDlg_Impl::Execute() { @@ -255,7 +259,7 @@ bool AbstractScColRowLabelDlg_Impl::IsRow() void AbstractScDataPilotDatabaseDlg_Impl::GetValues( ScImportSourceDesc& rDesc ) { - pDlg->GetValues(rDesc); + m_xDlg->GetValues(rDesc); } bool AbstractScDataPilotSourceTypeDlg_Impl::IsDatabase() const @@ -719,10 +723,9 @@ VclPtr<AbstractScCondFormatManagerDlg> ScAbstractDialogFactory_Impl::CreateScCon return VclPtr<AbstractScCondFormatManagerDlg_Impl>::Create( pDlg ); } -VclPtr<AbstractScDataPilotDatabaseDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotDatabaseDlg(vcl::Window* pParent) +VclPtr<AbstractScDataPilotDatabaseDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotDatabaseDlg(weld::Window* pParent) { - VclPtr<ScDataPilotDatabaseDlg> pDlg = VclPtr<ScDataPilotDatabaseDlg>::Create( pParent ); - return VclPtr<AbstractScDataPilotDatabaseDlg_Impl>::Create( pDlg ); + return VclPtr<AbstractScDataPilotDatabaseDlg_Impl>::Create(new ScDataPilotDatabaseDlg(pParent)); } VclPtr<AbstractScDataPilotSourceTypeDlg> ScAbstractDialogFactory_Impl::CreateScDataPilotSourceTypeDlg( diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index a27a52ab26d7..50f206cb5ac6 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -142,7 +142,13 @@ class AbstractScCondFormatManagerDlg_Impl : public AbstractScCondFormatManagerDl class AbstractScDataPilotDatabaseDlg_Impl :public AbstractScDataPilotDatabaseDlg { - DECL_ABSTDLG_BASE(AbstractScDataPilotDatabaseDlg_Impl, ScDataPilotDatabaseDlg) + std::unique_ptr<ScDataPilotDatabaseDlg> m_xDlg; +public: + explicit AbstractScDataPilotDatabaseDlg_Impl(ScDataPilotDatabaseDlg* p) + : m_xDlg(p) + { + } + virtual short Execute() override; virtual void GetValues( ScImportSourceDesc& rDesc ) override; }; @@ -526,7 +532,7 @@ public: virtual VclPtr<AbstractScCondFormatManagerDlg> CreateScCondFormatMgrDlg(vcl::Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList ) override; - virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(vcl::Window* pParent) override; + virtual VclPtr<AbstractScDataPilotDatabaseDlg> CreateScDataPilotDatabaseDlg(weld::Window* pParent) override; virtual VclPtr<AbstractScDataPilotSourceTypeDlg> CreateScDataPilotSourceTypeDlg(weld::Window* pParent, bool bEnableExternal) override; diff --git a/sc/source/ui/dbgui/dapidata.cxx b/sc/source/ui/dbgui/dapidata.cxx index 4e6e36e5eee8..b75b19609916 100644 --- a/sc/source/ui/dbgui/dapidata.cxx +++ b/sc/source/ui/dbgui/dapidata.cxx @@ -42,15 +42,13 @@ using namespace com::sun::star; #define DP_TYPELIST_QUERY 1 #define DP_TYPELIST_SQLNAT 3 -ScDataPilotDatabaseDlg::ScDataPilotDatabaseDlg( vcl::Window* pParent ) : - ModalDialog(pParent, "SelectDataSourceDialog", - "modules/scalc/ui/selectdatasource.ui") +ScDataPilotDatabaseDlg::ScDataPilotDatabaseDlg(weld::Window* pParent) + : GenericDialogController(pParent, "modules/scalc/ui/selectdatasource.ui", "SelectDataSourceDialog") + , m_xLbDatabase(m_xBuilder->weld_combo_box_text("database")) + , m_xCbObject(m_xBuilder->weld_combo_box_text("datasource")) + , m_xLbType(m_xBuilder->weld_combo_box_text("type")) { - get(m_pLbDatabase, "database"); - get(m_pCbObject, "datasource"); - get(m_pLbType, "type"); - - WaitObject aWait( this ); // initializing the database service the first time takes a while + weld::WaitObject aWait(pParent); // initializing the database service the first time takes a while try { @@ -64,7 +62,7 @@ ScDataPilotDatabaseDlg::ScDataPilotDatabaseDlg( vcl::Window* pParent ) : for (long nPos = 0; nPos < nCount; nPos++) { OUString aName = pArray[nPos]; - m_pLbDatabase->InsertEntry( aName ); + m_xLbDatabase->append_text(aName); } } catch(uno::Exception&) @@ -72,34 +70,25 @@ ScDataPilotDatabaseDlg::ScDataPilotDatabaseDlg( vcl::Window* pParent ) : OSL_FAIL("exception in database"); } - m_pLbDatabase->SelectEntryPos( 0 ); - m_pLbType->SelectEntryPos( 0 ); + m_xLbDatabase->set_active(0); + m_xLbType->set_active(0); FillObjects(); - m_pLbDatabase->SetSelectHdl( LINK( this, ScDataPilotDatabaseDlg, SelectHdl ) ); - m_pLbType->SetSelectHdl( LINK( this, ScDataPilotDatabaseDlg, SelectHdl ) ); + m_xLbDatabase->connect_changed( LINK( this, ScDataPilotDatabaseDlg, SelectHdl ) ); + m_xLbType->connect_changed( LINK( this, ScDataPilotDatabaseDlg, SelectHdl ) ); } ScDataPilotDatabaseDlg::~ScDataPilotDatabaseDlg() { - disposeOnce(); -} - -void ScDataPilotDatabaseDlg::dispose() -{ - m_pLbDatabase.clear(); - m_pCbObject.clear(); - m_pLbType.clear(); - ModalDialog::dispose(); } void ScDataPilotDatabaseDlg::GetValues( ScImportSourceDesc& rDesc ) { - const sal_Int32 nSelect = m_pLbType->GetSelectedEntryPos(); + const sal_Int32 nSelect = m_xLbType->get_active(); - rDesc.aDBName = m_pLbDatabase->GetSelectedEntry(); - rDesc.aObject = m_pCbObject->GetText(); + rDesc.aDBName = m_xLbDatabase->get_active_text(); + rDesc.aObject = m_xCbObject->get_active_text(); if (rDesc.aDBName.isEmpty() || rDesc.aObject.isEmpty()) rDesc.nType = sheet::DataImportMode_NONE; @@ -113,20 +102,20 @@ void ScDataPilotDatabaseDlg::GetValues( ScImportSourceDesc& rDesc ) rDesc.bNative = ( nSelect == DP_TYPELIST_SQLNAT ); } -IMPL_LINK_NOARG(ScDataPilotDatabaseDlg, SelectHdl, ListBox&, void) +IMPL_LINK_NOARG(ScDataPilotDatabaseDlg, SelectHdl, weld::ComboBoxText&, void) { FillObjects(); } void ScDataPilotDatabaseDlg::FillObjects() { - m_pCbObject->Clear(); + m_xCbObject->clear(); - OUString aDatabaseName = m_pLbDatabase->GetSelectedEntry(); + OUString aDatabaseName = m_xLbDatabase->get_active_text(); if (aDatabaseName.isEmpty()) return; - const sal_Int32 nSelect = m_pLbType->GetSelectedEntryPos(); + const int nSelect = m_xLbType->get_active(); if ( nSelect > DP_TYPELIST_QUERY ) return; // only tables and queries @@ -181,7 +170,7 @@ void ScDataPilotDatabaseDlg::FillObjects() for( long nPos=0; nPos<nCount; nPos++ ) { OUString aName = pArray[nPos]; - m_pCbObject->InsertEntry( aName ); + m_xCbObject->append_text(aName); } } catch(uno::Exception&) diff --git a/sc/source/ui/inc/dapidata.hxx b/sc/source/ui/inc/dapidata.hxx index 6216d4f6fc2f..f916a834af89 100644 --- a/sc/source/ui/inc/dapidata.hxx +++ b/sc/source/ui/inc/dapidata.hxx @@ -20,28 +20,24 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_DAPIDATA_HXX #define INCLUDED_SC_SOURCE_UI_INC_DAPIDATA_HXX -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/combobox.hxx> +#include <vcl/weld.hxx> struct ScImportSourceDesc; -class ScDataPilotDatabaseDlg : public ModalDialog +class ScDataPilotDatabaseDlg : public weld::GenericDialogController { private: - VclPtr<ListBox> m_pLbDatabase; - VclPtr<ComboBox> m_pCbObject; - VclPtr<ListBox> m_pLbType; + std::unique_ptr<weld::ComboBoxText> m_xLbDatabase; + std::unique_ptr<weld::ComboBoxText> m_xCbObject; + std::unique_ptr<weld::ComboBoxText> m_xLbType; void FillObjects(); - DECL_LINK( SelectHdl, ListBox&, void ); + DECL_LINK(SelectHdl, weld::ComboBoxText&, void); public: - ScDataPilotDatabaseDlg(vcl::Window* pParent); + ScDataPilotDatabaseDlg(weld::Window* pParent); virtual ~ScDataPilotDatabaseDlg() override; - virtual void dispose() override; void GetValues( ScImportSourceDesc& rDesc ); }; diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 55fa9e421210..896465c74933 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2861,13 +2861,10 @@ void ScCellShell::ExecuteDataPilotDialog() } else if ( pTypeDlg->IsDatabase() ) { - OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - + assert(pFact && "ScAbstractFactory create fail!"); ScopedVclPtr<AbstractScDataPilotDatabaseDlg> pDataDlg( - pFact->CreateScDataPilotDatabaseDlg( - pTabViewShell->GetDialogParent())); - - OSL_ENSURE(pDataDlg, "Dialog create fail!"); + pFact->CreateScDataPilotDatabaseDlg(pTabViewShell->GetFrameWeld())); + assert(pDataDlg && "Dialog create fail!"); if ( pDataDlg->Execute() == RET_OK ) { ScImportSourceDesc aImpDesc(pDoc); diff --git a/sc/uiconfig/scalc/ui/selectdatasource.ui b/sc/uiconfig/scalc/ui/selectdatasource.ui index 38f63fa54417..0bd178bb50e7 100644 --- a/sc/uiconfig/scalc/ui/selectdatasource.ui +++ b/sc/uiconfig/scalc/ui/selectdatasource.ui @@ -1,11 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.20.4 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="SelectDataSourceDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="selectdatasource|SelectDataSourceDialog">Select Data Source</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox3"> @@ -95,32 +98,28 @@ <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="selectdatasource|label2">_Database:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">database</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="label4"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="selectdatasource|label4">_Type:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">type</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -132,8 +131,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -151,24 +148,20 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="label3"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="selectdatasource|label3">Data so_urce:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">datasource</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -186,8 +179,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -218,5 +209,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> |