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