summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-10-25 19:41:30 +0200
committerCaolán McNamara <caolanm@redhat.com>2016-10-26 11:09:54 +0000
commitef4051a295b76a5398e6c4a64bc0f8e1322291c7 (patch)
treeccdefe9e57d54939dbbc0265439b09c73447731e
parent1bfa382b4af649ff2b56b988d89bada156e29078 (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 (cherry picked from commit 8464ea6961b9cc54af9c11cce1b80ed7e0cc77e2) Reviewed-on: https://gerrit.libreoffice.org/30277 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-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 b9d1394a460a..9577f9a5d734 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 14e3f45eaa1c..d7a574e39271 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -435,6 +435,10 @@ void FormulaBuffer::finalizeImport()
}
}
+ // 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 dac47e581ad2..59863f68efbd 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2645,6 +2645,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())