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_macro.h"
15 #include "math_support.h"
16 #include "math_extern.h"
17 #include "math_mathmlstream.h"
22 #include "BufferView.h"
23 #include "LaTeXFeatures.h"
32 MathMacro::MathMacro(string const & name)
37 auto_ptr<InsetBase> MathMacro::clone() const
39 return auto_ptr<InsetBase>(new MathMacro(*this));
43 string MathMacro::name() const
49 void MathMacro::setExpansion(MathArray const & exp, MathArray const & arg) const
56 void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
58 LyXFont font = mi.base.font;
59 augmentFont(font, "lyxtex");
60 mathed_string_dim(font, "\\" + name(), dim);
65 void MathMacro::metricsExpanded(MetricsInfo & mi, Dimension & dim) const
68 expanded_.metrics(mi, dim);
69 dim.wid -= args_.size() ? args_.width() : 0;
74 void MathMacro::draw(PainterInfo & pi, int x, int y) const
76 LyXFont font = pi.base.font;
77 augmentFont(font, "lyxtex");
78 drawStr(pi, font, x, y, "\\" + name());
79 setPosCache(pi, x, y);
83 void MathMacro::drawExpanded(PainterInfo & pi, int x, int y) const
85 expanded_.draw(pi, x, y);
86 drawMarkers2(pi, x, y);
90 int MathMacro::widthExpanded() const
92 return expanded_.width();
96 void MathMacro::validate(LaTeXFeatures & features) const
98 if (name() == "binom" || name() == "mathcircumflex")
99 features.require(name());
103 void MathMacro::maple(MapleStream & os) const
106 ::maple(expanded_, os);
110 void MathMacro::mathmlize(MathMLStream & os) const
113 ::mathmlize(expanded_, os);
117 void MathMacro::octave(OctaveStream & os) const
120 ::octave(expanded_, os);
124 void MathMacro::updateExpansion() const
128 //expanded_.substitute(*this);
132 void MathMacro::infoize(std::ostream & os) const
134 os << "Macro: " << name();
138 void MathMacro::infoize2(std::ostream & os) const
140 os << "Macro: " << name();