]> git.lyx.org Git - lyx.git/blob - src/mathed/math_factory.C
deco drawing bug fix
[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_macro.h"
12 #include "math_macrotable.h"
13 #include "math_noglyphinset.h"
14 #include "math_rootinset.h"
15 #include "math_spaceinset.h"
16 #include "math_sqrtinset.h"
17 #include "math_symbolinset.h"
18 #include "math_stackrelinset.h"
19
20
21 MathInset * createMathInset(latexkeys const * l)
22 {
23         switch (l->token) {
24                 case LM_TK_NOGLYPH:
25                 case LM_TK_NOGLYPHB:
26                         return new MathNoglyphInset(l);
27                 case LM_TK_BIGSYM:
28                         return new MathBigopInset(l);
29                 case LM_TK_FUNCLIM:
30                         return new MathFuncLimInset(l);
31                 case LM_TK_SYM: 
32                         return new MathSymbolInset(l);
33                 case LM_TK_STACK:
34                         return new MathStackrelInset;
35                 case LM_TK_BINOM:
36                 case LM_TK_CHOOSE:
37                         return new MathBinomInset;
38                 case LM_TK_OVER:
39                 case LM_TK_FRAC:
40                         return new MathFracInset;
41                 case LM_TK_SQRT:
42                         return new MathSqrtInset;
43                 case LM_TK_ROOT:
44                         return new MathRootInset;
45                 case LM_TK_DECORATION:
46                         return new MathDecorationInset(l);
47                 case LM_TK_SPACE:
48                         return new MathSpaceInset(l->id);
49                 case LM_TK_DOTS:
50                         return new MathDotsInset(l);
51         }
52         return new MathFuncInset(l->name);
53 }
54
55
56 MathInset * createMathInset(string const & s)
57 {
58         latexkeys const * l = in_word_set(s);
59         if (l) 
60                 return createMathInset(l);
61
62         if (MathMacroTable::hasTemplate(s)) 
63                 return new MathMacro(MathMacroTable::provideTemplate(s));
64
65         return new MathFuncInset(s);
66 }