]> git.lyx.org Git - lyx.git/blob - src/mathed/math_factory.C
some support for TeX's \kern primitive in the parser.
[lyx.git] / src / mathed / math_factory.C
1 #include <config.h>
2
3 #include "math_parser.h"
4 #include "math_bigopinset.h"
5 #include "math_binominset.h"
6 #include "math_decorationinset.h"
7 #include "math_dotsinset.h"
8 #include "math_funcinset.h"
9 #include "math_funcliminset.h"
10 #include "math_fracinset.h"
11 #include "math_kerninset.h"
12 #include "math_macro.h"
13 #include "math_macrotable.h"
14 #include "math_noglyphinset.h"
15 #include "math_notinset.h"
16 #include "math_rootinset.h"
17 #include "math_spaceinset.h"
18 #include "math_sqrtinset.h"
19 #include "math_symbolinset.h"
20 #include "math_stackrelinset.h"
21
22
23 MathInset * createMathInset(latexkeys const * l)
24 {
25         switch (l->token) {
26                 case LM_TK_NOGLYPH:
27                 case LM_TK_NOGLYPHB:
28                         return new MathNoglyphInset(l);
29                 case LM_TK_BIGSYM:
30                         return new MathBigopInset(l);
31                 case LM_TK_FUNCLIM:
32                         return new MathFuncLimInset(l);
33                 case LM_TK_SYM: 
34                         return new MathSymbolInset(l);
35                 case LM_TK_STACK:
36                         return new MathStackrelInset;
37                 case LM_TK_KERN: 
38                         return new MathKernInset;
39                 case LM_TK_BINOM:
40                 case LM_TK_CHOOSE:
41                         return new MathBinomInset;
42                 case LM_TK_OVER:
43                 case LM_TK_FRAC:
44                         return new MathFracInset;
45                 case LM_TK_ATOP:
46                         return new MathFracInset(true);
47                 case LM_TK_NOT:
48                         return new MathNotInset;
49                 case LM_TK_SQRT:
50                         return new MathSqrtInset;
51                 case LM_TK_ROOT:
52                         return new MathRootInset;
53                 case LM_TK_DECORATION:
54                         return new MathDecorationInset(l);
55                 case LM_TK_SPACE:
56                         return new MathSpaceInset(l->id);
57                 case LM_TK_DOTS:
58                         return new MathDotsInset(l);
59         }
60         return new MathFuncInset(l->name);
61 }
62
63
64 MathInset * createMathInset(string const & s)
65 {
66         latexkeys const * l = in_word_set(s);
67         if (l) 
68                 return createMathInset(l);
69
70         if (MathMacroTable::hasTemplate(s)) 
71                 return new MathMacro(MathMacroTable::provideTemplate(s));
72
73         return new MathFuncInset(s);
74 }