diff options
author | Tünde Tóth <toth.tunde@nisz.hu> | 2021-06-29 13:58:59 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-06-30 13:36:18 +0200 |
commit | 67e2cc17bad3fd7aacb94da47f9024b731434a84 (patch) | |
tree | a43551737e83fb0305c8eea103077d6bd3a7a763 | |
parent | c34ab8e41610c4bf13b9e6cbe1a3a5f6b3505044 (diff) |
tdf#140431 XLSX export: fix double file:// prefix
Regression from commit: fc58d7d65b9683db7b7632137126680b8483f6c5
(tdf#129969 XLSX export: file URLs need IURI encoding)
Change-Id: I5bfb0ef9ba7fe82cd3f4d0e0b3fdcf8f705cba64
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118090
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r-- | sc/qa/unit/data/xlsx/129969-min.xlsx | bin | 0 -> 9474 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test2.cxx | 19 | ||||
-rw-r--r-- | sc/source/filter/excel/xecontent.cxx | 4 |
3 files changed, 21 insertions, 2 deletions
diff --git a/sc/qa/unit/data/xlsx/129969-min.xlsx b/sc/qa/unit/data/xlsx/129969-min.xlsx Binary files differnew file mode 100644 index 000000000000..b6fd8e9e2069 --- /dev/null +++ b/sc/qa/unit/data/xlsx/129969-min.xlsx diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 8e4f77ebbd79..1c088c813f21 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -186,6 +186,7 @@ public: void testTdf136721_paper_size(); void testTdf139258_rotated_image(); void testTdf126541_SheetVisibilityImportXlsx(); + void testTdf140431(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -280,6 +281,7 @@ public: CPPUNIT_TEST(testTdf136721_paper_size); CPPUNIT_TEST(testTdf139258_rotated_image); CPPUNIT_TEST(testTdf126541_SheetVisibilityImportXlsx); + CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST_SUITE_END(); @@ -2282,6 +2284,23 @@ void ScExportTest2::testTdf126541_SheetVisibilityImportXlsx() CPPUNIT_ASSERT(xShell->GetDocument().GetViewOptions().GetOption(VOPT_GRID)); } +void ScExportTest2::testTdf140431() +{ + ScDocShellRef xShell = loadDoc(u"129969-min.", FORMAT_XLSX); + CPPUNIT_ASSERT(xShell.is()); + + ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); + CPPUNIT_ASSERT(xDocSh.is()); + ScDocument& rDoc = xDocSh->GetDocument(); + ScAddress aPos(0, 2, 0); + const EditTextObject* pEditText = rDoc.GetEditText(aPos); + const SvxFieldData* pData = pEditText->GetFieldData(0, 0, text::textfield::Type::URL); + const SvxURLField* pURLData = static_cast<const SvxURLField*>(pData); + CPPUNIT_ASSERT(pURLData->GetURL().startsWith("file://ndhlis")); + + xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index cf0c3777f39f..0848745b8d4a 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -394,9 +394,9 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU for( int i = 0; i < nLevel; ++i ) msTarget = "../" + msTarget; } - else + else if (rRoot.GetOutput() != EXC_OUTPUT_XML_2007) { - // ooxml expects the file:/// part appended ( or at least + // xls expects the file:/// part appended ( or at least // ms2007 does, ms2010 is more tolerant ) msTarget = "file:///" + msTarget; } |