include/sfx2/childwin.hxx | 2 ++ sc/source/ui/dbgui/validate.cxx | 6 ++++++ sc/source/ui/inc/validate.hxx | 2 ++ sfx2/source/appl/childwin.cxx | 21 +++++++++++++++------ 4 files changed, 25 insertions(+), 6 deletions(-)
New commits: commit 1f4093d11d6d99490972d37df7e9f30e8ebc1583 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Mon Jul 3 19:56:43 2023 +0200 Commit: Balazs Varga <balazs.varga.ext...@allotropia.de> CommitDate: Sun Jul 16 20:32:24 2023 +0200 tdf#155708 Fix validity dialog closes when moving focus to another window Do not close Validation window if click on another Calc sheet. Change-Id: I75569cbb91ebd445ac57f7a52d914297c21349e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153930 Tested-by: Balazs Varga <balazs.varga.ext...@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> (cherry picked from commit a5c61b143d53bb10430b8a486874856c16a2d86c) and (cherry picked from commit efaa065eb7053954242c83760f897e7dba2e9fe8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154033 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx index 57c2369233ef..6e4b20037be0 100644 --- a/include/sfx2/childwin.hxx +++ b/include/sfx2/childwin.hxx @@ -156,6 +156,8 @@ public: }; const int nCloseResponseToJustHide = -42; +// sc.hrc --> SID_VALIDITY_REFERENCE: 26161 +const sal_uInt16 nScValidityWindowSlotID = 26161; #define SFX_DECL_CHILDWINDOW(Class) \ public : \ diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index f202d8ab7926..c0f62d4521b8 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -104,6 +104,12 @@ ScValidationDlg::ScValidationDlg(weld::Window* pParent, const SfxItemSet* pArgSe void ScValidationDlg::EndDialog(int nResponse) { + // tdf#155708 - do not close, just hide validation window if we click in another sheet + if (nResponse == nCloseResponseToJustHide && getDialog()->get_visible()) + { + getDialog()->hide(); + return; + } // tdf#137215 ensure original modality of true is restored before dialog loop ends if (m_bOwnRefHdlr) RemoveRefDlg(true); diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx index c8ed4447c400..c58ae53bbf7f 100644 --- a/sc/source/ui/inc/validate.hxx +++ b/sc/source/ui/inc/validate.hxx @@ -154,6 +154,8 @@ class ScValidationDlg bool m_bOwnRefHdlr:1; bool m_bRefInputting:1; + const int nCloseResponseToJustHide = -42; + std::unique_ptr<weld::Container> m_xHBox; bool EnterRefStatus(); diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 1fe6c39a7a03..633c33bb35c9 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -522,12 +522,21 @@ void SfxChildWindow::Show( ShowFlags nFlags ) { if (!xController->getDialog()->get_visible()) { - weld::DialogController::runAsync(xController, - [this](sal_Int32 nResult) { - if (nResult == nCloseResponseToJustHide) - return; - xController->Close(); - }); + if (nScValidityWindowSlotID == GetType()) + { + // tdf#155708 - do not run a new (Async) validation window, + // because we already have one in sync mode, just show the running one + xController->getDialog()->show(); + } + else + { + weld::DialogController::runAsync(xController, + [this](sal_Int32 nResult) { + if (nResult == nCloseResponseToJustHide) + return; + xController->Close(); + }); + } } } else