sw/qa/extras/inc/swmodeltestbase.hxx | 1 + sw/qa/extras/ooxmlexport/data/fdo76098.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 ++++++++++++ sw/source/filter/ww8/docxexport.cxx | 7 ++++++- 4 files changed, 19 insertions(+), 1 deletion(-)
New commits: commit e1b5e32a704a93ceb777799b20647ae0bc452866 Author: Ravindra Vidhate <ravindra.vidh...@synerzip.com> Date: Thu Mar 13 15:13:32 2014 +0530 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 diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index d2f3b29..dde4a45 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 new file mode 100644 index 0000000..8a616e9 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76098.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 772156e..e31bef9 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 a595f7f..50eb592 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits