]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathFont.cpp
remove unneeded includes.
[lyx.git] / src / mathed / InsetMathFont.cpp
1 /**
2  * \file InsetMathFont.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "InsetMathFont.h"
14
15 #include "LaTeXFeatures.h"
16 #include "MathData.h"
17 #include "MathStream.h"
18 #include "MathParser.h"
19 #include "MetricsInfo.h"
20
21
22 namespace lyx {
23
24 InsetMathFont::InsetMathFont(latexkeys const * key)
25         : InsetMathNest(1), key_(key)
26 {}
27
28
29 Inset * InsetMathFont::clone() const
30 {
31         return new InsetMathFont(*this);
32 }
33
34
35 InsetMath::mode_type InsetMathFont::currentMode() const
36 {
37         if (key_->extra == "mathmode")
38                 return MATH_MODE;
39         if (key_->extra == "textmode")
40                 return TEXT_MODE;
41         return UNDECIDED_MODE;
42 }
43
44
45 void InsetMathFont::metrics(MetricsInfo & mi, Dimension & dim) const
46 {
47         FontSetChanger dummy(mi.base, key_->name);
48         cell(0).metrics(mi, dim);
49         metricsMarkers(dim);
50 }
51
52
53 void InsetMathFont::draw(PainterInfo & pi, int x, int y) const
54 {
55         FontSetChanger dummy(pi.base, key_->name.c_str());
56         cell(0).draw(pi, x + 1, y);
57         drawMarkers(pi, x, y);
58         setPosCache(pi, x, y);
59 }
60
61
62 void InsetMathFont::metricsT(TextMetricsInfo const & mi, Dimension &) const
63 {
64         // FIXME: BROKEN!
65         Dimension dim;
66         cell(0).metricsT(mi, dim);
67 }
68
69
70 void InsetMathFont::drawT(TextPainter & pain, int x, int y) const
71 {
72         cell(0).drawT(pain, x, y);
73 }
74
75
76 docstring InsetMathFont::name() const
77 {
78         return key_->name;
79 }
80
81
82 void InsetMathFont::validate(LaTeXFeatures & features) const
83 {
84         InsetMathNest::validate(features);
85         // Make sure amssymb is put in preamble if Blackboard Bold or
86         // Fraktur used:
87         if (key_->name == "mathfrak" || key_->name == "mathbb")
88                 features.require("amssymb");
89         if (key_->name == "text")
90                 features.require("amsmath");
91         if (key_->name == "textipa")
92                 features.require("tipa");
93 }
94
95
96 void InsetMathFont::infoize(odocstream & os) const
97 {
98         os << "Font: " << key_->name;
99 }
100
101
102 } // namespace lyx