summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/svdata.hxx1
-rw-r--r--vcl/source/app/svapp.cxx16
-rw-r--r--vcl/source/window/dialog.cxx67
-rw-r--r--vcl/source/window/msgbox.cxx16
4 files changed, 64 insertions, 36 deletions
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 9edd2e9d9d07..65e1c1010b36 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -144,6 +144,7 @@ struct ImplSVAppData
bool mbInAppMain = false; // is Application::Main() on stack
bool mbInAppExecute = false; // is Application::Execute() on stack
bool mbAppQuit = false; // is Application::Quit() called
+ bool mbShutdownDelayed = false;
bool mbSettingsInit = false; // true: Settings are initialized
Application::DialogCancelMode meDialogCancel = Application::DialogCancelMode::Off; // true: All Dialog::Execute() calls will be terminated immediately with return false
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index c4b900754f6f..5a5be865906f 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1677,4 +1677,20 @@ void Application::setDeInitHook(Link<LinkParamNone*,void> const & hook) {
pSVData->maAppData.mbInAppMain = true;
}
+void Application::SetShutdownDelayed()
+{
+ ImplSVData * pSVData = ImplGetSVData();
+ pSVData->maAppData.mbShutdownDelayed = true;
+}
+
+void Application::TriggerShutdownDelayed()
+{
+ ImplSVData * pSVData = ImplGetSVData();
+
+ if (pSVData->maAppData.mbShutdownDelayed && !Dialog::AreDialogsOpen())
+ {
+ Application::PostUserEvent(LINK(nullptr, ImplSVAppData, ImplPrepareExitMsg));
+ }
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index aa25bae8c74b..1ad300fdbf9b 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -356,6 +356,36 @@ void Dialog::ImplInitDialogData()
mpDialogImpl.reset(new DialogImpl);
}
+vcl::Window* Dialog::GetDefaultParent(WinBits nStyle)
+{
+ vcl::Window* pParent = Application::GetDefDialogParent();
+ if (!pParent && !(nStyle & WB_SYSTEMWINDOW))
+ pParent = ImplGetSVData()->maWinData.mpAppWin;
+
+ // If Parent is disabled, then we search for a modal dialog
+ // in this frame
+ if (pParent && (!pParent->IsInputEnabled() || pParent->IsInModalMode()))
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ Dialog* pExeDlg = pSVData->maWinData.mpLastExecuteDlg;
+ while (pExeDlg)
+ {
+ // only if visible and enabled
+ if (pParent->ImplGetFirstOverlapWindow()->IsWindowOrChild(pExeDlg, true) &&
+ pExeDlg->IsReallyVisible() &&
+ pExeDlg->IsEnabled() && pExeDlg->IsInputEnabled() && !pExeDlg->IsInModalMode())
+ {
+ pParent = pExeDlg;
+ break;
+ }
+
+ pExeDlg = pExeDlg->mpPrevExecuteDlg;
+ }
+ }
+
+ return pParent;
+}
+
void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag )
{
SystemWindowFlags nSysWinMode = Application::GetSystemWindowMode();
@@ -367,34 +397,13 @@ void Dialog::ImplInit( vcl::Window* pParent, WinBits nStyle, InitFlag eFlag )
// Now, all Dialogs are per default system windows !!!
nStyle |= WB_SYSTEMWINDOW;
- if (eFlag == InitFlag::NoParent)
+ if (InitFlag::NoParent == eFlag || InitFlag::NoParentCentered == eFlag)
+ {
pParent = nullptr;
+ }
else if (!pParent) // parent is NULL: get the default Dialog parent
{
- pParent = Application::GetDefDialogParent();
- if ( !pParent && !(nStyle & WB_SYSTEMWINDOW) )
- pParent = ImplGetSVData()->maWinData.mpAppWin;
-
- // If Parent is disabled, then we search for a modal dialog
- // in this frame
- if ( pParent && (!pParent->IsInputEnabled() || pParent->IsInModalMode()) )
- {
- ImplSVData* pSVData = ImplGetSVData();
- Dialog* pExeDlg = pSVData->maWinData.mpLastExecuteDlg;
- while ( pExeDlg )
- {
- // only if visible and enabled
- if ( pParent->ImplGetFirstOverlapWindow()->IsWindowOrChild( pExeDlg, true ) &&
- pExeDlg->IsReallyVisible() &&
- pExeDlg->IsEnabled() && pExeDlg->IsInputEnabled() && !pExeDlg->IsInModalMode() )
- {
- pParent = pExeDlg;
- break;
- }
-
- pExeDlg = pExeDlg->mpPrevExecuteDlg;
- }
- }
+ pParent = Dialog::GetDefaultParent(nStyle);
}
if ( !pParent || (nStyle & WB_SYSTEMWINDOW) ||
@@ -1011,6 +1020,14 @@ void Dialog::EndAllDialogs( vcl::Window const * pParent )
}
}
+bool Dialog::AreDialogsOpen()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ Dialog* pModDialog = pSVData->maWinData.mpLastExecuteDlg;
+
+ return (nullptr != pModDialog);
+}
+
void Dialog::SetModalInputMode( bool bModal )
{
if ( bModal == mbModalMode )
diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx
index e00f2e45bd61..096ad1f57d28 100644
--- a/vcl/source/window/msgbox.cxx
+++ b/vcl/source/window/msgbox.cxx
@@ -122,21 +122,15 @@ void MessBox::ImplInitButtons()
}
}
-MessBox::MessBox( vcl::Window* pParent, MessBoxStyle nMessBoxStyle,
- const OUString& rTitle, const OUString& rMessage ) :
- MessBox(pParent, nMessBoxStyle, 0, rTitle, rMessage)
-{
-}
-
MessBox::MessBox( vcl::Window* pParent, MessBoxStyle nMessBoxStyle, WinBits nWinBits,
- const OUString& rTitle, const OUString& rMessage ) :
+ const OUString& rTitle, const OUString& rMessage, Dialog::InitFlag eInitFlag) :
ButtonDialog( WindowType::MESSBOX ),
mbHelpBtn( false ),
mbCheck( false ),
mnMessBoxStyle( nMessBoxStyle ),
maMessText( rMessage )
{
- ImplInit( pParent, nWinBits | WB_MOVEABLE | WB_HORZ | WB_CENTER );
+ ImplInit( pParent, nWinBits | WB_MOVEABLE | WB_HORZ | WB_CENTER, eInitFlag);
ImplInitButtons();
if ( !rTitle.isEmpty() )
@@ -373,7 +367,7 @@ Size MessBox::GetOptimalSize() const
}
InfoBox::InfoBox( vcl::Window* pParent, const OUString& rMessage ) :
- MessBox( pParent, MessBoxStyle::Ok | MessBoxStyle::DefaultOk, OUString(), rMessage )
+ MessBox( pParent, MessBoxStyle::Ok | MessBoxStyle::DefaultOk, 0, OUString(), rMessage )
{
// Default Text is the display title from the application
if ( GetText().isEmpty() )
@@ -383,7 +377,7 @@ InfoBox::InfoBox( vcl::Window* pParent, const OUString& rMessage ) :
}
InfoBox::InfoBox( vcl::Window* pParent, MessBoxStyle nStyle, const OUString& rMessage ) :
- MessBox( pParent, nStyle, OUString(), rMessage )
+ MessBox( pParent, nStyle, 0, OUString(), rMessage )
{
// Default Text is the display title from the application
if ( GetText().isEmpty() )
@@ -437,7 +431,7 @@ OUString WarningBox::GetStandardText()
}
ErrorBox::ErrorBox( vcl::Window* pParent, const OUString& rMessage ) :
- MessBox( pParent, MessBoxStyle::Ok | MessBoxStyle::DefaultOk, OUString(), rMessage )
+ MessBox( pParent, MessBoxStyle::Ok | MessBoxStyle::DefaultOk, 0, OUString(), rMessage )
{
// Default Text is the display title from the application
if ( GetText().isEmpty() )