summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-10-25 19:41:30 +0200
committerEike Rathke <erack@redhat.com>2016-10-25 19:45:45 +0200
commit8464ea6961b9cc54af9c11cce1b80ed7e0cc77e2 (patch)
tree4070b3c87090a7db61960cc7b715affe6b01934b
parent36e390eaa55ae302dc5a64fa7098ec43e2009748 (diff)
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
-rw-r--r--sc/inc/externalrefmgr.hxx3
-rw-r--r--sc/source/filter/oox/formulabuffer.cxx4
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx12
3 files changed, 19 insertions, 0 deletions
diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index 4743d5e9a513..434685c085b3 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 bed3f5ff2600..f2aff256d7b6 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 5b70a5bc3647..70569667b4cc 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())