summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-08-30 12:08:39 +0200
committerLuboš Luňák <l.lunak@suse.cz>2011-08-30 16:56:36 +0200
commitd1359c4d6ee6562137a5fbd5c95032a9a812314c (patch)
treecc645c5c79ff79b222b73b0d863c71a877b77655 /starmath
parent61b1fb0f42f51235bb0b92da30c0d4e2d6297960 (diff)
implement .docx matrix export
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/ooxml.cxx23
-rw-r--r--starmath/source/ooxml.hxx1
2 files changed, 21 insertions, 3 deletions
diff --git a/starmath/source/ooxml.cxx b/starmath/source/ooxml.cxx
index aec33e973146..38eac203eb77 100644
--- a/starmath/source/ooxml.cxx
+++ b/starmath/source/ooxml.cxx
@@ -153,11 +153,9 @@ void SmOoxml::HandleNode( const SmNode* pNode, int nLevel )
//Root Node, PILE equivalent, i.e. vertical stack
HandleTable(pNode,nLevel);
break;
-#if 0
case NMATRIX:
- HandleSmMatrix( static_cast< const SmMatrixNode* >( pNode ), nLevel );
+ HandleMatrix( static_cast< const SmMatrixNode* >( pNode ), nLevel );
break;
-#endif
case NLINE:
{
// TODO
@@ -532,7 +530,26 @@ void SmOoxml::HandleSubSupScriptInternal( const SmSubSupNode* pNode, int nLevel,
else
{
OSL_FAIL( "Unhandled sub/sup combination" );
+ HandleAllSubNodes( pNode, nLevel );
+ }
+}
+
+void SmOoxml::HandleMatrix( const SmMatrixNode* pNode, int nLevel )
+{
+ m_pSerializer->startElementNS( XML_m, XML_m, FSEND );
+ for( int row = 0; row < pNode->GetNumRows(); ++row )
+ {
+ m_pSerializer->startElementNS( XML_m, XML_mr, FSEND );
+ for( int col = 0; col < pNode->GetNumCols(); ++col )
+ {
+ m_pSerializer->startElementNS( XML_m, XML_e, FSEND );
+ if( const SmNode* node = pNode->GetSubNode( row * pNode->GetNumCols() + col ))
+ HandleNode( node, nLevel + 1 );
+ m_pSerializer->endElementNS( XML_m, XML_e );
+ }
+ m_pSerializer->endElementNS( XML_m, XML_mr );
}
+ m_pSerializer->endElementNS( XML_m, XML_m );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/starmath/source/ooxml.hxx b/starmath/source/ooxml.hxx
index dbebd37f8b11..2b651ed81f34 100644
--- a/starmath/source/ooxml.hxx
+++ b/starmath/source/ooxml.hxx
@@ -57,6 +57,7 @@ private:
void HandleOperator( const SmOperNode* pNode, int nLevel );
void HandleSubSupScript( const SmSubSupNode* pNode, int nLevel );
void HandleSubSupScriptInternal( const SmSubSupNode* pNode, int nLevel, int flags );
+ void HandleMatrix( const SmMatrixNode* pNode, int nLevel );
String str;
const SmNode* const pTree;
::sax_fastparser::FSHelperPtr m_pSerializer;