diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-08-22 16:01:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-08-22 18:31:16 +0200 |
commit | 055c249847548a5c28ab5b29f3603ffbe74fe1f0 (patch) | |
tree | 5aa2f02e6bcf502234db45da40fe33f96c292393 /dbaccess | |
parent | d661cb17610af93b1607025284f23187c6d2fc06 (diff) |
weld ODbTypeWizDialog
Change-Id: Ie85e8f7a9a7551078e3108e7be9747ae4501d5eb
Reviewed-on: https://gerrit.libreoffice.org/77966
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/dlg/dbwiz.cxx | 70 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbwiz.hxx | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/uno/DBTypeWizDlg.cxx | 4 |
3 files changed, 38 insertions, 41 deletions
diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx index d36da8d5c0e0..9e6fef02f0e6 100644 --- a/dbaccess/source/ui/dlg/dbwiz.cxx +++ b/dbaccess/source/ui/dlg/dbwiz.cxx @@ -62,14 +62,11 @@ using namespace com::sun::star::container; #define ADDITIONAL_PAGE_MYSQL_NATIVE 12 // ODbTypeWizDialog -ODbTypeWizDialog::ODbTypeWizDialog(vcl::Window* _pParent - ,SfxItemSet const * _pItems - ,const Reference< XComponentContext >& _rxORB - ,const css::uno::Any& _aDataSourceName - ) - :OWizardMachine(_pParent, WizardButtonFlags::NEXT | WizardButtonFlags::PREVIOUS | WizardButtonFlags::FINISH | WizardButtonFlags::CANCEL | WizardButtonFlags::HELP ) +ODbTypeWizDialog::ODbTypeWizDialog(weld::Window* _pParent, SfxItemSet const * _pItems, + const Reference< XComponentContext >& _rxORB, const css::uno::Any& _aDataSourceName) + : WizardMachine(_pParent, WizardButtonFlags::NEXT | WizardButtonFlags::PREVIOUS | WizardButtonFlags::FINISH | WizardButtonFlags::CANCEL | WizardButtonFlags::HELP ) { - m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB,GetFrameWeld(), _pParent ? _pParent->GetFrameWeld() : nullptr, this)); + m_pImpl.reset(new ODbDataSourceAdministrationHelper(_rxORB, m_xAssistant.get(), _pParent, this)); m_pImpl->setDataSourceOrName(_aDataSourceName); Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource(); m_pOutSet.reset(new SfxItemSet( *_pItems->GetPool(), _pItems->GetRanges() )); @@ -77,15 +74,14 @@ ODbTypeWizDialog::ODbTypeWizDialog(vcl::Window* _pParent m_pImpl->translateProperties(xDatasource, *m_pOutSet); m_eType = dbaui::ODbDataSourceAdministrationHelper::getDatasourceType(*m_pOutSet); - SetPageSizePixel(LogicToPixel(::Size(PAGE_X, PAGE_Y), MapMode(MapUnit::MapAppFont))); defaultButton(WizardButtonFlags::NEXT); enableButtons(WizardButtonFlags::FINISH, false); enableAutomaticNextButtonState(); - m_pPrevPage->SetHelpId(HID_DBWIZ_PREVIOUS); - m_pNextPage->SetHelpId(HID_DBWIZ_NEXT); - m_pCancel->SetHelpId(HID_DBWIZ_CANCEL); - m_pFinish->SetHelpId(HID_DBWIZ_FINISH); + m_xPrevPage->set_help_id(HID_DBWIZ_PREVIOUS); + m_xNextPage->set_help_id(HID_DBWIZ_NEXT); + m_xCancel->set_help_id(HID_DBWIZ_CANCEL); + m_xFinish->set_help_id(HID_DBWIZ_FINISH); // no local resources needed anymore const DbuTypeCollectionItem& rCollectionItem = dynamic_cast<const DbuTypeCollectionItem&>(*_pItems->GetItem(DSID_TYPECOLLECTION)); @@ -93,17 +89,12 @@ ODbTypeWizDialog::ODbTypeWizDialog(vcl::Window* _pParent ActivatePage(); setTitleBase(DBA_RES(STR_DATABASE_TYPE_CHANGE)); -} -ODbTypeWizDialog::~ODbTypeWizDialog() -{ - disposeOnce(); + m_xAssistant->set_current_page(0); } -void ODbTypeWizDialog::dispose() +ODbTypeWizDialog::~ODbTypeWizDialog() { - m_pOutSet.reset(); - vcl::OWizardMachine::dispose(); } IMPL_LINK(ODbTypeWizDialog, OnTypeSelected, OGeneralPage&, _rTabPage, void) @@ -232,50 +223,56 @@ VclPtr<TabPage> ODbTypeWizDialog::createPage(WizardState _nState) { const char* pStringId = STR_PAGETITLE_ADVANCED; VclPtr<TabPage> pPage; + + OString sIdent(OString::number(_nState)); + weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); + // TODO eventually pass DialogController as distinct argument instead of bundling into TabPageParent + TabPageParent aParent(pPageContainer, this); + switch(_nState) { case START_PAGE: // start state { - pPage = VclPtr<OGeneralPageDialog>::Create(this,*m_pOutSet); + pPage = VclPtr<OGeneralPageDialog>::Create(aParent, *m_pOutSet); OGeneralPage* pGeneralPage = static_cast< OGeneralPage* >( pPage.get() ); pGeneralPage->SetTypeSelectHandler( LINK( this, ODbTypeWizDialog, OnTypeSelected)); pStringId = STR_PAGETITLE_GENERAL; } break; case CONNECTION_PAGE: - pPage = OConnectionTabPage::Create(this,m_pOutSet.get()); + pPage = OConnectionTabPage::Create(aParent, m_pOutSet.get()); pStringId = STR_PAGETITLE_CONNECTION; break; case ADDITIONAL_PAGE_DBASE: - pPage = ODriversSettings::CreateDbase(this,m_pOutSet.get()); + pPage = ODriversSettings::CreateDbase(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_FLAT: - pPage = ODriversSettings::CreateText(this,m_pOutSet.get()); + pPage = ODriversSettings::CreateText(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_LDAP: - pPage = ODriversSettings::CreateLDAP(this,m_pOutSet.get()); + pPage = ODriversSettings::CreateLDAP(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_MYSQL_JDBC: - pPage = ODriversSettings::CreateMySQLJDBC(this,m_pOutSet.get()); + pPage = ODriversSettings::CreateMySQLJDBC(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_MYSQL_NATIVE: - pPage = ODriversSettings::CreateMySQLNATIVE(this,m_pOutSet.get()); + pPage = ODriversSettings::CreateMySQLNATIVE(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_MYSQL_ODBC: - pPage = ODriversSettings::CreateMySQLODBC(this,m_pOutSet.get()); + pPage = ODriversSettings::CreateMySQLODBC(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_ORACLE_JDBC: - pPage = ODriversSettings::CreateOracleJDBC(this,m_pOutSet.get()); + pPage = ODriversSettings::CreateOracleJDBC(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_ADO: - pPage = ODriversSettings::CreateAdo(this,m_pOutSet.get()); + pPage = ODriversSettings::CreateAdo(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_ODBC: - pPage = ODriversSettings::CreateODBC(this,m_pOutSet.get()); + pPage = ODriversSettings::CreateODBC(aParent, m_pOutSet.get()); break; case ADDITIONAL_USERDEFINED: - pPage = ODriversSettings::CreateUser(this,m_pOutSet.get()); + pPage = ODriversSettings::CreateUser(aParent, m_pOutSet.get()); break; default: OSL_FAIL("Wrong state!"); @@ -287,9 +284,10 @@ VclPtr<TabPage> ODbTypeWizDialog::createPage(WizardState _nState) { static_cast<OGenericAdministrationPage*>(pPage.get())->SetServiceFactory( m_pImpl->getORB() ); static_cast<OGenericAdministrationPage*>(pPage.get())->SetAdminDialog(this,this); - pPage->SetText(DBA_RES(pStringId)); + m_xAssistant->set_page_title(sIdent, DBA_RES(pStringId)); defaultButton( _nState == START_PAGE ? WizardButtonFlags::NEXT : WizardButtonFlags::FINISH ); enableButtons( WizardButtonFlags::FINISH, _nState != START_PAGE); + pPage->Show(); } return pPage; @@ -297,7 +295,7 @@ VclPtr<TabPage> ODbTypeWizDialog::createPage(WizardState _nState) bool ODbTypeWizDialog::leaveState(WizardState _nState) { - SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(_nState)); + SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardMachine::GetPage(_nState)); if ( pPage ) pPage->FillItemSet(m_pOutSet.get()); return true; @@ -305,7 +303,7 @@ bool ODbTypeWizDialog::leaveState(WizardState _nState) void ODbTypeWizDialog::setTitle(const OUString& _sTitle) { - SetText(_sTitle); + m_xAssistant->set_title(_sTitle); } void ODbTypeWizDialog::enableConfirmSettings( bool _bEnable ) @@ -321,7 +319,7 @@ void ODbTypeWizDialog::enableConfirmSettings( bool _bEnable ) void ODbTypeWizDialog::saveDatasource() { - SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardDialog::GetPage(getCurrentState())); + SfxTabPage* pPage = static_cast<SfxTabPage*>(WizardMachine::GetPage(getCurrentState())); if ( pPage ) pPage->FillItemSet(m_pOutSet.get()); @@ -340,7 +338,7 @@ vcl::IWizardPageController* ODbTypeWizDialog::getPageController( TabPage* _pCurr bool ODbTypeWizDialog::onFinish() { saveDatasource(); - return m_pImpl->saveChanges(*m_pOutSet) && OWizardMachine::onFinish(); + return m_pImpl->saveChanges(*m_pOutSet) && WizardMachine::onFinish(); } } // namespace dbaui diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx index 5887004e2567..468efc995279 100644 --- a/dbaccess/source/ui/inc/dbwiz.hxx +++ b/dbaccess/source/ui/inc/dbwiz.hxx @@ -50,7 +50,7 @@ class OGeneralPage; class ODbDataSourceAdministrationHelper; /** tab dialog for administrating the office wide registered data sources */ -class ODbTypeWizDialog : public vcl::OWizardMachine , public IItemSetHelper, public IDatabaseSettingsDialog +class ODbTypeWizDialog : public vcl::WizardMachine , public IItemSetHelper, public IDatabaseSettingsDialog { private: std::unique_ptr<ODbDataSourceAdministrationHelper> m_pImpl; @@ -63,13 +63,12 @@ public: /** ctor. The itemset given should have been created by <method>createItemSet</method> and should be destroyed after the dialog has been destroyed */ - ODbTypeWizDialog(vcl::Window* pParent + ODbTypeWizDialog(weld::Window* pParent ,SfxItemSet const * _pItems ,const css::uno::Reference< css::uno::XComponentContext >& _rxORB ,const css::uno::Any& _aDataSourceName ); virtual ~ODbTypeWizDialog() override; - virtual void dispose() override; virtual const SfxItemSet* getOutputSet() const override; virtual SfxItemSet* getWriteOutputSet() override; diff --git a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx index ebe98cfbb873..683632a52cb0 100644 --- a/dbaccess/source/ui/uno/DBTypeWizDlg.cxx +++ b/dbaccess/source/ui/uno/DBTypeWizDlg.cxx @@ -22,7 +22,7 @@ #include "DBTypeWizDlg.hxx" #include <dbwiz.hxx> #include <comphelper/processfactory.hxx> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/svapp.hxx> using namespace dbaui; @@ -94,7 +94,7 @@ Reference<XPropertySetInfo> SAL_CALL ODBTypeWizDialog::getPropertySetInfo() svt::OGenericUnoDialog::Dialog ODBTypeWizDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) { - return svt::OGenericUnoDialog::Dialog(VclPtr<ODbTypeWizDialog>::Create(VCLUnoHelper::GetWindow(rParent), m_pDatasourceItems.get(), m_aContext, m_aInitialSelection)); + return svt::OGenericUnoDialog::Dialog(std::make_unique<ODbTypeWizDialog>(Application::GetFrameWeld(rParent), m_pDatasourceItems.get(), m_aContext, m_aInitialSelection)); } } // namespace dbaui |