2002-06-24 15:51:35 +00:00
|
|
|
|
|
|
|
#include "command_inset.h"
|
|
|
|
#include "math_mathmlstream.h"
|
2002-08-19 10:11:13 +00:00
|
|
|
#include "funcrequest.h"
|
2003-03-04 16:39:13 +00:00
|
|
|
#include "Lsstream.h"
|
2002-06-24 15:51:35 +00:00
|
|
|
|
|
|
|
|
2003-03-04 18:54:56 +00:00
|
|
|
CommandInset::CommandInset(string const & name)
|
|
|
|
: name_(name)
|
2002-06-24 15:51:35 +00:00
|
|
|
{
|
|
|
|
lock_ = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MathInset * CommandInset::clone() const
|
|
|
|
{
|
|
|
|
return new CommandInset(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-18 11:47:16 +00:00
|
|
|
dispatch_result
|
2002-08-19 10:11:13 +00:00
|
|
|
CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
|
|
|
|
{
|
|
|
|
switch (cmd.action) {
|
|
|
|
default:
|
|
|
|
return ButtonInset::dispatch(cmd, idx, pos);
|
|
|
|
}
|
|
|
|
return UNDISPATCHED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-24 15:51:35 +00:00
|
|
|
void CommandInset::write(WriteStream & os) const
|
|
|
|
{
|
2002-11-27 10:30:28 +00:00
|
|
|
os << '\\' << name_.c_str();
|
2002-06-24 15:51:35 +00:00
|
|
|
if (cell(1).size())
|
2002-11-27 10:30:28 +00:00
|
|
|
os << '[' << cell(1) << ']';
|
|
|
|
os << '{' << cell(0) << '}';
|
2002-06-24 15:51:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string CommandInset::screenLabel() const
|
|
|
|
{
|
|
|
|
return name_;
|
|
|
|
}
|
2003-03-04 16:39:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
string const CommandInset::createDialogStr(string const & name) const
|
|
|
|
{
|
|
|
|
ostringstream data;
|
|
|
|
data << name << " LatexCommand ";
|
|
|
|
WriteStream wsdata(data);
|
|
|
|
write(wsdata);
|
|
|
|
wsdata << "\n\\end_inset\n\n";
|
|
|
|
|
|
|
|
return data.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
|