add Application::EndAllPopups

Change-Id: Id4548aa2e32f736f4cd332ba824137d88fe963fc
This commit is contained in:
Caolán McNamara 2015-10-19 15:41:03 +01:00
parent 6c39f7bba6
commit 7fb1b14750
3 changed files with 20 additions and 0 deletions

View file

@ -1485,6 +1485,10 @@ public:
*/
static void EndAllDialogs();
/** Cancel all open popups
*/
static void EndAllPopups();
///@}
// For vclbootstrapprotector:

View file

@ -163,6 +163,7 @@ struct ImplSVAppData
DECL_STATIC_LINK_TYPED(ImplSVAppData, ImplQuitMsg, void*, void);
DECL_STATIC_LINK_TYPED(ImplSVAppData, ImplEndAllDialogsMsg, void*, void);
DECL_STATIC_LINK_TYPED(ImplSVAppData, ImplEndAllPopupsMsg, void*, void);
DECL_STATIC_LINK_TYPED(ImplSVAppData, ImplVclEventTestingHdl, void*, void);
DECL_LINK_TYPED(VclEventTestingHdl, Idle*, void);
};

View file

@ -37,6 +37,7 @@
#include <unotools/syslocaleoptions.hxx>
#include "vcl/dialog.hxx"
#include "vcl/floatwin.hxx"
#include "vcl/settings.hxx"
#include "vcl/keycod.hxx"
#include "vcl/event.hxx"
@ -328,6 +329,13 @@ const vcl::KeyCode* Application::GetReservedKeyCode( sal_uLong i )
return &ImplReservedKeys::get()->first[i].mKeyCode;
}
IMPL_STATIC_LINK_NOARG_TYPED( ImplSVAppData, ImplEndAllPopupsMsg, void*, void )
{
ImplSVData* pSVData = ImplGetSVData();
while (pSVData->maWinData.mpFirstFloat)
pSVData->maWinData.mpFirstFloat->EndPopupMode(FloatWinPopupEndFlags::Cancel);
}
IMPL_STATIC_LINK_NOARG_TYPED( ImplSVAppData, ImplEndAllDialogsMsg, void*, void )
{
vcl::Window* pAppWindow = Application::GetFirstTopLevelWindow();
@ -343,6 +351,12 @@ void Application::EndAllDialogs()
Application::PostUserEvent( LINK( NULL, ImplSVAppData, ImplEndAllDialogsMsg ) );
}
void Application::EndAllPopups()
{
Application::PostUserEvent( LINK( NULL, ImplSVAppData, ImplEndAllPopupsMsg ) );
}
namespace
{
bool InjectKeyEvent(SvStream& rStream)
@ -382,6 +396,7 @@ namespace
void CloseDialogsAndQuit()
{
Application::EndAllPopups();
Application::EndAllDialogs();
Application::Quit();
}