[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 16 12:51:41 UTC 2019


 sc/source/ui/inc/solvrdlg.hxx      |    2 +
 sc/source/ui/miscdlgs/solvrdlg.cxx |   49 +++++++++++++------------------------
 2 files changed, 20 insertions(+), 31 deletions(-)

New commits:
commit ad0922143a2f8ae1ca8622580afd9c6c34f4173f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Dec 13 13:31:57 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Dec 16 13:51:01 2019 +0100

    Resolves: tdf#128077 cancel goalseek subdialogs on forced removal
    
    Change-Id: Ifd0d81d8b5e1b6bea68e74be1cebf082e24d6dde
    Reviewed-on: https://gerrit.libreoffice.org/85115
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/inc/solvrdlg.hxx b/sc/source/ui/inc/solvrdlg.hxx
index f6fac01c7f97..3cb352dddf9e 100644
--- a/sc/source/ui/inc/solvrdlg.hxx
+++ b/sc/source/ui/inc/solvrdlg.hxx
@@ -72,6 +72,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


More information about the Libreoffice-commits mailing list