]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macroarg.C
Remove mixed_content from output parameters.
[lyx.git] / src / mathed / math_macroarg.C
1 /**
2  * \file math_macroarg.C
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 "math_macroarg.h"
15 #include "math_macro.h"
16 #include "math_mathmlstream.h"
17 #include "math_support.h"
18 #include "debug.h"
19
20 using std::endl;
21 using std::auto_ptr;
22 using std::size_t;
23
24
25 MathMacroArgument::MathMacroArgument(size_t n)
26         : number_(n)
27 {
28         if (n < 1 || n > 9) {
29                 lyxerr << "MathMacroArgument::MathMacroArgument: wrong Argument id: "
30                         << n << endl;
31         }
32         str_[0] = '#';
33         str_[1] = static_cast<unsigned char>('0' + n);
34         str_[2] = '\0';
35 }
36
37
38 auto_ptr<InsetBase> MathMacroArgument::clone() const
39 {
40         return auto_ptr<InsetBase>(new MathMacroArgument(*this));
41 }
42
43
44 void MathMacroArgument::write(WriteStream & os) const
45 {
46         os << str_;
47 }
48
49
50 void MathMacroArgument::metrics(MetricsInfo & mi, Dimension & dim) const
51 {
52         mathed_string_dim(mi.base.font, str_, dim_);
53         dim = dim_;
54 }
55
56
57 void MathMacroArgument::draw(PainterInfo & pi, int x, int y) const
58 {
59         drawStrRed(pi, x, y, str_);
60         setPosCache(pi, x, y);
61 }
62
63
64 void MathMacroArgument::normalize(NormalStream & os) const
65 {
66         os << "[macroarg " << str_ << "] ";
67 }