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

Caolán McNamara caolanm at redhat.com
Mon Apr 20 03:42:48 PDT 2015


 sw/source/filter/ww8/docxattributeoutput.cxx |   15 ++++++---------
 sw/source/filter/ww8/docxattributeoutput.hxx |    4 ++--
 2 files changed, 8 insertions(+), 11 deletions(-)

New commits:
commit f517052783b232e31969e944bce565905fea8cf4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Apr 20 11:21:58 2015 +0100

    fix crash on export of abi9702-1.doc to docx
    
    Change-Id: I3c0d7560d9a47123ca98f72c0319fcee97894913

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 263c722..797abe0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1188,7 +1188,9 @@ void DocxAttributeOutput::EndRun()
 
     m_pSerializer->mergeTopMarks();
 
-    WritePostponedMath();
+    for (std::vector<const SwOLENode*>::iterator it = m_aPostponedMaths.begin(); it != m_aPostponedMaths.end(); ++it)
+        WritePostponedMath(*it);
+    m_aPostponedMaths.clear();
 
     for (std::vector<const SdrObject*>::iterator it = m_aPostponedFormControls.begin(); it != m_aPostponedFormControls.end(); ++it)
         WritePostponedFormControl(*it);
@@ -4339,16 +4341,13 @@ bool DocxAttributeOutput::WriteOLEMath( const SdrObject*, const SwOLENode& rOLEN
 
     if( !SotExchange::IsMath(aObjName) )
         return false;
-    assert( m_postponedMath == NULL ); // make it a list if there can be more inside one run
-    m_postponedMath = &rOLENode;
+    m_aPostponedMaths.push_back(&rOLENode);
     return true;
 }
 
-void DocxAttributeOutput::WritePostponedMath()
+void DocxAttributeOutput::WritePostponedMath(const SwOLENode* pPostponedMath)
 {
-    if( m_postponedMath == NULL )
-        return;
-    uno::Reference < embed::XEmbeddedObject > xObj(const_cast<SwOLENode*>(m_postponedMath)->GetOLEObj().GetOleRef());
+    uno::Reference < embed::XEmbeddedObject > xObj(const_cast<SwOLENode*>(pPostponedMath)->GetOLEObj().GetOleRef());
     uno::Reference< uno::XInterface > xInterface( xObj->getComponent(), uno::UNO_QUERY );
 // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class,
 // so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated
@@ -4357,7 +4356,6 @@ void DocxAttributeOutput::WritePostponedMath()
     assert( formulaexport != NULL );
     if (formulaexport)
         formulaexport->writeFormulaOoxml( m_pSerializer, GetExport().GetFilter().getVersion());
-    m_postponedMath = NULL;
 }
 
 void DocxAttributeOutput::WritePostponedFormControl(const SdrObject* pObject)
@@ -8295,7 +8293,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
       m_nHyperLinkCount(0),
       m_nFieldsInHyperlink( 0 ),
       m_postponedDMLDrawing(NULL),
-      m_postponedMath( NULL ),
       m_postponedChart( NULL ),
       pendingPlaceholder( NULL ),
       m_postitFieldsMaxId( 0 ),
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index d0bf46c..66964a5 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -693,7 +693,7 @@ private:
     void DoWriteBookmarks( );
     void DoWriteAnnotationMarks( );
     void WritePostponedGraphic();
-    void WritePostponedMath();
+    void WritePostponedMath(const SwOLENode* pObject);
     void WritePostponedFormControl(const SdrObject* pObject);
     void WritePostponedDiagram();
     void WritePostponedChart();
@@ -860,7 +860,7 @@ private:
     };
     std::unique_ptr< std::list<PostponedOLE> > m_pPostponedOLEs;
 
-    const SwOLENode* m_postponedMath;
+    std::vector<const SwOLENode*> m_aPostponedMaths;
     const SdrObject* m_postponedChart;
     Size m_postponedChartSize;
     std::vector<const SdrObject*> m_aPostponedFormControls;


More information about the Libreoffice-commits mailing list