Kaydet (Commit) 74d4f1b4 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld TextConnectionSettingsDialog

Change-Id: Iaa08d066d9c2198bca7e21f619fb89808620fba9
Reviewed-on: https://gerrit.libreoffice.org/62295Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 510c64cd
...@@ -444,7 +444,7 @@ namespace dbaui ...@@ -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_aFieldSeparatorList (DBA_RES(STR_AUTOFIELDSEPARATORLIST))
, m_aTextSeparatorList (STR_AUTOTEXTSEPARATORLIST) , m_aTextSeparatorList (STR_AUTOTEXTSEPARATORLIST)
, m_aTextNone (DBA_RES(STR_AUTOTEXT_FIELD_SEP_NONE)) , m_aTextNone (DBA_RES(STR_AUTOTEXT_FIELD_SEP_NONE))
......
...@@ -95,7 +95,7 @@ namespace dbaui ...@@ -95,7 +95,7 @@ namespace dbaui
class DBOTextConnectionHelper final class DBOTextConnectionHelper final
{ {
public: public:
DBOTextConnectionHelper(weld::Container* pParent , const short _nAvailableSections); DBOTextConnectionHelper(weld::Widget* pParent , const short _nAvailableSections);
private: private:
OUString m_aFieldSeparatorList; OUString m_aFieldSeparatorList;
......
...@@ -26,26 +26,18 @@ ...@@ -26,26 +26,18 @@
namespace dbaui namespace dbaui
{ {
// TextConnectionSettingsDialog // TextConnectionSettingsDialog
TextConnectionSettingsDialog::TextConnectionSettingsDialog( vcl::Window* _pParent, SfxItemSet& _rItems ) TextConnectionSettingsDialog::TextConnectionSettingsDialog(weld::Window* pParent, SfxItemSet& rItems)
:ModalDialog( _pParent, "TextConnectionSettingsDialog", "dbaccess/ui/textconnectionsettings.ui" ) : GenericDialogController(pParent, "dbaccess/ui/textconnectionsettings.ui", "TextConnectionSettingsDialog")
,m_rItems( _rItems ) , 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_xOK->connect_clicked(LINK(this, TextConnectionSettingsDialog, OnOK));
m_pTextConnectionHelper.reset( VclPtr<OTextConnectionHelper>::Create( get<VclVBox>("TextPageContainer"), TC_HEADER | TC_SEPARATORS | TC_CHARSET ) );
m_pOK->SetClickHdl( LINK( this, TextConnectionSettingsDialog, OnOK ) );
} }
TextConnectionSettingsDialog::~TextConnectionSettingsDialog() TextConnectionSettingsDialog::~TextConnectionSettingsDialog()
{ {
disposeOnce();
}
void TextConnectionSettingsDialog::dispose()
{
m_pOK.clear();
m_pTextConnectionHelper.disposeAndClear();
ModalDialog::dispose();
} }
void TextConnectionSettingsDialog::bindItemStorages( SfxItemSet& _rSet, PropertyValues& _rValues ) void TextConnectionSettingsDialog::bindItemStorages( SfxItemSet& _rSet, PropertyValues& _rValues )
...@@ -58,18 +50,18 @@ namespace dbaui ...@@ -58,18 +50,18 @@ namespace dbaui
_rValues[ PROPERTY_ID_ENCODING ].reset( new SetItemPropertyStorage( _rSet, DSID_CHARSET ) ); _rValues[ PROPERTY_ID_ENCODING ].reset( new SetItemPropertyStorage( _rSet, DSID_CHARSET ) );
} }
short TextConnectionSettingsDialog::Execute() short TextConnectionSettingsDialog::run()
{ {
m_pTextConnectionHelper->implInitControls( m_rItems, true ); m_xTextConnectionHelper->implInitControls(m_rItems, true);
return ModalDialog::Execute(); 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*/ ); m_xTextConnectionHelper->FillItemSet( m_rItems, false/*bUnused*/ );
EndDialog( RET_OK ); m_xDialog->response(RET_OK);
} }
} }
......
...@@ -21,40 +21,38 @@ ...@@ -21,40 +21,38 @@
#define INCLUDED_DBACCESS_SOURCE_UI_INC_TEXTCONNECTIONSETTINGS_HXX #define INCLUDED_DBACCESS_SOURCE_UI_INC_TEXTCONNECTIONSETTINGS_HXX
#include "propertystorage.hxx" #include "propertystorage.hxx"
#include <vcl/weld.hxx>
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
#include <memory> #include <memory>
class SfxItemSet; class SfxItemSet;
namespace dbaui namespace dbaui
{ {
class OTextConnectionHelper; class DBOTextConnectionHelper;
// TextConnectionSettingsDialog // TextConnectionSettingsDialog
class TextConnectionSettingsDialog : public ModalDialog class TextConnectionSettingsDialog : public weld::GenericDialogController
{ {
public: public:
TextConnectionSettingsDialog( vcl::Window* _pParent, SfxItemSet& _rItems ); TextConnectionSettingsDialog(weld::Window* _pParent, SfxItemSet& rItems);
virtual ~TextConnectionSettingsDialog() override; virtual ~TextConnectionSettingsDialog() override;
virtual void dispose() override;
/** initializes a set of PropertyStorage instances, which are bound to /** initializes a set of PropertyStorage instances, which are bound to
the text-connection relevant items in our item sets the text-connection relevant items in our item sets
*/ */
static void bindItemStorages( SfxItemSet& _rSet, PropertyValues& _rValues ); static void bindItemStorages( SfxItemSet& _rSet, PropertyValues& _rValues );
virtual short Execute() override; virtual short run() override;
private: private:
VclPtr<OTextConnectionHelper> m_pTextConnectionHelper; SfxItemSet& m_rItems;
VclPtr<OKButton> m_pOK;
SfxItemSet& m_rItems; std::unique_ptr<weld::Widget> m_xContainer;
std::unique_ptr<weld::Button> m_xOK;
std::unique_ptr<DBOTextConnectionHelper> m_xTextConnectionHelper;
private: private:
DECL_LINK( OnOK, Button*, void ); DECL_LINK(OnOK, weld::Button&, void);
}; };
} // namespace dbaui } // namespace dbaui
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <comphelper/proparrhlp.hxx> #include <comphelper/proparrhlp.hxx>
#include <svtools/genericunodialog.hxx> #include <svtools/genericunodialog.hxx>
#include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/vclunohelper.hxx>
#include <vcl/svapp.hxx>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
namespace dbaui namespace dbaui
...@@ -205,7 +206,7 @@ namespace dbaui ...@@ -205,7 +206,7 @@ namespace dbaui
svt::OGenericUnoDialog::Dialog OTextConnectionSettingsDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) 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 ) void SAL_CALL OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue )
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 --> <!-- Generated with glade 3.22.1 -->
<interface domain="dba"> <interface domain="dba">
<requires lib="gtk+" version="3.18"/> <requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="TextConnectionSettingsDialog"> <object class="GtkDialog" id="TextConnectionSettingsDialog">
...@@ -7,7 +7,13 @@ ...@@ -7,7 +7,13 @@
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="textconnectionsettings|TextConnectionSettingsDialog">Text Connection Settings</property> <property name="title" translatable="yes" context="textconnectionsettings|TextConnectionSettingsDialog">Text Connection Settings</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="modal">True</property>
<property name="default_width">0</property>
<property name="default_height">0</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property> <property name="can_focus">False</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment