Skip to content

Commit

Permalink
Use sfx2::LinkManager::GetUserAllowsLinkUpdate()
Browse files Browse the repository at this point in the history
(cherry picked from commit 1b9d139)
  • Loading branch information
ardovm committed Nov 8, 2023
1 parent f92f29d commit f8c074b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
4 changes: 3 additions & 1 deletion main/sd/source/core/drawdoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
11 changes: 7 additions & 4 deletions main/svx/source/svdraw/svdograf.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 9 additions & 1 deletion main/svx/source/unodraw/unoshap2.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 )
{
Expand Down
1 change: 1 addition & 0 deletions main/sw/source/core/doc/docnew.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ SwDoc::SwDoc()
mbPurgeOLE =
true;

pLinkMgr->SetAutoAskUpdateAllLinks();
//
// COMPATIBILITY FLAGS START
//
Expand Down
9 changes: 6 additions & 3 deletions main/sw/source/core/doc/notxtfrm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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() )
Expand Down

0 comments on commit f8c074b

Please sign in to comment.