summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsushil_shinde <sushil.shinde@synerzip.com>2014-03-11 18:13:35 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-12 03:51:54 -0500
commitdf0b8665b5539eae1718eccd8250fe9b0a57d886 (patch)
treea6076513023f75963c23cbaa3ee0935bd020cbba
parenta8a195c9e722861dac5d9fce282edd9558c797a7 (diff)
fdo#76015 : Oleobject relationship entry was exported into wrong file.
- In given file header contains oleobject. - Relationship for oleobject was wrongly exported into document.xml.rels file. - serializer for writeoleobject was wrong. - fixed issue and added UT For it. Change-Id: I03ab3a14def62b8061f58f7001684e0e945ad74a Reviewed-on: https://gerrit.libreoffice.org/8534 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/ooxmlexport/data/2129393649.docxbin0 -> 50312 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx13
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx1
-rw-r--r--sw/source/filter/ww8/docxexport.cxx11
-rw-r--r--sw/source/filter/ww8/docxexport.hxx7
5 files changed, 31 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/2129393649.docx b/sw/qa/extras/ooxmlexport/data/2129393649.docx
new file mode 100644
index 000000000000..e1fd7581f093
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/2129393649.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 89b3c7823b94..b7fdef7d40fd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2731,6 +2731,19 @@ DECLARE_OOXMLEXPORT_TEST(testComboBoxControl, "combobox-control.docx")
CPPUNIT_ASSERT_EQUAL(OUString("pepito"), aItems[1]);
}
+DECLARE_OOXMLEXPORT_TEST(testOLEObjectinHeader, "2129393649.docx")
+{
+ // fdo#76015 : Document contains oleobject in header xml.
+ // Problem was relationship entry for oleobject from header was
+ // exported into document.xml.rels file because of this rels file
+ // for headers were missing from document/word/rels.
+ xmlDocPtr pXmlDoc = parseExport("word/_rels/header3.xml.rels");
+ if(!pXmlDoc)
+ return;
+
+ assertXPath(pXmlDoc,"/rels:Relationships/rels:Relationship[1]","Id","rId1");
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index d8a981dc70d6..a4cfd0b7035c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3816,6 +3816,7 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S
// write preview image
const Graphic* pGraphic = rNode.GetGraphic();
+ m_rDrawingML.SetFS(m_pSerializer);
OUString sImageId = m_rDrawingML.WriteImage( *pGraphic );
m_pSerializer->startElementNS( XML_w, XML_object, FSEND );
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 493a57d5f688..a595f7f6a409 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -373,7 +373,7 @@ OString DocxExport::WriteOLEObject( SwOLEObj& rObject, OUString sMediaType, OUSt
OUString sId;
if( lcl_CopyStream( xInStream, xOutStream ) )
- sId = m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ sId = m_pFilter->addRelation( GetFS()->getOutputStream(),
sRelationType, sFileName, false );
return OUStringToOString( sId, RTL_TEXTENCODING_UTF8 );
@@ -706,6 +706,7 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char*
m_pAttrOutput->SetSerializer( pFS );
m_pVMLExport->SetFS( pFS );
m_pSdrExport->setSerializer(pFS);
+ SetFS( pFS );
m_pAttrOutput->switchHeaderFooter(true, m_nHeadersFootersInSection++);
// do the work
WriteHeaderFooterText( rFmt, bHeader );
@@ -714,6 +715,7 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char*
m_pAttrOutput->SetSerializer( m_pDocumentFS );
m_pVMLExport->SetFS( m_pDocumentFS );
m_pSdrExport->setSerializer(m_pDocumentFS);
+ SetFS( m_pDocumentFS );
// close the tag
sal_Int32 nReference;
@@ -1385,6 +1387,11 @@ void DocxExport::WriteOutliner(const OutlinerParaObject& rParaObj, sal_uInt8 nTy
}
}
+void DocxExport::SetFS( ::sax_fastparser::FSHelperPtr pFS )
+{
+ mpFS = pFS;
+}
+
DocxExport::DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam )
: MSWordExportBase( pDocument, pCurrentPam, pOriginalPam ),
m_pFilter( pFilter ),
@@ -1408,6 +1415,8 @@ DocxExport::DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, SwPaM *pCur
m_pDocumentFS = m_pFilter->openFragmentStreamWithSerializer( "word/document.xml",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" );
+ SetFS(m_pDocumentFS);
+
// the DrawingML access
m_pDrawingML = new oox::drawingml::DrawingML( m_pDocumentFS, m_pFilter, oox::drawingml::DrawingML::DOCUMENT_DOCX );
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index 8871ead4d1e3..e8ef5c038ad8 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -70,6 +70,9 @@ class DocxExport : public MSWordExportBase
/// Fast serializer for the document output.
::sax_fastparser::FSHelperPtr m_pDocumentFS;
+ /// Fast serializer to output the data.
+ ::sax_fastparser::FSHelperPtr mpFS;
+
/// Access to the DrawingML writer.
oox::drawingml::DrawingML *m_pDrawingML;
@@ -273,6 +276,10 @@ public:
/// Set the document default tab stop.
void setDefaultTabStop( int stop ) { m_aSettings.defaultTabStop = stop; }
+ ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; }
+
+ void SetFS(::sax_fastparser::FSHelperPtr mpFS);
+
private:
/// No copying.
DocxExport( const DocxExport& );