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 @@
<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>
......
......@@ -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:
......
<?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>
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