diff options
-rw-r--r-- | starmath/source/ooxmlimport.cxx | 56 |
1 files changed, 24 insertions, 32 deletions
diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index 9dcad23a3862..566b3d7e9c2a 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -69,10 +69,30 @@ OUString SmOoxmlImport::handleStream() { stream.ensureOpeningTag( M_TOKEN( oMath )); OUString ret; + while( !stream.atEnd() && stream.currentToken() != CLOSING( M_TOKEN( oMath ))) + { + // strictly speaking, it is not OMathArg here, but currently supported + // functionality is the same like OMathArg, in the future this may need improving + OUString item = readOMathArg( M_TOKEN( oMath )); + if( item.isEmpty()) + continue; + if( !ret.isEmpty()) + ret += STR( " " ); + ret += item; + } + stream.ensureClosingTag( M_TOKEN( oMath )); + fprintf(stderr, "FORMULA: %s\n", rtl::OUStringToOString( ret, RTL_TEXTENCODING_UTF8 ).getStr()); + return ret; +} + + +OUString SmOoxmlImport::readOMathArg( int endtoken ) +{ + OUString ret; while( !stream.atEnd()) { XmlStream::Tag tag = stream.currentTag(); - if( tag.token == CLOSING( M_TOKEN( oMath ))) + if( tag.token == CLOSING( endtoken )) break; if( !ret.isEmpty()) ret += STR( " " ); @@ -93,13 +113,14 @@ OUString SmOoxmlImport::handleStream() case OPENING( M_TOKEN( f )): ret += handleF(); break; + case OPENING( M_TOKEN( r )): + ret += handleR(); + break; default: stream.handleUnexpectedTag(); break; } } - stream.ensureClosingTag( M_TOKEN( oMath )); - fprintf(stderr, "FORMULA: %s\n", rtl::OUStringToOString( ret, RTL_TEXTENCODING_UTF8 ).getStr()); return ret; } @@ -260,35 +281,6 @@ OUString SmOoxmlImport::handleE() return ret; } -OUString SmOoxmlImport::readOMathArg( int endtoken ) -{ - OUString ret; - while( !stream.atEnd()) - { // TODO can there really be more or just one sub-elements? - XmlStream::Tag tag = stream.currentTag(); - if( tag.token == CLOSING( endtoken )) - break; - if( !ret.isEmpty()) - ret += STR( " " ); - switch( tag.token ) - { - case OPENING( M_TOKEN( acc )): - ret += handleAcc(); - break; - case OPENING( M_TOKEN( f )): - ret += handleF(); - break; - case OPENING( M_TOKEN( r )): - ret += handleR(); - break; - default: - stream.handleUnexpectedTag(); - break; - } - } - return ret; -} - OUString SmOoxmlImport::handleF() { stream.ensureOpeningTag( M_TOKEN( f )); |