]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMath.cpp
Fixed some lines that were too long. It compiled afterwards.
[lyx.git] / src / mathed / InsetMath.cpp
1 /**
2  * \file InsetMath.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "InsetMath.h"
15 #include "MathData.h"
16 #include "MathStream.h"
17 #include "gettext.h"
18 #include "debug.h"
19
20 #include "support/lstrings.h"
21 #include "support/textutils.h"
22
23 #include <boost/current_function.hpp>
24
25 using std::endl;
26
27 namespace lyx {
28
29
30
31 MathData & InsetMath::cell(idx_type)
32 {
33         static MathData dummyCell;
34         lyxerr << BOOST_CURRENT_FUNCTION << ": I don't have any cell" << endl;
35         return dummyCell;
36 }
37
38
39 MathData const & InsetMath::cell(idx_type) const
40 {
41         static MathData dummyCell;
42         lyxerr << BOOST_CURRENT_FUNCTION << ": I don't have any cell" << endl;
43         return dummyCell;
44 }
45
46
47 void InsetMath::dump() const
48 {
49         lyxerr << "---------------------------------------------" << endl;
50         odocstringstream os;
51         WriteStream wi(os, false, true);
52         write(wi);
53         lyxerr << to_utf8(os.str());
54         lyxerr << "\n---------------------------------------------" << endl;
55 }
56
57
58 void InsetMath::metricsT(TextMetricsInfo const &, Dimension &) const
59 {
60         lyxerr << "InsetMath::metricsT(Text) called directly!" << endl;
61 }
62
63
64 void InsetMath::drawT(TextPainter &, int, int) const
65 {
66         lyxerr << "InsetMath::drawT(Text) called directly!" << endl;
67 }
68
69
70 void InsetMath::write(WriteStream & os) const
71 {
72         docstring const s = name();
73         os << "\\" << s;
74         // We need an extra ' ' unless this is a single-char-non-ASCII name
75         // or anything non-ASCII follows
76         if (s.size() != 1 || isAlphaASCII(s[0]))
77                 os.pendingSpace(true);
78 }
79
80
81 int InsetMath::plaintext(Buffer const &, odocstream &,
82                          OutputParams const &) const
83 {
84         // all math plain text output shall take place in InsetMathHull
85         BOOST_ASSERT(false);
86         return 0;
87 }
88
89
90 void InsetMath::normalize(NormalStream & os) const
91 {
92         os << '[' << name() << "] ";
93 }
94
95
96 void InsetMath::octave(OctaveStream & os) const
97 {
98         NormalStream ns(os.os());
99         normalize(ns);
100 }
101
102
103 void InsetMath::maple(MapleStream & os) const
104 {
105         NormalStream ns(os.os());
106         normalize(ns);
107 }
108
109
110 void InsetMath::maxima(MaximaStream & os) const
111 {
112         MapleStream ns(os.os());
113         maple(ns);
114 }
115
116
117 void InsetMath::mathematica(MathematicaStream & os) const
118 {
119         NormalStream ns(os.os());
120         normalize(ns);
121 }
122
123
124 void InsetMath::mathmlize(MathStream & os) const
125 {
126         NormalStream ns(os.os());
127         normalize(ns);
128 }
129
130
131 HullType InsetMath::getType() const
132 {
133         return hullNone;
134 }
135
136
137 std::ostream & operator<<(std::ostream & os, MathAtom const & at)
138 {
139         odocstringstream oss;
140         WriteStream wi(oss, false, false);
141         at->write(wi);
142         return os << to_utf8(oss.str());
143 }
144
145
146 odocstream & operator<<(odocstream & os, MathAtom const & at)
147 {
148         WriteStream wi(os, false, false);
149         at->write(wi);
150         return os;
151 }
152
153
154 } // namespace lyx