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 4c215d7c983f209cfe3e4af7f8e8b5a20c6abf18 Author: Mike Kaganski <[email protected]> AuthorDate: Mon Aug 25 17:54:14 2025 +0500 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Aug 26 21:21: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 <[email protected]> Tested-by: Jenkins (cherry picked from commit be6aa7ca0a3d9d444956c0e19a262a2ef91bdd5a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190188 Reviewed-by: Ilmari Lauhakangas <[email protected]> Reviewed-by: Xisco Fauli <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190237 diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index d755d14e9b67..a39db35c32c4 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 246db43eda31..5b6dff97b067 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1178,7 +1178,7 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& rUpdLnk, SwSectionNode& rSe { nRet = SwFindDocShell( xDocSh, xLockRef, sFileName, rSection.GetLinkFilePassword(), - sFilter, 0, pDoc->GetDocShell() ); + sFilter, 0, pDoc->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 207ec8769a71..f18dfe953d33 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1701,7 +1701,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; @@ -1749,6 +1750,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 7f6384050d6b..e9c522a23e86 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -2904,7 +2904,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 );
