You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ar...@apache.org on 2023/06/04 19:37:07 UTC

[openoffice] branch links created (now 30a26c270c)

This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a change to branch links
in repository https://gitbox.apache.org/repos/asf/openoffice.git


      at 30a26c270c Use sfx2::LinkManager::GetUserAllowsLinkUpdate()

This branch includes the following new commits:

     new 72f0cbba72 Make method sfx2::LinkManager::GetUserAllowsLinkUpdate public
     new 30a26c270c Use sfx2::LinkManager::GetUserAllowsLinkUpdate()

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[openoffice] 02/02: Use sfx2::LinkManager::GetUserAllowsLinkUpdate()

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a commit to branch links
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 30a26c270c0da5807000f86de8afe84da4bc1daf
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Sun Jun 4 21:36:22 2023 +0200

    Use sfx2::LinkManager::GetUserAllowsLinkUpdate()
---
 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 41d74eb08f..30146c9b82 100644
--- a/main/sd/source/core/drawdoc.cxx
+++ b/main/sd/source/core/drawdoc.cxx
@@ -276,7 +276,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 d21a1420c0..988ae37c5d 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 011c20879e..d3c17aa52b 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 f8312e56d0..0b3589f66c 100644
--- a/main/sw/source/core/doc/docnew.cxx
+++ b/main/sw/source/core/doc/docnew.cxx
@@ -358,6 +358,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 8754d214dd..b96b6b3b7f 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>
@@ -950,9 +951,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() )


[openoffice] 01/02: Make method sfx2::LinkManager::GetUserAllowsLinkUpdate public

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ardovm pushed a commit to branch links
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 72f0cbba72f867bc4e951eddecaa0af4a763bc29
Author: Arrigo Marchiori <ar...@yahoo.it>
AuthorDate: Sun Jun 4 21:24:24 2023 +0200

    Make method sfx2::LinkManager::GetUserAllowsLinkUpdate public
---
 main/sfx2/inc/sfx2/linkmgr.hxx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/main/sfx2/inc/sfx2/linkmgr.hxx b/main/sfx2/inc/sfx2/linkmgr.hxx
index faef316243..f638aeeca8 100644
--- a/main/sfx2/inc/sfx2/linkmgr.hxx
+++ b/main/sfx2/inc/sfx2/linkmgr.hxx
@@ -59,7 +59,6 @@ class SFX2_DLLPUBLIC LinkManager
 	sal_Bool mUpdateAsked;
 	sal_Bool mAllowUpdate;
 
-	sal_Bool GetUserAllowsLinkUpdate(Window *pParent);
 	void SetUserAllowsLinkUpdate(SvBaseLink *pLink, sal_Bool allows);
 protected:
 	sal_Bool 		InsertLink( SvBaseLink* pLink, sal_uInt16 nObjType, sal_uInt16 nUpdateType,
@@ -111,6 +110,8 @@ public:
 
     SvLinkSourceRef CreateObj( SvBaseLink* );
 
+    /// Ask (once) to allow updating links
+	sal_Bool GetUserAllowsLinkUpdate(Window *pParent);
 	
 	// Automatically ask user about update all links, on first insert
 	void SetAutoAskUpdateAllLinks();