2 * \file command_inset.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "command_inset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "funcrequest.h"
17 #include "support/std_sstream.h"
20 using std::ostringstream;
23 CommandInset::CommandInset(string const & name)
32 auto_ptr<InsetBase> CommandInset::clone() const
34 return auto_ptr<InsetBase>(new CommandInset(*this));
38 void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
42 button_.update(screenLabel(), true);
44 button_.metrics(mi, dim);
48 void CommandInset::draw(PainterInfo & pi, int x, int y) const
50 button_.draw(pi, x, y);
54 CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
58 return MathNestInset::dispatch(cmd, idx, pos);
64 void CommandInset::write(WriteStream & os) const
66 os << '\\' << name_.c_str();
68 os << '[' << cell(1) << ']';
69 os << '{' << cell(0) << '}';
73 string const CommandInset::screenLabel() const
79 string const CommandInset::createDialogStr(string const & name) const
82 data << name << " LatexCommand ";
83 WriteStream wsdata(data);
85 wsdata << "\n\\end_inset\n\n";