summaryrefslogtreecommitdiff
path: root/sw/source/ui/dialog
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-06-06 14:46:23 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-06-06 22:09:58 +0200
commit4d598dca80720738077e335eb17b6c757e1dc18c (patch)
tree863be9a62066c04d0f68bcc026ae0c3a655fb452 /sw/source/ui/dialog
parent09849abf10d70b2e4680c9b0d2ad8e977752d87b (diff)
weld SwSectionIndentTabPage
Change-Id: I961686c1257f0d85686df06aa7c73c324d0f70b8 Reviewed-on: https://gerrit.libreoffice.org/55389 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/dialog')
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx70
1 files changed, 30 insertions, 40 deletions
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index c0510143c38e..56c8279bf153 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -2105,38 +2105,28 @@ void SwSectionPropertyTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage
static_cast<SwSectionIndentTabPage&>(rPage).SetWrtShell(rWrtSh);
}
-SwSectionIndentTabPage::SwSectionIndentTabPage(vcl::Window *pParent, const SfxItemSet &rAttrSet)
- : SfxTabPage(pParent, "IndentPage", "modules/swriter/ui/indentpage.ui", &rAttrSet)
+SwSectionIndentTabPage::SwSectionIndentTabPage(TabPageParent pParent, const SfxItemSet &rAttrSet)
+ : SfxTabPage(pParent, "modules/swriter/ui/indentpage.ui", "IndentPage", &rAttrSet)
+ , m_xBeforeMF(m_xBuilder->weld_metric_spin_button("before", FUNIT_CM))
+ , m_xAfterMF(m_xBuilder->weld_metric_spin_button("after", FUNIT_CM))
+ , m_xPreviewWin(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin))
{
- get(m_pBeforeMF, "before");
- get(m_pAfterMF, "after");
- get(m_pPreviewWin, "preview");
- Link<Edit&,void> aLk = LINK(this, SwSectionIndentTabPage, IndentModifyHdl);
- m_pBeforeMF->SetModifyHdl(aLk);
- m_pAfterMF->SetModifyHdl(aLk);
+ Link<weld::MetricSpinButton&,void> aLk = LINK(this, SwSectionIndentTabPage, IndentModifyHdl);
+ m_xBeforeMF->connect_value_changed(aLk);
+ m_xAfterMF->connect_value_changed(aLk);
}
SwSectionIndentTabPage::~SwSectionIndentTabPage()
{
- disposeOnce();
-}
-
-void SwSectionIndentTabPage::dispose()
-{
- m_pBeforeMF.clear();
- m_pAfterMF.clear();
- m_pPreviewWin.clear();
- SfxTabPage::dispose();
}
-bool SwSectionIndentTabPage::FillItemSet( SfxItemSet* rSet)
+bool SwSectionIndentTabPage::FillItemSet(SfxItemSet* rSet)
{
- if(m_pBeforeMF->IsValueModified() ||
- m_pAfterMF->IsValueModified())
+ if (m_xBeforeMF->get_value_changed_from_saved() || m_xAfterMF->get_value_changed_from_saved())
{
SvxLRSpaceItem aLRSpace(
- static_cast< long >(m_pBeforeMF->Denormalize(m_pBeforeMF->GetValue(FUNIT_TWIP))) ,
- static_cast< long >(m_pAfterMF->Denormalize(m_pAfterMF->GetValue(FUNIT_TWIP))), 0, 0, RES_LR_SPACE);
+ m_xBeforeMF->denormalize(m_xBeforeMF->get_value(FUNIT_TWIP)) ,
+ m_xAfterMF->denormalize(m_xAfterMF->get_value(FUNIT_TWIP)), 0, 0, RES_LR_SPACE);
rSet->Put(aLRSpace);
}
return true;
@@ -2146,8 +2136,8 @@ void SwSectionIndentTabPage::Reset( const SfxItemSet* rSet)
{
//this page doesn't show up in HTML mode
FieldUnit aMetric = ::GetDfltMetric(false);
- SetMetric(*m_pBeforeMF, aMetric);
- SetMetric(*m_pAfterMF , aMetric);
+ SetFieldUnit(*m_xBeforeMF, aMetric);
+ SetFieldUnit(*m_xAfterMF , aMetric);
SfxItemState eItemState = rSet->GetItemState( RES_LR_SPACE );
if ( eItemState >= SfxItemState::DEFAULT )
@@ -2155,39 +2145,39 @@ void SwSectionIndentTabPage::Reset( const SfxItemSet* rSet)
const SvxLRSpaceItem& rSpace =
rSet->Get( RES_LR_SPACE );
- m_pBeforeMF->SetValue( m_pBeforeMF->Normalize(rSpace.GetLeft()), FUNIT_TWIP );
- m_pAfterMF->SetValue( m_pAfterMF->Normalize(rSpace.GetRight()), FUNIT_TWIP );
+ m_xBeforeMF->set_value(m_xBeforeMF->normalize(rSpace.GetLeft()), FUNIT_TWIP);
+ m_xAfterMF->set_value(m_xAfterMF->normalize(rSpace.GetRight()), FUNIT_TWIP);
}
else
{
- m_pBeforeMF->SetEmptyFieldValue();
- m_pAfterMF->SetEmptyFieldValue();
+ m_xBeforeMF->set_text("");
+ m_xAfterMF->set_text("");
}
- m_pBeforeMF->SaveValue();
- m_pAfterMF->SaveValue();
- IndentModifyHdl(*m_pBeforeMF);
+ m_xBeforeMF->save_value();
+ m_xAfterMF->save_value();
+ IndentModifyHdl(*m_xBeforeMF);
}
-VclPtr<SfxTabPage> SwSectionIndentTabPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet)
+VclPtr<SfxTabPage> SwSectionIndentTabPage::Create(TabPageParent pParent, const SfxItemSet* rAttrSet)
{
- return VclPtr<SwSectionIndentTabPage>::Create(pParent.pParent, *rAttrSet);
+ return VclPtr<SwSectionIndentTabPage>::Create(pParent, *rAttrSet);
}
void SwSectionIndentTabPage::SetWrtShell(SwWrtShell const & rSh)
{
//set sensible values at the preview
- m_pPreviewWin->SetAdjust(SvxAdjust::Block);
- m_pPreviewWin->SetLastLine(SvxAdjust::Block);
+ m_aPreviewWin.SetAdjust(SvxAdjust::Block);
+ m_aPreviewWin.SetLastLine(SvxAdjust::Block);
const SwRect& rPageRect = rSh.GetAnyCurRect( CurRectType::Page );
Size aPageSize(rPageRect.Width(), rPageRect.Height());
- m_pPreviewWin->SetSize(aPageSize);
+ m_aPreviewWin.SetSize(aPageSize);
}
-IMPL_LINK_NOARG(SwSectionIndentTabPage, IndentModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(SwSectionIndentTabPage, IndentModifyHdl, weld::MetricSpinButton&, void)
{
- m_pPreviewWin->SetLeftMargin( static_cast< long >(m_pBeforeMF->Denormalize(m_pBeforeMF->GetValue(FUNIT_TWIP))) );
- m_pPreviewWin->SetRightMargin( static_cast< long >(m_pAfterMF->Denormalize(m_pAfterMF->GetValue(FUNIT_TWIP))) );
- m_pPreviewWin->Invalidate();
+ m_aPreviewWin.SetLeftMargin(m_xBeforeMF->denormalize(m_xBeforeMF->get_value(FUNIT_TWIP)));
+ m_aPreviewWin.SetRightMargin(m_xAfterMF->denormalize(m_xAfterMF->get_value(FUNIT_TWIP)));
+ m_aPreviewWin.Invalidate();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */