sfx2/source/doc/objserv.cxx | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
New commits: commit b7aadb5298d8a42525da3b206952e61d59c5c202 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Jan 22 17:31:25 2025 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu Jan 23 09:27:34 2025 +0100 defer finding dialog parent until we need it which might be never for the typical save Change-Id: I2989f2e9629ce13c8b301a6b85707443ddc4954a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180606 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 7c4f79b57d22..1e3a0d9a4972 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -532,24 +532,30 @@ void ResetSignatureSelection(SfxObjectShell& rObjectShell, SfxViewShell& rViewSh } } -void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) +static weld::Window* GetReqDialogParent(SfxRequest &rReq, SfxObjectShell& rShell) { weld::Window* pDialogParent = rReq.GetFrameWeld(); if (!pDialogParent) { - SfxViewFrame* pFrame = GetFrame(); + SfxViewFrame* pFrame = rShell.GetFrame(); if (!pFrame) - pFrame = SfxViewFrame::GetFirst(this); + pFrame = SfxViewFrame::GetFirst(&rShell); if (pFrame) pDialogParent = pFrame->GetFrameWeld(); } + return pDialogParent; +} +void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) +{ sal_uInt16 nId = rReq.GetSlot(); bool bHaveWeSigned = false; if( SID_SIGNATURE == nId || SID_MACRO_SIGNATURE == nId ) { + weld::Window* pDialogParent = GetReqDialogParent(rReq, *this); + QueryHiddenInformation(HiddenWarningFact::WhenSigning); if (SID_SIGNATURE == nId) @@ -677,6 +683,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( !IsOwnStorageFormat( *GetMedium() ) ) return; + weld::Window* pDialogParent = GetReqDialogParent(rReq, *this); SfxVersionDialog aDlg(pDialogParent, pFrame, IsSaveVersionOnClose()); aDlg.run(); SetSaveVersionOnClose(aDlg.IsSaveVersionOnClose()); @@ -785,6 +792,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) case SID_AUTOREDACTDOC: { + weld::Window* pDialogParent = GetReqDialogParent(rReq, *this); + // Actual redaction takes place on a newly generated Draw document if (!SvtModuleOptions().IsDrawInstalled()) { @@ -824,6 +833,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // Actual redaction takes place on a newly generated Draw document if (!SvtModuleOptions().IsDrawInstalled()) { + weld::Window* pDialogParent = GetReqDialogParent(rReq, *this); std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog( pDialogParent, VclMessageType::Warning, VclButtonsType::Ok, SfxResId(STR_REDACTION_NO_DRAW_WARNING))); @@ -1200,6 +1210,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) else { SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC,GetTitle()); + weld::Window* pDialogParent = GetReqDialogParent(rReq, *this); ErrorHandler::HandleError(lErr, pDialogParent); } } @@ -1373,7 +1384,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if (comphelper::LibreOfficeKit::isActive()) sendErrorToLOK(lErr); else + { + weld::Window* pDialogParent = GetReqDialogParent(rReq, *this); ErrorHandler::HandleError(lErr, pDialogParent); + } rReq.SetReturnValue( SfxBoolItem(0, true) ); rReq.Done(); @@ -1386,6 +1400,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) case SID_DOCTEMPLATE: { // save as document templates + weld::Window* pDialogParent = GetReqDialogParent(rReq, *this); SfxSaveAsTemplateDialog aDlg(pDialogParent, GetModel()); (void)aDlg.run(); break;