diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo77759.docx | bin | 0 -> 23880 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.hxx | 2 |
5 files changed, 21 insertions, 5 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo77759.docx b/sw/qa/extras/ooxmlexport/data/fdo77759.docx Binary files differnew file mode 100644 index 000000000000..6558690690a8 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo77759.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 31fd36badc1e..18f91a8ce92a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3225,6 +3225,19 @@ DECLARE_OOXMLEXPORT_TEST(testFDO75431, "fdo75431.docx") assertXPath(pXmlDoc, "//w:p/w:pPr/w:sectPr/w:type", "val", "nextPage"); } +DECLARE_OOXMLEXPORT_TEST(testContentTypeOLE, "fdo77759.docx") +{ + xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml"); + + if (!pXmlDoc) + return; + + assertXPath(pXmlDoc, + "/ContentType:Types/ContentType:Override[@ContentType='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']", + "PartName", + "/word/embeddings/oleObject1.xlsx"); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index a4679f7e9fd4..27835b308780 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4011,7 +4011,7 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S OUString sObjectName = aContainer->GetEmbeddedObjectName( xObj ); // set some attributes according to the type of the embedded object - OUString sProgID, sMediaType, sRelationType; + OUString sProgID, sMediaType, sRelationType, sFileExtension; for( sal_Int32 i=0; i < aObjectsInteropList.getLength(); ++i ) if ( aObjectsInteropList[i].Name == sObjectName ) { @@ -4022,20 +4022,23 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S { sMediaType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; sRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"; + sFileExtension = "xlsx"; } else if( sProgID.startsWith("PowerPoint.Show") ) { sMediaType = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; sRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"; + sFileExtension = "pptx"; } else { sMediaType = "application/vnd.openxmlformats-officedocument.oleObject"; sRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"; + sFileExtension = "bin"; } // write embedded file - OString sId = m_rExport.WriteOLEObject( aObject, sMediaType, sRelationType ); + OString sId = m_rExport.WriteOLEObject( aObject, sMediaType, sRelationType, sFileExtension ); if( sId.isEmpty() ) { diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index ff74f3a4800a..c3a6ddf93678 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -358,13 +358,13 @@ OString DocxExport::OutputChart( uno::Reference< frame::XModel >& xModel, sal_In return OUStringToOString( sId, RTL_TEXTENCODING_UTF8 ); } -OString DocxExport::WriteOLEObject( SwOLEObj& rObject, const OUString& sMediaType, const OUString& sRelationType ) +OString DocxExport::WriteOLEObject( SwOLEObj& rObject, const OUString& sMediaType, const OUString& sRelationType, const OUString& sFileExtension ) { uno::Reference <embed::XEmbeddedObject> xObj( rObject.GetOleRef() ); comphelper::EmbeddedObjectContainer* aContainer = rObject.GetObject().GetContainer(); uno::Reference< io::XInputStream > xInStream = aContainer->GetObjectStream( xObj, NULL ); - OUString sFileName = "embeddings/oleObject" + OUString::number( ++m_nOLEObjects ) + ".bin"; + OUString sFileName = "embeddings/oleObject" + OUString::number( ++m_nOLEObjects ) + "." + sFileExtension; uno::Reference< io::XOutputStream > xOutStream = GetFilter().openFragmentStream( OUStringBuffer() .appendAscii( "word/" ) .append( sFileName ) diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 2c55b2b3e0e7..cd5450ed7cc4 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -168,7 +168,7 @@ public: /// Returns the relationd id OString OutputChart( com::sun::star::uno::Reference< com::sun::star::frame::XModel >& xModel, sal_Int32 nCount, ::sax_fastparser::FSHelperPtr m_pSerializer ); - OString WriteOLEObject( SwOLEObj& rObject, const OUString& sMediaType, const OUString& sRelationType ); + OString WriteOLEObject( SwOLEObj& rObject, const OUString& sMediaType, const OUString& sRelationType, const OUString& sFileExtension ); bool lcl_CopyStream( css::uno::Reference< css::io::XInputStream> xIn, css::uno::Reference< css::io::XOutputStream > xOut ); /// Writes the shape using drawingML syntax. |