From 438b5717ab783d13ba8249c0c11d87896a5ee49b Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Tue, 16 Aug 2011 17:31:20 +0200 Subject: implement ooxml math (basic) fractions --- starmath/source/ooxml.cxx | 17 +++++++++++++++++ starmath/source/ooxml.hxx | 1 + 2 files changed, 18 insertions(+) (limited to 'starmath') diff --git a/starmath/source/ooxml.cxx b/starmath/source/ooxml.cxx index 5bf642696936..4e0198eeb7d4 100644 --- a/starmath/source/ooxml.cxx +++ b/starmath/source/ooxml.cxx @@ -113,9 +113,11 @@ void SmOoxml::HandleNodes(SmNode *pNode,int nLevel) case NOPER: HandleOperator(pNode,nLevel); break; +#endif case NBINVER: HandleFractions(pNode,nLevel); break; +#if 0 case NROOT: HandleRoot(pNode,nLevel); break; @@ -294,6 +296,7 @@ void SmOoxml::HandleText(SmNode *pNode, int /*nLevel*/) void SmOoxml::HandleMath(SmNode *pNode,int nLevel) { HandleText( pNode, nLevel ); +// TODO at least some items (e.g. y/2 need to handled as ooxml and not as plain text symbols) #if 0 if (pNode->GetToken().eType == TMLINE) { @@ -402,4 +405,18 @@ void SmOoxml::HandleMath(SmNode *pNode,int nLevel) #endif } +void SmOoxml::HandleFractions(SmNode *pNode,int nLevel) +{ + m_pSerializer->startElementNS( XML_m, XML_f, FSEND ); + m_pSerializer->startElementNS( XML_m, XML_num, FSEND ); + if( SmNode* num = pNode->GetSubNode( 0 )) + HandleNodes( num, nLevel + 1 ); + m_pSerializer->endElementNS( XML_m, XML_num ); + m_pSerializer->startElementNS( XML_m, XML_den, FSEND ); + if( SmNode* num = pNode->GetSubNode( 2 )) + HandleNodes( num, nLevel + 1 ); + m_pSerializer->endElementNS( XML_m, XML_den ); + m_pSerializer->endElementNS( XML_m, XML_f ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/source/ooxml.hxx b/starmath/source/ooxml.hxx index 22aa91f61375..1cdf55d9c9b2 100644 --- a/starmath/source/ooxml.hxx +++ b/starmath/source/ooxml.hxx @@ -47,6 +47,7 @@ private: void HandleTable(SmNode *pNode,int nLevel); void HandleText(SmNode *pNode,int nLevel); void HandleMath(SmNode *pNode,int nLevel); + void HandleFractions(SmNode *pNode,int nLevel); String str; SmNode *pTree; ::sax_fastparser::FSHelperPtr m_pSerializer; -- cgit