diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-09-20 20:29:36 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-09-26 09:54:18 +0200 |
commit | a37e559ed123789f6bc8f7972242d6461ce692ab (patch) | |
tree | 7c6304b4541335b2bb706efda58b882132fe3819 /dbaccess | |
parent | b3f249c1351642be6f2774230ff80a6d20bd1401 (diff) |
disinherit OWizardPage and SfxTabPage from vcl TabPage
Now that there's no need to support weld/unwelded mixes of
pages in dialog any more.
inherit from a BuilderPage which contains a Builder and
Toplevel container
BuilderPage Activate and Deactivate replace TabPage ActivatePage and
DeactivatePage, allowing disambiguation wrt SfxTabPage ActivatePage and
DeactivatePage.
Change-Id: I5706e50fd92f712a25328ee9791e054bb9ad9812
Reviewed-on: https://gerrit.libreoffice.org/79317
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
38 files changed, 259 insertions, 357 deletions
diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index 7a6901ce2150..72fe9b8b0a01 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -42,10 +42,12 @@ #include "dsselect.hxx" #include <svl/filenotation.hxx> #include <stringconstants.hxx> +#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> +#include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/ui/dialogs/FolderPicker.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/lang/SystemDependent.hpp> #include <com/sun/star/sdbc/XRow.hpp> -#include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/mozilla/MozillaBootstrap.hpp> #include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/XProgressHandler.hpp> @@ -57,6 +59,7 @@ #include <connectivity/CommonTools.hxx> #include <tools/urlobj.hxx> #include <tools/diagnose_ex.h> +#include <rtl/process.h> #include <sfx2/docfilt.hxx> #if defined _WIN32 @@ -106,12 +109,7 @@ namespace dbaui OConnectionHelper::~OConnectionHelper() { - } - - void OConnectionHelper::dispose() - { m_xConnectionURL.reset(); - OGenericAdministrationPage::dispose(); } void OConnectionHelper::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) @@ -215,7 +213,7 @@ namespace dbaui ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, FileDialogFlags::NONE, aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::EFactory::CALC) - ,SfxFilterFlags::IMPORT, SfxFilterFlags::NONE, GetFrameWeld()); + ,SfxFilterFlags::IMPORT, SfxFilterFlags::NONE, GetDialogFrameWeld()); askForFileName(aFileDlg); } break; @@ -226,7 +224,7 @@ namespace dbaui ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, FileDialogFlags::NONE, aModule.GetFactoryEmptyDocumentURL(SvtModuleOptions::EFactory::WRITER), - SfxFilterFlags::IMPORT, SfxFilterFlags::NONE, GetFrameWeld()); + SfxFilterFlags::IMPORT, SfxFilterFlags::NONE, GetDialogFrameWeld()); askForFileName(aFileDlg); } break; @@ -236,7 +234,7 @@ namespace dbaui OUString sFilterName(DBA_RES (STR_MSACCESS_FILTERNAME)); ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, - FileDialogFlags::NONE, GetFrameWeld()); + FileDialogFlags::NONE, GetDialogFrameWeld()); aFileDlg.AddFilter(sFilterName,sExt); aFileDlg.SetCurrentFilter(sFilterName); askForFileName(aFileDlg); @@ -248,7 +246,7 @@ namespace dbaui OUString sFilterName2(DBA_RES (STR_MSACCESS_2007_FILTERNAME)); ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, - FileDialogFlags::NONE, GetFrameWeld()); + FileDialogFlags::NONE, GetDialogFrameWeld()); aFileDlg.AddFilter(sFilterName2,sAccdb); aFileDlg.SetCurrentFilter(sFilterName2); askForFileName(aFileDlg); @@ -275,7 +273,20 @@ namespace dbaui { OUString sOldDataSource=getURLNoPrefix(); OUString sNewDataSource; - HWND hWnd = GetParent()->GetSystemData()->hWnd; + HWND hWnd = 0; + + weld::Window* pDialog = GetDialogFrameWeld(); + css::uno::Reference<css::awt::XSystemDependentWindowPeer> xSysDepWin(pDialog->GetXWindow(), css::uno::UNO_QUERY); + if (xSysDepWin.is()) + { + css::uno::Sequence<sal_Int8> aProcessIdent(16); + rtl_getGlobalProcessId(reinterpret_cast<sal_uInt8*>(aProcessIdent.getArray())); + css::uno::Any aAny = xSysDepWin->getWindowHandle(aProcessIdent, css::lang::SystemDependent::SYSTEM_WIN32); + sal_Int64 tmp(0); + aAny >>= tmp; + hWnd = reinterpret_cast<HWND>(tmp); + } + sNewDataSource = getAdoDatalink(reinterpret_cast<LONG_PTR>(hWnd),sOldDataSource); if ( !sNewDataSource.isEmpty() ) { @@ -283,8 +294,6 @@ namespace dbaui SetRoadmapStateValue(true); callModifiedHdl(); } - else - return; } break; #endif @@ -311,7 +320,7 @@ namespace dbaui aProfiles.insert(pArray[index]); // execute the select dialog - ODatasourceSelectDialog aSelector(GetFrameWeld(), aProfiles); + ODatasourceSelectDialog aSelector(GetDialogFrameWeld(), aProfiles); OUString sOldProfile=getURLNoPrefix(); if (!sOldProfile.isEmpty()) @@ -329,7 +338,7 @@ namespace dbaui OUString sFilterName(DBA_RES (STR_FIREBIRD_FILTERNAME)); ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - FileDialogFlags::NONE, GetFrameWeld()); + FileDialogFlags::NONE, GetDialogFrameWeld()); aFileDlg.AddFilter(sFilterName,sExt); aFileDlg.SetCurrentFilter(sFilterName); askForFileName(aFileDlg); @@ -354,7 +363,7 @@ namespace dbaui OUString sFilterName(DBA_RES (STR_FIREBIRD_FILTERNAME)); ::sfx2::FileDialogHelper aFileDlg( ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, - FileDialogFlags::NONE, GetFrameWeld()); + FileDialogFlags::NONE, GetDialogFrameWeld()); aFileDlg.AddFilter(sFilterName,sExt); aFileDlg.SetCurrentFilter(sFilterName); askForFileName(aFileDlg); @@ -470,8 +479,7 @@ namespace dbaui sQuery = sQuery.replaceFirst("$path$", aTransformer.get(OFileNotation::N_SYSTEM)); m_bUserGrabFocus = false; - vcl::Window* pWin = GetParent(); - std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetDialogFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, sQuery)); xQueryBox->set_default_response(RET_YES); @@ -492,7 +500,7 @@ namespace dbaui m_bUserGrabFocus = false; - std::unique_ptr<weld::MessageDialog> xWhatToDo(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xWhatToDo(Application::CreateMessageDialog(GetDialogFrameWeld(), VclMessageType::Question, VclButtonsType::NONE, sQuery)); xWhatToDo->add_button(GetStandardText(StandardButtonType::Retry), RET_RETRY); @@ -680,7 +688,7 @@ namespace dbaui { OUString sFile = DBA_RES( STR_FILE_DOES_NOT_EXIST ); sFile = sFile.replaceFirst("$file$", aTransformer.get(OFileNotation::N_SYSTEM)); - OSQLWarningBox aWarning(GetFrameWeld(), sFile); + OSQLWarningBox aWarning(GetDialogFrameWeld(), sFile); aWarning.run(); setURLNoPrefix(sOldPath); SetRoadmapStateValue(false); diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.hxx b/dbaccess/source/ui/dlg/ConnectionHelper.hxx index 094d9336356d..9d38e1d67b4d 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.hxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.hxx @@ -42,7 +42,6 @@ namespace dbaui public: OConnectionHelper(TabPageParent pParent, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs); virtual ~OConnectionHelper() override; - virtual void dispose() override; OUString m_eType; // the type can't be changed in this class, so we hold it as member. // setting/retrieving the current connection URL diff --git a/dbaccess/source/ui/dlg/ConnectionPage.cxx b/dbaccess/source/ui/dlg/ConnectionPage.cxx index 0138f3d70db4..e9618fec8e05 100644 --- a/dbaccess/source/ui/dlg/ConnectionPage.cxx +++ b/dbaccess/source/ui/dlg/ConnectionPage.cxx @@ -76,9 +76,9 @@ namespace dbaui using namespace ::dbtools; using namespace ::svt; - VclPtr<SfxTabPage> OConnectionTabPage::Create(TabPageParent pParent, const SfxItemSet* _rAttrSet) + std::unique_ptr<SfxTabPage> OConnectionTabPage::Create(TabPageParent pParent, const SfxItemSet* _rAttrSet) { - return VclPtr<OConnectionTabPage>::Create(pParent, *_rAttrSet); + return std::make_unique<OConnectionTabPage>(pParent, *_rAttrSet); } // OConnectionTabPage @@ -105,7 +105,6 @@ namespace dbaui OConnectionTabPage::~OConnectionTabPage() { - disposeOnce(); } void OConnectionTabPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) @@ -285,7 +284,7 @@ namespace dbaui const char* pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error; - OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); + OSQLMessageBox aMsg(GetDialogFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); aMsg.run(); } bool OConnectionTabPage::checkTestConnection() diff --git a/dbaccess/source/ui/dlg/ConnectionPage.hxx b/dbaccess/source/ui/dlg/ConnectionPage.hxx index 2d09046d72b1..8ce5e1050ccf 100644 --- a/dbaccess/source/ui/dlg/ConnectionPage.hxx +++ b/dbaccess/source/ui/dlg/ConnectionPage.hxx @@ -34,7 +34,6 @@ namespace dbaui */ class OConnectionTabPage final : public OConnectionHelper { - friend class VclPtr<OConnectionTabPage>; private: // user authentication std::unique_ptr<weld::Label> m_xFL2; @@ -56,8 +55,9 @@ namespace dbaui DECL_LINK(OnEditModified, weld::Entry&, void); public: + OConnectionTabPage(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); + static std::unique_ptr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* _rAttrSet); virtual ~OConnectionTabPage() override; - static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* _rAttrSet ); virtual bool FillItemSet (SfxItemSet* _rCoreAttrs) override; virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; @@ -67,9 +67,6 @@ namespace dbaui affect the type may be changed (compared to the previous URL).</p> */ private: - OConnectionTabPage(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); - // nControlFlags is a combination of the CBTP_xxx-constants - /** enables the test connection button, if allowed */ virtual bool checkTestConnection() override; diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx index 5052ed5f59cd..141f81fce5f0 100644 --- a/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx +++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.cxx @@ -61,29 +61,29 @@ namespace dbaui using namespace ::dbtools; using namespace ::svt; - VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateDbaseTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) + std::unique_ptr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateDbaseTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) { - return VclPtr<OConnectionTabPageSetup>::Create ( pParent, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, STR_DBASE_HELPTEXT, STR_DBASE_HEADERTEXT, STR_DBASE_PATH_OR_FILE ); + return std::make_unique<OConnectionTabPageSetup>( pParent, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, STR_DBASE_HELPTEXT, STR_DBASE_HEADERTEXT, STR_DBASE_PATH_OR_FILE ); } - VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateMSAccessTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) + std::unique_ptr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateMSAccessTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) { - return VclPtr<OConnectionTabPageSetup>::Create( pParent, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, STR_MSACCESS_HELPTEXT, STR_MSACCESS_HEADERTEXT, STR_MSACCESS_MDB_FILE ); + return std::make_unique<OConnectionTabPageSetup>( pParent, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, STR_MSACCESS_HELPTEXT, STR_MSACCESS_HEADERTEXT, STR_MSACCESS_MDB_FILE ); } - VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateADOTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) + std::unique_ptr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateADOTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) { - return VclPtr<OConnectionTabPageSetup>::Create( pParent, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL ); + return std::make_unique<OConnectionTabPageSetup>( pParent, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, STR_ADO_HELPTEXT, STR_ADO_HEADERTEXT, STR_COMMONURL ); } - VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateODBCTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) + std::unique_ptr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateODBCTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) { - return VclPtr<OConnectionTabPageSetup>::Create( pParent, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, STR_ODBC_HELPTEXT, STR_ODBC_HEADERTEXT, STR_NAME_OF_ODBC_DATASOURCE ); + return std::make_unique<OConnectionTabPageSetup>( pParent, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, STR_ODBC_HELPTEXT, STR_ODBC_HEADERTEXT, STR_NAME_OF_ODBC_DATASOURCE ); } - VclPtr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateUserDefinedTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) + std::unique_ptr<OGenericAdministrationPage> OConnectionTabPageSetup::CreateUserDefinedTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) { - return VclPtr<OConnectionTabPageSetup>::Create(pParent, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, nullptr, nullptr, STR_COMMONURL); + return std::make_unique<OConnectionTabPageSetup>(pParent, "dbaccess/ui/dbwizconnectionpage.ui", "ConnectionPage", _rAttrSet, nullptr, nullptr, STR_COMMONURL); } OConnectionTabPageSetup::OConnectionTabPageSetup(TabPageParent pParent, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs, const char* pHelpTextResId, const char* pHeaderResId, const char* pUrlResId) @@ -118,7 +118,6 @@ namespace dbaui OConnectionTabPageSetup::~OConnectionTabPageSetup() { - disposeOnce(); } void OConnectionTabPageSetup::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) diff --git a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx index 5ab2d4776ff6..b456f722f8ea 100644 --- a/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx +++ b/dbaccess/source/ui/dlg/ConnectionPageSetup.hxx @@ -36,8 +36,6 @@ namespace dbaui */ class OConnectionTabPageSetup : public OConnectionHelper { - friend class VclPtr<OConnectionTabPageSetup>; - std::unique_ptr<weld::Label> m_xHelpText; std::unique_ptr<weld::Label> m_xHeaderText; @@ -45,12 +43,14 @@ namespace dbaui DECL_LINK(OnEditModified, weld::Entry&, void); public: + OConnectionTabPageSetup(TabPageParent pParent, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs, const char* pHelpTextResId, const char* pHeaderResId, const char* pUrlResId); virtual ~OConnectionTabPageSetup() override; - static VclPtr<OGenericAdministrationPage> CreateDbaseTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); - static VclPtr<OGenericAdministrationPage> CreateMSAccessTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); - static VclPtr<OGenericAdministrationPage> CreateADOTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); - static VclPtr<OGenericAdministrationPage> CreateODBCTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); - static VclPtr<OGenericAdministrationPage> CreateUserDefinedTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); + + static std::unique_ptr<OGenericAdministrationPage> CreateDbaseTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); + static std::unique_ptr<OGenericAdministrationPage> CreateMSAccessTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); + static std::unique_ptr<OGenericAdministrationPage> CreateADOTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); + static std::unique_ptr<OGenericAdministrationPage> CreateODBCTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); + static std::unique_ptr<OGenericAdministrationPage> CreateUserDefinedTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); virtual bool FillItemSet (SfxItemSet* _rCoreAttrs) override; @@ -58,9 +58,7 @@ namespace dbaui virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason _eReason ) override; protected: - OConnectionTabPageSetup(TabPageParent pParent, const OUString& _rUIXMLDescription, const OString& _rId, const SfxItemSet& _rCoreAttrs, const char* pHelpTextResId, const char* pHeaderResId, const char* pUrlResId); virtual bool checkTestConnection() override; - // nControlFlags is a combination of the CBTP_xxx-constants }; diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index 5db44f69bfb8..b6a0bf5c962c 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -60,9 +60,9 @@ namespace dbaui { using namespace ::com::sun::star; - VclPtr<OGenericAdministrationPage> OTextConnectionPageSetup::CreateTextTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) + std::unique_ptr<OGenericAdministrationPage> OTextConnectionPageSetup::CreateTextTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) { - return VclPtr<OTextConnectionPageSetup>::Create(pParent, _rAttrSet); + return std::make_unique<OTextConnectionPageSetup>(pParent, _rAttrSet); } // OTextConnectionPageSetup @@ -75,15 +75,9 @@ using namespace ::com::sun::star; m_xTextConnectionHelper->SetClickHandler(LINK( this, OTextConnectionPageSetup, ImplGetExtensionHdl ) ); } - void OTextConnectionPageSetup::dispose() - { - m_xTextConnectionHelper.reset(); - OConnectionTabPageSetup::dispose(); - } - OTextConnectionPageSetup::~OTextConnectionPageSetup() { - disposeOnce(); + m_xTextConnectionHelper.reset(); } IMPL_LINK_NOARG(OTextConnectionPageSetup, ImplGetExtensionHdl, OTextConnectionHelper*, void) @@ -132,9 +126,9 @@ using namespace ::com::sun::star; return m_xTextConnectionHelper->prepareLeave(); } - VclPtr<OGenericAdministrationPage> OLDAPConnectionPageSetup::CreateLDAPTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ) + std::unique_ptr<OGenericAdministrationPage> OLDAPConnectionPageSetup::CreateLDAPTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ) { - return VclPtr<OLDAPConnectionPageSetup>::Create( pParent, _rAttrSet ); + return std::make_unique<OLDAPConnectionPageSetup>(pParent, _rAttrSet); } // OLDAPPageSetup @@ -225,9 +219,9 @@ using namespace ::com::sun::star; OGenericAdministrationPage::callModifiedHdl(); } - VclPtr<OMySQLIntroPageSetup> OMySQLIntroPageSetup::CreateMySQLIntroTabPage(TabPageParent pParent, const SfxItemSet& rAttrSet) + std::unique_ptr<OMySQLIntroPageSetup> OMySQLIntroPageSetup::CreateMySQLIntroTabPage(TabPageParent pParent, const SfxItemSet& rAttrSet) { - return VclPtr<OMySQLIntroPageSetup>::Create(pParent, rAttrSet); + return std::make_unique<OMySQLIntroPageSetup>(pParent, rAttrSet); } OMySQLIntroPageSetup::OMySQLIntroPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs) @@ -305,18 +299,12 @@ using namespace ::com::sun::star; MySQLNativeSetupPage::~MySQLNativeSetupPage() { - disposeOnce(); - } - - void MySQLNativeSetupPage::dispose() - { m_xMySQLSettings.reset(); - OGenericAdministrationPage::dispose(); - } + } - VclPtr<OGenericAdministrationPage> MySQLNativeSetupPage::Create(TabPageParent pParent, const SfxItemSet& rAttrSet) + std::unique_ptr<OGenericAdministrationPage> MySQLNativeSetupPage::Create(TabPageParent pParent, const SfxItemSet& rAttrSet) { - return VclPtr<MySQLNativeSetupPage>::Create(pParent, rAttrSet); + return std::make_unique<MySQLNativeSetupPage>(pParent, rAttrSet); } void MySQLNativeSetupPage::fillControls( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList ) @@ -398,9 +386,9 @@ using namespace ::com::sun::star; { } - VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ) + std::unique_ptr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ) { - return VclPtr<OGeneralSpecialJDBCConnectionPageSetup>::Create( pParent, + return std::make_unique<OGeneralSpecialJDBCConnectionPageSetup>(pParent, _rAttrSet, DSID_MYSQL_PORTNUMBER , STR_MYSQL_DEFAULT, @@ -409,9 +397,9 @@ using namespace ::com::sun::star; STR_MYSQL_DRIVERCLASSTEXT); } - VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ) + std::unique_ptr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ) { - return VclPtr<OGeneralSpecialJDBCConnectionPageSetup>::Create( pParent, + return std::make_unique<OGeneralSpecialJDBCConnectionPageSetup>(pParent, _rAttrSet, DSID_ORACLE_PORTNUMBER, STR_ORACLE_DEFAULT, @@ -427,6 +415,7 @@ using namespace ::com::sun::star; _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETHostname.get())); _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::SpinButton>(m_xNFPortNumber.get())); } + void OGeneralSpecialJDBCConnectionPageSetup::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) { _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTHelpText.get())); @@ -508,7 +497,7 @@ using namespace ::com::sun::star; #endif const char *pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error; - OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); + OSQLMessageBox aMsg(GetDialogFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); aMsg.run(); } @@ -521,9 +510,9 @@ using namespace ::com::sun::star; OGenericAdministrationPage::callModifiedHdl(); } - VclPtr<OGenericAdministrationPage> OJDBCConnectionPageSetup::CreateJDBCTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) + std::unique_ptr<OGenericAdministrationPage> OJDBCConnectionPageSetup::CreateJDBCTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) { - return VclPtr<OJDBCConnectionPageSetup>::Create(pParent, _rAttrSet); + return std::make_unique<OJDBCConnectionPageSetup>(pParent, _rAttrSet); } // OMySQLJDBCConnectionPageSetup @@ -540,7 +529,6 @@ using namespace ::com::sun::star; OJDBCConnectionPageSetup::~OJDBCConnectionPageSetup() { - disposeOnce(); } void OJDBCConnectionPageSetup::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) @@ -621,7 +609,7 @@ using namespace ::com::sun::star; #endif const char* pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error; - OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); + OSQLMessageBox aMsg(GetDialogFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); aMsg.run(); } @@ -634,9 +622,9 @@ using namespace ::com::sun::star; callModifiedHdl(); } - VclPtr<OGenericAdministrationPage> OSpreadSheetConnectionPageSetup::CreateDocumentOrSpreadSheetTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) + std::unique_ptr<OGenericAdministrationPage> OSpreadSheetConnectionPageSetup::CreateDocumentOrSpreadSheetTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) { - return VclPtr<OSpreadSheetConnectionPageSetup>::Create( pParent, _rAttrSet ); + return std::make_unique<OSpreadSheetConnectionPageSetup>(pParent, _rAttrSet); } OSpreadSheetConnectionPageSetup::OSpreadSheetConnectionPageSetup(TabPageParent pParent, const SfxItemSet& rCoreAttrs) @@ -649,7 +637,6 @@ using namespace ::com::sun::star; OSpreadSheetConnectionPageSetup::~OSpreadSheetConnectionPageSetup() { - disposeOnce(); } void OSpreadSheetConnectionPageSetup::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& /*_rControlList*/) @@ -670,9 +657,9 @@ using namespace ::com::sun::star; return bChangedSomething; } - VclPtr<OGenericAdministrationPage> OAuthentificationPageSetup::CreateAuthentificationTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) + std::unique_ptr<OGenericAdministrationPage> OAuthentificationPageSetup::CreateAuthentificationTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) { - return VclPtr<OAuthentificationPageSetup>::Create( pParent, _rAttrSet); + return std::make_unique<OAuthentificationPageSetup>(pParent, _rAttrSet); } OAuthentificationPageSetup::OAuthentificationPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs) @@ -733,9 +720,9 @@ using namespace ::com::sun::star; return bChangedSomething; } - VclPtr<OGenericAdministrationPage> OFinalDBPageSetup::CreateFinalDBTabPageSetup(TabPageParent pParent, const SfxItemSet& _rAttrSet) + std::unique_ptr<OGenericAdministrationPage> OFinalDBPageSetup::CreateFinalDBTabPageSetup(TabPageParent pParent, const SfxItemSet& _rAttrSet) { - return VclPtr<OFinalDBPageSetup>::Create( pParent, _rAttrSet); + return std::make_unique<OFinalDBPageSetup>(pParent, _rAttrSet); } OFinalDBPageSetup::OFinalDBPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs) diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx index 4cee46b500af..23d20562ad66 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx @@ -40,7 +40,7 @@ namespace dbaui { public: virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; - static VclPtr<OGenericAdministrationPage> CreateDocumentOrSpreadSheetTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); + static std::unique_ptr<OGenericAdministrationPage> CreateDocumentOrSpreadSheetTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); OSpreadSheetConnectionPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); virtual ~OSpreadSheetConnectionPageSetup() override; @@ -56,9 +56,8 @@ namespace dbaui { public: virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; - static VclPtr<OGenericAdministrationPage> CreateTextTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet ); + static std::unique_ptr<OGenericAdministrationPage> CreateTextTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet ); OTextConnectionPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); - virtual void dispose() override; virtual ~OTextConnectionPageSetup() override; protected: virtual bool prepareLeave() override; @@ -77,7 +76,7 @@ namespace dbaui { public: virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; - static VclPtr<OGenericAdministrationPage> CreateLDAPTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ); + static std::unique_ptr<OGenericAdministrationPage> CreateLDAPTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ); OLDAPConnectionPageSetup( TabPageParent pParent, const SfxItemSet& _rCoreAttrs ); virtual ~OLDAPConnectionPageSetup() override; virtual void callModifiedHdl(weld::Widget* pControl = nullptr) override; @@ -109,10 +108,9 @@ namespace dbaui public: MySQLNativeSetupPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs); - virtual void dispose() override; virtual ~MySQLNativeSetupPage() override; - static VclPtr<OGenericAdministrationPage> Create(TabPageParent pParent, const SfxItemSet& rAttrSet); + static std::unique_ptr<OGenericAdministrationPage> Create(TabPageParent pParent, const SfxItemSet& rAttrSet); protected: virtual void fillControls( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList ) override; @@ -136,8 +134,8 @@ namespace dbaui , const char* pHeaderTextResId , const char* pDriverClassId ); virtual ~OGeneralSpecialJDBCConnectionPageSetup() override; - static VclPtr<OGenericAdministrationPage> CreateMySQLJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ); - static VclPtr<OGenericAdministrationPage> CreateOracleJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ); + static std::unique_ptr<OGenericAdministrationPage> CreateMySQLJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ); + static std::unique_ptr<OGenericAdministrationPage> CreateOracleJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ); private: virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override; @@ -172,7 +170,7 @@ namespace dbaui public: OJDBCConnectionPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); virtual ~OJDBCConnectionPageSetup() override; - static VclPtr<OGenericAdministrationPage> CreateJDBCTabPage(TabPageParent pParent, const SfxItemSet& rAttrSet); + static std::unique_ptr<OGenericAdministrationPage> CreateJDBCTabPage(TabPageParent pParent, const SfxItemSet& rAttrSet); private: virtual bool checkTestConnection() override; @@ -203,7 +201,7 @@ namespace dbaui OMySQLIntroPageSetup(TabPageParent pParent, const SfxItemSet& rCoreAttrs); virtual ~OMySQLIntroPageSetup() override; - static VclPtr<OMySQLIntroPageSetup> CreateMySQLIntroTabPage(TabPageParent pParent, const SfxItemSet& rAttrSet); + static std::unique_ptr<OMySQLIntroPageSetup> CreateMySQLIntroTabPage(TabPageParent pParent, const SfxItemSet& rAttrSet); ConnectionType getMySQLMode() const; void SetClickHdl( const Link<OMySQLIntroPageSetup *, void>& rLink ) { maClickHdl = rLink; } @@ -227,7 +225,7 @@ namespace dbaui { public: virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; - static VclPtr<OGenericAdministrationPage> CreateAuthentificationTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); + static std::unique_ptr<OGenericAdministrationPage> CreateAuthentificationTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); OAuthentificationPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); virtual ~OAuthentificationPageSetup() override; @@ -248,7 +246,7 @@ namespace dbaui { public: virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; - static VclPtr<OGenericAdministrationPage> CreateFinalDBTabPageSetup(TabPageParent pParent, const SfxItemSet& _rAttrSet); + static std::unique_ptr<OGenericAdministrationPage> CreateFinalDBTabPageSetup(TabPageParent pParent, const SfxItemSet& _rAttrSet); OFinalDBPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); virtual ~OFinalDBPageSetup() override; diff --git a/dbaccess/source/ui/dlg/DriverSettings.hxx b/dbaccess/source/ui/dlg/DriverSettings.hxx index 4fa30d49b3a4..dc1482b7184f 100644 --- a/dbaccess/source/ui/dlg/DriverSettings.hxx +++ b/dbaccess/source/ui/dlg/DriverSettings.hxx @@ -36,48 +36,48 @@ namespace dbaui /** Creates the detail page for ado */ - static VclPtr<SfxTabPage> CreateDbase( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateDbase( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); /** Creates the detail page for ado */ - static VclPtr<SfxTabPage> CreateAdo( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateAdo( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); /** Creates the detail page for ODBC */ - static VclPtr<SfxTabPage> CreateODBC( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateODBC( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); /** Creates the detail page for user */ - static VclPtr<SfxTabPage> CreateUser( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateUser( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); /** Creates the detail page for MySQLODBC */ - static VclPtr<SfxTabPage> CreateMySQLODBC( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateMySQLODBC( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); /** Creates the detail page for MySQLJDBC */ - static VclPtr<SfxTabPage> CreateMySQLJDBC( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateMySQLJDBC( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); /** Creates the detail page for MySQLNATIVE */ - static VclPtr<SfxTabPage> CreateMySQLNATIVE( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateMySQLNATIVE( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); /** Creates the detail page for Oracle JDBC */ - static VclPtr<SfxTabPage> CreateOracleJDBC( TabPageParent pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateOracleJDBC( TabPageParent pParent, const SfxItemSet* _rAttrSet ); /** Creates the detail page for LDAP */ - static VclPtr<SfxTabPage> CreateLDAP( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateLDAP( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); /// Creates the detail page for Text - static VclPtr<SfxTabPage> CreateText( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateText( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); /// creates the GeneratedValues page - static VclPtr<SfxTabPage> CreateGeneratedValuesPage( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateGeneratedValuesPage( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); /// creates the "Special Settings" page of the "Advanced Settings" dialog - static VclPtr<SfxTabPage> CreateSpecialSettingsPage( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); + static std::unique_ptr<SfxTabPage> CreateSpecialSettingsPage( TabPageParent _pParent, const SfxItemSet* _rAttrSet ); }; } diff --git a/dbaccess/source/ui/dlg/TablesSingleDlg.cxx b/dbaccess/source/ui/dlg/TablesSingleDlg.cxx index c6fcbc7c81d4..ab8a20fa0385 100644 --- a/dbaccess/source/ui/dlg/TablesSingleDlg.cxx +++ b/dbaccess/source/ui/dlg/TablesSingleDlg.cxx @@ -49,9 +49,9 @@ OTableSubscriptionDialog::OTableSubscriptionDialog(weld::Window* pParent SetInputSet(m_pOutSet.get()); TabPageParent pPageParent(get_content_area(), this); - auto pTabPage = VclPtrInstance<OTableSubscriptionPage>(pPageParent, *m_pOutSet, this); - pTabPage->SetServiceFactory(_rxORB); - SetTabPage(pTabPage); + auto xTabPage = std::make_unique<OTableSubscriptionPage>(pPageParent, *m_pOutSet, this); + xTabPage->SetServiceFactory(_rxORB); + SetTabPage(std::move(xTabPage)); } OTableSubscriptionDialog::~OTableSubscriptionDialog() diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx index b0f31d07771f..4d65851e0664 100644 --- a/dbaccess/source/ui/dlg/UserAdmin.cxx +++ b/dbaccess/source/ui/dlg/UserAdmin.cxx @@ -128,16 +128,10 @@ OUserAdmin::OUserAdmin(TabPageParent pParent,const SfxItemSet& _rAttrSet) OUserAdmin::~OUserAdmin() { - disposeOnce(); -} - -void OUserAdmin::dispose() -{ m_xConnection = nullptr; m_xTableCtrl.disposeAndClear(); m_xTableCtrlParent->dispose(); m_xTableCtrlParent.clear(); - OGenericAdministrationPage::dispose(); } void OUserAdmin::FillUserNames() @@ -186,9 +180,9 @@ void OUserAdmin::FillUserNames() m_xTableCtrl->Enable(m_xUsers.is()); } -VclPtr<SfxTabPage> OUserAdmin::Create( TabPageParent pParent, const SfxItemSet* _rAttrSet ) +std::unique_ptr<SfxTabPage> OUserAdmin::Create( TabPageParent pParent, const SfxItemSet* _rAttrSet ) { - return VclPtr<OUserAdmin>::Create( pParent, *_rAttrSet ); + return std::make_unique<OUserAdmin>( pParent, *_rAttrSet ); } IMPL_LINK(OUserAdmin, UserHdl, weld::Button&, rButton, void) @@ -312,7 +306,7 @@ void OUserAdmin::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) } catch(const SQLException& e) { - ::dbtools::showError(::dbtools::SQLExceptionInfo(e), VCLUnoHelper::GetInterface(this), m_xORB); + ::dbtools::showError(::dbtools::SQLExceptionInfo(e), GetDialogController()->getDialog()->GetXWindow(), m_xORB); } OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue); diff --git a/dbaccess/source/ui/dlg/UserAdmin.hxx b/dbaccess/source/ui/dlg/UserAdmin.hxx index bfcf77ea8af4..50561a95f256 100644 --- a/dbaccess/source/ui/dlg/UserAdmin.hxx +++ b/dbaccess/source/ui/dlg/UserAdmin.hxx @@ -37,7 +37,6 @@ namespace dbaui class OUserAdmin final : public OGenericAdministrationPage { - friend class VclPtr<OUserAdmin>; std::unique_ptr<weld::ComboBox> m_xUSER; std::unique_ptr<weld::Button> m_xNEWUSER; std::unique_ptr<weld::Button> m_xCHANGEPWD; @@ -58,12 +57,11 @@ class OUserAdmin final : public OGenericAdministrationPage void FillUserNames(); - OUserAdmin(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); public: - static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* _rAttrSet); - + OUserAdmin(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); + static std::unique_ptr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rAttrSet); virtual ~OUserAdmin() override; - virtual void dispose() override; + OUString GetUser() const; // subclasses must override this, but it isn't pure virtual diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx index 1133a0961e5c..6678824e28db 100644 --- a/dbaccess/source/ui/dlg/adminpages.cxx +++ b/dbaccess/source/ui/dlg/adminpages.cxx @@ -62,8 +62,8 @@ namespace dbaui { SetExchangeSupport(); - Size aSize(LogicToPixel(::Size(WIZARD_PAGE_X, WIZARD_PAGE_Y), MapMode(MapUnit::MapAppFont))); - m_xContainer->set_size_request(aSize.Width(), aSize.Height()); + m_xContainer->set_size_request(m_xContainer->get_approximate_digit_width() * WIZARD_PAGE_X, + m_xContainer->get_text_height() * WIZARD_PAGE_Y); } DeactivateRC OGenericAdministrationPage::DeactivatePage(SfxItemSet* _pSet) @@ -82,13 +82,15 @@ namespace dbaui { implInitControls(*_rCoreAttrs, false); } - void OGenericAdministrationPage::ActivatePage() + + void OGenericAdministrationPage::Activate() { - TabPage::ActivatePage(); + BuilderPage::Activate(); OSL_ENSURE(m_pItemSetHelper,"NO ItemSetHelper set!"); if ( m_pItemSetHelper ) ActivatePage(*m_pItemSetHelper->getOutputSet()); } + void OGenericAdministrationPage::ActivatePage(const SfxItemSet& _rSet) { implInitControls(_rSet, true); @@ -132,7 +134,7 @@ namespace dbaui // show an error message OUString sError(DBA_RES(STR_COULD_NOT_LOAD_ODBC_LIB)); sError = sError.replaceFirst("#lib#", aEnumeration.getLibraryName()); - std::unique_ptr<weld::MessageDialog> xDialog(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xDialog(Application::CreateMessageDialog(GetDialogFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok, sError)); xDialog->run(); @@ -142,7 +144,7 @@ namespace dbaui { aEnumeration.getDatasourceNames(aOdbcDatasources); // execute the select dialog - ODatasourceSelectDialog aSelector(GetFrameWeld(), aOdbcDatasources); + ODatasourceSelectDialog aSelector(GetDialogFrameWeld(), aOdbcDatasources); if (!_sCurr.isEmpty()) aSelector.Select(_sCurr); if (RET_OK == aSelector.run()) @@ -270,7 +272,7 @@ namespace dbaui eImage = MessageType::Error; aMessage = DBA_RES(STR_CONNECTION_NO_SUCCESS); } - OSQLMessageBox aMsg(GetFrameWeld(), sTitle, aMessage, MessBoxStyle::Ok, eImage); + OSQLMessageBox aMsg(GetDialogFrameWeld(), sTitle, aMessage, MessBoxStyle::Ok, eImage); aMsg.run(); } if ( !bSuccess ) diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx index 7266901af8f8..bc473b627ece 100644 --- a/dbaccess/source/ui/dlg/adminpages.hxx +++ b/dbaccess/source/ui/dlg/adminpages.hxx @@ -149,14 +149,13 @@ namespace dbaui protected: /// default implementation: call FillItemSet, call prepareLeave, virtual DeactivateRC DeactivatePage(SfxItemSet* pSet) override; - using SfxTabPage::DeactivatePage; /// default implementation: call implInitControls with the given item set and _bSaveValue = sal_False virtual void Reset(const SfxItemSet* _rCoreAttrs) override; /// default implementation: call implInitControls with the given item set and _bSaveValue = sal_True virtual void ActivatePage(const SfxItemSet& _rSet) override; - // TabPage overridables - virtual void ActivatePage() override; + // BuilderPage overridables + virtual void Activate() override; protected: virtual void callModifiedHdl(weld::Widget* /*pControl*/ = nullptr) { m_aModifiedHandler.Call(this); } diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx index ccbc88c96371..02661a2871c0 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.cxx +++ b/dbaccess/source/ui/dlg/advancedsettings.cxx @@ -151,7 +151,6 @@ namespace dbaui SpecialSettingsPage::~SpecialSettingsPage() { - disposeOnce(); } void SpecialSettingsPage::fillWindows( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList ) @@ -307,7 +306,6 @@ namespace dbaui GeneratedValuesPage::~GeneratedValuesPage() { - disposeOnce(); } void GeneratedValuesPage::fillWindows( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList ) diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx index 2c6314606135..002c5cda4ac1 100644 --- a/dbaccess/source/ui/dlg/advancedsettings.hxx +++ b/dbaccess/source/ui/dlg/advancedsettings.hxx @@ -73,10 +73,9 @@ namespace dbaui virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; SpecialSettingsPage(TabPageParent pParent, const SfxItemSet& _rCoreAttrs, const DataSourceMetaData& _rDSMeta); - - private: virtual ~SpecialSettingsPage() override; + private: // OGenericAdministrationPage overridables virtual void implInitControls (const SfxItemSet& _rSet, bool _bSaveValue ) override; @@ -103,12 +102,11 @@ namespace dbaui virtual bool FillItemSet (SfxItemSet* _rCoreAttrs) override; GeneratedValuesPage(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); + virtual ~GeneratedValuesPage() override; + private: DECL_LINK(OnAutoToggleHdl, weld::ToggleButton&, void); - // nControlFlags is a combination of the CBTP_xxx-constants - virtual ~GeneratedValuesPage() override; - // subclasses must override this, but it isn't pure virtual virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; diff --git a/dbaccess/source/ui/dlg/dbwiz.cxx b/dbaccess/source/ui/dlg/dbwiz.cxx index af03675abd71..76e933a40651 100644 --- a/dbaccess/source/ui/dlg/dbwiz.cxx +++ b/dbaccess/source/ui/dlg/dbwiz.cxx @@ -219,10 +219,10 @@ void ODbTypeWizDialog::clearPassword() m_pImpl->clearPassword(); } -VclPtr<TabPage> ODbTypeWizDialog::createPage(WizardState _nState) +std::unique_ptr<BuilderPage> ODbTypeWizDialog::createPage(WizardState _nState) { const char* pStringId = STR_PAGETITLE_ADVANCED; - VclPtr<TabPage> pPage; + std::unique_ptr<BuilderPage> xPage; OString sIdent(OString::number(_nState)); weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); @@ -233,46 +233,46 @@ VclPtr<TabPage> ODbTypeWizDialog::createPage(WizardState _nState) { case START_PAGE: // start state { - pPage = VclPtr<OGeneralPageDialog>::Create(aParent, *m_pOutSet); - OGeneralPage* pGeneralPage = static_cast< OGeneralPage* >( pPage.get() ); + xPage = std::make_unique<OGeneralPageDialog>(aParent, *m_pOutSet); + OGeneralPage* pGeneralPage = static_cast<OGeneralPage*>(xPage.get()); pGeneralPage->SetTypeSelectHandler( LINK( this, ODbTypeWizDialog, OnTypeSelected)); pStringId = STR_PAGETITLE_GENERAL; } break; case CONNECTION_PAGE: - pPage = OConnectionTabPage::Create(aParent, m_pOutSet.get()); + xPage = OConnectionTabPage::Create(aParent, m_pOutSet.get()); pStringId = STR_PAGETITLE_CONNECTION; break; case ADDITIONAL_PAGE_DBASE: - pPage = ODriversSettings::CreateDbase(aParent, m_pOutSet.get()); + xPage = ODriversSettings::CreateDbase(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_FLAT: - pPage = ODriversSettings::CreateText(aParent, m_pOutSet.get()); + xPage = ODriversSettings::CreateText(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_LDAP: - pPage = ODriversSettings::CreateLDAP(aParent, m_pOutSet.get()); + xPage = ODriversSettings::CreateLDAP(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_MYSQL_JDBC: - pPage = ODriversSettings::CreateMySQLJDBC(aParent, m_pOutSet.get()); + xPage = ODriversSettings::CreateMySQLJDBC(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_MYSQL_NATIVE: - pPage = ODriversSettings::CreateMySQLNATIVE(aParent, m_pOutSet.get()); + xPage = ODriversSettings::CreateMySQLNATIVE(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_MYSQL_ODBC: - pPage = ODriversSettings::CreateMySQLODBC(aParent, m_pOutSet.get()); + xPage = ODriversSettings::CreateMySQLODBC(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_ORACLE_JDBC: - pPage = ODriversSettings::CreateOracleJDBC(aParent, m_pOutSet.get()); + xPage = ODriversSettings::CreateOracleJDBC(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_ADO: - pPage = ODriversSettings::CreateAdo(aParent, m_pOutSet.get()); + xPage = ODriversSettings::CreateAdo(aParent, m_pOutSet.get()); break; case ADDITIONAL_PAGE_ODBC: - pPage = ODriversSettings::CreateODBC(aParent, m_pOutSet.get()); + xPage = ODriversSettings::CreateODBC(aParent, m_pOutSet.get()); break; case ADDITIONAL_USERDEFINED: - pPage = ODriversSettings::CreateUser(aParent, m_pOutSet.get()); + xPage = ODriversSettings::CreateUser(aParent, m_pOutSet.get()); break; default: OSL_FAIL("Wrong state!"); @@ -280,17 +280,15 @@ VclPtr<TabPage> ODbTypeWizDialog::createPage(WizardState _nState) } // register ourself as modified listener - if ( pPage ) + if ( xPage ) { - static_cast<OGenericAdministrationPage*>(pPage.get())->SetServiceFactory( m_pImpl->getORB() ); - static_cast<OGenericAdministrationPage*>(pPage.get())->SetAdminDialog(this,this); + static_cast<OGenericAdministrationPage*>(xPage.get())->SetServiceFactory( m_pImpl->getORB() ); + static_cast<OGenericAdministrationPage*>(xPage.get())->SetAdminDialog(this,this); 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; + return xPage; } bool ODbTypeWizDialog::leaveState(WizardState _nState) @@ -329,9 +327,9 @@ void ODbTypeWizDialog::saveDatasource() DataSourceInfoConverter::convert( getORB(), m_pCollection,sOldURL,m_eType,m_pImpl->getCurrentDataSource()); } -vcl::IWizardPageController* ODbTypeWizDialog::getPageController( TabPage* _pCurrentPage ) const +vcl::IWizardPageController* ODbTypeWizDialog::getPageController(BuilderPage* pCurrentPage) const { - OGenericAdministrationPage* pPage = static_cast<OGenericAdministrationPage*>(_pCurrentPage); + OGenericAdministrationPage* pPage = static_cast<OGenericAdministrationPage*>(pCurrentPage); return pPage; } diff --git a/dbaccess/source/ui/dlg/dbwizsetup.cxx b/dbaccess/source/ui/dlg/dbwizsetup.cxx index e37edfa475fe..6431801d82a7 100644 --- a/dbaccess/source/ui/dlg/dbwizsetup.cxx +++ b/dbaccess/source/ui/dlg/dbwizsetup.cxx @@ -423,7 +423,7 @@ Reference< XDriver > ODbTypeWizDialogSetup::getDriver() OUString ODbTypeWizDialogSetup::getDatasourceType(const SfxItemSet& _rSet) const { OUString sRet = dbaui::ODbDataSourceAdministrationHelper::getDatasourceType(_rSet); - if (m_pMySQLIntroPage != nullptr && m_pMySQLIntroPage->IsVisible() ) + if (m_pMySQLIntroPage && m_pMySQLIntroPage->IsVisible()) { switch( m_pMySQLIntroPage->getMySQLMode() ) { @@ -446,10 +446,9 @@ void ODbTypeWizDialogSetup::clearPassword() m_pImpl->clearPassword(); } -VclPtr<TabPage> ODbTypeWizDialogSetup::createPage(WizardState _nState) +std::unique_ptr<BuilderPage> ODbTypeWizDialogSetup::createPage(WizardState _nState) { - VclPtr<SfxTabPage> pFirstPage; - VclPtr<OGenericAdministrationPage> pPage; + std::unique_ptr<OGenericAdministrationPage> xPage; OString sIdent(OString::number(_nState)); weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); @@ -459,9 +458,8 @@ VclPtr<TabPage> ODbTypeWizDialogSetup::createPage(WizardState _nState) switch(_nState) { case PAGE_DBSETUPWIZARD_INTRO: - pFirstPage = VclPtr<OGeneralPageWizard>::Create(aParent,*m_pOutSet); - pPage = static_cast<OGenericAdministrationPage*> (pFirstPage.get()); - m_pGeneralPage = static_cast<OGeneralPageWizard*>(pFirstPage.get()); + xPage = std::make_unique<OGeneralPageWizard>(aParent,*m_pOutSet); + m_pGeneralPage = static_cast<OGeneralPageWizard*>(xPage.get()); m_pGeneralPage->SetTypeSelectHandler(LINK(this, ODbTypeWizDialogSetup, OnTypeSelected)); m_pGeneralPage->SetCreationModeHandler(LINK( this, ODbTypeWizDialogSetup, OnChangeCreationMode ) ); m_pGeneralPage->SetDocumentSelectionHandler(LINK( this, ODbTypeWizDialogSetup, OnRecentDocumentSelected ) ); @@ -469,83 +467,83 @@ VclPtr<TabPage> ODbTypeWizDialogSetup::createPage(WizardState _nState) break; case PAGE_DBSETUPWIZARD_DBASE: - pPage = OConnectionTabPageSetup::CreateDbaseTabPage(aParent, *m_pOutSet); + xPage = OConnectionTabPageSetup::CreateDbaseTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_ADO: - pPage = OConnectionTabPageSetup::CreateADOTabPage(aParent, *m_pOutSet); + xPage = OConnectionTabPageSetup::CreateADOTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_TEXT: - pPage = OTextConnectionPageSetup::CreateTextTabPage(aParent, *m_pOutSet); + xPage = OTextConnectionPageSetup::CreateTextTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_ODBC: - pPage = OConnectionTabPageSetup::CreateODBCTabPage(aParent, *m_pOutSet); + xPage = OConnectionTabPageSetup::CreateODBCTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_JDBC: - pPage = OJDBCConnectionPageSetup::CreateJDBCTabPage(aParent, *m_pOutSet); + xPage = OJDBCConnectionPageSetup::CreateJDBCTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_MYSQL_ODBC: m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix("sdbc:mysql:odbc:"))); - pPage = OConnectionTabPageSetup::CreateODBCTabPage(aParent, *m_pOutSet); + xPage = OConnectionTabPageSetup::CreateODBCTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_MYSQL_JDBC: m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix("sdbc:mysql:jdbc:"))); - pPage = OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage(aParent, *m_pOutSet); + xPage = OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_MYSQL_NATIVE: m_pOutSet->Put(SfxStringItem(DSID_CONNECTURL, m_pCollection->getPrefix("sdbc:mysql:mysqlc:"))); - pPage = MySQLNativeSetupPage::Create(aParent, *m_pOutSet); + xPage = MySQLNativeSetupPage::Create(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_ORACLE: - pPage = OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage(aParent, *m_pOutSet); + xPage = OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_LDAP: - pPage = OLDAPConnectionPageSetup::CreateLDAPTabPage(aParent, *m_pOutSet); + xPage = OLDAPConnectionPageSetup::CreateLDAPTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_DOCUMENT_OR_SPREADSHEET: - pPage = OSpreadSheetConnectionPageSetup::CreateDocumentOrSpreadSheetTabPage(aParent, *m_pOutSet); + xPage = OSpreadSheetConnectionPageSetup::CreateDocumentOrSpreadSheetTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_MSACCESS: - pPage = OConnectionTabPageSetup::CreateMSAccessTabPage(aParent, *m_pOutSet); + xPage = OConnectionTabPageSetup::CreateMSAccessTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_MYSQL_INTRO: - m_pMySQLIntroPage = OMySQLIntroPageSetup::CreateMySQLIntroTabPage(aParent, *m_pOutSet); + xPage = OMySQLIntroPageSetup::CreateMySQLIntroTabPage(aParent, *m_pOutSet); + m_pMySQLIntroPage = static_cast<OMySQLIntroPageSetup*>(xPage.get()); m_pMySQLIntroPage->SetClickHdl(LINK( this, ODbTypeWizDialogSetup, ImplClickHdl ) ); - pPage = m_pMySQLIntroPage; break; case PAGE_DBSETUPWIZARD_AUTHENTIFICATION: - pPage = OAuthentificationPageSetup::CreateAuthentificationTabPage(aParent, *m_pOutSet); + xPage = OAuthentificationPageSetup::CreateAuthentificationTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_USERDEFINED: - pPage = OConnectionTabPageSetup::CreateUserDefinedTabPage(aParent, *m_pOutSet); + xPage = OConnectionTabPageSetup::CreateUserDefinedTabPage(aParent, *m_pOutSet); break; case PAGE_DBSETUPWIZARD_FINAL: - pPage = OFinalDBPageSetup::CreateFinalDBTabPageSetup(aParent, *m_pOutSet); - m_pFinalPage = static_cast<OFinalDBPageSetup*> (pPage.get()); + xPage = OFinalDBPageSetup::CreateFinalDBTabPageSetup(aParent, *m_pOutSet); + m_pFinalPage = static_cast<OFinalDBPageSetup*>(xPage.get()); break; } - if ( pPage ) + if ( xPage ) { if ((_nState != PAGE_DBSETUPWIZARD_INTRO) && (_nState != PAGE_DBSETUPWIZARD_AUTHENTIFICATION)) { - pPage->SetModifiedHandler(LINK( this, ODbTypeWizDialogSetup, ImplModifiedHdl ) ); + xPage->SetModifiedHandler(LINK( this, ODbTypeWizDialogSetup, ImplModifiedHdl ) ); } - pPage->SetServiceFactory( m_pImpl->getORB() ); - pPage->SetAdminDialog(this, this); + xPage->SetServiceFactory( m_pImpl->getORB() ); + xPage->SetAdminDialog(this, this); defaultButton( _nState == PAGE_DBSETUPWIZARD_FINAL ? WizardButtonFlags::FINISH : WizardButtonFlags::NEXT ); enableButtons( WizardButtonFlags::FINISH, _nState == PAGE_DBSETUPWIZARD_FINAL ); @@ -553,7 +551,7 @@ VclPtr<TabPage> ODbTypeWizDialogSetup::createPage(WizardState _nState) m_xAssistant->set_page_title(sIdent, getStateDisplayName(_nState)); } - return pPage; + return xPage; } IMPL_LINK(ODbTypeWizDialogSetup, ImplModifiedHdl, OGenericAdministrationPage const *, _pConnectionPageSetup, void) @@ -847,9 +845,9 @@ bool ODbTypeWizDialogSetup::SaveDatabaseDocument() return aExistenceCheck.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset ); } - vcl::IWizardPageController* ODbTypeWizDialogSetup::getPageController( TabPage* _pCurrentPage ) const + vcl::IWizardPageController* ODbTypeWizDialogSetup::getPageController(BuilderPage* pCurrentPage) const { - OGenericAdministrationPage* pPage = static_cast<OGenericAdministrationPage*>(_pCurrentPage); + OGenericAdministrationPage* pPage = static_cast<OGenericAdministrationPage*>(pCurrentPage); return pPage; } diff --git a/dbaccess/source/ui/dlg/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx index 4f23ef8737fb..21ad0a6e312d 100644 --- a/dbaccess/source/ui/dlg/detailpages.cxx +++ b/dbaccess/source/ui/dlg/detailpages.cxx @@ -88,13 +88,7 @@ namespace dbaui OCommonBehaviourTabPage::~OCommonBehaviourTabPage() { - disposeOnce(); - } - - void OCommonBehaviourTabPage::dispose() - { m_xCharset.reset(); - OGenericAdministrationPage::dispose(); } void OCommonBehaviourTabPage::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) @@ -178,12 +172,11 @@ namespace dbaui ODbaseDetailsPage::~ODbaseDetailsPage() { - disposeOnce(); } - VclPtr<SfxTabPage> ODriversSettings::CreateDbase(TabPageParent pParent, const SfxItemSet* _rAttrSet) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateDbase(TabPageParent pParent, const SfxItemSet* _rAttrSet) { - return VclPtr<ODbaseDetailsPage>::Create(pParent, *_rAttrSet); + return std::make_unique<ODbaseDetailsPage>(pParent, *_rAttrSet); } void ODbaseDetailsPage::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) @@ -242,9 +235,9 @@ namespace dbaui } - VclPtr<SfxTabPage> ODriversSettings::CreateAdo(TabPageParent pParent, const SfxItemSet* rAttrSet) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateAdo(TabPageParent pParent, const SfxItemSet* rAttrSet) { - return VclPtr<OAdoDetailsPage>::Create(pParent, *rAttrSet); + return std::make_unique<OAdoDetailsPage>(pParent, *rAttrSet); } // OOdbcDetailsPage @@ -258,12 +251,11 @@ namespace dbaui OOdbcDetailsPage::~OOdbcDetailsPage() { - disposeOnce(); } - VclPtr<SfxTabPage> ODriversSettings::CreateODBC(TabPageParent pParent, const SfxItemSet* pAttrSet) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateODBC(TabPageParent pParent, const SfxItemSet* pAttrSet) { - return VclPtr<OOdbcDetailsPage>::Create(pParent, *pAttrSet); + return std::make_unique<OOdbcDetailsPage>(pParent, *pAttrSet); } bool OOdbcDetailsPage::FillItemSet( SfxItemSet* _rSet ) @@ -300,12 +292,11 @@ namespace dbaui OUserDriverDetailsPage::~OUserDriverDetailsPage() { - disposeOnce(); } - VclPtr<SfxTabPage> ODriversSettings::CreateUser(TabPageParent pParent, const SfxItemSet* pAttrSet) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateUser(TabPageParent pParent, const SfxItemSet* pAttrSet) { - return VclPtr<OUserDriverDetailsPage>::Create(pParent, *pAttrSet); + return std::make_unique<OUserDriverDetailsPage>(pParent, *pAttrSet); } bool OUserDriverDetailsPage::FillItemSet( SfxItemSet* _rSet ) @@ -361,9 +352,9 @@ namespace dbaui { } - VclPtr<SfxTabPage> ODriversSettings::CreateMySQLODBC(TabPageParent pParent, const SfxItemSet* pAttrSet) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateMySQLODBC(TabPageParent pParent, const SfxItemSet* pAttrSet) { - return VclPtr<OMySQLODBCDetailsPage>::Create(pParent, *pAttrSet); + return std::make_unique<OMySQLODBCDetailsPage>(pParent, *pAttrSet); } // OMySQLJDBCDetailsPage @@ -410,7 +401,6 @@ namespace dbaui OGeneralSpecialJDBCDetailsPage::~OGeneralSpecialJDBCDetailsPage() { - disposeOnce(); } bool OGeneralSpecialJDBCDetailsPage::FillItemSet( SfxItemSet* _rSet ) @@ -485,7 +475,7 @@ namespace dbaui #endif const char* pMessage = bSuccess ? STR_JDBCDRIVER_SUCCESS : STR_JDBCDRIVER_NO_SUCCESS; const MessageType mt = bSuccess ? MessageType::Info : MessageType::Error; - OSQLMessageBox aMsg(GetFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); + OSQLMessageBox aMsg(GetDialogFrameWeld(), DBA_RES(pMessage), OUString(), MessBoxStyle::Ok | MessBoxStyle::DefaultOk, mt); aMsg.run(); } @@ -512,15 +502,9 @@ namespace dbaui m_xUserName->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl)); } - void MySQLNativePage::dispose() - { - m_xMySQLSettings.reset(); - OCommonBehaviourTabPage::dispose(); - } - MySQLNativePage::~MySQLNativePage() { - disposeOnce(); + m_xMySQLSettings.reset(); } void MySQLNativePage::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) @@ -579,19 +563,19 @@ namespace dbaui OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue); } - VclPtr<SfxTabPage> ODriversSettings::CreateMySQLJDBC( TabPageParent pParent, const SfxItemSet* _rAttrSet ) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateMySQLJDBC( TabPageParent pParent, const SfxItemSet* _rAttrSet ) { - return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create(pParent, *_rAttrSet,DSID_MYSQL_PORTNUMBER); + return std::make_unique<OGeneralSpecialJDBCDetailsPage>(pParent, *_rAttrSet,DSID_MYSQL_PORTNUMBER); } - VclPtr<SfxTabPage> ODriversSettings::CreateMySQLNATIVE(TabPageParent pParent, const SfxItemSet* pAttrSet) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateMySQLNATIVE(TabPageParent pParent, const SfxItemSet* pAttrSet) { - return VclPtr<MySQLNativePage>::Create(pParent, *pAttrSet); + return std::make_unique<MySQLNativePage>(pParent, *pAttrSet); } - VclPtr<SfxTabPage> ODriversSettings::CreateOracleJDBC(TabPageParent pParent, const SfxItemSet* _rAttrSet) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateOracleJDBC(TabPageParent pParent, const SfxItemSet* _rAttrSet) { - return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create(pParent, *_rAttrSet,DSID_ORACLE_PORTNUMBER, false); + return std::make_unique<OGeneralSpecialJDBCDetailsPage>(pParent, *_rAttrSet,DSID_ORACLE_PORTNUMBER, false); } // OLDAPDetailsPage @@ -614,12 +598,11 @@ namespace dbaui OLDAPDetailsPage::~OLDAPDetailsPage() { - disposeOnce(); } - VclPtr<SfxTabPage> ODriversSettings::CreateLDAP(TabPageParent pParent, const SfxItemSet* _rAttrSet) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateLDAP(TabPageParent pParent, const SfxItemSet* _rAttrSet) { - return VclPtr<OLDAPDetailsPage>::Create(pParent, *_rAttrSet); + return std::make_unique<OLDAPDetailsPage>(pParent, *_rAttrSet); } bool OLDAPDetailsPage::FillItemSet( SfxItemSet* _rSet ) @@ -680,18 +663,12 @@ namespace dbaui OTextDetailsPage::~OTextDetailsPage() { - disposeOnce(); - } - - void OTextDetailsPage::dispose() - { m_xTextConnectionHelper.reset(); - OCommonBehaviourTabPage::dispose(); } - VclPtr<SfxTabPage> ODriversSettings::CreateText(TabPageParent pParent, const SfxItemSet* pAttrSet) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateText(TabPageParent pParent, const SfxItemSet* pAttrSet) { - return VclPtr<OTextDetailsPage>::Create(pParent, *pAttrSet); + return std::make_unique<OTextDetailsPage>(pParent, *pAttrSet); } void OTextDetailsPage::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) @@ -728,16 +705,16 @@ namespace dbaui return m_xTextConnectionHelper->prepareLeave(); } - VclPtr<SfxTabPage> ODriversSettings::CreateGeneratedValuesPage(TabPageParent pParent, const SfxItemSet* _rAttrSet) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateGeneratedValuesPage(TabPageParent pParent, const SfxItemSet* _rAttrSet) { - return VclPtr<GeneratedValuesPage>::Create(pParent, *_rAttrSet); + return std::make_unique<GeneratedValuesPage>(pParent, *_rAttrSet); } - VclPtr<SfxTabPage> ODriversSettings::CreateSpecialSettingsPage(TabPageParent pParent, const SfxItemSet* _rAttrSet) + std::unique_ptr<SfxTabPage> ODriversSettings::CreateSpecialSettingsPage(TabPageParent pParent, const SfxItemSet* _rAttrSet) { OUString eType = ODbDataSourceAdministrationHelper::getDatasourceType( *_rAttrSet ); DataSourceMetaData aMetaData( eType ); - return VclPtr<SpecialSettingsPage>::Create(pParent, *_rAttrSet, aMetaData); + return std::make_unique<SpecialSettingsPage>(pParent, *_rAttrSet, aMetaData); } } // namespace dbaui diff --git a/dbaccess/source/ui/dlg/detailpages.hxx b/dbaccess/source/ui/dlg/detailpages.hxx index da0f28fbb942..bc0086d65648 100644 --- a/dbaccess/source/ui/dlg/detailpages.hxx +++ b/dbaccess/source/ui/dlg/detailpages.hxx @@ -69,7 +69,6 @@ namespace dbaui protected: virtual ~OCommonBehaviourTabPage() override; - virtual void dispose() override; // subclasses must override this, but it isn't pure virtual virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; @@ -190,7 +189,6 @@ namespace dbaui { public: MySQLNativePage(TabPageParent pParent, const SfxItemSet& rCoreAttrs); - virtual void dispose() override; virtual ~MySQLNativePage() override; private: @@ -238,10 +236,9 @@ namespace dbaui virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; OTextDetailsPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs); + virtual ~OTextDetailsPage() override; protected: - virtual ~OTextDetailsPage() override; - virtual void dispose() override; virtual bool prepareLeave() override; virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index c703a2fdba8d..8c65d9720f41 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -515,7 +515,7 @@ namespace dbaui bool bValid, bReadonly; getFlags( _rSet, bValid, bReadonly ); - SetText( OUString() ); + SetPageTitle(OUString()); if ( !bValid || bReadonly ) { diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx index 339eb9103ea2..ec1d912ac7cf 100644 --- a/dbaccess/source/ui/dlg/tablespage.cxx +++ b/dbaccess/source/ui/dlg/tablespage.cxx @@ -88,18 +88,12 @@ namespace dbaui OTableSubscriptionPage::~OTableSubscriptionPage() { - disposeOnce(); - } - - void OTableSubscriptionPage::dispose() - { // just to make sure that our connection will be removed try { ::comphelper::disposeComponent(m_xCurrentConnection); } catch (RuntimeException&) { } - OGenericAdministrationPage::dispose(); } void OTableSubscriptionPage::implCheckTables(const Sequence< OUString >& _rTables) diff --git a/dbaccess/source/ui/dlg/tablespage.hxx b/dbaccess/source/ui/dlg/tablespage.hxx index 6103e4915915..24ef1c05f9e5 100644 --- a/dbaccess/source/ui/dlg/tablespage.hxx +++ b/dbaccess/source/ui/dlg/tablespage.hxx @@ -48,11 +48,9 @@ namespace dbaui public: virtual bool FillItemSet(SfxItemSet* _rCoreAttrs) override; virtual DeactivateRC DeactivatePage(SfxItemSet* _pSet) override; - using OGenericAdministrationPage::DeactivatePage; OTableSubscriptionPage(TabPageParent pParent, const SfxItemSet& _rCoreAttrs ,OTableSubscriptionDialog* _pTablesDlg); virtual ~OTableSubscriptionPage() override; - virtual void dispose() override; private: virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override; diff --git a/dbaccess/source/ui/inc/WCPage.hxx b/dbaccess/source/ui/inc/WCPage.hxx index 61b1f78a779e..4bfeb5909a13 100644 --- a/dbaccess/source/ui/inc/WCPage.hxx +++ b/dbaccess/source/ui/inc/WCPage.hxx @@ -55,7 +55,7 @@ namespace dbaui public: virtual void Reset() override; - virtual void ActivatePage() override; + virtual void Activate() override; virtual bool LeavePage() override; virtual OUString GetTitle() const override ; diff --git a/dbaccess/source/ui/inc/WColumnSelect.hxx b/dbaccess/source/ui/inc/WColumnSelect.hxx index 816b13bc1d1e..23024c46b021 100644 --- a/dbaccess/source/ui/inc/WColumnSelect.hxx +++ b/dbaccess/source/ui/inc/WColumnSelect.hxx @@ -74,13 +74,12 @@ namespace dbaui public: virtual void Reset ( ) override; - virtual void ActivatePage() override; + virtual void Activate() override; virtual bool LeavePage() override; virtual OUString GetTitle() const override ; OWizColumnSelect(OCopyTableWizard* pWizard, TabPageParent pParent); virtual ~OWizColumnSelect() override; - virtual void dispose() override; }; } #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WCOLUMNSELECT_HXX diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx index 53fb201a4b0b..e12c00b159cb 100644 --- a/dbaccess/source/ui/inc/WCopyTable.hxx +++ b/dbaccess/source/ui/inc/WCopyTable.hxx @@ -286,7 +286,7 @@ namespace dbaui // checks if the type is supported in the destination database bool supportsType(sal_Int32 _nDataType,sal_Int32& _rNewDataType); - virtual VclPtr<TabPage> createPage(vcl::WizardTypes::WizardState /*nState*/) override + virtual std::unique_ptr<BuilderPage> createPage(vcl::WizardTypes::WizardState /*nState*/) override { assert(false); return nullptr; @@ -331,7 +331,7 @@ namespace dbaui weld::Button& GetOKButton() { return *m_xFinish; } Wizard_Button_Style GetPressedButton() const { return m_ePressed; } void EnableNextButton(bool bEnable); - void AddWizardPage(OWizardPage* pPage); // delete page from OCopyTableWizard + void AddWizardPage(std::unique_ptr<OWizardPage> xPage); // delete page from OCopyTableWizard void CheckButtons(); // checks which button can be disabled, enabled // returns a vector where the position of a column and if the column is in the selection diff --git a/dbaccess/source/ui/inc/WExtendPages.hxx b/dbaccess/source/ui/inc/WExtendPages.hxx index 90ba9ede00a8..b9cc15b6fda1 100644 --- a/dbaccess/source/ui/inc/WExtendPages.hxx +++ b/dbaccess/source/ui/inc/WExtendPages.hxx @@ -37,7 +37,7 @@ namespace dbaui { } - static VclPtr<OWizTypeSelect> Create(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream& rInput ) { return VclPtr<OWizHTMLExtend>::Create(pWizard, pParent, rInput); } + static std::unique_ptr<OWizTypeSelect> Create(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream& rInput ) { return std::make_unique<OWizHTMLExtend>(pWizard, pParent, rInput); } }; // Wizard Page: OWizRTFExtend class OWizRTFExtend : public OWizTypeSelect @@ -50,7 +50,7 @@ namespace dbaui { } - static VclPtr<OWizTypeSelect> Create(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream& rInput) { return VclPtr<OWizRTFExtend>::Create(pWizard, pParent, rInput); } + static std::unique_ptr<OWizTypeSelect> Create(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream& rInput) { return std::make_unique<OWizRTFExtend>(pWizard, pParent, rInput); } }; // Wizard Page: OWizNormalExtend diff --git a/dbaccess/source/ui/inc/WNameMatch.hxx b/dbaccess/source/ui/inc/WNameMatch.hxx index 05cc948f7713..5bf0df89dbea 100644 --- a/dbaccess/source/ui/inc/WNameMatch.hxx +++ b/dbaccess/source/ui/inc/WNameMatch.hxx @@ -55,7 +55,7 @@ namespace dbaui public: virtual void Reset ( ) override; - virtual void ActivatePage() override; + virtual void Activate() override; virtual bool LeavePage() override; virtual OUString GetTitle() const override ; diff --git a/dbaccess/source/ui/inc/WTabPage.hxx b/dbaccess/source/ui/inc/WTabPage.hxx index fe2df1d3069d..9f8abfa011c8 100644 --- a/dbaccess/source/ui/inc/WTabPage.hxx +++ b/dbaccess/source/ui/inc/WTabPage.hxx @@ -20,18 +20,15 @@ #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_WTABPAGE_HXX #define INCLUDED_DBACCESS_SOURCE_UI_INC_WTABPAGE_HXX -#include <vcl/tabpage.hxx> +#include <vcl/wizardmachine.hxx> namespace dbaui { // Wizard Page class OCopyTableWizard; - class OWizardPage : public TabPage + class OWizardPage : public ::vcl::OWizardPage { protected: - std::unique_ptr<weld::Builder> m_xBuilder; - std::unique_ptr<weld::Container> m_xContainer; - OCopyTableWizard* m_pParent; bool m_bFirstTime; // Page is called the first time; should be set in the reset method diff --git a/dbaccess/source/ui/inc/WTypeSelect.hxx b/dbaccess/source/ui/inc/WTypeSelect.hxx index e0cfabb3fb53..aafdd9e94f9b 100644 --- a/dbaccess/source/ui/inc/WTypeSelect.hxx +++ b/dbaccess/source/ui/inc/WTypeSelect.hxx @@ -37,7 +37,7 @@ namespace dbaui // OWizTypeSelectControl class OWizTypeSelectControl final : public OFieldDescControl { - VclPtr<OWizTypeSelect> m_xParentTabPage; + OWizTypeSelect* m_pParentTabPage; virtual void ActivateAggregate( EControlType eType ) override; virtual void DeactivateAggregate( EControlType eType ) override; @@ -52,7 +52,6 @@ namespace dbaui public: OWizTypeSelectControl(TabPageParent pParent, OWizTypeSelect* pParentTabPage); - virtual void dispose() override; virtual ~OWizTypeSelectControl() override; virtual css::uno::Reference< css::sdbc::XDatabaseMetaData> getMetaData() override; @@ -72,14 +71,14 @@ namespace dbaui DECL_LINK(CommandHdl, const CommandEvent&, bool); - VclPtr<OWizTypeSelect> m_xParentTabPage; + OWizTypeSelect* m_pParentTabPage; Link<weld::TreeView&, void> m_aChangeHdl; public: OWizTypeSelectList(std::unique_ptr<weld::TreeView> xControl); void SetPKey(bool bPKey) { m_bPKey = bPKey; } - void SetParentTabPage(OWizTypeSelect* pParentTabPage) { m_xParentTabPage = pParentTabPage; } + void SetParentTabPage(OWizTypeSelect* pParentTabPage) { m_pParentTabPage = pParentTabPage; } weld::TreeView* GetWidget() { return m_xControl.get(); } OUString get_selected_id() const { return m_xControl->get_selected_id(); } void show() { m_xControl->show(); } @@ -133,19 +132,18 @@ namespace dbaui void EnableAuto(bool bEnable); public: virtual void Reset ( ) override; - virtual void ActivatePage( ) override; + virtual void Activate( ) override; virtual bool LeavePage() override; virtual OUString GetTitle() const override; OWizTypeSelect(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream* pStream = nullptr); - virtual void dispose() override; virtual ~OWizTypeSelect() override; void setDisplayRow(sal_Int32 _nRow) { m_nDisplayRow = _nRow - 1; } void setDuplicateName(bool _bDuplicateName) { m_bDuplicateName = _bDuplicateName; } }; - typedef VclPtr<OWizTypeSelect> (*TypeSelectionPageFactory)(OCopyTableWizard*, TabPageParent, SvStream&); + typedef std::unique_ptr<OWizTypeSelect> (*TypeSelectionPageFactory)(OCopyTableWizard*, TabPageParent, SvStream&); } #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_WTYPESELECT_HXX diff --git a/dbaccess/source/ui/inc/dbu_dlg.hxx b/dbaccess/source/ui/inc/dbu_dlg.hxx index f6d36879efdf..02e7034b251c 100644 --- a/dbaccess/source/ui/inc/dbu_dlg.hxx +++ b/dbaccess/source/ui/inc/dbu_dlg.hxx @@ -19,13 +19,8 @@ #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DBU_DLG_HRC #define INCLUDED_DBACCESS_SOURCE_UI_INC_DBU_DLG_HRC -#define PAGE_X 281 -#define PAGE_Y 215 -#define WIZARD_PAGE_X 225 -#define WIZARD_PAGE_Y 240 - -//constants for the wizards -#define INDENT_BELOW_RADIO 10 +#define WIZARD_PAGE_X 56 +#define WIZARD_PAGE_Y 30 #endif diff --git a/dbaccess/source/ui/inc/dbwiz.hxx b/dbaccess/source/ui/inc/dbwiz.hxx index 8773477cd03f..6c17e3319bfc 100644 --- a/dbaccess/source/ui/inc/dbwiz.hxx +++ b/dbaccess/source/ui/inc/dbwiz.hxx @@ -88,11 +88,10 @@ public: protected: /// to override to create new pages - virtual VclPtr<TabPage> createPage(WizardState _nState) override; + virtual std::unique_ptr<BuilderPage> createPage(WizardState _nState) override; virtual WizardState determineNextState(WizardState _nCurrentState) const override; virtual bool leaveState(WizardState _nState) override; - virtual ::vcl::IWizardPageController* - getPageController( TabPage* _pCurrentPage ) const override; + virtual ::vcl::IWizardPageController* getPageController(BuilderPage* pCurrentPage) const override; virtual bool onFinish() override; private: diff --git a/dbaccess/source/ui/inc/dbwizsetup.hxx b/dbaccess/source/ui/inc/dbwizsetup.hxx index 4747397fbf24..ce23ef6f80cb 100644 --- a/dbaccess/source/ui/inc/dbwizsetup.hxx +++ b/dbaccess/source/ui/inc/dbwizsetup.hxx @@ -82,9 +82,9 @@ private: OUString m_sRM_FinalText; INetURLObject m_aDocURL; OUString m_sWorkPath; - VclPtr<OGeneralPageWizard> m_pGeneralPage; - VclPtr<OMySQLIntroPageSetup> m_pMySQLIntroPage; - VclPtr<OFinalDBPageSetup> m_pFinalPage; + OGeneralPageWizard* m_pGeneralPage; + OMySQLIntroPageSetup* m_pMySQLIntroPage; + OFinalDBPageSetup* m_pFinalPage; ::dbaccess::ODsnTypeCollection* m_pCollection; /// the DSN type collection instance @@ -124,10 +124,10 @@ public: private: /// to override to create new pages - virtual VclPtr<TabPage> createPage(WizardState _nState) override; + virtual std::unique_ptr<BuilderPage> createPage(WizardState _nState) override; virtual bool leaveState(WizardState _nState) override; virtual void enterState(WizardState _nState) override; - virtual ::vcl::IWizardPageController* getPageController( TabPage* _pCurrentPage ) const override; + virtual ::vcl::IWizardPageController* getPageController(BuilderPage* pCurrentPage) const override; virtual bool onFinish() override; void resetPages(const css::uno::Reference< css::beans::XPropertySet >& _rxDatasource); diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx index ae07cb947fb8..fe3b15b869a6 100644 --- a/dbaccess/source/ui/misc/WCPage.cxx +++ b/dbaccess/source/ui/misc/WCPage.cxx @@ -91,7 +91,7 @@ OCopyTable::OCopyTable(OCopyTableWizard* pWizard, TabPageParent pParent) m_xEdKeyName->set_max_length(nMaxLen ? nMaxLen : EDIT_NOLIMIT); } - SetText(DBA_RES(STR_COPYTABLE_TITLE_COPY)); + SetPageTitle(DBA_RES(STR_COPYTABLE_TITLE_COPY)); } OCopyTable::~OCopyTable() @@ -216,7 +216,7 @@ bool OCopyTable::LeavePage() return true; } -void OCopyTable::ActivatePage() +void OCopyTable::Activate() { m_pParent->GetOKButton().set_sensitive(true); m_nOldOperation = m_pParent->getOperation(); diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx index 89fd3a86bc41..5939edaacbed 100644 --- a/dbaccess/source/ui/misc/WColumnSelect.cxx +++ b/dbaccess/source/ui/misc/WColumnSelect.cxx @@ -44,10 +44,7 @@ namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOper OUString OWizColumnSelect::GetTitle() const { return DBA_RES(STR_WIZ_COLUMN_SELECT_TITEL); } OWizardPage::OWizardPage(OCopyTableWizard* pWizard, TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID) - : TabPage(pParent.pPage ? Application::GetDefDialogParent() : pParent.pParent.get()) //just drag this along hidden in this scenario - , m_xBuilder(pParent.pPage ? Application::CreateBuilder(pParent.pPage, rUIXMLDescription) - : Application::CreateInterimBuilder(this, rUIXMLDescription)) - , m_xContainer(m_xBuilder->weld_container(rID)) + : ::vcl::OWizardPage(pParent, rUIXMLDescription, rID) , m_pParent(pWizard) , m_bFirstTime(true) { @@ -81,17 +78,11 @@ OWizColumnSelect::OWizColumnSelect(OCopyTableWizard* pWizard, TabPageParent pPar OWizColumnSelect::~OWizColumnSelect() { - disposeOnce(); -} - -void OWizColumnSelect::dispose() -{ while (m_xNewColumnNames->n_children()) { delete reinterpret_cast<OFieldDescription*>(m_xNewColumnNames->get_id(0).toInt64()); m_xNewColumnNames->remove(0); } - OWizardPage::dispose(); } void OWizColumnSelect::Reset() @@ -116,7 +107,7 @@ void OWizColumnSelect::Reset() m_bFirstTime = false; } -void OWizColumnSelect::ActivatePage( ) +void OWizColumnSelect::Activate( ) { // if there are no dest columns reset the left side with the original columns if(m_pParent->getDestColumns().empty()) diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index fe217d367b8c..e4c26e74e0a8 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -566,16 +566,16 @@ OCopyTableWizard::OCopyTableWizard(weld::Window* pParent, const OUString& _rDefa m_sName = ::dbtools::composeTableName(m_xDestConnection->getMetaData(),sCatalog,sSchema,sTable,false,::dbtools::EComposeRule::InTableDefinitions); } - VclPtrInstance<OCopyTable> pPage1(this, CreatePageContainer()); - pPage1->disallowUseHeaderLine(); + std::unique_ptr<OCopyTable> xPage1(new OCopyTable(this, CreatePageContainer())); + xPage1->disallowUseHeaderLine(); if ( !bAllowViews ) - pPage1->disallowViews(); - pPage1->setCreateStyleAction(); - AddWizardPage(pPage1); + xPage1->disallowViews(); + xPage1->setCreateStyleAction(); + AddWizardPage(std::move(xPage1)); - AddWizardPage( VclPtr<OWizNameMatching>::Create(this, CreatePageContainer() ) ); - AddWizardPage( VclPtr<OWizColumnSelect>::Create(this, CreatePageContainer() ) ); - AddWizardPage( VclPtr<OWizNormalExtend>::Create(this, CreatePageContainer() ) ); + AddWizardPage( std::make_unique<OWizNameMatching>(this, CreatePageContainer() ) ); + AddWizardPage( std::make_unique<OWizColumnSelect>(this, CreatePageContainer() ) ); + AddWizardPage( std::make_unique<OWizNormalExtend>(this, CreatePageContainer() ) ); ActivatePage(); m_xAssistant->set_current_page(0); @@ -620,13 +620,13 @@ OCopyTableWizard::OCopyTableWizard( weld::Window* pParent, const OUString& _rDef m_xInteractionHandler = InteractionHandler::createWithParent(m_xContext, nullptr); - VclPtrInstance<OCopyTable> pPage1( this, CreatePageContainer() ); - pPage1->disallowViews(); - pPage1->setCreateStyleAction(); - AddWizardPage( pPage1 ); + std::unique_ptr<OCopyTable> xPage1(new OCopyTable(this, CreatePageContainer())); + xPage1->disallowViews(); + xPage1->setCreateStyleAction(); + AddWizardPage(std::move(xPage1)); - AddWizardPage( VclPtr<OWizNameMatching>::Create( this, CreatePageContainer() ) ); - AddWizardPage( VclPtr<OWizColumnSelect>::Create( this, CreatePageContainer() ) ); + AddWizardPage( std::make_unique<OWizNameMatching>( this, CreatePageContainer() ) ); + AddWizardPage( std::make_unique<OWizColumnSelect>( this, CreatePageContainer() ) ); AddWizardPage( (*_pTypeSelectionPageFactory)( this, CreatePageContainer(), _rTypeSelectionPageArg ) ); ActivatePage(); @@ -951,9 +951,9 @@ bool OCopyTableWizard::DeactivatePage() return pPage && pPage->LeavePage(); } -void OCopyTableWizard::AddWizardPage(OWizardPage* pPage) +void OCopyTableWizard::AddWizardPage(std::unique_ptr<OWizardPage> xPage) { - AddPage(pPage); + AddPage(std::move(xPage)); ++m_nPageCount; } diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx index 258394be15c0..47539c27ae6b 100644 --- a/dbaccess/source/ui/misc/WNameMatch.cxx +++ b/dbaccess/source/ui/misc/WNameMatch.cxx @@ -78,7 +78,7 @@ void OWizNameMatching::Reset() m_bFirstTime = false; } -void OWizNameMatching::ActivatePage( ) +void OWizNameMatching::Activate( ) { // set source table name OUString aName = m_sSourceText + m_pParent->m_sSourceName; diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx index 06fcf50d0a46..a9bf1af33e40 100644 --- a/dbaccess/source/ui/misc/WTypeSelect.cxx +++ b/dbaccess/source/ui/misc/WTypeSelect.cxx @@ -46,19 +46,12 @@ using namespace ::com::sun::star::sdbc; // OWizTypeSelectControl OWizTypeSelectControl::OWizTypeSelectControl(TabPageParent pParent, OWizTypeSelect* pParentTabPage) : OFieldDescControl(pParent, nullptr) - , m_xParentTabPage(pParentTabPage) + , m_pParentTabPage(pParentTabPage) { } OWizTypeSelectControl::~OWizTypeSelectControl() { - disposeOnce(); -} - -void OWizTypeSelectControl::dispose() -{ - m_xParentTabPage.clear(); - OFieldDescControl::dispose(); } void OWizTypeSelectControl::ActivateAggregate( EControlType eType ) @@ -93,7 +86,7 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId ) { OSL_ENSURE(nRow == -1,"nRow must be -1!"); - weld::TreeView* pListBox = m_xParentTabPage->m_xColumnNames->GetWidget(); + weld::TreeView* pListBox = m_pParentTabPage->m_xColumnNames->GetWidget(); OFieldDescription* pCurFieldDescr = getCurrentFieldDescData(); @@ -114,7 +107,7 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId ) { case FIELD_PROPERTY_COLUMNNAME: { - OCopyTableWizard* pWiz = m_xParentTabPage->m_pParent; + OCopyTableWizard* pWiz = m_pParentTabPage->m_pParent; // first we have to check if this name already exists bool bDoubleName = false; bool bCase = true; @@ -143,13 +136,13 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId ) pWiz->showError(strMessage); pCurFieldDescr->SetName(sName); DisplayData(pCurFieldDescr); - m_xParentTabPage->setDuplicateName(true); + m_pParentTabPage->setDuplicateName(true); return; } OUString sOldName = pCurFieldDescr->GetName(); pCurFieldDescr->SetName(sNewName); - m_xParentTabPage->setDuplicateName(false); + m_pParentTabPage->setDuplicateName(false); // now we change the name @@ -176,42 +169,42 @@ void OWizTypeSelectControl::CellModified(long nRow, sal_uInt16 nColId ) css::lang::Locale OWizTypeSelectControl::GetLocale() const { - return m_xParentTabPage->m_pParent->GetLocale(); + return m_pParentTabPage->m_pParent->GetLocale(); } Reference< XNumberFormatter > OWizTypeSelectControl::GetFormatter() const { - return m_xParentTabPage->m_pParent->GetFormatter(); + return m_pParentTabPage->m_pParent->GetFormatter(); } TOTypeInfoSP OWizTypeSelectControl::getTypeInfo(sal_Int32 _nPos) { - return m_xParentTabPage->m_pParent->getDestTypeInfo(_nPos); + return m_pParentTabPage->m_pParent->getDestTypeInfo(_nPos); } const OTypeInfoMap* OWizTypeSelectControl::getTypeInfo() const { - return &m_xParentTabPage->m_pParent->getDestTypeInfo(); + return &m_pParentTabPage->m_pParent->getDestTypeInfo(); } css::uno::Reference< css::sdbc::XDatabaseMetaData> OWizTypeSelectControl::getMetaData() { - return m_xParentTabPage->m_pParent->m_xDestConnection->getMetaData(); + return m_pParentTabPage->m_pParent->m_xDestConnection->getMetaData(); } css::uno::Reference< css::sdbc::XConnection> OWizTypeSelectControl::getConnection() { - return m_xParentTabPage->m_pParent->m_xDestConnection; + return m_pParentTabPage->m_pParent->m_xDestConnection; } bool OWizTypeSelectControl::isAutoIncrementValueEnabled() const { - return m_xParentTabPage->m_bAutoIncrementEnabled; + return m_pParentTabPage->m_bAutoIncrementEnabled; } OUString OWizTypeSelectControl::getAutoIncrementValue() const { - return m_xParentTabPage->m_sAutoIncrementValue; + return m_pParentTabPage->m_sAutoIncrementValue; } OWizTypeSelect::OWizTypeSelect(OCopyTableWizard* pWizard, TabPageParent pParent, SvStream* pStream) @@ -254,13 +247,7 @@ OWizTypeSelect::OWizTypeSelect(OCopyTableWizard* pWizard, TabPageParent pParent, OWizTypeSelect::~OWizTypeSelect() { - disposeOnce(); -} - -void OWizTypeSelect::dispose() -{ m_xTypeControl.disposeAndClear(); - OWizardPage::dispose(); } OUString OWizTypeSelect::GetTitle() const @@ -296,7 +283,7 @@ void OWizTypeSelect::Reset() m_bFirstTime = false; } -void OWizTypeSelect::ActivatePage( ) +void OWizTypeSelect::Activate( ) { bool bOldFirstTime = m_bFirstTime; Reset(); @@ -342,13 +329,13 @@ IMPL_LINK_NOARG(OWizTypeSelect, ButtonClickHdl, weld::Button&, void) m_pParserStream->Seek(nTell); } - ActivatePage(); + Activate(); } OWizTypeSelectList::OWizTypeSelectList(std::unique_ptr<weld::TreeView> xControl) : m_xControl(std::move(xControl)) , m_bPKey(false) - , m_xParentTabPage(nullptr) + , m_pParentTabPage(nullptr) { m_xControl->connect_popup_menu(LINK(this, OWizTypeSelectList, CommandHdl)); } |