This is an automated email from the ASF dual-hosted git repository. ardovm pushed a commit to branch AOO41X in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit f8c074b1219af2a7160e5b8f8157fac1a2076a93 Author: Arrigo Marchiori <ard...@yahoo.it> AuthorDate: Sun Jun 4 21:36:22 2023 +0200 Use sfx2::LinkManager::GetUserAllowsLinkUpdate() (cherry picked from commit 1b9d1397d93e567a9042ac64832efcc85d3fed81) --- main/sd/source/core/drawdoc.cxx | 4 +++- main/svx/source/svdraw/svdograf.cxx | 11 +++++++---- main/svx/source/unodraw/unoshap2.cxx | 10 +++++++++- main/sw/source/core/doc/docnew.cxx | 1 + main/sw/source/core/doc/notxtfrm.cxx | 9 ++++++--- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/main/sd/source/core/drawdoc.cxx b/main/sd/source/core/drawdoc.cxx index 369a474241..76df50a4af 100644 --- a/main/sd/source/core/drawdoc.cxx +++ b/main/sd/source/core/drawdoc.cxx @@ -277,7 +277,9 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) if (mpDocSh) { - SetLinkManager( new sfx2::LinkManager(mpDocSh) ); + sfx2::LinkManager *linkMgr = new sfx2::LinkManager(mpDocSh); + linkMgr->SetAutoAskUpdateAllLinks(); + SetLinkManager( linkMgr ); } sal_uLong nCntrl = rOutliner.GetControlWord(); diff --git a/main/svx/source/svdraw/svdograf.cxx b/main/svx/source/svdraw/svdograf.cxx index 52a8b4b9dc..e18bcb14c7 100644 --- a/main/svx/source/svdraw/svdograf.cxx +++ b/main/svx/source/svdraw/svdograf.cxx @@ -819,10 +819,13 @@ sal_Bool SdrGrafObj::ImpUpdateGraphicLink( sal_Bool bAsynchron ) const sal_Bool bRet = sal_False; if( pGraphicLink ) { - if ( bAsynchron ) - pGraphicLink->UpdateAsynchron(); - else - pGraphicLink->DataChanged( ImpLoadLinkedGraphic( aFileName, aFilterName ) ); + sfx2::LinkManager *linkMgr = pGraphicLink->GetLinkManager(); + if ((linkMgr == NULL) || (linkMgr->GetUserAllowsLinkUpdate(NULL))) { + if ( bAsynchron ) + pGraphicLink->UpdateAsynchron(); + else + pGraphicLink->DataChanged( ImpLoadLinkedGraphic( aFileName, aFilterName ) ); + } // else links shall not be updated bRet = sal_True; } return bRet; diff --git a/main/svx/source/unodraw/unoshap2.cxx b/main/svx/source/unodraw/unoshap2.cxx index bbf8065272..24835802d9 100644 --- a/main/svx/source/unodraw/unoshap2.cxx +++ b/main/svx/source/unodraw/unoshap2.cxx @@ -1623,6 +1623,7 @@ uno::Sequence< OUString > SAL_CALL SvxShapePolyPolygonBezier::getSupportedServic #ifndef _SFXDOCFILE_HXX #include <sfx2/docfile.hxx> #endif +#include <sfx2/linkmgr.hxx> #include <sfx2/app.hxx> #include <sfx2/fcontnr.hxx> #endif @@ -1718,7 +1719,14 @@ bool SvxGraphicObject::setPropertyValueImpl( const ::rtl::OUString& rName, const const SfxFilter* pSfxFilter = NULL; SfxMedium aSfxMedium( aURL, STREAM_READ | STREAM_SHARE_DENYNONE, sal_False ); - SFX_APP()->GetFilterMatcher().GuessFilter( aSfxMedium, &pSfxFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE ); + // SfxFilterMatcher::GuessFilter() may ``taste'' linked files, so we must be sure we are authorized to access them + sfx2::LinkManager *linkManager = NULL; + if (mpModel) { + linkManager = mpModel->GetLinkManager(); + } + if ((linkManager == NULL) || (linkManager->GetUserAllowsLinkUpdate(SFX_APP()->GetTopWindow()))) { + SFX_APP()->GetFilterMatcher().GuessFilter( aSfxMedium, &pSfxFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE ); + } if( !pSfxFilter ) { diff --git a/main/sw/source/core/doc/docnew.cxx b/main/sw/source/core/doc/docnew.cxx index 6c4afa89d8..4c1a07878a 100644 --- a/main/sw/source/core/doc/docnew.cxx +++ b/main/sw/source/core/doc/docnew.cxx @@ -341,6 +341,7 @@ SwDoc::SwDoc() mbPurgeOLE = true; + pLinkMgr->SetAutoAskUpdateAllLinks(); // // COMPATIBILITY FLAGS START // diff --git a/main/sw/source/core/doc/notxtfrm.cxx b/main/sw/source/core/doc/notxtfrm.cxx index 114ee5cb34..eebdae9690 100644 --- a/main/sw/source/core/doc/notxtfrm.cxx +++ b/main/sw/source/core/doc/notxtfrm.cxx @@ -33,6 +33,7 @@ #include <svtools/soerr.hxx> #include <sfx2/progress.hxx> #include <sfx2/docfile.hxx> +#include <sfx2/linkmgr.hxx> #include <sfx2/printer.hxx> #include <editeng/udlnitem.hxx> #include <editeng/colritem.hxx> @@ -937,9 +938,11 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons !(aTmpSz = pGrfNd->GetTwipSize()).Width() || !aTmpSz.Height() || !pGrfNd->GetAutoFmtLvl() ) { - // --> OD 2006-12-22 #i73788# - pGrfNd->TriggerAsyncRetrieveInputStream(); - // <-- + if (pShell->GetDoc()->GetLinkManager().GetUserAllowsLinkUpdate(pShell->GetWin())) { + // --> OD 2006-12-22 #i73788# + pGrfNd->TriggerAsyncRetrieveInputStream(); + // <-- + } } String aTxt( pGrfNd->GetTitle() ); if ( !aTxt.Len() )