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.
6 * \author Alejandro Aguilar Sierra
9 * Full author contact details are available in file CREDITS.
14 #include "math_macroarg.h"
15 #include "math_macro.h"
16 #include "math_mathmlstream.h"
17 #include "math_support.h"
24 MathMacroArgument::MathMacroArgument(int n)
25 : MathNestInset(1), number_(n), expanded_(false)
28 lyxerr << "MathMacroArgument::MathMacroArgument: wrong Argument id: "
32 str_[1] = static_cast<unsigned char>('0' + n);
37 auto_ptr<InsetBase> MathMacroArgument::clone() const
39 return auto_ptr<InsetBase>(new MathMacroArgument(*this));
43 void MathMacroArgument::write(WriteStream & os) const
49 void MathMacroArgument::metrics(MetricsInfo & mi, Dimension & dim) const
52 cell(0).metrics(mi, dim_);
54 mathed_string_dim(mi.base.font, str_, dim_);
59 void MathMacroArgument::draw(PainterInfo & pi, int x, int y) const
62 cell(0).draw(pi, x, y);
64 drawStrRed(pi, x, y, str_);
68 void MathMacroArgument::normalize(NormalStream & os) const
70 os << "[macroarg " << str_ << "] ";
74 void MathMacroArgument::substitute(MathMacro const & m)
76 cell(0) = m.cell(number_ - 1);