Kaydet (Commit) b2fc2ad7 authored tarafından Balazs Varga's avatar Balazs Varga Kaydeden (comit) László Németh

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: 's avatarLászló Németh <nemeth@numbertext.org>
üst fed7c693
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment