From 34e2e7dd8441148fa8f05c1e9ca324003058ed11 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Tue, 29 Nov 2011 20:19:11 +0100 Subject: implement docx m:groupChr --- starmath/source/ooxmlimport.cxx | 26 +++++++++++++++++++++++++- starmath/source/ooxmlimport.hxx | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'starmath') diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx index 760505ca3cb9..300d81860e77 100644 --- a/starmath/source/ooxmlimport.cxx +++ b/starmath/source/ooxmlimport.cxx @@ -108,6 +108,8 @@ OUString SmOoxmlImport::readOMathArg() return handleLimLowUpp( LimLow ); case OPENING( M_TOKEN( limUpp )): return handleLimLowUpp( LimUpp ); + case OPENING( M_TOKEN( groupChr )): + return handleGroupChr(); case OPENING( M_TOKEN( r )): return handleR(); default: @@ -319,6 +321,9 @@ OUString SmOoxmlImport::handleFunc() stream.ensureOpeningTag( M_TOKEN( fName )); OUString fname = readOMathArg(); stream.ensureClosingTag( M_TOKEN( fName )); + // fix the various functions + if( fname.match( STR( "lim {" ), 0 )) // startsWith() + fname = STR( "lim from {" ) + fname.copy( 5 ); OUString ret = fname + STR( " {" ) + handleE() + STR( "}" ); stream.ensureClosingTag( M_TOKEN( func )); return ret; @@ -333,7 +338,26 @@ OUString SmOoxmlImport::handleLimLowUpp( LimLowUpp_t limlowupp ) OUString lim = readOMathArg(); stream.ensureClosingTag( M_TOKEN( lim )); stream.ensureClosingTag( token ); - return e + STR( " from {" ) + lim + STR( "}" ); + return e + STR( " {" ) + lim + STR( "}" ); +} + +OUString SmOoxmlImport::handleGroupChr() +{ + stream.ensureOpeningTag( M_TOKEN( groupChr )); + enum pos_t { top, bot } pos = bot; + if( stream.checkOpeningTag( M_TOKEN( groupChrPr ))) + { + if( XmlStream::Tag posTag = stream.checkOpeningTag( M_TOKEN( pos ))) + { + if( posTag.attribute( M_TOKEN( val ), STR( "bot" )) == STR( "top" )) + pos = top; + stream.ensureClosingTag( M_TOKEN( pos )); + } + stream.ensureClosingTag( M_TOKEN( groupChrPr )); + } + OUString ret = STR( "{ " ) + handleE() + ( pos == top ? STR( "} overbrace" ) : STR( "} underbrace" )); + stream.ensureClosingTag( M_TOKEN( groupChr )); + return ret; } // NOT complete diff --git a/starmath/source/ooxmlimport.hxx b/starmath/source/ooxmlimport.hxx index af7d1ca964bc..c0786bc5336f 100644 --- a/starmath/source/ooxmlimport.hxx +++ b/starmath/source/ooxmlimport.hxx @@ -53,6 +53,7 @@ private: rtl::OUString handleFunc(); enum LimLowUpp_t { LimLow, LimUpp }; rtl::OUString handleLimLowUpp( LimLowUpp_t limlowupp ); + rtl::OUString handleGroupChr(); rtl::OUString handleR(); rtl::OUString readOMathArg(); oox::formulaimport::XmlStream& stream; -- cgit v1.2.3