sw/qa/extras/ooxmlexport/data/fdo77759.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 13 +++++++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 7 +++++-- sw/source/filter/ww8/docxexport.cxx | 4 ++-- sw/source/filter/ww8/docxexport.hxx | 2 +- 5 files changed, 21 insertions(+), 5 deletions(-)
New commits: commit a3c00ee3c7b3b0fbcde32baeb7023c7e8526b908 Author: Ravindra Vidhate <ravindra.vidh...@synerzip.com> Date: Tue Apr 22 15:28:46 2014 +0530 fdo#77759 : Embedded excel getting renamed to binary object. The embedded excel (xlsx) when inserted on its own (unlike with chart) is getting converted to ".bin". Note that only extension differs otherwise its an excel file only. There is no loss of user experience in editing the file in MS Word. The similar case is also exists when power point is inserted on it's own. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/9126 Change-Id: Ie13c098a794179c3b27100a7b9e30884fb47f656 diff --git a/sw/qa/extras/ooxmlexport/data/fdo77759.docx b/sw/qa/extras/ooxmlexport/data/fdo77759.docx new file mode 100644 index 0000000..6558690 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo77759.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 31fd36b..18f91a8 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 a4679f7..27835b3 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 ff74f3a..c3a6ddf 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 2c55b2b..cd5450e 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. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits