sc/inc/externalrefmgr.hxx | 3 +++ sc/source/filter/oox/formulabuffer.cxx | 4 ++++ sc/source/ui/docshell/externalrefmgr.cxx | 12 ++++++++++++ 3 files changed, 19 insertions(+)
New commits: commit 8464ea6961b9cc54af9c11cce1b80ed7e0cc77e2 Author: Eike Rathke <er...@redhat.com> Date: Tue Oct 25 19:41:30 2016 +0200 Resolves: tdf#79442 in OOXML import add external files to LinkManager Now that we store formula results without recalculating, the implicit logic that adds files of external references to the LinkManager is not triggered, explicitly force it during import. Change-Id: Id867d2fa2b39841fb4c8e90941814457c8db431d diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx index 4743d5e..434685c0 100644 --- a/sc/inc/externalrefmgr.hxx +++ b/sc/inc/externalrefmgr.hxx @@ -724,6 +724,9 @@ public: void enableDocTimer( bool bEnable ); + /** Add all known external files to the LinkManager. */ + void addFilesToLinkManager(); + private: ScExternalRefManager(const ScExternalRefManager&) = delete; diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index bed3f5f..f2aff25 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -376,6 +376,10 @@ void FormulaBuffer::finalizeImport() processSheetFormulaCells(rDoc, *it, *rDoc.getDoc().GetFormatTable(), getExternalLinks().getLinkInfos(), isGeneratorKnownGood()); + // With formula results being set and not recalculated we need to + // force-trigger adding all linked external files to the LinkManager. + rDoc.getDoc().GetExternalRefManager()->addFilesToLinkManager(); + rDoc.getDoc().SetAutoNameCache(nullptr); xFormulaBar->setPosition( 1.0 ); diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 5b70a5b..7056966 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -2646,6 +2646,18 @@ void ScExternalRefManager::maybeLinkExternalFile(sal_uInt16 nFileId) maLinkedDocs.insert(LinkedDocMap::value_type(nFileId, true)); } +void ScExternalRefManager::addFilesToLinkManager() +{ + if (maSrcFiles.empty()) + return; + + SAL_WARN_IF( maSrcFiles.size() >= SAL_MAX_UINT16, + "sc.ui", "ScExternalRefManager::addFilesToLinkManager: files overflow"); + const sal_uInt16 nSize = static_cast<sal_uInt16>( std::max<size_t>( maSrcFiles.size(), SAL_MAX_UINT16)); + for (sal_uInt16 nFileId = 0; nFileId < nSize; ++nFileId) + maybeLinkExternalFile( nFileId); +} + void ScExternalRefManager::SrcFileData::maybeCreateRealFileName(const OUString& rOwnDocName) { if (maRelativeName.isEmpty()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits