diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-02-13 10:54:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-02-13 16:51:11 +0100 |
commit | a2e0abc7c6b02e2ea37d269e216d6550be76c8fe (patch) | |
tree | eca3a48065db76f1740a3a83465c341abf942793 /vcl | |
parent | 119044e8c9e13dcdc0d5d1e080c8f168446c48f4 (diff) |
factor out dialog hacks
Change-Id: Iceefc8d739fb93b97adfa1e35d8308f0c48f02e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88600
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/svapp.cxx | 3 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 36 |
2 files changed, 31 insertions, 8 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 6e389da9c87a..4f70cceae081 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -33,6 +33,7 @@ #include <unotools/syslocaleoptions.hxx> #include <vcl/dialog.hxx> +#include <vcl/dialoghelper.hxx> #include <vcl/lok.hxx> #include <vcl/floatwin.hxx> #include <vcl/settings.hxx> @@ -300,7 +301,7 @@ IMPL_STATIC_LINK_NOARG( ImplSVAppData, ImplEndAllDialogsMsg, void*, void ) vcl::Window* pAppWindow = Application::GetFirstTopLevelWindow(); while (pAppWindow) { - Dialog::EndAllDialogs(pAppWindow); + vcl::EndAllDialogs(pAppWindow); pAppWindow = Application::GetNextTopLevelWindow(pAppWindow); } } diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 588fbbd874fa..91516baffeb5 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -50,6 +50,7 @@ #include <vcl/button.hxx> #include <vcl/mnemonic.hxx> #include <vcl/dialog.hxx> +#include <vcl/dialoghelper.hxx> #include <vcl/settings.hxx> #include <vcl/virdev.hxx> #include <vcl/weld.hxx> @@ -1135,19 +1136,40 @@ void Dialog::EndDialog( long nResult ) } } -void Dialog::EndAllDialogs( vcl::Window const * pParent ) +namespace vcl { - ImplSVData* pSVData = ImplGetSVData(); - auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs; + void EndAllDialogs( vcl::Window const * pParent ) + { + ImplSVData* pSVData = ImplGetSVData(); + auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs; + + for (auto it = rExecuteDialogs.rbegin(); it != rExecuteDialogs.rend(); ++it) + { + if (!pParent || pParent->IsWindowOrChild(*it, true)) + { + (*it)->EndDialog(); + (*it)->PostUserEvent(Link<void*, void>()); + } + } + } - for (auto it = rExecuteDialogs.rbegin(); it != rExecuteDialogs.rend(); ++it) + void EnableDialogInput(vcl::Window* pWindow) { - if (!pParent || pParent->IsWindowOrChild(*it, true)) + if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow)) { - (*it)->EndDialog(); - (*it)->PostUserEvent(Link<void*, void>()); + pDialog->EnableInput(); } } + + bool CloseDialog(vcl::Window* pWindow) + { + if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow)) + { + pDialog->Close(); + return true; + } + return false; + } } void Dialog::SetModalInputMode( bool bModal ) |