diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-01-24 17:10:48 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-01-24 20:38:51 +0100 |
commit | 6c5c6ede0103e15b8e8ac432f0ca7f6e00c9dcb4 (patch) | |
tree | ac9eee5af19ae935b09e58b5d0944b8b692c3e46 /sfx2 | |
parent | de170db187852c42f6bad845d00c2b19b99e9a31 (diff) |
tdf#146913 don't destroy the dialog if we just want to hide it
Change-Id: Ie534aba915120d12e65aa965e5435bc7575ecb29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128879
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/childwin.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/appl/workwin.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 8 |
3 files changed, 15 insertions, 7 deletions
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 263f750f9b12..944fe47ed64a 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -511,7 +511,7 @@ void SfxChildWindow::SetVisible_Impl( bool bVis ) void SfxChildWindow::Hide() { if (xController) - xController->EndDialog(); + xController->EndDialog(nCloseResponseToJustHide); else pWindow->Hide(); } @@ -523,7 +523,11 @@ void SfxChildWindow::Show( ShowFlags nFlags ) if (!xController->getDialog()->get_visible()) { weld::DialogController::runAsync(xController, - [this](sal_Int32 /*nResult*/){ xController->Close(); }); + [this](sal_Int32 nResult) { + if (nResult == nCloseResponseToJustHide) + return; + xController->Close(); + }); } } else diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index ef9f546c20fa..ca0e55d5cdb8 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -999,7 +999,11 @@ void SfxWorkWindow::ShowChildren_Impl() { auto xController = pCli->xController; weld::DialogController::runAsync(xController, - [=](sal_Int32 /*nResult*/){ xController->Close(); }); + [=](sal_Int32 nResult){ + if (nResult == nCloseResponseToJustHide) + return; + xController->Close(); + }); } } else diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index f28d31d7882d..7319b9981419 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -142,11 +142,11 @@ SfxModelessDialogController::~SfxModelessDialogController() m_pBindings->SetActiveFrame(nullptr); } -void SfxDialogController::EndDialog() +void SfxDialogController::EndDialog(int nResponse) { if (!m_xDialog->get_visible()) return; - response(RET_CLOSE); + response(nResponse); } bool SfxModelessDialogController::IsClosing() const @@ -154,7 +154,7 @@ bool SfxModelessDialogController::IsClosing() const return m_xImpl->bClosing; } -void SfxModelessDialogController::EndDialog() +void SfxModelessDialogController::EndDialog(int nResponse) { if (m_xImpl->bClosing) return; @@ -163,7 +163,7 @@ void SfxModelessDialogController::EndDialog() // stack frame. auto aHoldSelf = shared_from_this(); m_xImpl->bClosing = true; - SfxDialogController::EndDialog(); + SfxDialogController::EndDialog(nResponse); if (!m_xImpl) return; m_xImpl->bClosing = false; |