sw/source/ui/dbui/createaddresslistdialog.cxx | 76 ++++++++++---------------- sw/source/ui/dbui/createaddresslistdialog.hxx | 32 +++++----- sw/uiconfig/swriter/ui/findentrydialog.ui | 29 +++------ vcl/unx/gtk3/gtk3gtkinst.cxx | 6 ++ 4 files changed, 63 insertions(+), 80 deletions(-)
New commits: commit 1346d0c125c35094d241bbc1e0e0316433a292aa Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Oct 4 11:49:52 2018 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Oct 4 15:43:32 2018 +0200 weld SwFindEntryDialog Change-Id: Ia45e4ce13b92fd73fcc8ad52233aa5eccc3cfb6d Reviewed-on: https://gerrit.libreoffice.org/61365 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index b024cd71c264..6c227ea5273c 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -394,8 +394,7 @@ SwCreateAddressListDialog::SwCreateAddressListDialog( SfxModalDialog(pParent, "CreateAddressList", "modules/swriter/ui/createaddresslist.ui"), m_sAddressListFilterName( SwResId( ST_FILTERNAME)), m_sURL(rURL), - m_pCSVData( new SwCSVData ), - m_pFindDlg(nullptr) + m_pCSVData( new SwCSVData ) { get(m_pNewPB, "NEW"); get(m_pDeletePB, "DELETE"); @@ -509,7 +508,7 @@ void SwCreateAddressListDialog::dispose() m_pNextPB.clear(); m_pEndPB.clear(); m_pOK.clear(); - m_pFindDlg.disposeAndClear(); + m_xFindDlg.reset(); SfxModalDialog::dispose(); } @@ -549,20 +548,20 @@ IMPL_LINK_NOARG(SwCreateAddressListDialog, DeleteHdl_Impl, Button*, void) IMPL_LINK_NOARG(SwCreateAddressListDialog, FindHdl_Impl, Button*, void) { - if(!m_pFindDlg) + if (!m_xFindDlg) { - m_pFindDlg = VclPtr<SwFindEntryDialog>::Create(this); - ListBox& rColumnBox = m_pFindDlg->GetFieldsListBox(); + m_xFindDlg.reset(new SwFindEntryDialog(this)); + weld::ComboBox& rColumnBox = m_xFindDlg->GetFieldsListBox(); std::vector< OUString >::iterator aHeaderIter; for(aHeaderIter = m_pCSVData->aDBColumnHeaders.begin(); aHeaderIter != m_pCSVData->aDBColumnHeaders.end(); ++aHeaderIter) - rColumnBox.InsertEntry(*aHeaderIter); - rColumnBox.SelectEntryPos( 0 ); - m_pFindDlg->Show(); + rColumnBox.append_text(*aHeaderIter); + rColumnBox.set_active(0); + m_xFindDlg->show(); } else - m_pFindDlg->Show(!m_pFindDlg->IsVisible()); + m_xFindDlg->show(!m_xFindDlg->get_visible()); } IMPL_LINK(SwCreateAddressListDialog, CustomizeHdl_Impl, Button*, pButton, void) @@ -577,15 +576,15 @@ IMPL_LINK(SwCreateAddressListDialog, CustomizeHdl_Impl, Button*, pButton, void) pDlg.reset(); //update find dialog - if(m_pFindDlg) + if (m_xFindDlg) { - ListBox& rColumnBox = m_pFindDlg->GetFieldsListBox(); - rColumnBox.Clear(); + weld::ComboBox& rColumnBox = m_xFindDlg->GetFieldsListBox(); + rColumnBox.clear(); std::vector< OUString >::iterator aHeaderIter; for(aHeaderIter = m_pCSVData->aDBColumnHeaders.begin(); aHeaderIter != m_pCSVData->aDBColumnHeaders.end(); ++aHeaderIter) - rColumnBox.InsertEntry(*aHeaderIter); + rColumnBox.append_text(*aHeaderIter); } } @@ -741,54 +740,39 @@ void SwCreateAddressListDialog::Find(const OUString& rSearch, sal_Int32 nColumn) } SwFindEntryDialog::SwFindEntryDialog(SwCreateAddressListDialog* pParent) - : ModelessDialog(pParent, "FindEntryDialog", - "modules/swriter/ui/findentrydialog.ui") + : GenericDialogController(pParent->GetFrameWeld(), "modules/swriter/ui/findentrydialog.ui", "FindEntryDialog") , m_pParent(pParent) + , m_xFindED(m_xBuilder->weld_entry("entry")) + , m_xFindOnlyCB(m_xBuilder->weld_check_button("findin")) + , m_xFindOnlyLB(m_xBuilder->weld_combo_box("area")) + , m_xFindPB(m_xBuilder->weld_button("find")) + , m_xCancel(m_xBuilder->weld_button("cancel")) { - get(m_pCancel, "cancel"); - get(m_pFindPB, "find"); - get(m_pFindOnlyLB, "area"); - get(m_pFindOnlyCB, "findin"); - get(m_pFindED, "entry"); - m_pFindPB->SetClickHdl(LINK(this, SwFindEntryDialog, FindHdl_Impl)); - m_pFindED->SetModifyHdl(LINK(this, SwFindEntryDialog, FindEnableHdl_Impl)); - m_pCancel->SetClickHdl(LINK(this, SwFindEntryDialog, CloseHdl_Impl)); + m_xFindPB->connect_clicked(LINK(this, SwFindEntryDialog, FindHdl_Impl)); + m_xFindED->connect_changed(LINK(this, SwFindEntryDialog, FindEnableHdl_Impl)); + m_xCancel->connect_clicked(LINK(this, SwFindEntryDialog, CloseHdl_Impl)); } SwFindEntryDialog::~SwFindEntryDialog() { - disposeOnce(); -} - -void SwFindEntryDialog::dispose() -{ - m_pFindED.clear(); - m_pFindOnlyCB.clear(); - m_pFindOnlyLB.clear(); - m_pFindPB.clear(); - m_pCancel.clear(); - m_pParent.clear(); - ModelessDialog::dispose(); } - -IMPL_LINK_NOARG(SwFindEntryDialog, FindHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SwFindEntryDialog, FindHdl_Impl, weld::Button&, void) { sal_Int32 nColumn = -1; - if(m_pFindOnlyCB->IsChecked()) - nColumn = m_pFindOnlyLB->GetSelectedEntryPos(); - if(nColumn != LISTBOX_ENTRY_NOTFOUND) - m_pParent->Find(m_pFindED->GetText(), nColumn); + if (m_xFindOnlyCB->get_active()) + nColumn = m_xFindOnlyLB->get_active(); + m_pParent->Find(m_xFindED->get_text(), nColumn); } -IMPL_LINK_NOARG(SwFindEntryDialog, FindEnableHdl_Impl, Edit&, void) +IMPL_LINK_NOARG(SwFindEntryDialog, FindEnableHdl_Impl, weld::Entry&, void) { - m_pFindPB->Enable(!m_pFindED->GetText().isEmpty()); + m_xFindPB->set_sensitive(!m_xFindED->get_text().isEmpty()); } -IMPL_LINK_NOARG(SwFindEntryDialog, CloseHdl_Impl, Button*, void) +IMPL_LINK_NOARG(SwFindEntryDialog, CloseHdl_Impl, weld::Button&, void) { - Show(false); + m_xDialog->show(false); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dbui/createaddresslistdialog.hxx b/sw/source/ui/dbui/createaddresslistdialog.hxx index a2543f545920..ed28356fda96 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.hxx +++ b/sw/source/ui/dbui/createaddresslistdialog.hxx @@ -25,6 +25,7 @@ #include <vcl/field.hxx> #include <vcl/fixed.hxx> #include <vcl/lstbox.hxx> +#include <vcl/weld.hxx> #include <vector> class SwAddressControl_Impl; @@ -60,7 +61,7 @@ class SwCreateAddressListDialog : public SfxModalDialog OUString m_sURL; std::unique_ptr<SwCSVData> m_pCSVData; - VclPtr<SwFindEntryDialog> m_pFindDlg; + std::unique_ptr<SwFindEntryDialog> m_xFindDlg; DECL_LINK(NewHdl_Impl, Button*, void); DECL_LINK(DeleteHdl_Impl, Button*, void); @@ -82,29 +83,30 @@ public: void Find( const OUString& rSearch, sal_Int32 nColumn); }; -class SwFindEntryDialog : public ModelessDialog +class SwFindEntryDialog : public weld::GenericDialogController { - VclPtr<Edit> m_pFindED; - VclPtr<CheckBox> m_pFindOnlyCB; - VclPtr<ListBox> m_pFindOnlyLB; - - VclPtr<PushButton> m_pFindPB; - VclPtr<CancelButton> m_pCancel; - VclPtr<SwCreateAddressListDialog> m_pParent; - DECL_LINK(FindHdl_Impl, Button*, void); - DECL_LINK(FindEnableHdl_Impl, Edit&, void); - DECL_LINK(CloseHdl_Impl, Button*, void); + std::unique_ptr<weld::Entry> m_xFindED; + std::unique_ptr<weld::CheckButton> m_xFindOnlyCB; + std::unique_ptr<weld::ComboBox> m_xFindOnlyLB; + std::unique_ptr<weld::Button> m_xFindPB; + std::unique_ptr<weld::Button> m_xCancel; + + DECL_LINK(FindHdl_Impl, weld::Button&, void); + DECL_LINK(FindEnableHdl_Impl, weld::Entry&, void); + DECL_LINK(CloseHdl_Impl, weld::Button&, void); public: SwFindEntryDialog(SwCreateAddressListDialog* pParent); virtual ~SwFindEntryDialog() override; - virtual void dispose() override; - ListBox& GetFieldsListBox() + void show(bool bShow = true) { m_xDialog->show(bShow); } + bool get_visible() const { return m_xDialog->get_visible(); } + + weld::ComboBox& GetFieldsListBox() { - return *m_pFindOnlyLB; + return *m_xFindOnlyLB; } }; diff --git a/sw/uiconfig/swriter/ui/findentrydialog.ui b/sw/uiconfig/swriter/ui/findentrydialog.ui index ce29439e4336..cb57e2aad4aa 100644 --- a/sw/uiconfig/swriter/ui/findentrydialog.ui +++ b/sw/uiconfig/swriter/ui/findentrydialog.ui @@ -1,12 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> - <!-- interface-requires gtk+ 3.0 --> + <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="FindEntryDialog"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="border_width">6</property> - <property name="title" translatable="yes" context="findentrydialog|FindEntryDialog">Find Entry</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child type="titlebar"> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="visible">True</property> @@ -87,16 +91,14 @@ <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="findentrydialog|label1">F_ind</property> <property name="use_underline">True</property> <property name="mnemonic_widget">entry</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -104,20 +106,17 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -141,8 +140,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -150,8 +147,6 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_left">12</property> - <property name="entry_text_column">0</property> - <property name="id_column">1</property> <accessibility> <relation type="labelled-by" target="findin"/> </accessibility> @@ -159,16 +154,12 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index f1d69a509e2d..d935dc672c8b 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2210,6 +2210,12 @@ public: return GtkToVcl(ret); } + virtual void show() override + { + sort_native_button_order(GTK_BOX(gtk_dialog_get_action_area(m_pDialog))); + gtk_widget_show(m_pWidget); + } + static int VclToGtk(int nResponse) { if (nResponse == RET_OK) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits