sw/inc/docsh.hxx | 3 ++- sw/source/core/docnode/section.cxx | 2 +- sw/source/uibase/app/docsh2.cxx | 5 ++++- sw/source/uibase/uiview/view2.cxx | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-)
New commits: commit be6aa7ca0a3d9d444956c0e19a262a2ef91bdd5a Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Aug 25 17:54:14 2025 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Aug 25 17:13:00 2025 +0200 tdf#168070: SwFindDocShell may need an interaction handler It may attempt to open the passed document, and then it would create an SfxMedium, that will define how to interact e.g. on errors. When caller has an interaction handler, it should pass it. Change-Id: Icd0881ecf31b1e1a4731e1776413c1f62803c256 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190173 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index a4a650b3a4ee..189f6296bfef 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -359,6 +359,7 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh, const OUString& rPasswd, const OUString& rFilter, sal_Int16 nVersion, - SwDocShell* pDestSh ); + SwDocShell* pDestSh, + const css::uno::Reference<css::task::XInteractionHandler>& xIHandler); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index a53eaff1fecd..13e61eaf0caf 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1200,7 +1200,7 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& rUpdLnk, SwSectionNode& rSe { nRet = SwFindDocShell( xDocSh, xLockRef, sFileName, rSection.GetLinkFilePassword(), - sFilter, 0, rDoc.GetDocShell() ); + sFilter, 0, rDoc.GetDocShell(), {} ); if( nRet ) { SwDoc* pSrcDoc = static_cast<SwDocShell*>( xDocSh.get() )->GetDoc(); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index e43c3500b657..6a462c700b19 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1714,7 +1714,8 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh, const OUString& rPasswd, const OUString& rFilter, sal_Int16 nVersion, - SwDocShell* pDestSh ) + SwDocShell* pDestSh, + const uno::Reference<task::XInteractionHandler>& xIHandler ) { if ( rFileName.empty() ) return 0; @@ -1762,6 +1763,8 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh, // 2. Open the file ourselves std::unique_ptr<SfxMedium> xMed(new SfxMedium( aTmpObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ )); + if (xIHandler) + xMed->GetItemSet().Put(SfxUnoAnyItem(SID_INTERACTIONHANDLER, uno::Any(xIHandler))); if( INetProtocol::File == aTmpObj.GetProtocol() ) xMed->Download(); // Touch the medium (download it) diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 6fb0897cead7..3a03899e3597 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -2952,7 +2952,7 @@ tools::Long SwView::InsertMedium( sal_uInt16 nSlotId, std::unique_ptr<SfxMedium> SfxObjectShellLock xLockRef; const int nRet = SwFindDocShell( xDocSh, xLockRef, pMedium->GetName(), OUString(), - OUString(), nVersion, pDocSh ); + OUString(), nVersion, pDocSh, pMedium->GetInteractionHandler() ); if( nRet ) { SwWait aWait( *GetDocShell(), true );