chart2/qa/extras/chart2import.cxx | 12 ++++++++++++ chart2/qa/extras/data/xlsx/tdf100084.xlsx |binary oox/source/core/xmlfilterbase.cxx | 14 +++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-)
New commits: commit b2fc2ad7beceaff660de684435a5c37d69cf8ae9 Author: Balazs Varga <balazs.varga...@gmail.com> AuthorDate: Fri May 10 09:34:30 2019 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Mon May 13 13:16:10 2019 +0200 tdf#100084 XLSX import: fix missing charts caused by case-sensitive path handling of relationship files. OOXML documents contain case-insensitive file paths, for example, uppercase "Sheet.xml" can have a lowercase "sheet.xml.rels" in the ZIP archive, as in the case of the XLSX documents generated by IBM Cognos. Change-Id: I4210e3b96fb512d61e1687ec8d41a3c77292ec0c Reviewed-on: https://gerrit.libreoffice.org/72100 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 4510ac447487..affab028f46e 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -70,6 +70,7 @@ public: void testTdf105517(); void testTdf106217(); void testTdf108021(); + void testTdf100084(); void testAutoBackgroundXLSX(); void testAutoChartAreaBorderPropXLSX(); void testChartAreaStyleBackgroundXLSX(); @@ -158,6 +159,7 @@ public: CPPUNIT_TEST(testTdf105517); CPPUNIT_TEST(testTdf106217); CPPUNIT_TEST(testTdf108021); + CPPUNIT_TEST(testTdf100084); CPPUNIT_TEST(testAutoBackgroundXLSX); CPPUNIT_TEST(testAutoChartAreaBorderPropXLSX); CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX); @@ -883,6 +885,16 @@ void Chart2ImportTest::testTdf108021() CPPUNIT_ASSERT(bTextBreak); } +void Chart2ImportTest::testTdf100084() +{ + // The test file was created with IBM Cognos, so just check there is a diagram. + load("/chart2/qa/extras/data/xlsx/", "tdf100084.xlsx"); + Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is()); + Reference<beans::XPropertySet> xDiagram(xChartDoc->getFirstDiagram(), UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE("There should be a Diagram.", xDiagram.is()); +} + void Chart2ImportTest::testTransparentBackground(OUString const & filename) { load("/chart2/qa/extras/data/xlsx/", filename); diff --git a/chart2/qa/extras/data/xlsx/tdf100084.xlsx b/chart2/qa/extras/data/xlsx/tdf100084.xlsx new file mode 100755 index 000000000000..5f03f39244e5 Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf100084.xlsx differ diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 738412fb182c..be9b2261c272 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -342,7 +342,7 @@ bool XmlFilterBase::importFragment( const rtl::Reference<FragmentHandler>& rxHan return false; // fragment handler must contain path to fragment stream - const OUString aFragmentPath = rxHandler->getFragmentPath(); + OUString aFragmentPath = rxHandler->getFragmentPath(); OSL_ENSURE( !aFragmentPath.isEmpty(), "XmlFilterBase::importFragment - missing fragment path" ); if( aFragmentPath.isEmpty() ) return false; @@ -385,6 +385,18 @@ bool XmlFilterBase::importFragment( const rtl::Reference<FragmentHandler>& rxHan handler to create specialized input streams, e.g. VML streams that have to preprocess the raw input data. */ Reference< XInputStream > xInStrm = rxHandler->openFragmentStream(); + // Check again the aFragmentPath route if there is no any file with lowercase letter. (tdf#100084) + if ( !xInStrm.is() ) + { + sal_Int32 nPathLen = aFragmentPath.lastIndexOf('/') + 1; + OUString fileName = aFragmentPath.copy(nPathLen); + if ( fileName != fileName.toAsciiLowerCase() ) + { + fileName = fileName.toAsciiLowerCase(); + aFragmentPath = OUStringBuffer(aFragmentPath.copy(0, nPathLen)).append(fileName).makeStringAndClear(); + xInStrm = openInputStream(aFragmentPath); + } + } // own try/catch block for showing parser failure assertion with fragment path if( xInStrm.is() ) try _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits