sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods |binary
 sc/qa/unit/subsequent_export-test.cxx                    |   12 ++++++++++++
 sc/source/core/tool/compiler.cxx                         |    2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit a808742d5528648c1f4378997def426d244216f4
Author:     Attila Szűcs <szucs.atti...@nisz.hu>
AuthorDate: Mon Jan 11 12:13:48 2021 +0100
Commit:     Gabor Kelemen <kelemen.gab...@nisz.hu>
CommitDate: Wed Mar 3 12:26:00 2021 +0100

    tdf#138832 XLSX export: fix lost file names in modified links
    
    Also for single-reference links, use the temporary indexes
    calculated in commit f85d860ccbebd99bc128218148e2992c9415f221
    (tdf#87973 XLSX export: fix lost file names in modified links),
    
    Note: only a new test case has been added to the modified unit
    test document.
    
    Co-authored-by: Tibor Nagy (NISZ)
    
    Change-Id: I4337a4e68008956ea42b626d210f07b1cbfe59ee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109088
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109536
    Tested-by: Jenkins
    (cherry picked from commit 3b481336018d274384b7ade7c2c5e858f24f0e8c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111883
    Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu>

diff --git a/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods 
b/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods
index cdaf9d4e7007..d25a18b19cac 100644
Binary files a/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods and 
b/sc/qa/unit/data/ods/tdf87973_externalLinkSkipUnuseds.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index f988256a8b28..760b194ed371 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -5551,6 +5551,15 @@ void ScExportTest::testTdf87973_externalLinkSkipUnuseds()
     aFormula = aFormula.replaceAt(nIdxOfFile, nIdxOfFilename - nIdxOfFile, 
aTempFilename);
     rDoc.SetFormula(ScAddress(3, 1, 0), aFormula, 
formula::FormulaGrammar::GRAM_NATIVE_UI);
 
+    // tdf#138832: test the same thing with singleref link
+    rDoc.GetFormula(3, 2, 0, aFormula);
+    nIdxOfFilename = aFormula.indexOf("tdf132105_external.ods");
+    aFormula = aFormula.replaceAt(nIdxOfFilename, 22, 
"87973_externalSource.ods");
+    nIdxOfFile = aFormula.indexOf("file");
+
+    aFormula = aFormula.replaceAt(nIdxOfFile, nIdxOfFilename - nIdxOfFile, 
aTempFilename);
+    rDoc.SetFormula(ScAddress(3, 2, 0), aFormula, 
formula::FormulaGrammar::GRAM_NATIVE_UI);
+
     // save and load back
     ScDocShellRef pDocSh = saveAndReload(&(*pShell), FORMAT_XLSX);
     CPPUNIT_ASSERT(pDocSh.is());
@@ -5560,6 +5569,9 @@ void ScExportTest::testTdf87973_externalLinkSkipUnuseds()
     rDoc2.GetFormula(3, 1, 0, aFormula2);
     CPPUNIT_ASSERT(aFormula2.indexOf("tdf132105_external.ods") < 0);
     CPPUNIT_ASSERT(aFormula2.indexOf("87973_externalSource.ods") >= 0);
+    rDoc2.GetFormula(3, 2, 0, aFormula2);
+    CPPUNIT_ASSERT(aFormula2.indexOf("tdf132105_external.ods") < 0);
+    CPPUNIT_ASSERT(aFormula2.indexOf("87973_externalSource.ods") >= 0);
 
     pDocSh->DoClose();
 }
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index d6d83c18e841..3ce2d9f13663 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -5099,7 +5099,7 @@ void ScCompiler::CreateStringFromExternal( 
OUStringBuffer& rBuffer, const Formul
         break;
         case svExternalSingleRef:
             pConv->makeExternalRefStr(pDoc->GetSheetLimits(),
-                   rBuffer, GetPos(), nFileId, *pFileName, 
t->GetString().getString(),
+                   rBuffer, GetPos(), nUsedFileId, *pFileName, 
t->GetString().getString(),
                    *t->GetSingleRef());
         break;
         case svExternalDoubleRef:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to