sfx2/source/doc/objserv.cxx | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
New commits: commit 1e00430d3b5e20136eb72f5551637bbd643e1c58 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Jan 22 17:31:25 2025 +0000 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Jan 23 08:46:06 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/+/180602 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 40c7dd9dd888..00e35f282f94 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -542,24 +542,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) @@ -687,6 +693,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()); @@ -795,6 +802,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().IsModuleInstalled(SvtModuleOptions::EModule::DRAW)) { @@ -834,6 +843,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // Actual redaction takes place on a newly generated Draw document if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::EModule::DRAW)) { + 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))); @@ -1210,6 +1220,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) else if (!(lErr == ERRCODE_IO_GENERAL && bIsPDFExport)) { SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC,GetTitle()); + weld::Window* pDialogParent = GetReqDialogParent(rReq, *this); ErrorHandler::HandleError(lErr, pDialogParent); } } @@ -1383,7 +1394,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(); @@ -1396,6 +1410,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;