summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-07-09 18:44:42 +1000
committerAndras Timar <andras.timar@collabora.com>2021-05-10 16:33:53 +0200
commitb10555fce638c8b06a52a6f49bfb05d78a1755b6 (patch)
tree0ea3e27479037ce180296c36f1fce7613f5eac9f
parent995c6d1c847bcfb5e4f0b7fb34440d1eef728fe8 (diff)
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@collabora.com> (cherry picked from commit 03c708bf085f91480c014d7fa31e7a317b2c7b8f) Reviewed-on: https://gerrit.libreoffice.org/76303 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 43bf332aeede732557378e81765f29b704b17188) (cherry picked from commit 73176974d613b01bdf5223b93cf2705d3fd8c155)
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx23
1 files changed, 16 insertions, 7 deletions
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 80bd63d1c89d..445d06a8720b 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)
@@ -2369,13 +2378,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));
@@ -2620,6 +2624,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 successfull loadSrcDocument()