diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-09 15:28:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-09 21:48:28 +0200 |
commit | 8c72e780694e86f84e1d5b5eab6b724e7ec06754 (patch) | |
tree | 955fd11d60d7f9e54c23b22cef79aba959331bce /starmath/source | |
parent | 40ca52ee802ea3992caa82f811eab124381bc121 (diff) |
weld SmAlignDialog
Change-Id: Ie17f8da3ee26b366d4c325ff9aa2dbc7b419d8cd
Reviewed-on: https://gerrit.libreoffice.org/52640
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 'starmath/source')
-rw-r--r-- | starmath/source/dialog.cxx | 49 | ||||
-rw-r--r-- | starmath/source/document.cxx | 10 |
2 files changed, 19 insertions, 40 deletions
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 176ad2352804..ad70b04e3402 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -992,9 +992,9 @@ void SmDistanceDialog::WriteTo(SmFormat &rFormat) /*const*/ rFormat.RequestApplyChanges(); } -IMPL_LINK_NOARG( SmAlignDialog, DefaultButtonClickHdl, Button *, void ) +IMPL_LINK_NOARG( SmAlignDialog, DefaultButtonClickHdl, weld::Button&, void ) { - SaveDefaultsQuery aQuery(GetFrameWeld()); + SaveDefaultsQuery aQuery(m_xDialog.get()); if (aQuery.run() == RET_YES) { SmModule *pp = SM_MOD(); @@ -1004,29 +1004,18 @@ IMPL_LINK_NOARG( SmAlignDialog, DefaultButtonClickHdl, Button *, void ) } } -SmAlignDialog::SmAlignDialog(vcl::Window * pParent) - : ModalDialog(pParent, "AlignmentDialog", - "modules/smath/ui/alignmentdialog.ui") +SmAlignDialog::SmAlignDialog(weld::Window* pParent) + : GenericDialogController(pParent, "modules/smath/ui/alignmentdialog.ui", "AlignmentDialog") + , m_xLeft(m_xBuilder->weld_radio_button("left")) + , m_xCenter(m_xBuilder->weld_radio_button("center")) + , m_xRight(m_xBuilder->weld_radio_button("right")) + , m_xDefaultButton(m_xBuilder->weld_button("default")) { - get(m_pLeft, "left"); - get(m_pCenter, "center"); - get(m_pRight, "right"); - get(m_pDefaultButton, "default"); - m_pDefaultButton->SetClickHdl(LINK(this, SmAlignDialog, DefaultButtonClickHdl)); + m_xDefaultButton->connect_clicked(LINK(this, SmAlignDialog, DefaultButtonClickHdl)); } SmAlignDialog::~SmAlignDialog() { - disposeOnce(); -} - -void SmAlignDialog::dispose() -{ - m_pLeft.clear(); - m_pCenter.clear(); - m_pRight.clear(); - m_pDefaultButton.clear(); - ModalDialog::dispose(); } void SmAlignDialog::ReadFrom(const SmFormat &rFormat) @@ -1034,31 +1023,22 @@ void SmAlignDialog::ReadFrom(const SmFormat &rFormat) switch (rFormat.GetHorAlign()) { case SmHorAlign::Left: - m_pLeft->Check(); - m_pCenter->Check(false); - m_pRight->Check(false); + m_xLeft->set_active(true); break; - case SmHorAlign::Center: - m_pLeft->Check(false); - m_pCenter->Check(); - m_pRight->Check(false); + m_xCenter->set_active(true); break; - case SmHorAlign::Right: - m_pLeft->Check(false); - m_pCenter->Check(false); - m_pRight->Check(); + m_xRight->set_active(true); break; } } - void SmAlignDialog::WriteTo(SmFormat &rFormat) const { - if (m_pLeft->IsChecked()) + if (m_xLeft->get_active()) rFormat.SetHorAlign(SmHorAlign::Left); - else if (m_pRight->IsChecked()) + else if (m_xRight->get_active()) rFormat.SetHorAlign(SmHorAlign::Right); else rFormat.SetHorAlign(SmHorAlign::Center); @@ -1066,7 +1046,6 @@ void SmAlignDialog::WriteTo(SmFormat &rFormat) const rFormat.RequestApplyChanges(); } - SmShowSymbolSetWindow::SmShowSymbolSetWindow(vcl::Window *pParent, WinBits nStyle) : Control(pParent, nStyle) , m_pVScrollBar(nullptr) diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 686b9b75ef96..c4a312888d0b 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -996,19 +996,19 @@ void SmDocShell::Execute(SfxRequest& rReq) case SID_ALIGN: { - VclPtrInstance< SmAlignDialog > xAlignDialog(nullptr); + SmAlignDialog aAlignDialog(rReq.GetFrameWeld()); SmFormat aOldFormat = GetFormat(); - xAlignDialog->ReadFrom( aOldFormat ); - if (xAlignDialog->Execute() == RET_OK) + aAlignDialog.ReadFrom( aOldFormat ); + if (aAlignDialog.run() == RET_OK) { SmFormat aNewFormat( aOldFormat ); - xAlignDialog->WriteTo(aNewFormat); + aAlignDialog.WriteTo(aNewFormat); SmModule *pp = SM_MOD(); SmFormat aFmt( pp->GetConfig()->GetStandardFormat() ); - xAlignDialog->WriteTo( aFmt ); + aAlignDialog.WriteTo( aFmt ); pp->GetConfig()->SetStandardFormat( aFmt ); ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager(); |