sc/source/ui/inc/solvrdlg.hxx | 2 + sc/source/ui/miscdlgs/solvrdlg.cxx | 49 +++++++++++++------------------------ 2 files changed, 20 insertions(+), 31 deletions(-)
New commits: commit 8a7e25d1320f5ea25e74af440810e10f8c02f65a Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Dec 13 13:31:57 2019 +0000 Commit: Xisco Faulí <xiscofa...@libreoffice.org> CommitDate: Tue Dec 17 12:09:05 2019 +0100 Resolves: tdf#128077 cancel goalseek subdialogs on forced removal Change-Id: Ifd0d81d8b5e1b6bea68e74be1cebf082e24d6dde Reviewed-on: https://gerrit.libreoffice.org/85116 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> diff --git a/sc/source/ui/inc/solvrdlg.hxx b/sc/source/ui/inc/solvrdlg.hxx index 474d202c0a2b..d661d320928d 100644 --- a/sc/source/ui/inc/solvrdlg.hxx +++ b/sc/source/ui/inc/solvrdlg.hxx @@ -74,6 +74,8 @@ private: std::unique_ptr<weld::Button> m_xBtnOk; std::unique_ptr<weld::Button> m_xBtnCancel; + std::shared_ptr<weld::MessageDialog> m_xMessageBox; + void Init(); bool CheckTargetValue( const OUString& rStrVal ); void RaiseError( ScSolverErr eError ); diff --git a/sc/source/ui/miscdlgs/solvrdlg.cxx b/sc/source/ui/miscdlgs/solvrdlg.cxx index 25a36c30941d..b4a848671259 100644 --- a/sc/source/ui/miscdlgs/solvrdlg.cxx +++ b/sc/source/ui/miscdlgs/solvrdlg.cxx @@ -31,17 +31,6 @@ #include <sc.hrc> #include <solvrdlg.hxx> -namespace -{ - void lclErrorDialog(weld::Window* pParent, const OUString& rString, const std::function<void(sal_Int32)>& func) - { - std::shared_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, - VclMessageType::Warning, VclButtonsType::Ok, - rString)); - xBox->runAsync(xBox, func); - } -} - ScSolverDlg::ScSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, ScDocument* pDocument, const ScAddress& aCursorPos ) @@ -76,6 +65,9 @@ ScSolverDlg::ScSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pP ScSolverDlg::~ScSolverDlg() { + if (m_xMessageBox) + m_xMessageBox->response(RET_CANCEL); + assert(!m_xMessageBox); } void ScSolverDlg::Init() @@ -152,36 +144,31 @@ void ScSolverDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) void ScSolverDlg::RaiseError( ScSolverErr eError ) { - switch ( eError ) + OUString sMessage; + + switch (eError) { case SOLVERR_NOFORMULA: - lclErrorDialog(m_xDialog.get(), errMsgNoFormula, - [this](sal_Int32 /*nResult*/) { - m_xEdFormulaCell->GrabFocus(); - }); + sMessage = errMsgNoFormula; break; - case SOLVERR_INVALID_FORMULA: - lclErrorDialog(m_xDialog.get(), errMsgInvalidForm, - [this](sal_Int32 /*nResult*/) { - m_xEdFormulaCell->GrabFocus(); - }); + sMessage = errMsgInvalidForm; break; - case SOLVERR_INVALID_VARIABLE: - lclErrorDialog(m_xDialog.get(), errMsgInvalidVar, - [this](sal_Int32 /*nResult*/) { - m_xEdVariableCell->GrabFocus(); - }); + sMessage = errMsgInvalidVar; break; - case SOLVERR_INVALID_TARGETVALUE: - lclErrorDialog(m_xDialog.get(), errMsgInvalidVal, - [this](sal_Int32 /*nResult*/) { - m_xEdTargetVal->grab_focus(); - }); + sMessage = errMsgInvalidVal; break; } + + m_xMessageBox.reset(Application::CreateMessageDialog(m_xDialog.get(), + VclMessageType::Warning, VclButtonsType::Ok, + sMessage)); + m_xMessageBox->runAsync(m_xMessageBox, [this](sal_Int32 /*nResult*/) { + m_xEdTargetVal->grab_focus(); + m_xMessageBox.reset(); + }); } bool ScSolverDlg::IsRefInputMode() const _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits