diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-02 14:36:59 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-02 21:52:54 +0200 |
commit | 3cf2909f268ec63897d862714853ab85a295eb08 (patch) | |
tree | 7ce09d78eaaad7537e677eb6fc2d35f6b196cec5 | |
parent | 387896a05189c60570e031191c3f5959e7737bcb (diff) |
weld SwPreviewZoomDlg
Change-Id: Ie159032cfdf6201aba707a8980845ac15c1fba17
Reviewed-on: https://gerrit.libreoffice.org/52264
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | svx/uiconfig/ui/passwd.ui | 3 | ||||
-rw-r--r-- | sw/source/uibase/uiview/pview.cxx | 65 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/previewzoomdialog.ui | 25 |
3 files changed, 41 insertions, 52 deletions
diff --git a/svx/uiconfig/ui/passwd.ui b/svx/uiconfig/ui/passwd.ui index b1367463462a..3facc8882c07 100644 --- a/svx/uiconfig/ui/passwd.ui +++ b/svx/uiconfig/ui/passwd.ui @@ -120,6 +120,7 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="visibility">False</property> + <property name="activates_default">True</property> <property name="input_purpose">password</property> </object> <packing> @@ -176,6 +177,7 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="visibility">False</property> + <property name="activates_default">True</property> <property name="input_purpose">password</property> </object> <packing> @@ -189,6 +191,7 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="visibility">False</property> + <property name="activates_default">True</property> <property name="input_purpose">password</property> </object> <packing> diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 32d37c62c8e8..dbcef1d013f0 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -25,6 +25,7 @@ #include <vcl/commandevent.hxx> #include <vcl/button.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <svl/whiter.hxx> #include <svl/stritem.hxx> @@ -139,47 +140,31 @@ static void lcl_InvalidateZoomSlots(SfxBindings& rBindings) } // At first the zoom dialog -class SwPreviewZoomDlg : public SvxStandardDialog +class SwPreviewZoomDlg : public weld::GenericDialogController { - VclPtr<NumericField> m_pRowEdit; - VclPtr<NumericField> m_pColEdit; - - virtual void Apply() override; + SwPagePreviewWin& m_rParent; + std::unique_ptr<weld::SpinButton> m_xRowEdit; + std::unique_ptr<weld::SpinButton> m_xColEdit; public: - explicit SwPreviewZoomDlg( SwPagePreviewWin& rParent ); - virtual ~SwPreviewZoomDlg() override; - virtual void dispose() override; -}; - -SwPreviewZoomDlg::SwPreviewZoomDlg( SwPagePreviewWin& rParent ) - : SvxStandardDialog(&rParent, "PreviewZoomDialog", "modules/swriter/ui/previewzoomdialog.ui") -{ - get(m_pRowEdit, "rows"); - get(m_pColEdit, "cols"); - - m_pRowEdit->SetValue( rParent.GetRow() ); - m_pColEdit->SetValue( rParent.GetCol() ); -} - -SwPreviewZoomDlg::~SwPreviewZoomDlg() -{ - disposeOnce(); -} - -void SwPreviewZoomDlg::dispose() -{ - m_pRowEdit.clear(); - m_pColEdit.clear(); - SvxStandardDialog::dispose(); -} + SwPreviewZoomDlg(SwPagePreviewWin& rParent) + : GenericDialogController(rParent.GetFrameWeld(), "modules/swriter/ui/previewzoomdialog.ui", "PreviewZoomDialog") + , m_rParent(rParent) + , m_xRowEdit(m_xBuilder->weld_spin_button("rows")) + , m_xColEdit(m_xBuilder->weld_spin_button("cols")) + { + m_xRowEdit->set_value(rParent.GetRow()); + m_xColEdit->set_value(rParent.GetCol()); + } -void SwPreviewZoomDlg::Apply() -{ - static_cast<SwPagePreviewWin*>(GetParent())->CalcWish( - sal_uInt8(m_pRowEdit->GetValue()), - sal_uInt8(m_pColEdit->GetValue()) ); -} + void execute() + { + if (run() == RET_OK) + { + m_rParent.CalcWish(sal_uInt8(m_xRowEdit->get_value()), sal_uInt8(m_xColEdit->get_value())); + } + } +}; // all for SwPagePreviewWin SwPagePreviewWin::SwPagePreviewWin( vcl::Window *pParent, SwPagePreview& rPView ) @@ -709,8 +694,10 @@ void SwPagePreview::Execute( SfxRequest &rReq ) } else - ScopedVclPtrInstance<SwPreviewZoomDlg>( *m_pViewWin )->Execute(); - + { + SwPreviewZoomDlg aDlg(*m_pViewWin); + aDlg.execute(); + } } break; case FN_SHOW_BOOKVIEW: diff --git a/sw/uiconfig/swriter/ui/previewzoomdialog.ui b/sw/uiconfig/swriter/ui/previewzoomdialog.ui index 59f1cc33fcc6..d46718c6709f 100644 --- a/sw/uiconfig/swriter/ui/previewzoomdialog.ui +++ b/sw/uiconfig/swriter/ui/previewzoomdialog.ui @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.20.4 --> <interface domain="sw"> - <!-- interface-requires gtk+ 3.0 --> + <requires lib="gtk+" version="3.0"/> <object class="GtkAdjustment" id="adjustment1"> <property name="lower">1</property> <property name="upper">10</property> @@ -19,6 +20,9 @@ <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="previewzoomdialog|PreviewZoomDialog">Multiple Pages</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 internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> @@ -86,7 +90,6 @@ <object class="GtkGrid" id="grid1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="valign">center</property> <property name="margin_left">6</property> <property name="margin_right">6</property> <property name="hexpand">True</property> @@ -97,32 +100,28 @@ <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="previewzoomdialog|label1">_Rows</property> <property name="use_underline">True</property> <property name="mnemonic_widget">rows</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> <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="previewzoomdialog|label2">_Columns</property> <property name="use_underline">True</property> <property name="mnemonic_widget">cols</property> + <property name="xalign">0</property> </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> <child> @@ -131,13 +130,12 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="invisible_char">●</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment1</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> <child> @@ -146,14 +144,12 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="invisible_char">●</property> - <property name="invisible_char_set">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment2</property> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -170,5 +166,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> |