diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-05-03 16:46:52 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-05-04 09:54:00 +0200 |
commit | 736cebb414af587e7ac82f1326b06ce4022badf4 (patch) | |
tree | 5f2914ff65971760028510fe9158538b47a0aefc /sc/source | |
parent | c1293a13b0e98eae5a2e12e59693bdfbf93b6dc9 (diff) |
weld ScMergeCellsDialog
Change-Id: I513f7e9b0c969706646821af508e41bb2331bbc2
Reviewed-on: https://gerrit.libreoffice.org/53809
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 'sc/source')
-rw-r--r-- | sc/source/ui/inc/mergecellsdialog.hxx | 15 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/mergecellsdialog.cxx | 30 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 7 |
3 files changed, 19 insertions, 33 deletions
diff --git a/sc/source/ui/inc/mergecellsdialog.hxx b/sc/source/ui/inc/mergecellsdialog.hxx index 49ef2da533b5..5fcbea926dda 100644 --- a/sc/source/ui/inc/mergecellsdialog.hxx +++ b/sc/source/ui/inc/mergecellsdialog.hxx @@ -11,9 +11,7 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_MERGECELLSDIALOG_HXX #define INCLUDED_SC_SOURCE_UI_INC_MERGECELLSDIALOG_HXX -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/fixed.hxx> +#include <vcl/weld.hxx> enum ScMergeCellsOption { @@ -22,16 +20,15 @@ enum ScMergeCellsOption EmptyContentHiddenCells }; -class ScMergeCellsDialog : public ModalDialog +class ScMergeCellsDialog : public weld::GenericDialogController { - VclPtr<RadioButton> mpRBMoveContent; - VclPtr<RadioButton> mpRBKeepContent; - VclPtr<RadioButton> mpRBEmptyContent; + std::unique_ptr<weld::RadioButton> m_xRBMoveContent; + std::unique_ptr<weld::RadioButton> m_xRBKeepContent; + std::unique_ptr<weld::RadioButton> m_xRBEmptyContent; public: - ScMergeCellsDialog( vcl::Window * pParent ); + ScMergeCellsDialog(weld::Window* pParent); virtual ~ScMergeCellsDialog() override; - virtual void dispose() override; ScMergeCellsOption GetMergeCellsOption(); }; diff --git a/sc/source/ui/miscdlgs/mergecellsdialog.cxx b/sc/source/ui/miscdlgs/mergecellsdialog.cxx index aaff85bf8eaf..b936890437ab 100644 --- a/sc/source/ui/miscdlgs/mergecellsdialog.cxx +++ b/sc/source/ui/miscdlgs/mergecellsdialog.cxx @@ -10,41 +10,29 @@ #include <mergecellsdialog.hxx> -ScMergeCellsDialog::ScMergeCellsDialog( vcl::Window * pParent ) - : ModalDialog( pParent, "MergeCellsDialog", - "modules/scalc/ui/mergecellsdialog.ui" ) +ScMergeCellsDialog::ScMergeCellsDialog(weld::Window * pParent) + : GenericDialogController(pParent, "modules/scalc/ui/mergecellsdialog.ui", "MergeCellsDialog") + , m_xRBMoveContent(m_xBuilder->weld_radio_button("move-cells-radio")) + , m_xRBKeepContent(m_xBuilder->weld_radio_button("keep-content-radio")) + , m_xRBEmptyContent(m_xBuilder->weld_radio_button("empty-cells-radio")) { - get(mpRBMoveContent, "move-cells-radio"); - get(mpRBKeepContent, "keep-content-radio"); - get(mpRBEmptyContent, "empty-cells-radio"); - - mpRBKeepContent->Check(); + m_xRBKeepContent->set_active(true); } ScMergeCellsDialog::~ScMergeCellsDialog() { - disposeOnce(); -} - -void ScMergeCellsDialog::dispose() -{ - mpRBMoveContent.disposeAndClear(); - mpRBKeepContent.disposeAndClear(); - mpRBEmptyContent.disposeAndClear(); - ModalDialog::dispose(); } ScMergeCellsOption ScMergeCellsDialog::GetMergeCellsOption() { - if ( mpRBMoveContent->IsChecked() ) + if ( m_xRBMoveContent->get_active() ) return MoveContentHiddenCells; - if ( mpRBKeepContent->IsChecked() ) + if ( m_xRBKeepContent->get_active() ) return KeepContentHiddenCells; - if ( mpRBEmptyContent->IsChecked() ) + if ( m_xRBEmptyContent->get_active() ) return EmptyContentHiddenCells; assert(!"Unknown selection for merge cells."); return KeepContentHiddenCells; // default value - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 956593bfd234..29da9f810ff0 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1148,12 +1148,13 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bCenter ) bool bShowDialog = officecfg::Office::Calc::Compatibility::MergeCells::ShowDialog::get(); if (!bApi && bShowDialog) { - ScopedVclPtr<ScMergeCellsDialog> aBox( VclPtr<ScMergeCellsDialog>::Create( GetViewData().GetDialogParent() ) ); - sal_uInt16 nRetVal = aBox->Execute(); + vcl::Window* pWin = GetViewData().GetDialogParent(); + ScMergeCellsDialog aBox(pWin ? pWin->GetFrameWeld() : nullptr); + sal_uInt16 nRetVal = aBox.run(); if ( nRetVal == RET_OK ) { - switch ( aBox->GetMergeCellsOption() ) + switch (aBox.GetMergeCellsOption()) { case MoveContentHiddenCells: rDoContents = true; |