summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-01-24 17:10:48 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-01-24 20:38:51 +0100
commit6c5c6ede0103e15b8e8ac432f0ca7f6e00c9dcb4 (patch)
treeac9eee5af19ae935b09e58b5d0944b8b692c3e46
parentde170db187852c42f6bad845d00c2b19b99e9a31 (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>
-rw-r--r--include/sfx2/basedlgs.hxx4
-rw-r--r--include/sfx2/childwin.hxx1
-rw-r--r--sc/source/ui/dbgui/validate.cxx4
-rw-r--r--sc/source/ui/inc/validate.hxx2
-rw-r--r--sfx2/source/appl/childwin.cxx8
-rw-r--r--sfx2/source/appl/workwin.cxx6
-rw-r--r--sfx2/source/dialog/basedlgs.cxx8
-rw-r--r--sw/source/ui/fldui/fldtdlg.cxx6
-rw-r--r--sw/source/uibase/inc/fldtdlg.hxx2
9 files changed, 25 insertions, 16 deletions
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
index c198f12dbc3b..e7cf250d1159 100644
--- a/include/sfx2/basedlgs.hxx
+++ b/include/sfx2/basedlgs.hxx
@@ -48,7 +48,7 @@ public:
// when the dialog has an associated SfxChildWin, typically for Modeless interaction
virtual void ChildWinDispose() {} // called from the associated SfxChildWin dtor
virtual void Close() {} // called by the SfxChildWin when the dialog is closed
- virtual void EndDialog(); // called by the SfxChildWin to close the dialog
+ virtual void EndDialog(int nResponse); // called by the SfxChildWin to close the dialog
};
class SfxModelessDialog_Impl;
@@ -73,7 +73,7 @@ public:
void Initialize (SfxChildWinInfo const * pInfo);
bool IsClosing() const;
virtual void Close() override;
- virtual void EndDialog() override;
+ virtual void EndDialog(int nRespose) override;
virtual void Activate() override;
virtual void Deactivate() override;
virtual void ChildWinDispose() override;
diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
index 66d125accaf5..6a93b46d84be 100644
--- a/include/sfx2/childwin.hxx
+++ b/include/sfx2/childwin.hxx
@@ -155,6 +155,7 @@ public:
SAL_DLLPRIVATE void SetFactory_Impl( const SfxChildWinFactory* );
};
+const int nCloseResponseToJustHide = -42;
#define SFX_DECL_CHILDWINDOW(Class) \
public : \
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index 237ec6c94f83..ac75d90fd8a2 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -101,12 +101,12 @@ ScValidationDlg::ScValidationDlg(weld::Window* pParent, const SfxItemSet* pArgSe
}
}
-void ScValidationDlg::EndDialog()
+void ScValidationDlg::EndDialog(int nResponse)
{
// tdf#137215 ensure original modality of true is restored before dialog loop ends
if (m_bOwnRefHdlr)
RemoveRefDlg(true);
- ScValidationDlgBase::EndDialog();
+ ScValidationDlgBase::EndDialog(nResponse);
}
ScValidationDlg::~ScValidationDlg()
diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx
index 6117e87b7984..618cfb23f1c0 100644
--- a/sc/source/ui/inc/validate.hxx
+++ b/sc/source/ui/inc/validate.hxx
@@ -176,7 +176,7 @@ public:
void SetModal(bool bModal) { m_xDialog->set_modal(bModal); }
- virtual void EndDialog() override;
+ virtual void EndDialog(int nResponse) override;
virtual void SetReference( const ScRange& rRef, ScDocument& rDoc ) override
{
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;
diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
index 2075175ec57c..002f14cc39ba 100644
--- a/sw/source/ui/fldui/fldtdlg.cxx
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -102,10 +102,10 @@ SwFieldDlg::~SwFieldDlg()
{
}
-void SwFieldDlg::EndDialog()
+void SwFieldDlg::EndDialog(int nResponse)
{
m_bClosing = true;
- SfxTabDialogController::EndDialog();
+ SfxTabDialogController::EndDialog(nResponse);
m_bClosing = false;
}
@@ -121,7 +121,7 @@ void SwFieldDlg::Close()
// If Execute action did fail for whatever reason, this means that request
// to close did fail or wasn't delivered to SwTextShell::ExecField().
// Just explicitly close dialog in this case.
- SfxTabDialogController::EndDialog();
+ SfxTabDialogController::EndDialog(RET_CLOSE);
}
}
diff --git a/sw/source/uibase/inc/fldtdlg.hxx b/sw/source/uibase/inc/fldtdlg.hxx
index b2cd767e41f1..b7bda89f9d62 100644
--- a/sw/source/uibase/inc/fldtdlg.hxx
+++ b/sw/source/uibase/inc/fldtdlg.hxx
@@ -59,7 +59,7 @@ public:
void ActivateDatabasePage();
void ShowReferencePage();
virtual void Close() override;
- virtual void EndDialog() override;
+ virtual void EndDialog(int nResponse) override;
virtual void Activate() override;
};