summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavindra Vidhate <ravindra.vidhate@synerzip.com>2014-04-22 15:28:46 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-04-28 09:20:16 +0200
commita3c00ee3c7b3b0fbcde32baeb7023c7e8526b908 (patch)
treebf57790ba50049838065852b1981468a2ebb83ff
parentdf0dea0bf055fce59beedadbc8d20a2681c96bd6 (diff)
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
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo77759.docxbin0 -> 23880 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx13
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx7
-rw-r--r--sw/source/filter/ww8/docxexport.cxx4
-rw-r--r--sw/source/filter/ww8/docxexport.hxx2
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
new file mode 100644
index 000000000000..6558690690a8
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo77759.docx
Binary files differ
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.