[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sc/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 10 13:05:39 UTC 2019


 sc/source/ui/docshell/externalrefmgr.cxx |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 73bedffa28de5597a4882bed514ecaf0b416bfde
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Jul 9 18:44:42 2019 +1000
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Wed Jul 10 15:05:03 2019 +0200

    Postpone filter detection until link update is allowed
    
    Change-Id: I85b2185e550f2a133ceb485241ef513b40593e34
    Reviewed-on: https://gerrit.libreoffice.org/75301
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 03c708bf085f91480c014d7fa31e7a317b2c7b8f)
    Reviewed-on: https://gerrit.libreoffice.org/75331
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index c7086d6b70d1..e0d0e1dce1ae 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2159,6 +2159,15 @@ void insertRefCellByIterator(
     }
 }
 
+bool IsLinkUpdateAllowedInDoc(const ScDocument& rDoc)
+{
+    SfxObjectShell* pDocShell = rDoc.GetDocumentShell();
+    if (!pDocShell)
+        return false;
+
+    return pDocShell->GetEmbeddedObjectContainer().getUserAllowsLinkUpdate();
+}
+
 }
 
 void ScExternalRefManager::insertRefCell(sal_uInt16 nFileId, const ScAddress& rCell)
@@ -2370,13 +2379,8 @@ ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId)
         return nullptr;
 
     // Do not load document until it was allowed
-    SfxObjectShell* pDocShell = mpDoc->GetDocumentShell();
-    if ( pDocShell )
-    {
-        const comphelper::EmbeddedObjectContainer& rContainer = pDocShell->GetEmbeddedObjectContainer();
-        if ( !rContainer.getUserAllowsLinkUpdate() )
-            return nullptr;
-    }
+    if (!IsLinkUpdateAllowedInDoc(*mpDoc))
+        return nullptr;
 
     ScDocument* pSrcDoc = nullptr;
     ScDocShell* pShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>, false));
@@ -2621,6 +2625,11 @@ void ScExternalRefManager::maybeLinkExternalFile( sal_uInt16 nFileId, bool bDefe
         aFilter = pFileData->maFilterName;
         aOptions = pFileData->maFilterOptions;
     }
+
+    // Filter detection may access external links; defer it until we are allowed
+    if (!bDeferFilterDetection)
+        bDeferFilterDetection = !IsLinkUpdateAllowedInDoc(*mpDoc);
+
     // If a filter was already set (for example, loading the cached table),
     // don't call GetFilterName which has to access the source file.
     // If filter detection is deferred, the next successful loadSrcDocument()


More information about the Libreoffice-commits mailing list