Kaydet (Commit) 416752b9 authored tarafından Eike Rathke's avatar Eike Rathke

Resolves: tdf#104875 defer filter detection to first load/update of external

Attempting to access all linked external documents right on load time was
specifically nasty for non-local URIs (unmounted smb, http, ...)

Change-Id: If4a7414dfe36875b505c73b8c963b650eeffe204
üst 420cecf5
......@@ -772,7 +772,7 @@ private:
*/
ScDocument& cacheNewDocShell( sal_uInt16 nFileId, SrcShell& rSrcShell );
void maybeLinkExternalFile(sal_uInt16 nFileId);
void maybeLinkExternalFile( sal_uInt16 nFileId, bool bDeferFilterDetection = false );
/**
* Try to create a "real" file name from the relative path. The original
......
......@@ -2594,7 +2594,7 @@ bool ScExternalRefManager::isFileLoadable(const OUString& rFile) const
return true; // for http and others, Exists doesn't work, but the URL can still be opened
}
void ScExternalRefManager::maybeLinkExternalFile(sal_uInt16 nFileId)
void ScExternalRefManager::maybeLinkExternalFile( sal_uInt16 nFileId, bool bDeferFilterDetection )
{
if (maLinkedDocs.count(nFileId))
// file already linked, or the link has been broken.
......@@ -2614,7 +2614,9 @@ void ScExternalRefManager::maybeLinkExternalFile(sal_uInt16 nFileId)
}
// If a filter was already set (for example, loading the cached table),
// don't call GetFilterName which has to access the source file.
if (aFilter.isEmpty())
// If filter detection is deferred, the next successfull loadSrcDocument()
// will update SrcFileData filter name.
if (aFilter.isEmpty() && !bDeferFilterDetection)
ScDocumentLoader::GetFilterName(*pFileName, aFilter, aOptions, true, false);
sfx2::LinkManager* pLinkMgr = mpDoc->GetLinkManager();
if (!pLinkMgr)
......@@ -2624,8 +2626,8 @@ void ScExternalRefManager::maybeLinkExternalFile(sal_uInt16 nFileId)
}
ScExternalRefLink* pLink = new ScExternalRefLink(mpDoc, nFileId, aFilter);
OSL_ENSURE(pFileName, "ScExternalRefManager::maybeLinkExternalFile: file name pointer is NULL");
OUString aTmp = aFilter;
pLinkMgr->InsertFileLink(*pLink, OBJECT_CLIENT_FILE, *pFileName, &aTmp);
pLinkMgr->InsertFileLink(*pLink, OBJECT_CLIENT_FILE, *pFileName,
(aFilter.isEmpty() && bDeferFilterDetection ? nullptr : &aFilter));
pLink->SetDoReferesh(false);
pLink->Update();
......@@ -2643,7 +2645,7 @@ void ScExternalRefManager::addFilesToLinkManager()
"sc.ui", "ScExternalRefManager::addFilesToLinkManager: files overflow");
const sal_uInt16 nSize = static_cast<sal_uInt16>( std::min<size_t>( maSrcFiles.size(), SAL_MAX_UINT16));
for (sal_uInt16 nFileId = 0; nFileId < nSize; ++nFileId)
maybeLinkExternalFile( nFileId);
maybeLinkExternalFile( nFileId, true);
}
void ScExternalRefManager::SrcFileData::maybeCreateRealFileName(const OUString& rOwnDocName)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment