diff options
author | Ravindra Vidhate <ravindra.vidhate@synerzip.com> | 2014-03-13 15:13:32 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-03-17 10:29:01 +0100 |
commit | e1b5e32a704a93ceb777799b20647ae0bc452866 (patch) | |
tree | 72c19a170fac14a75c32d7adc719bf5ed8ccbbe2 /sw | |
parent | 6415f3e7ab6a7728d44dbb49c1486ac9ca649a17 (diff) |
fdo#76098 ContentType for .xlsm external data file is wrong
1. Open a File which has Pie Chart in LO.
2. The content type of Pie Chart should Macro Enabled.
3. using LO, SAVE this file.
4. Opened the Save file in MS-Office.
5. The file gets corrupted due to the ContentType gets changed.
Conflicts:
sw/qa/extras/inc/swmodeltestbase.hxx
Reviewed on:
https://gerrit.libreoffice.org/8572
Change-Id: I20f92f52cc79df4fc5e10c4e4867e2e704ba3c86
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/inc/swmodeltestbase.hxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo76098.docx | bin | 0 -> 79411 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.cxx | 7 |
4 files changed, 19 insertions, 1 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index d2f3b2933ef8..dde4a453d5bb 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -552,6 +552,7 @@ protected: xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("rels"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w14"), BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordml")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("m"), BAD_CAST("http://schemas.openxmlformats.org/officeDocument/2006/math")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("ContentType"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/content-types")); xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(rXPath.getStr()), pXmlXpathCtx); return pXmlXpathObj->nodesetval; } diff --git a/sw/qa/extras/ooxmlexport/data/fdo76098.docx b/sw/qa/extras/ooxmlexport/data/fdo76098.docx Binary files differnew file mode 100644 index 000000000000..8a616e9b735c --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo76098.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 772156ecb99b..e31bef9974f8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2813,6 +2813,18 @@ DECLARE_OOXMLEXPORT_TEST(testNestedAlternateContent, "nestedAlternateContent.doc assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wpg:wgp[1]/wps:wsp[2]/wps:txbx[1]/w:txbxContent[1]/w:p[1]/w:r[2]/mc:AlternateContent[1]",0); } +DECLARE_OOXMLEXPORT_TEST(testContentTypeXLSM, "fdo76098.docx") +{ + xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + + if (!pXmlDoc) + return; + + assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[2]", "ContentType", "application/vnd.ms-excel.sheet.macroEnabled.12"); + +} + + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index a595f7f6a409..50eb592b8e2b 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -1213,10 +1213,15 @@ void DocxExport::WriteEmbeddings() OUString embeddingPath = embeddingsList[j].Name; uno::Reference<io::XInputStream> embeddingsStream; embeddingsList[j].Value >>= embeddingsStream; + + OUString contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + if (embeddingPath.endsWith(OUString(".xlsm"))) + contentType = "application/vnd.ms-excel.sheet.macroEnabled.12"; + if ( embeddingsStream.is() ) { uno::Reference< io::XOutputStream > xOutStream = GetFilter().openFragmentStream(embeddingPath, - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + contentType); try { sal_Int32 nBufferSize = 512; |