diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-24 12:45:08 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-24 17:46:09 +0200 |
commit | 74d4f1b43bc6c9b5ea2a8197e51cbcb2c376de6b (patch) | |
tree | 7893d81c71a4b5f8f965461506774d36ee2279c9 /dbaccess/source | |
parent | 510c64cd540694f4b7e0896a56b3d0d3fbdacd0a (diff) |
weld TextConnectionSettingsDialog
Change-Id: Iaa08d066d9c2198bca7e21f619fb89808620fba9
Reviewed-on: https://gerrit.libreoffice.org/62295
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source')
5 files changed, 29 insertions, 38 deletions
diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 405273b80c46..8903a32ebe90 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -444,7 +444,7 @@ namespace dbaui } } - DBOTextConnectionHelper::DBOTextConnectionHelper(weld::Container* pParent, const short _nAvailableSections) + DBOTextConnectionHelper::DBOTextConnectionHelper(weld::Widget* pParent, const short _nAvailableSections) : m_aFieldSeparatorList (DBA_RES(STR_AUTOFIELDSEPARATORLIST)) , m_aTextSeparatorList (STR_AUTOTEXTSEPARATORLIST) , m_aTextNone (DBA_RES(STR_AUTOTEXT_FIELD_SEP_NONE)) diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx index 0da671112f51..db71db300c0c 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx @@ -95,7 +95,7 @@ namespace dbaui class DBOTextConnectionHelper final { public: - DBOTextConnectionHelper(weld::Container* pParent , const short _nAvailableSections); + DBOTextConnectionHelper(weld::Widget* pParent , const short _nAvailableSections); private: OUString m_aFieldSeparatorList; diff --git a/dbaccess/source/ui/dlg/textconnectionsettings.cxx b/dbaccess/source/ui/dlg/textconnectionsettings.cxx index 6e87f811da5a..dcf578c6e40d 100644 --- a/dbaccess/source/ui/dlg/textconnectionsettings.cxx +++ b/dbaccess/source/ui/dlg/textconnectionsettings.cxx @@ -26,26 +26,18 @@ namespace dbaui { // TextConnectionSettingsDialog - TextConnectionSettingsDialog::TextConnectionSettingsDialog( vcl::Window* _pParent, SfxItemSet& _rItems ) - :ModalDialog( _pParent, "TextConnectionSettingsDialog", "dbaccess/ui/textconnectionsettings.ui" ) - ,m_rItems( _rItems ) + TextConnectionSettingsDialog::TextConnectionSettingsDialog(weld::Window* pParent, SfxItemSet& rItems) + : GenericDialogController(pParent, "dbaccess/ui/textconnectionsettings.ui", "TextConnectionSettingsDialog") + , m_rItems(rItems) + , m_xContainer(m_xBuilder->weld_widget("TextPageContainer")) + , m_xOK(m_xBuilder->weld_button("ok")) + , m_xTextConnectionHelper(new DBOTextConnectionHelper(m_xContainer.get(), TC_HEADER | TC_SEPARATORS | TC_CHARSET)) { - get(m_pOK, "ok"); - m_pTextConnectionHelper.reset( VclPtr<OTextConnectionHelper>::Create( get<VclVBox>("TextPageContainer"), TC_HEADER | TC_SEPARATORS | TC_CHARSET ) ); - - m_pOK->SetClickHdl( LINK( this, TextConnectionSettingsDialog, OnOK ) ); + m_xOK->connect_clicked(LINK(this, TextConnectionSettingsDialog, OnOK)); } TextConnectionSettingsDialog::~TextConnectionSettingsDialog() { - disposeOnce(); - } - - void TextConnectionSettingsDialog::dispose() - { - m_pOK.clear(); - m_pTextConnectionHelper.disposeAndClear(); - ModalDialog::dispose(); } void TextConnectionSettingsDialog::bindItemStorages( SfxItemSet& _rSet, PropertyValues& _rValues ) @@ -58,18 +50,18 @@ namespace dbaui _rValues[ PROPERTY_ID_ENCODING ].reset( new SetItemPropertyStorage( _rSet, DSID_CHARSET ) ); } - short TextConnectionSettingsDialog::Execute() + short TextConnectionSettingsDialog::run() { - m_pTextConnectionHelper->implInitControls( m_rItems, true ); - return ModalDialog::Execute(); + m_xTextConnectionHelper->implInitControls(m_rItems, true); + return GenericDialogController::run(); } - IMPL_LINK_NOARG( TextConnectionSettingsDialog, OnOK, Button*, void ) + IMPL_LINK_NOARG(TextConnectionSettingsDialog, OnOK, weld::Button&, void) { - if ( m_pTextConnectionHelper->prepareLeave() ) + if (m_xTextConnectionHelper->prepareLeave()) { - m_pTextConnectionHelper->FillItemSet( m_rItems, false/*bUnused*/ ); - EndDialog( RET_OK ); + m_xTextConnectionHelper->FillItemSet( m_rItems, false/*bUnused*/ ); + m_xDialog->response(RET_OK); } } diff --git a/dbaccess/source/ui/inc/textconnectionsettings.hxx b/dbaccess/source/ui/inc/textconnectionsettings.hxx index 3bccf4a36a62..713371ad40e1 100644 --- a/dbaccess/source/ui/inc/textconnectionsettings.hxx +++ b/dbaccess/source/ui/inc/textconnectionsettings.hxx @@ -21,40 +21,38 @@ #define INCLUDED_DBACCESS_SOURCE_UI_INC_TEXTCONNECTIONSETTINGS_HXX #include "propertystorage.hxx" - -#include <vcl/dialog.hxx> -#include <vcl/button.hxx> - +#include <vcl/weld.hxx> #include <memory> class SfxItemSet; namespace dbaui { - class OTextConnectionHelper; + class DBOTextConnectionHelper; // TextConnectionSettingsDialog - class TextConnectionSettingsDialog : public ModalDialog + class TextConnectionSettingsDialog : public weld::GenericDialogController { public: - TextConnectionSettingsDialog( vcl::Window* _pParent, SfxItemSet& _rItems ); + TextConnectionSettingsDialog(weld::Window* _pParent, SfxItemSet& rItems); virtual ~TextConnectionSettingsDialog() override; - virtual void dispose() override; /** initializes a set of PropertyStorage instances, which are bound to the text-connection relevant items in our item sets */ static void bindItemStorages( SfxItemSet& _rSet, PropertyValues& _rValues ); - virtual short Execute() override; + virtual short run() override; private: - VclPtr<OTextConnectionHelper> m_pTextConnectionHelper; - VclPtr<OKButton> m_pOK; - SfxItemSet& m_rItems; + SfxItemSet& m_rItems; + + std::unique_ptr<weld::Widget> m_xContainer; + std::unique_ptr<weld::Button> m_xOK; + std::unique_ptr<DBOTextConnectionHelper> m_xTextConnectionHelper; private: - DECL_LINK( OnOK, Button*, void ); + DECL_LINK(OnOK, weld::Button&, void); }; } // namespace dbaui diff --git a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx index 987b095c6e88..899a521eb5e9 100644 --- a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx +++ b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx @@ -33,6 +33,7 @@ #include <comphelper/proparrhlp.hxx> #include <svtools/genericunodialog.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <vcl/svapp.hxx> #include <cppuhelper/implbase.hxx> namespace dbaui @@ -205,7 +206,7 @@ namespace dbaui svt::OGenericUnoDialog::Dialog OTextConnectionSettingsDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) { - return svt::OGenericUnoDialog::Dialog(VclPtr<TextConnectionSettingsDialog>::Create(VCLUnoHelper::GetWindow(rParent), *m_pDatasourceItems)); + return svt::OGenericUnoDialog::Dialog(o3tl::make_unique<TextConnectionSettingsDialog>(Application::GetFrameWeld(rParent), *m_pDatasourceItems)); } void SAL_CALL OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) |