sfx2/source/dialog/templdlg.cxx | 6 +++++- sw/source/uibase/app/docsh2.cxx | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-)
New commits: commit 4072e87b4e1b3a5e6c84be5f008a72dea04fb48c Author: Caolán McNamara <[email protected]> AuthorDate: Sat Dec 21 16:48:47 2024 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Sat Dec 21 21:57:51 2024 +0100 crash reporting: use SfxRequest to get parent for dialogs 0: return pWindow ? pWindow->GetFrameWeld() : nullptr; 2: SfxNewFileDialog aNewFileDlg(GetView()->GetFrameWeld(), SfxNewFileDialogMode::LoadTemplate); Reproducible by adding "LoadStyles" to the menu in writer, then print preview and then use that "LoadStyles" entry. Also dispatch "SID_TEMPLATE_LOAD", as used by "Load Styles from Template" entry in the dropdown from the "Styles Action" toolbar of the style panel, with an explicit frame it is associated with. Change-Id: I3d536b897fbf6be9e20e4238e6a761df56ac9701 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179084 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 09e320e05357..6acd68b51675 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -664,7 +664,11 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(const OUString& rEntry, StyleLis static_cast<sal_uInt16>(m_aStyleList.GetFamilyItem()->GetFamily()), rStyleList); } else if (rEntry == "load") - SfxGetpApp()->GetDispatcher_Impl()->Execute(SID_TEMPLATE_LOAD); + { + SfxViewFrame* pViewFrame = pBindings->GetDispatcher_Impl()->GetFrame(); + SfxFrameItem aFrameItem(SID_DOCFRAME, pViewFrame); + SfxGetpApp()->GetDispatcher_Impl()->ExecuteList(SID_TEMPLATE_LOAD, SfxCallMode::SLOT, { &aFrameItem }); + } else SAL_WARN("sfx", "not implemented: " << rEntry); } diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 733121e9dd0e..207ec8769a71 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -549,14 +549,16 @@ void SwDocShell::Execute(SfxRequest& rReq) if ( aFileName.isEmpty() ) { - SfxNewFileDialog aNewFileDlg(GetView()->GetFrameWeld(), SfxNewFileDialogMode::LoadTemplate); + weld::Window* pDialogParent = rReq.GetFrameWeld(); + SAL_WARN_IF(!pDialogParent, "sw.ui", "missing parameter for DialogParent"); + SfxNewFileDialog aNewFileDlg(pDialogParent, SfxNewFileDialogMode::LoadTemplate); aNewFileDlg.SetTemplateFlags(nFlags); sal_uInt16 nRet = aNewFileDlg.run(); if(RET_TEMPLATE_LOAD == nRet) { FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE, - FileDialogFlags::NONE, GetView()->GetFrameWeld()); + FileDialogFlags::NONE, pDialogParent); aDlgHelper.SetContext(FileDialogHelper::WriterLoadTemplate); uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker();
