[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/inc sc/source

Eike Rathke erack at redhat.com
Wed Oct 26 11:10:15 UTC 2016


 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 ef4051a295b76a5398e6c4a64bc0f8e1322291c7
Author: Eike Rathke <erack at 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
    (cherry picked from commit 8464ea6961b9cc54af9c11cce1b80ed7e0cc77e2)
    Reviewed-on: https://gerrit.libreoffice.org/30277
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx
index b9d1394..9577f9a 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 14e3f45..d7a574e 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 dac47e5..59863f6 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())


More information about the Libreoffice-commits mailing list