summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-11-30 11:42:37 +0100
committerLuboš Luňák <l.lunak@suse.cz>2011-11-30 16:11:43 +0100
commit500b6af7773a9991425a1a031ebf8901b3549de2 (patch)
tree2f2a549d0ce13e826e13bd1e1a2a2da7697c283d /starmath
parent5f3bd5bed3f5d677208dc1b897b2f21eb5f622bb (diff)
implement docx m:nary
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/ooxmlimport.cxx75
-rw-r--r--starmath/source/ooxmlimport.hxx1
2 files changed, 76 insertions, 0 deletions
diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx
index c0d84abaf04c..c9353c0e7d82 100644
--- a/starmath/source/ooxmlimport.cxx
+++ b/starmath/source/ooxmlimport.cxx
@@ -125,6 +125,9 @@ OUString SmOoxmlImport::readOMathArg()
case OPENING( M_TOKEN( m )):
ret += handleM();
break;
+ case OPENING( M_TOKEN( nary )):
+ ret += handleNary();
+ break;
case OPENING( M_TOKEN( r )):
ret += handleR();
break;
@@ -424,6 +427,78 @@ OUString SmOoxmlImport::handleM()
return STR( "matrix {" ) + allrows + STR( "}" );
}
+OUString SmOoxmlImport::handleNary()
+{
+ stream.ensureOpeningTag( M_TOKEN( nary ));
+ sal_Unicode chr = 0x222b;
+ bool subHide = false;
+ bool supHide = false;
+ if( stream.checkOpeningTag( M_TOKEN( naryPr )))
+ {
+ if( XmlStream::Tag chrTag = stream.checkOpeningTag( M_TOKEN( chr )))
+ {
+ chr = chrTag.attribute( M_TOKEN( val ), chr );
+ stream.ensureClosingTag( M_TOKEN( chr ));
+ }
+ if( XmlStream::Tag subHideTag = stream.checkOpeningTag( M_TOKEN( subHide )))
+ {
+ subHide = subHideTag.attribute( M_TOKEN( val ), subHide );
+ stream.ensureClosingTag( M_TOKEN( subHide ));
+ }
+ if( XmlStream::Tag supHideTag = stream.checkOpeningTag( M_TOKEN( supHide )))
+ {
+ supHide = supHideTag.attribute( M_TOKEN( val ), supHide );
+ stream.ensureClosingTag( M_TOKEN( supHide ));
+ }
+ stream.ensureClosingTag( M_TOKEN( naryPr ));
+ }
+ stream.ensureOpeningTag( M_TOKEN( sub ));
+ OUString sub = readOMathArg();
+ stream.ensureClosingTag( M_TOKEN( sub ));
+ stream.ensureOpeningTag( M_TOKEN( sup ));
+ OUString sup = readOMathArg();
+ stream.ensureClosingTag( M_TOKEN( sup ));
+ OUString e = handleE();
+ OUString ret;
+ switch( chr )
+ {
+ case MS_INT:
+ ret = STR( "int" );
+ break;
+ case MS_IINT:
+ ret = STR( "liint" );
+ break;
+ case MS_IIINT:
+ ret = STR( "liiint" );
+ break;
+ case MS_LINT:
+ ret = STR( "lint" );
+ break;
+ case MS_LLINT:
+ ret = STR( "llint" );
+ break;
+ case MS_LLLINT:
+ ret = STR( "lllint" );
+ break;
+ case MS_PROD:
+ ret = STR( "prod" );
+ break;
+ case MS_COPROD:
+ ret = STR( "coprod" );
+ break;
+ default:
+ fprintf( stderr, "Unknown m:nary chr '%d'\n", chr );
+ break;
+ }
+ if( !subHide )
+ ret += STR( " from {" ) + sub + STR( "}" );
+ if( !supHide )
+ ret += STR( " to {" ) + sup + STR( "}" );
+ ret += STR( " {" ) + e + STR( "}" );
+ stream.ensureClosingTag( M_TOKEN( nary ));
+ return ret;
+}
+
// NOT complete
OUString SmOoxmlImport::handleR()
{
diff --git a/starmath/source/ooxmlimport.hxx b/starmath/source/ooxmlimport.hxx
index 05963d654ed4..350ff3f1efd2 100644
--- a/starmath/source/ooxmlimport.hxx
+++ b/starmath/source/ooxmlimport.hxx
@@ -55,6 +55,7 @@ private:
rtl::OUString handleLimLowUpp( LimLowUpp_t limlowupp );
rtl::OUString handleGroupChr();
rtl::OUString handleM();
+ rtl::OUString handleNary();
rtl::OUString handleR();
rtl::OUString readOMathArg();
oox::formulaimport::XmlStream& stream;