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
}
}
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))
......
......@@ -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;
......
......@@ -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);
}
}
......
......@@ -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;
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
......
......@@ -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 )
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="dba">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="TextConnectionSettingsDialog">
......@@ -7,7 +7,13 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="textconnectionsettings|TextConnectionSettingsDialog">Text Connection Settings</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>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<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