[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - starmath/source

Dinesh Patil dinesh.patil at synerzip.com
Thu Mar 13 09:09:43 PDT 2014


 starmath/source/ooxmlexport.cxx |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

New commits:
commit cde6d800698522a804dc8f82c158ce7e0c3e05f5
Author: Dinesh Patil <dinesh.patil at synerzip.com>
Date:   Wed Mar 12 20:04:16 2014 +0530

    fdo#76078: LO Crashes while saving the docx file containing only opening brace
    
    - System handles an equation having opening brace and closing brace.
    - Whereas it fails to handle equations having only opening brace and no closing
      brace, due to which LO crashes with assertion while exporting.
    - Fixed this issue and added unit test case for the same.
    - Also fixed the same for closing brace alone.
    
    Reviewed-on: https://gerrit.libreoffice.org/8561
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    
    (cherry picked from commit ade1641ab632565820ede720b6151435aca4dd78)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    
    Conflicts:
    	sw/qa/extras/inc/swmodeltestbase.hxx
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    
    Change-Id: I34a8a635b42bfdfac265fb70b977c0001cd2b4ff

diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx
index 8d1c808..0a98d98 100644
--- a/starmath/source/ooxmlexport.cxx
+++ b/starmath/source/ooxmlexport.cxx
@@ -453,8 +453,15 @@ void SmOoxmlExport::HandleBrace( const SmBraceNode* pNode, int nLevel )
 {
     m_pSerializer->startElementNS( XML_m, XML_d, FSEND );
     m_pSerializer->startElementNS( XML_m, XML_dPr, FSEND );
-    m_pSerializer->singleElementNS( XML_m, XML_begChr,
-        FSNS( XML_m, XML_val ), mathSymbolToString( pNode->OpeningBrace()).getStr(), FSEND );
+
+    //check if the node has an opening brace
+    if( TNONE == pNode->GetSubNode(0)->GetToken().eType )
+        m_pSerializer->singleElementNS( XML_m, XML_begChr,
+            FSNS( XML_m, XML_val ), "", FSEND );
+    else
+        m_pSerializer->singleElementNS( XML_m, XML_begChr,
+            FSNS( XML_m, XML_val ), mathSymbolToString( pNode->OpeningBrace()).getStr(), FSEND );
+
     std::vector< const SmNode* > subnodes;
     if( pNode->Body()->GetType() == NBRACEBODY )
     {
@@ -479,8 +486,14 @@ void SmOoxmlExport::HandleBrace( const SmBraceNode* pNode, int nLevel )
     }
     else
         subnodes.push_back( pNode->Body());
-    m_pSerializer->singleElementNS( XML_m, XML_endChr,
-        FSNS( XML_m, XML_val ), mathSymbolToString( pNode->ClosingBrace()).getStr(), FSEND );
+
+    if( TNONE == pNode->GetSubNode(2)->GetToken().eType )
+        m_pSerializer->singleElementNS( XML_m, XML_endChr,
+            FSNS( XML_m, XML_val ), "", FSEND );
+    else
+        m_pSerializer->singleElementNS( XML_m, XML_endChr,
+            FSNS( XML_m, XML_val ), mathSymbolToString( pNode->ClosingBrace()).getStr(), FSEND );
+
     m_pSerializer->endElementNS( XML_m, XML_dPr );
     for( unsigned int i = 0; i < subnodes.size(); ++i )
     {


More information about the Libreoffice-commits mailing list