summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-08-16 17:31:20 +0200
committerLuboš Luňák <l.lunak@suse.cz>2011-08-18 15:33:46 +0200
commit438b5717ab783d13ba8249c0c11d87896a5ee49b (patch)
tree2f8fed13ada7492586ca1f400a74bf2d187eec00 /starmath
parentc0bcff297b9282baa6de998804e451d66e2863b7 (diff)
implement ooxml math (basic) fractions
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/ooxml.cxx17
-rw-r--r--starmath/source/ooxml.hxx1
2 files changed, 18 insertions, 0 deletions
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;