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 d5446d7c6e59defb3c9abcf2a9545d13fdd4c887 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Aug 25 17:54:14 2025 +0500 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Aug 25 19:44:34 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 (cherry picked from commit be6aa7ca0a3d9d444956c0e19a262a2ef91bdd5a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190188 Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> 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 88f54ffcf072..53687be58f90 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1710,7 +1710,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; @@ -1758,6 +1759,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 f3130d93fb3e..86c75a43557b 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -2943,7 +2943,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 );