2001-08-13 14:19:16 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "math_parser.h"
|
2001-08-13 15:26:41 +00:00
|
|
|
#include "math_binominset.h"
|
2001-08-13 14:19:16 +00:00
|
|
|
#include "math_decorationinset.h"
|
|
|
|
#include "math_dotsinset.h"
|
|
|
|
#include "math_funcinset.h"
|
|
|
|
#include "math_funcliminset.h"
|
|
|
|
#include "math_fracinset.h"
|
2001-08-21 14:20:50 +00:00
|
|
|
#include "math_kerninset.h"
|
2001-08-13 14:19:16 +00:00
|
|
|
#include "math_macro.h"
|
|
|
|
#include "math_macrotable.h"
|
2001-09-12 14:31:18 +00:00
|
|
|
#include "math_macroarg.h"
|
2001-08-17 09:48:24 +00:00
|
|
|
#include "math_notinset.h"
|
2001-08-13 14:19:16 +00:00
|
|
|
#include "math_rootinset.h"
|
|
|
|
#include "math_spaceinset.h"
|
2001-08-30 08:55:13 +00:00
|
|
|
#include "math_specialcharinset.h"
|
2001-08-13 14:19:16 +00:00
|
|
|
#include "math_sqrtinset.h"
|
|
|
|
#include "math_symbolinset.h"
|
|
|
|
#include "math_stackrelinset.h"
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * createMathInset(latexkeys const * l)
|
|
|
|
{
|
|
|
|
switch (l->token) {
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_FUNCLIM:
|
|
|
|
return new MathFuncLimInset(l);
|
|
|
|
case LM_TK_SPECIAL:
|
|
|
|
return new MathSpecialCharInset(l->id);
|
|
|
|
case LM_TK_SYM:
|
2001-08-31 21:15:57 +00:00
|
|
|
case LM_TK_CMR:
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_CMSY:
|
|
|
|
case LM_TK_CMM:
|
|
|
|
case LM_TK_CMEX:
|
|
|
|
case LM_TK_MSA:
|
|
|
|
case LM_TK_MSB:
|
|
|
|
return new MathSymbolInset(l);
|
|
|
|
case LM_TK_STACK:
|
|
|
|
return new MathStackrelInset;
|
|
|
|
case LM_TK_KERN:
|
|
|
|
return new MathKernInset;
|
|
|
|
case LM_TK_BINOM:
|
|
|
|
case LM_TK_CHOOSE:
|
|
|
|
return new MathBinomInset;
|
|
|
|
case LM_TK_OVER:
|
|
|
|
case LM_TK_FRAC:
|
|
|
|
return new MathFracInset;
|
|
|
|
case LM_TK_ATOP:
|
|
|
|
return new MathFracInset(true);
|
|
|
|
case LM_TK_NOT:
|
|
|
|
return new MathNotInset;
|
|
|
|
case LM_TK_SQRT:
|
|
|
|
return new MathSqrtInset;
|
|
|
|
case LM_TK_ROOT:
|
|
|
|
return new MathRootInset;
|
|
|
|
case LM_TK_DECORATION:
|
2001-09-03 15:22:55 +00:00
|
|
|
return new MathDecorationInset(l->name);
|
2001-08-30 22:42:26 +00:00
|
|
|
case LM_TK_SPACE:
|
|
|
|
return new MathSpaceInset(l->id);
|
|
|
|
case LM_TK_DOTS:
|
2001-09-03 15:22:55 +00:00
|
|
|
return new MathDotsInset(l->name);
|
2001-08-13 14:19:16 +00:00
|
|
|
}
|
|
|
|
return new MathFuncInset(l->name);
|
|
|
|
}
|
2001-08-15 05:50:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
MathInset * createMathInset(string const & s)
|
|
|
|
{
|
2001-09-11 10:58:17 +00:00
|
|
|
//cerr << "creating inset with name: '" << s << "'\n";
|
2001-09-12 14:31:18 +00:00
|
|
|
if (s.size() == 2 && s[0] == '#' && s[1] >= '1' && s[1] <= '9')
|
|
|
|
return new MathMacroArgument(s[1] - '0');
|
|
|
|
|
2001-10-10 16:35:18 +00:00
|
|
|
if (s.size() == 3 && s[0] == '\\' && s[1] == '#' && s[2] >= '1' && s[2] <= '9')
|
|
|
|
return new MathMacroArgument(s[2] - '0');
|
|
|
|
|
2001-08-15 05:50:39 +00:00
|
|
|
latexkeys const * l = in_word_set(s);
|
2001-09-11 10:58:17 +00:00
|
|
|
if (l)
|
2001-08-15 05:50:39 +00:00
|
|
|
return createMathInset(l);
|
|
|
|
|
|
|
|
if (MathMacroTable::hasTemplate(s))
|
|
|
|
return new MathMacro(MathMacroTable::provideTemplate(s));
|
|
|
|
|
|
|
|
return new MathFuncInset(s);
|
|
|
|
}
|