[Libreoffice-commits] core.git: sw/qa sw/source

sushil_shinde sushil.shinde at synerzip.com
Wed Mar 12 01:52:15 PDT 2014


 sw/qa/extras/ooxmlexport/data/2129393649.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx      |   13 +++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx  |    1 +
 sw/source/filter/ww8/docxexport.cxx           |   11 ++++++++++-
 sw/source/filter/ww8/docxexport.hxx           |    7 +++++++
 5 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit df0b8665b5539eae1718eccd8250fe9b0a57d886
Author: sushil_shinde <sushil.shinde at synerzip.com>
Date:   Tue Mar 11 18:13:35 2014 +0530

    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 at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/2129393649.docx b/sw/qa/extras/ooxmlexport/data/2129393649.docx
new file mode 100644
index 0000000..e1fd758
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/2129393649.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 89b3c78..b7fdef7 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 d8a981d..a4cfd0b 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 493a57d..a595f7f 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 8871ead..e8ef5c0 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& );


More information about the Libreoffice-commits mailing list