Kaydet (Commit) 3cf2909f authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SwPreviewZoomDlg

Change-Id: Ie159032cfdf6201aba707a8980845ac15c1fba17
Reviewed-on: https://gerrit.libreoffice.org/52264Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 387896a0
...@@ -120,6 +120,7 @@ ...@@ -120,6 +120,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="visibility">False</property> <property name="visibility">False</property>
<property name="activates_default">True</property>
<property name="input_purpose">password</property> <property name="input_purpose">password</property>
</object> </object>
<packing> <packing>
...@@ -176,6 +177,7 @@ ...@@ -176,6 +177,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="visibility">False</property> <property name="visibility">False</property>
<property name="activates_default">True</property>
<property name="input_purpose">password</property> <property name="input_purpose">password</property>
</object> </object>
<packing> <packing>
...@@ -189,6 +191,7 @@ ...@@ -189,6 +191,7 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="visibility">False</property> <property name="visibility">False</property>
<property name="activates_default">True</property>
<property name="input_purpose">password</property> <property name="input_purpose">password</property>
</object> </object>
<packing> <packing>
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <vcl/commandevent.hxx> #include <vcl/commandevent.hxx>
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#include <vcl/weld.hxx>
#include <svl/whiter.hxx> #include <svl/whiter.hxx>
#include <svl/stritem.hxx> #include <svl/stritem.hxx>
...@@ -139,47 +140,31 @@ static void lcl_InvalidateZoomSlots(SfxBindings& rBindings) ...@@ -139,47 +140,31 @@ static void lcl_InvalidateZoomSlots(SfxBindings& rBindings)
} }
// At first the zoom dialog // At first the zoom dialog
class SwPreviewZoomDlg : public SvxStandardDialog class SwPreviewZoomDlg : public weld::GenericDialogController
{ {
VclPtr<NumericField> m_pRowEdit; SwPagePreviewWin& m_rParent;
VclPtr<NumericField> m_pColEdit; std::unique_ptr<weld::SpinButton> m_xRowEdit;
std::unique_ptr<weld::SpinButton> m_xColEdit;
virtual void Apply() override;
public: public:
explicit SwPreviewZoomDlg( SwPagePreviewWin& rParent ); SwPreviewZoomDlg(SwPagePreviewWin& rParent)
virtual ~SwPreviewZoomDlg() override; : GenericDialogController(rParent.GetFrameWeld(), "modules/swriter/ui/previewzoomdialog.ui", "PreviewZoomDialog")
virtual void dispose() override; , m_rParent(rParent)
}; , m_xRowEdit(m_xBuilder->weld_spin_button("rows"))
, m_xColEdit(m_xBuilder->weld_spin_button("cols"))
SwPreviewZoomDlg::SwPreviewZoomDlg( SwPagePreviewWin& rParent ) {
: SvxStandardDialog(&rParent, "PreviewZoomDialog", "modules/swriter/ui/previewzoomdialog.ui") m_xRowEdit->set_value(rParent.GetRow());
{ m_xColEdit->set_value(rParent.GetCol());
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();
}
void SwPreviewZoomDlg::Apply() void execute()
{ {
static_cast<SwPagePreviewWin*>(GetParent())->CalcWish( if (run() == RET_OK)
sal_uInt8(m_pRowEdit->GetValue()), {
sal_uInt8(m_pColEdit->GetValue()) ); m_rParent.CalcWish(sal_uInt8(m_xRowEdit->get_value()), sal_uInt8(m_xColEdit->get_value()));
} }
}
};
// all for SwPagePreviewWin // all for SwPagePreviewWin
SwPagePreviewWin::SwPagePreviewWin( vcl::Window *pParent, SwPagePreview& rPView ) SwPagePreviewWin::SwPagePreviewWin( vcl::Window *pParent, SwPagePreview& rPView )
...@@ -709,8 +694,10 @@ void SwPagePreview::Execute( SfxRequest &rReq ) ...@@ -709,8 +694,10 @@ void SwPagePreview::Execute( SfxRequest &rReq )
} }
else else
ScopedVclPtrInstance<SwPreviewZoomDlg>( *m_pViewWin )->Execute(); {
SwPreviewZoomDlg aDlg(*m_pViewWin);
aDlg.execute();
}
} }
break; break;
case FN_SHOW_BOOKVIEW: case FN_SHOW_BOOKVIEW:
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.4 -->
<interface domain="sw"> <interface domain="sw">
<!-- interface-requires gtk+ 3.0 --> <requires lib="gtk+" version="3.0"/>
<object class="GtkAdjustment" id="adjustment1"> <object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property> <property name="lower">1</property>
<property name="upper">10</property> <property name="upper">10</property>
...@@ -19,6 +20,9 @@ ...@@ -19,6 +20,9 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="border_width">6</property> <property name="border_width">6</property>
<property name="title" translatable="yes" context="previewzoomdialog|PreviewZoomDialog">Multiple Pages</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> <property name="type_hint">dialog</property>
<child internal-child="vbox"> <child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1"> <object class="GtkBox" id="dialog-vbox1">
...@@ -86,7 +90,6 @@ ...@@ -86,7 +90,6 @@
<object class="GtkGrid" id="grid1"> <object class="GtkGrid" id="grid1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="valign">center</property>
<property name="margin_left">6</property> <property name="margin_left">6</property>
<property name="margin_right">6</property> <property name="margin_right">6</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
...@@ -97,32 +100,28 @@ ...@@ -97,32 +100,28 @@
<object class="GtkLabel" id="label1"> <object class="GtkLabel" id="label1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="previewzoomdialog|label1">_Rows</property> <property name="label" translatable="yes" context="previewzoomdialog|label1">_Rows</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">rows</property> <property name="mnemonic_widget">rows</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="label2"> <object class="GtkLabel" id="label2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" context="previewzoomdialog|label2">_Columns</property> <property name="label" translatable="yes" context="previewzoomdialog|label2">_Columns</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="mnemonic_widget">cols</property> <property name="mnemonic_widget">cols</property>
<property name="xalign">0</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -131,13 +130,12 @@ ...@@ -131,13 +130,12 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="invisible_char"></property> <property name="invisible_char"></property>
<property name="activates_default">True</property>
<property name="adjustment">adjustment1</property> <property name="adjustment">adjustment1</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
<child> <child>
...@@ -146,14 +144,12 @@ ...@@ -146,14 +144,12 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
<property name="invisible_char"></property> <property name="invisible_char"></property>
<property name="invisible_char_set">True</property> <property name="activates_default">True</property>
<property name="adjustment">adjustment2</property> <property name="adjustment">adjustment2</property>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="top_attach">1</property> <property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing> </packing>
</child> </child>
</object> </object>
...@@ -170,5 +166,8 @@ ...@@ -170,5 +166,8 @@
<action-widget response="-6">cancel</action-widget> <action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget> <action-widget response="-11">help</action-widget>
</action-widgets> </action-widgets>
<child>
<placeholder/>
</child>
</object> </object>
</interface> </interface>
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