summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-11-29 18:09:46 +0100
committerLuboš Luňák <l.lunak@suse.cz>2011-11-29 21:20:27 +0100
commiteb31865c852ac1843ab6060fdc401cf5cc2bf13c (patch)
treebfb63a07d6adc00d6d8636fa03b033a3779ea6b7 /starmath
parent09f94dc9d8d4b9501179399249dc2be7b95f8de8 (diff)
merge processing of OMathArg and OMath, for now
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/ooxmlimport.cxx56
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 ));