diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2011-11-29 16:19:53 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2011-11-29 21:20:25 +0100 |
commit | 7bdccfdc1d3dc070a19a604c4c76b28428cc5a0e (patch) | |
tree | 376dc3d04c2ffa89161080967c95f6968b2ebbd5 /starmath | |
parent | e9ed9d4d4548751b50d45b7082f776d6e69204e3 (diff) |
implement import of docx mathml m:d
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/ooxmlimport.cxx | 47 | ||||
-rw-r--r-- | starmath/source/ooxmlimport.hxx | 1 |
2 files changed, 48 insertions, 0 deletions
diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index 4b187ad90ce8..2394fa54bf11 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -35,6 +35,7 @@ using namespace oox; using namespace oox::formulaimport; using rtl::OUString; +using rtl::OUStringBuffer; /* The primary internal data structure for the formula is the text representation @@ -84,6 +85,9 @@ OUString SmOoxmlImport::handleStream() case OPENING( M_TOKEN( borderBox )): ret += STR( " " ) + handleBorderBox(); break; + case OPENING( M_TOKEN( d )): + ret += STR( " " ) + handleD(); + break; case OPENING( M_TOKEN( f )): ret += STR( " " ) + handleF(); break; @@ -93,6 +97,7 @@ OUString SmOoxmlImport::handleStream() } } stream.ensureClosingTag( M_TOKEN( oMath )); + fprintf(stderr, "FORMULA: %s\n", rtl::OUStringToOString( ret, RTL_TEXTENCODING_UTF8 ).getStr()); return ret; } @@ -203,6 +208,48 @@ OUString SmOoxmlImport::handleBorderBox() return e; } +OUString SmOoxmlImport::handleD() +{ + stream.ensureOpeningTag( M_TOKEN( d )); + sal_Unicode opening = '('; + sal_Unicode closing = ')'; + sal_Unicode separator = '|'; + if( XmlStream::Tag dPr = stream.checkOpeningTag( M_TOKEN( dPr ))) + { + if( XmlStream::Tag begChr = stream.checkOpeningTag( M_TOKEN( begChr ))) + { + opening = begChr.attribute( M_TOKEN( val ), opening ); + stream.ensureClosingTag( M_TOKEN( begChr )); + } + if( XmlStream::Tag sepChr = stream.checkOpeningTag( M_TOKEN( sepChr ))) + { + separator = sepChr.attribute( M_TOKEN( val ), separator ); + stream.ensureClosingTag( M_TOKEN( sepChr )); + } + if( XmlStream::Tag endChr = stream.checkOpeningTag( M_TOKEN( endChr ))) + { + closing = endChr.attribute( M_TOKEN( val ), closing ); + stream.ensureClosingTag( M_TOKEN( endChr )); + } + stream.ensureClosingTag( M_TOKEN( dPr )); + } + OUStringBuffer ret; + ret.append( opening ); + bool first = true; + while( stream.currentToken() == OPENING( M_TOKEN( e ))) + { + if( !first ) + { // plain "|" would be actually "V" (logical or) + ret.append( separator == '|' ? STR( " mline " ) : STR( "|" )); + } + first = false; + ret.append( handleE()); + } + ret.append( closing ); + stream.ensureClosingTag( M_TOKEN( d )); + return ret.makeStringAndClear(); +} + OUString SmOoxmlImport::handleE() { stream.ensureOpeningTag( M_TOKEN( e )); diff --git a/starmath/source/ooxmlimport.hxx b/starmath/source/ooxmlimport.hxx index 8d587f7fe69b..6c31e0d59909 100644 --- a/starmath/source/ooxmlimport.hxx +++ b/starmath/source/ooxmlimport.hxx @@ -47,6 +47,7 @@ private: rtl::OUString handleAcc(); rtl::OUString handleBar(); rtl::OUString handleBorderBox(); + rtl::OUString handleD(); rtl::OUString handleE(); rtl::OUString handleF(); rtl::OUString handleR(); |