diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-04-01 14:57:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-04-01 17:46:33 +0200 |
commit | 7de7e8ecb5d53d219e47dccf9b1b767852b215e2 (patch) | |
tree | abaf283f9ffd8380c96923d07c786407691a2077 /sc/source/ui/miscdlgs/optsolver.cxx | |
parent | 554bae3e550fb3c64473851bf9a24cb4a2eabdd8 (diff) |
weld ScSolverProgressDialog
Change-Id: I5ee081b1c9e542a2b717b4eb27ee0aba7331d57d
Reviewed-on: https://gerrit.libreoffice.org/70071
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/miscdlgs/optsolver.cxx')
-rw-r--r-- | sc/source/ui/miscdlgs/optsolver.cxx | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 239591ac28ba..4fd377d87b47 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -45,35 +45,27 @@ using namespace com::sun::star; -ScSolverProgressDialog::ScSolverProgressDialog(vcl::Window* pParent) - : ModelessDialog(pParent, "SolverProgressDialog", - "modules/scalc/ui/solverprogressdialog.ui") +ScSolverProgressDialog::ScSolverProgressDialog(weld::Window* pParent) + : GenericDialogController(pParent, "modules/scalc/ui/solverprogressdialog.ui", + "SolverProgressDialog") + , m_xFtTime(m_xBuilder->weld_label("progress")) { - get(m_pFtTime, "progress"); } ScSolverProgressDialog::~ScSolverProgressDialog() { - disposeOnce(); -} - -void ScSolverProgressDialog::dispose() -{ - m_pFtTime.clear(); - ModelessDialog::dispose(); } - void ScSolverProgressDialog::HideTimeLimit() { - m_pFtTime->Hide(); + m_xFtTime->hide(); } void ScSolverProgressDialog::SetTimeLimit( sal_Int32 nSeconds ) { - OUString aOld = m_pFtTime->GetText(); + OUString aOld = m_xFtTime->get_label(); OUString aNew = aOld.replaceFirst("#", OUString::number(nSeconds)); - m_pFtTime->SetText( aNew ); + m_xFtTime->set_label(aNew); } ScSolverNoSolutionDialog::ScSolverNoSolutionDialog(weld::Window* pParent, const OUString& rErrorText) @@ -811,15 +803,15 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal { // show progress dialog - ScopedVclPtrInstance< ScSolverProgressDialog > aProgress( this ); + std::shared_ptr<ScSolverProgressDialog> xProgress(new ScSolverProgressDialog(GetFrameWeld())); sal_Int32 nTimeout = 0; if ( FindTimeout( nTimeout ) ) - aProgress->SetTimeLimit( nTimeout ); + xProgress->SetTimeLimit( nTimeout ); else - aProgress->HideTimeLimit(); - aProgress->Show(); - aProgress->Update(); - aProgress->Flush(); + xProgress->HideTimeLimit(); + + weld::DialogController::runAsync(xProgress, [](sal_Int32 /*nResult*/){}); + // try to make sure the progress dialog is painted before continuing Application::Reschedule(true); @@ -1009,7 +1001,8 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal xSolver->solve(); bool bSuccess = xSolver->getSuccess(); - aProgress->Hide(); + xProgress->response(RET_CLOSE); + bool bClose = false; bool bRestore = true; // restore old values unless a solution is accepted if ( bSuccess ) |