2 #include "command_inset.h"
3 #include "math_mathmlstream.h"
4 #include "funcrequest.h"
8 CommandInset::CommandInset(string const & data)
12 string::size_type idx0 = data.find("|++|");
13 name_ = data.substr(0, idx0);
14 if (idx0 == string::npos)
17 string::size_type idx1 = data.find("|++|", idx0);
18 cell(0) = asArray(data.substr(idx0, idx1 - idx0));
19 if (idx1 == string::npos)
21 cell(1) = asArray(data.substr(idx1 + 4));
25 MathInset * CommandInset::clone() const
27 return new CommandInset(*this);
32 CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
36 return ButtonInset::dispatch(cmd, idx, pos);
42 void CommandInset::write(WriteStream & os) const
44 os << '\\' << name_.c_str();
46 os << '[' << cell(1) << ']';
47 os << '{' << cell(0) << '}';
51 string CommandInset::screenLabel() const
57 string const CommandInset::createDialogStr(string const & name) const
60 data << name << " LatexCommand ";
61 WriteStream wsdata(data);
63 wsdata << "\n\\end_inset\n\n";