summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basctl/source/basicide/baside3.cxx4
-rw-r--r--basic/source/runtime/iosys.cxx6
-rw-r--r--basic/source/runtime/methods.cxx2
-rw-r--r--cui/source/customize/cfg.cxx4
-rw-r--r--framework/source/dispatch/closedispatcher.cxx9
-rw-r--r--framework/source/loadenv/loadenv.cxx4
-rw-r--r--include/vcl/dialog.hxx16
-rw-r--r--include/vcl/msgbox.hxx5
-rw-r--r--include/vcl/svapp.hxx6
-rw-r--r--sc/source/core/data/validat.cxx2
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx2
-rw-r--r--sc/source/ui/view/dbfunc.cxx2
-rw-r--r--sc/source/ui/view/dbfunc3.cxx2
-rw-r--r--sc/source/ui/view/spelleng.cxx2
-rw-r--r--sc/source/ui/view/viewfun2.cxx2
-rw-r--r--sfx2/source/doc/querytemplate.cxx2
-rw-r--r--svx/source/dialog/prtqry.cxx2
-rw-r--r--sw/source/ui/table/tautofmt.cxx2
-rw-r--r--sw/source/uibase/shells/textsh1.cxx2
-rw-r--r--sw/source/uibase/uiview/viewling.cxx2
-rw-r--r--uui/source/alreadyopen.cxx2
-rw-r--r--uui/source/filechanged.cxx2
-rw-r--r--uui/source/iahndl.cxx32
-rw-r--r--uui/source/lockcorrupt.cxx2
-rw-r--r--uui/source/lockfailed.cxx2
-rw-r--r--uui/source/openlocked.cxx2
-rw-r--r--uui/source/trylater.cxx2
-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
31 files changed, 153 insertions, 69 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 6100d83d2baf..1467e0e8f984 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -787,7 +787,7 @@ public:
NameClashQueryBox::NameClashQueryBox( vcl::Window* pParent,
const OUString& rTitle, const OUString& rMessage )
- : MessBox( pParent, MessBoxStyle::NONE, rTitle, rMessage )
+ : MessBox( pParent, MessBoxStyle::NONE, 0, rTitle, rMessage )
{
if ( !rTitle.isEmpty() )
SetText( rTitle );
@@ -812,7 +812,7 @@ public:
LanguageMismatchQueryBox::LanguageMismatchQueryBox( vcl::Window* pParent,
const OUString& rTitle, const OUString& rMessage )
- : MessBox( pParent, MessBoxStyle::NONE, rTitle, rMessage )
+ : MessBox( pParent, MessBoxStyle::NONE, 0, rTitle, rMessage )
{
if ( !rTitle.isEmpty() )
SetText( rTitle );
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 73899c44a5cc..ee131487bd5a 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -722,9 +722,9 @@ void SbiIoSystem::Shutdown()
{
#if defined __GNUC__
vcl::Window* pParent = Application::GetDefDialogParent();
- ScopedVclPtrInstance<MessBox>( pParent, MessBoxStyle::Ok, OUString(), aOut )->Execute();
+ ScopedVclPtrInstance<MessBox>( pParent, MessBoxStyle::Ok, 0, OUString(), aOut )->Execute();
#else
- ScopedVclPtrInstance<MessBox>( Application::GetDefDialogParent(), MessBoxStyle::Ok, OUString(), aOut )->Execute();
+ ScopedVclPtrInstance<MessBox>( Application::GetDefDialogParent(), MessBoxStyle::Ok, 0, OUString(), aOut )->Execute();
#endif
}
aOut.clear();
@@ -870,7 +870,7 @@ void SbiIoSystem::WriteCon(const OUString& rText)
if( !ScopedVclPtrInstance<MessBox>(
Application::GetDefDialogParent(),
MessBoxStyle::OkCancel | MessBoxStyle::DefaultOk,
- OUString(), s)->Execute() )
+ 0, OUString(), s)->Execute() )
{
nError = ERRCODE_BASIC_USER_ABORT;
}
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 26fcf6bb2161..680b65a6f817 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4345,7 +4345,7 @@ void SbRtl_MsgBox(StarBASIC *, SbxArray & rPar, bool)
pBox.reset(VclPtr<InfoBox>::Create( pParent, nWinBits, aMsg ));
break;
default:
- pBox.reset(VclPtr<MessBox>::Create( pParent, nWinBits, aTitle, aMsg ));
+ pBox.reset(VclPtr<MessBox>::Create( pParent, nWinBits, 0, aTitle, aMsg ));
}
pBox->SetText( aTitle );
short nRet = pBox->Execute();
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 98b9444d8b10..72d08f21d265 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -3467,7 +3467,7 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
SvxIconReplacementDialog::SvxIconReplacementDialog(
vcl::Window *pWindow, const OUString& aMessage, bool /*bYestoAll*/ )
:
-MessBox( pWindow, MessBoxStyle::DefaultYes, CuiResId( RID_SVXSTR_REPLACE_ICON_CONFIRM ), CuiResId( RID_SVXSTR_REPLACE_ICON_WARNING ) )
+MessBox( pWindow, MessBoxStyle::DefaultYes, 0, CuiResId( RID_SVXSTR_REPLACE_ICON_CONFIRM ), CuiResId( RID_SVXSTR_REPLACE_ICON_WARNING ) )
{
SetImage( WarningBox::GetStandardImage() );
@@ -3481,7 +3481,7 @@ MessBox( pWindow, MessBoxStyle::DefaultYes, CuiResId( RID_SVXSTR_REPLACE_ICON_CO
SvxIconReplacementDialog::SvxIconReplacementDialog(
vcl::Window *pWindow, const OUString& aMessage )
- : MessBox( pWindow, MessBoxStyle::YesNoCancel, CuiResId( RID_SVXSTR_REPLACE_ICON_CONFIRM ), CuiResId( RID_SVXSTR_REPLACE_ICON_WARNING ) )
+ : MessBox( pWindow, MessBoxStyle::YesNoCancel, 0, CuiResId( RID_SVXSTR_REPLACE_ICON_CONFIRM ), CuiResId( RID_SVXSTR_REPLACE_ICON_WARNING ) )
{
SetImage( WarningBox::GetStandardImage() );
SetMessText( ReplaceIconName( aMessage ));
diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx
index 8ee7791ecd60..2d89836b3453 100644
--- a/framework/source/dispatch/closedispatcher.cxx
+++ b/framework/source/dispatch/closedispatcher.cxx
@@ -38,6 +38,7 @@
#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
#include <vcl/syswin.hxx>
+#include <vcl/dialog.hxx>
#include <unotools/moduleoptions.hxx>
#include <comphelper/processfactory.hxx>
@@ -366,6 +367,14 @@ IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, LinkParamNone*, void)
}
}
+ // if we still have dialogs open, temporary suppress termination
+ if (bTerminateApp && Dialog::AreDialogsOpen())
+ {
+ Application::SetShutdownDelayed();
+ bCloseFrame = true;
+ bTerminateApp = false;
+ }
+
// Do it now ...
bool bSuccess = false;
if (bCloseFrame)
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 0bff7d4127ef..ea57962e9b26 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -371,6 +371,10 @@ void LoadEnv::startLoading()
if (!bStarted)
bStarted = impl_loadContent();
+ // This may have triggered Dialogs (error cases) that may have
+ // delayed the shutdown, so give delayed shutdown a chance
+ Application::TriggerShutdownDelayed();
+
// not started => general error
// We can't say - what was the reason for.
if (!bStarted)
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index 49737fdc6057..2730467e4cab 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -34,7 +34,17 @@ class VclButtonBox;
class VCL_DLLPUBLIC Dialog : public SystemWindow
{
public:
- enum class InitFlag { Default, NoParent };
+ enum class InitFlag
+ {
+ /** Use given parent or get a default one using GetDefaultParent(...) */
+ Default,
+
+ /** Suppress Parent so that Parent is not blocked (kind of modal mode) */
+ NoParent,
+
+ /** Suppress Parent (no modal, see above) and additionally center on default parent */
+ NoParentCentered
+ };
private:
VclPtr<Dialog> mpPrevExecuteDlg;
@@ -84,6 +94,9 @@ public:
virtual ~Dialog() override;
virtual void dispose() override;
+ // get the default parent for a dialog as is done in standard initialization
+ static vcl::Window* GetDefaultParent(WinBits nStyle);
+
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
virtual void StateChanged( StateChangedType nStateChange ) override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
@@ -130,6 +143,7 @@ public:
void EndDialog( long nResult = 0 );
static void EndAllDialogs( vcl::Window const * pParent );
+ static bool AreDialogsOpen();
void GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
diff --git a/include/vcl/msgbox.hxx b/include/vcl/msgbox.hxx
index 8504c6c25ad9..7c377170566c 100644
--- a/include/vcl/msgbox.hxx
+++ b/include/vcl/msgbox.hxx
@@ -69,10 +69,9 @@ protected:
SAL_DLLPRIVATE void ImplPosControls();
public:
- MessBox( vcl::Window* pParent, MessBoxStyle nMessBoxStyle,
- const OUString& rTitle, const OUString& rMessage );
MessBox( vcl::Window* pParent, MessBoxStyle nMessBoxStyle, WinBits n,
- const OUString& rTitle, const OUString& rMessage );
+ const OUString& rTitle, const OUString& rMessage,
+ Dialog::InitFlag eInitFlag = Dialog::InitFlag::NoParentCentered);
virtual ~MessBox() override;
virtual void dispose() override;
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index d5b81b2a20a4..7bdb4daccfb6 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -1387,6 +1387,12 @@ public:
// For vclbootstrapprotector:
static void setDeInitHook(Link<LinkParamNone*,void> const & hook);
+ // for delayed shutdown: set using SetShutdownDelayed, then
+ // trigger using TriggerShutdownDelayed which may actually shutdown
+ // when SetShutdownDelayed is set
+ static void SetShutdownDelayed();
+ static void TriggerShutdownDelayed();
+
private:
DECL_STATIC_LINK( Application, PostEventHandler, void*, void );
};
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 79d77f73f8c8..03ca038d306a 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -408,7 +408,7 @@ bool ScValidationData::DoError( vcl::Window* pParent, const OUString& rInput,
}
}
- ScopedVclPtrInstance< MessBox > aBox( pParent, nStyle, aTitle, aMessage );
+ ScopedVclPtrInstance< MessBox > aBox( pParent, nStyle, 0, aTitle, aMessage );
sal_uInt16 nRet = aBox->Execute();
return ( eErrorStyle == SC_VALERR_STOP || nRet == RET_CANCEL );
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index df07acaebfc3..96fc5982fc13 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -994,7 +994,7 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
if (rParam.bReplace)
if (rDoc.TestRemoveSubTotals( nTab, rParam ))
{
- bOk = ScopedVclPtrInstance<MessBox>( ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
+ bOk = ScopedVclPtrInstance<MessBox>( ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
// "StarCalc" "Delete Data?"
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_1 ) )->Execute()
diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx
index 16a5d4d431cb..40e6ec4ad3b5 100644
--- a/sc/source/ui/view/dbfunc.cxx
+++ b/sc/source/ui/view/dbfunc.cxx
@@ -340,7 +340,7 @@ void ScDBFunc::ToggleAutoFilter()
{
if (!bHeader)
{
- if ( ScopedVclPtrInstance<MessBox>( GetViewData().GetDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
+ if ( ScopedVclPtrInstance<MessBox>( GetViewData().GetDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), // "StarCalc"
ScGlobal::GetRscString( STR_MSSG_MAKEAUTOFILTER_0 ) // header from first row?
)->Execute() == RET_YES )
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index fc0a8da88c46..c6d04090c997 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -396,7 +396,7 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord,
if (rParam.bReplace)
if (rDoc.TestRemoveSubTotals( nTab, rParam ))
{
- bOk = ScopedVclPtrInstance<MessBox>( GetViewData().GetDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
+ bOk = ScopedVclPtrInstance<MessBox>( GetViewData().GetDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
// "StarCalc" "delete data?"
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_1 ) )->Execute()
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index f3100a2376f8..c5405959b91c 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -306,7 +306,7 @@ bool ScSpellingEngine::ShowTableWrapDialog()
{
vcl::Window* pParent = GetDialogParent();
ScWaitCursorOff aWaitOff( pParent );
- ScopedVclPtrInstance<MessBox> aMsgBox( pParent, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes,
+ ScopedVclPtrInstance<MessBox> aMsgBox( pParent, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, 0,
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
ScGlobal::GetRscString( STR_SPELLING_BEGIN_TAB) );
return aMsgBox->Execute() == RET_YES;
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 0cf938c2058a..fc53751f31a6 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2042,7 +2042,7 @@ void ScViewFunc::Solve( const ScSolveParam& rParam )
}
ScopedVclPtrInstance<MessBox> aBox( GetViewData().GetDialogParent(),
- MessBoxStyle::YesNo | MessBoxStyle::DefaultNo,
+ MessBoxStyle::YesNo | MessBoxStyle::DefaultNo, 0,
ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ), aMsgStr );
sal_uInt16 nRetVal = aBox->Execute();
diff --git a/sfx2/source/doc/querytemplate.cxx b/sfx2/source/doc/querytemplate.cxx
index 1e1ca56344c7..521dd77ae19b 100644
--- a/sfx2/source/doc/querytemplate.cxx
+++ b/sfx2/source/doc/querytemplate.cxx
@@ -28,7 +28,7 @@ namespace sfx2
{
QueryTemplateBox::QueryTemplateBox( vcl::Window* pParent, const OUString& rMessage ) :
- MessBox ( pParent, MessBoxStyle::NONE, Application::GetDisplayName(), rMessage )
+ MessBox ( pParent, MessBoxStyle::NONE, 0, Application::GetDisplayName(), rMessage )
{
SetImage( QueryBox::GetStandardImage() );
SetHelpId( HID_QUERY_LOAD_TEMPLATE );
diff --git a/svx/source/dialog/prtqry.cxx b/svx/source/dialog/prtqry.cxx
index 898da9491711..3f8ddf0934d4 100644
--- a/svx/source/dialog/prtqry.cxx
+++ b/svx/source/dialog/prtqry.cxx
@@ -23,7 +23,7 @@
#include <svx/dialmgr.hxx>
SvxPrtQryBox::SvxPrtQryBox(vcl::Window* pParent) :
- MessBox(pParent, MessBoxStyle::NONE,
+ MessBox(pParent, MessBoxStyle::NONE, 0,
SvxResId(RID_SVXSTR_QRY_PRINT_TITLE),
SvxResId(RID_SVXSTR_QRY_PRINT_MSG))
{
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 420ff42e17f0..0793190c75b3 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -375,7 +375,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RemoveHdl, Button*, void)
aMessage += m_pLbFormat->GetSelectEntry();
aMessage += "\n";
- VclPtrInstance<MessBox> pBox( this, MessBoxStyle::OkCancel,
+ VclPtrInstance<MessBox> pBox( this, MessBoxStyle::OkCancel, 0,
aStrDelTitle, aMessage );
if ( pBox->Execute() == RET_OK )
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 001690e4978e..4142142f1fc4 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -251,7 +251,7 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const
static short lcl_AskRedlineFlags(vcl::Window *pWin)
{
- ScopedVclPtrInstance<MessBox> aQBox( pWin, MessBoxStyle::NONE,
+ ScopedVclPtrInstance<MessBox> aQBox( pWin, MessBoxStyle::NONE, 0,
SwResId( STR_REDLINE_TITLE ),
SwResId( STR_REDLINE_MSG ) );
aQBox->SetImage( QueryBox::GetStandardImage() );
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index 3aaafda5ecc7..5e3f9c4d373b 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -417,7 +417,7 @@ void SwView::HyphenateDocument()
// do not hyphenate if interactive hyphenation is active elsewhere
if (SwEditShell::HasHyphIter())
{
- ScopedVclPtrInstance<MessBox>( nullptr, MessBoxStyle::Ok, SwResId( STR_HYPH_TITLE ),
+ ScopedVclPtrInstance<MessBox>( nullptr, MessBoxStyle::Ok, 0, SwResId( STR_HYPH_TITLE ),
SwResId( STR_MULT_INTERACT_HYPH_WARN ) )->Execute();
return;
}
diff --git a/uui/source/alreadyopen.cxx b/uui/source/alreadyopen.cxx
index 02687af3800b..0c417c0747af 100644
--- a/uui/source/alreadyopen.cxx
+++ b/uui/source/alreadyopen.cxx
@@ -22,7 +22,7 @@
#include <unotools/resmgr.hxx>
AlreadyOpenQueryBox::AlreadyOpenQueryBox( vcl::Window* pParent, const std::locale& rLocale, const OUString& aMessage, bool bIsStoring ) :
- MessBox(pParent, MessBoxStyle::NONE,
+ MessBox(pParent, MessBoxStyle::NONE, 0,
Translate::get(STR_ALREADYOPEN_TITLE, rLocale),
aMessage )
{
diff --git a/uui/source/filechanged.cxx b/uui/source/filechanged.cxx
index e9d50ce12584..bac5fc67032c 100644
--- a/uui/source/filechanged.cxx
+++ b/uui/source/filechanged.cxx
@@ -22,7 +22,7 @@
#include "filechanged.hxx"
FileChangedQueryBox::FileChangedQueryBox( vcl::Window* pParent, const std::locale& rLocale ) :
- MessBox(pParent, MessBoxStyle::NONE,
+ MessBox(pParent, MessBoxStyle::NONE, 0,
Translate::get(STR_FILECHANGED_TITLE, rLocale),
OUString() )
{
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index d136f047c3f3..7bee920262cf 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -961,11 +961,35 @@ executeMessageBox(
vcl::Window * pParent,
OUString const & rTitle,
OUString const & rMessage,
- MessBoxStyle nButtonMask )
+ MessBoxStyle nButtonMask,
+ Dialog::InitFlag eInitFlag)
{
SolarMutexGuard aGuard;
+ WinBits nStyle(0);
- ScopedVclPtrInstance< MessBox > xBox(pParent, nButtonMask, rTitle, rMessage);
+ ScopedVclPtrInstance< MessBox > xBox(pParent, nButtonMask, nStyle, rTitle, rMessage, eInitFlag);
+
+ if (Dialog::InitFlag::NoParentCentered == eInitFlag)
+ {
+ vcl::Window* pDefaultParent = Dialog::GetDefaultParent(nStyle);
+
+ if (pDefaultParent)
+ {
+ // need to 'Show' to have the following tasks do someting, does
+ // not work without and may even stumble on nullptrs/errors
+ xBox->Show();
+
+ // center on parent window
+ const Point aP(pDefaultParent->GetPosPixel());
+ const Size aS(pDefaultParent->GetSizePixel());
+ const Size aMySize(xBox->GetSizePixel());
+
+ xBox->SetPosPixel(
+ Point(
+ aP.X() + ((aS.Width() - aMySize.Width()) >> 1),
+ aP.Y() + ((aS.Height() - aMySize.Height()) >> 1)));
+ }
+ }
sal_uInt16 aMessResult = xBox->Execute();
DialogMask aResult = DialogMask::NONE;
@@ -1110,7 +1134,7 @@ UUIInteractionHelper::handleGenericErrorRequest(
aTitle += aErrTitle;
executeMessageBox(
- getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok );
+ getParentProperty(), aTitle, aErrorString, MessBoxStyle::Ok, Dialog::InitFlag::NoParentCentered);
}
else
ErrorHandler::HandleError(nErrorCode);
@@ -1226,7 +1250,7 @@ UUIInteractionHelper::handleBrokenPackageRequest(
utl::ConfigManager::getProductVersion() );
switch (
- executeMessageBox( getParentProperty(), title, aMessage, nButtonMask ) )
+ executeMessageBox( getParentProperty(), title, aMessage, nButtonMask, Dialog::InitFlag::NoParentCentered) )
{
case DialogMask::ButtonsOk:
OSL_ENSURE( xAbort.is(), "unexpected situation" );
diff --git a/uui/source/lockcorrupt.cxx b/uui/source/lockcorrupt.cxx
index 5812216b0c4e..cfc2ed31c6a5 100644
--- a/uui/source/lockcorrupt.cxx
+++ b/uui/source/lockcorrupt.cxx
@@ -24,7 +24,7 @@
#include <vcl/button.hxx>
LockCorruptQueryBox::LockCorruptQueryBox(vcl::Window* pParent, const std::locale& rResLocale)
- : MessBox(pParent, MessBoxStyle::NONE, Translate::get(STR_LOCKCORRUPT_TITLE, rResLocale), OUString())
+ : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_LOCKCORRUPT_TITLE, rResLocale), OUString())
{
SetImage( ErrorBox::GetStandardImage() );
diff --git a/uui/source/lockfailed.cxx b/uui/source/lockfailed.cxx
index 80209ee5fbbc..2dbf09555f73 100644
--- a/uui/source/lockfailed.cxx
+++ b/uui/source/lockfailed.cxx
@@ -23,7 +23,7 @@
#include <vcl/button.hxx>
LockFailedQueryBox::LockFailedQueryBox(vcl::Window* pParent, const std::locale& rResLocale)
- : MessBox(pParent, MessBoxStyle::NONE, Translate::get(STR_LOCKFAILED_TITLE, rResLocale), OUString())
+ : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_LOCKFAILED_TITLE, rResLocale), OUString())
{
SetImage( ErrorBox::GetStandardImage() );
diff --git a/uui/source/openlocked.cxx b/uui/source/openlocked.cxx
index dfd59425e090..84f69bcc7bc8 100644
--- a/uui/source/openlocked.cxx
+++ b/uui/source/openlocked.cxx
@@ -22,7 +22,7 @@
#include <unotools/resmgr.hxx>
OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage ) :
- MessBox(pParent, MessBoxStyle::NONE,
+ MessBox(pParent, MessBoxStyle::NONE, 0,
Translate::get(STR_OPENLOCKED_TITLE, rResLocale),
aMessage )
{
diff --git a/uui/source/trylater.cxx b/uui/source/trylater.cxx
index 01a09502b286..2e996d98487e 100644
--- a/uui/source/trylater.cxx
+++ b/uui/source/trylater.cxx
@@ -22,7 +22,7 @@
#include "trylater.hxx"
TryLaterQueryBox::TryLaterQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage)
- : MessBox(pParent, MessBoxStyle::NONE, Translate::get(STR_TRYLATER_TITLE, rResLocale), aMessage)
+ : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_TRYLATER_TITLE, rResLocale), aMessage)
{
SetImage( QueryBox::GetStandardImage() );
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() )