]> git.lyx.org Git - lyx.git/blob - src/mathed/command_inset.C
fix #1073
[lyx.git] / src / mathed / command_inset.C
1
2 #include "command_inset.h"
3 #include "math_mathmlstream.h"
4 #include "funcrequest.h"
5 #include "Lsstream.h"
6
7
8 CommandInset::CommandInset(string const & name)
9         : name_(name)
10 {
11         lock_ = true;
12 }
13
14
15 MathInset * CommandInset::clone() const
16 {
17         return new CommandInset(*this);
18 }
19
20
21 dispatch_result
22 CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
23 {
24         switch (cmd.action) {
25                 default:
26                         return ButtonInset::dispatch(cmd, idx, pos);
27         }
28         return UNDISPATCHED;
29 }
30
31
32 void CommandInset::write(WriteStream & os) const
33 {
34         os << '\\' << name_.c_str();
35         if (cell(1).size())
36                 os << '[' << cell(1) << ']';
37         os << '{' << cell(0) << '}';
38 }
39
40
41 string CommandInset::screenLabel() const
42 {
43         return name_;
44 }
45
46
47 string const CommandInset::createDialogStr(string const & name) const
48 {
49         ostringstream data;
50         data << name << " LatexCommand ";
51         WriteStream wsdata(data);
52         write(wsdata);
53         wsdata << "\n\\end_inset\n\n";
54
55         return data.str();
56 }
57
58