summaryrefslogtreecommitdiff
path: root/sw/source/ui/table
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-02 16:57:30 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-04-02 21:54:28 +0200
commitcc78e723723bac34a43e5f3ad05947f775abe0db (patch)
treeaeecfe085de176aa3d9306b69687042d50368013 /sw/source/ui/table
parentfa8822c48e2a79589bebbd015b36d1da8b338cc2 (diff)
weld SwTableHeightDlg
Change-Id: I46b90b97da28a7461a069867bade40a64b17c9b5 Reviewed-on: https://gerrit.libreoffice.org/52269 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/ui/table')
-rw-r--r--sw/source/ui/table/colwd.cxx14
-rw-r--r--sw/source/ui/table/rowht.cxx50
2 files changed, 29 insertions, 35 deletions
diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx
index 4ca22dda4b5e..deb4fb03e35a 100644
--- a/sw/source/ui/table/colwd.cxx
+++ b/sw/source/ui/table/colwd.cxx
@@ -61,16 +61,18 @@ SwTableWidthDlg::SwTableWidthDlg(weld::Window *pParent, SwTableFUNC &rTableFnc)
LoseFocusHdl(*m_xColNF);
}
+void SwTableWidthDlg::Apply()
+{
+ m_rFnc.InitTabCols();
+ m_rFnc.SetColWidth(static_cast<sal_uInt16>(m_xColNF->get_value() - 1),
+ static_cast<sal_uInt16>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FUNIT_TWIP))));
+}
+
short SwTableWidthDlg::execute()
{
short nRet = run();
if (nRet == RET_OK)
- {
- m_rFnc.InitTabCols();
- m_rFnc.SetColWidth(
- static_cast<sal_uInt16>(m_xColNF->get_value() - 1),
- static_cast<sal_uInt16>(m_xWidthMF->denormalize(m_xWidthMF->get_value(FUNIT_TWIP))));
- }
+ Apply();
return nRet;
}
diff --git a/sw/source/ui/table/rowht.cxx b/sw/source/ui/table/rowht.cxx
index 3dcf60ae7531..29c84b7fd242 100644
--- a/sw/source/ui/table/rowht.cxx
+++ b/sw/source/ui/table/rowht.cxx
@@ -36,54 +36,46 @@
void SwTableHeightDlg::Apply()
{
- SwTwips nHeight = static_cast< SwTwips >(m_pHeightEdit->Denormalize(m_pHeightEdit->GetValue(FUNIT_TWIP)));
+ SwTwips nHeight = static_cast< SwTwips >(m_xHeightEdit->denormalize(m_xHeightEdit->get_value(FUNIT_TWIP)));
SwFormatFrameSize aSz(ATT_FIX_SIZE, 0, nHeight);
- SwFrameSize eFrameSize = m_pAutoHeightCB->IsChecked() ?
- ATT_MIN_SIZE : ATT_FIX_SIZE;
+ SwFrameSize eFrameSize = m_xAutoHeightCB->get_active() ? ATT_MIN_SIZE : ATT_FIX_SIZE;
if(eFrameSize != aSz.GetHeightSizeType())
{
aSz.SetHeightSizeType(eFrameSize);
}
- rSh.SetRowHeight( aSz );
+ m_rSh.SetRowHeight(aSz);
}
-SwTableHeightDlg::SwTableHeightDlg(vcl::Window *pParent, SwWrtShell &rS)
- : SvxStandardDialog(pParent, "RowHeightDialog", "modules/swriter/ui/rowheight.ui")
- , rSh( rS )
+SwTableHeightDlg::SwTableHeightDlg(weld::Window *pParent, SwWrtShell &rS)
+ : GenericDialogController(pParent, "modules/swriter/ui/rowheight.ui", "RowHeightDialog")
+ , m_rSh(rS)
+ , m_xHeightEdit(m_xBuilder->weld_metric_spin_button("heightmf"))
+ , m_xAutoHeightCB(m_xBuilder->weld_check_button("fit"))
{
- get(m_pHeightEdit, "heightmf");
- get(m_pAutoHeightCB, "fit");
-
FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( dynamic_cast< const SwWebDocShell*>(
- rSh.GetView().GetDocShell() ) != nullptr )->GetMetric();
- ::SetFieldUnit(*m_pHeightEdit, eFieldUnit);
+ m_rSh.GetView().GetDocShell() ) != nullptr )->GetMetric();
+ ::SetFieldUnit(*m_xHeightEdit, eFieldUnit);
- m_pHeightEdit->SetMin(MINLAY, FUNIT_TWIP);
- if(!m_pHeightEdit->GetMin())
- m_pHeightEdit->SetMin(1);
+ m_xHeightEdit->set_min(MINLAY, FUNIT_TWIP);
SwFormatFrameSize *pSz;
- rSh.GetRowHeight( pSz );
- if ( pSz )
+ m_rSh.GetRowHeight(pSz);
+ if (pSz)
{
- long nHeight = pSz->GetHeight();
- m_pAutoHeightCB->Check(pSz->GetHeightSizeType() != ATT_FIX_SIZE);
- m_pHeightEdit->SetValue(m_pHeightEdit->Normalize(nHeight), FUNIT_TWIP);
+ auto nHeight = pSz->GetHeight();
+ m_xAutoHeightCB->set_active(pSz->GetHeightSizeType() != ATT_FIX_SIZE);
+ m_xHeightEdit->set_value(m_xHeightEdit->normalize(nHeight), FUNIT_TWIP);
delete pSz;
}
}
-SwTableHeightDlg::~SwTableHeightDlg()
-{
- disposeOnce();
-}
-
-void SwTableHeightDlg::dispose()
+short SwTableHeightDlg::execute()
{
- m_pHeightEdit.clear();
- m_pAutoHeightCB.clear();
- SvxStandardDialog::dispose();
+ short nRet = run();
+ if (nRet == RET_OK)
+ Apply();
+ return nRet;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */