diff --git a/sc/source/ui/inc/solveroptions.hxx b/sc/source/ui/inc/solveroptions.hxx index 4d999ad76b95..9ad1fb0f6c17 100644 --- a/sc/source/ui/inc/solveroptions.hxx +++ b/sc/source/ui/inc/solveroptions.hxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -68,15 +69,14 @@ public: const css::uno::Sequence& GetProperties(); }; -class ScSolverIntegerDialog : public ModalDialog +class ScSolverIntegerDialog : public weld::GenericDialogController { - VclPtr m_pFrame; - VclPtr m_pNfValue; + std::unique_ptr m_xFrame; + std::unique_ptr m_xNfValue; public: - ScSolverIntegerDialog( vcl::Window * pParent ); + ScSolverIntegerDialog(weld::Window* pParent); virtual ~ScSolverIntegerDialog() override; - virtual void dispose() override; void SetOptionName( const OUString& rName ); void SetValue( sal_Int32 nValue ); diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 9d0e8b043a73..18fea8c6a470 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -333,12 +333,12 @@ void ScSolverOptionsDialog::EditOption() } else { - ScopedVclPtrInstance< ScSolverIntegerDialog > aIntDialog( this ); - aIntDialog->SetOptionName( pStringItem->GetText() ); - aIntDialog->SetValue( pStringItem->GetIntValue() ); - if ( aIntDialog->Execute() == RET_OK ) + ScSolverIntegerDialog aIntDialog(GetFrameWeld()); + aIntDialog.SetOptionName( pStringItem->GetText() ); + aIntDialog.SetValue( pStringItem->GetIntValue() ); + if (aIntDialog.run() == RET_OK) { - pStringItem->SetIntValue( aIntDialog->GetValue() ); + pStringItem->SetIntValue(aIntDialog.GetValue()); m_pLbSettings->InvalidateEntry( pEntry ); } } @@ -389,44 +389,30 @@ IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsSelHdl, SvTreeListBox*, void) m_pBtnEdit->Enable( !bCheckbox ); } -ScSolverIntegerDialog::ScSolverIntegerDialog(vcl::Window * pParent) - : ModalDialog( pParent, "IntegerDialog", - "modules/scalc/ui/integerdialog.ui" ) +ScSolverIntegerDialog::ScSolverIntegerDialog(weld::Window * pParent) + : GenericDialogController(pParent, "modules/scalc/ui/integerdialog.ui", "IntegerDialog") + , m_xFrame(m_xBuilder->weld_frame("frame")) + , m_xNfValue(m_xBuilder->weld_spin_button("value")) { - get(m_pFrame, "frame"); - get(m_pNfValue, "value"); } ScSolverIntegerDialog::~ScSolverIntegerDialog() { - disposeOnce(); -} - -void ScSolverIntegerDialog::dispose() -{ - m_pFrame.clear(); - m_pNfValue.clear(); - ModalDialog::dispose(); } void ScSolverIntegerDialog::SetOptionName( const OUString& rName ) { - m_pFrame->set_label(rName); + m_xFrame->set_label(rName); } void ScSolverIntegerDialog::SetValue( sal_Int32 nValue ) { - m_pNfValue->SetValue( nValue ); + m_xNfValue->set_value( nValue ); } sal_Int32 ScSolverIntegerDialog::GetValue() const { - sal_Int64 nValue = m_pNfValue->GetValue(); - if ( nValue < SAL_MIN_INT32 ) - return SAL_MIN_INT32; - if ( nValue > SAL_MAX_INT32 ) - return SAL_MAX_INT32; - return static_cast(nValue); + return m_xNfValue->get_value(); } ScSolverValueDialog::ScSolverValueDialog(weld::Window* pParent) diff --git a/sc/uiconfig/scalc/ui/integerdialog.ui b/sc/uiconfig/scalc/ui/integerdialog.ui index 09f383b26afc..c25dc896087e 100644 --- a/sc/uiconfig/scalc/ui/integerdialog.ui +++ b/sc/uiconfig/scalc/ui/integerdialog.ui @@ -1,5 +1,5 @@ - + @@ -13,7 +13,13 @@ 6 Edit Setting False + True + 0 + 0 dialog + + + False