2 /* This file is part of*
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2000 The LyX Team.
10 * ====================================================== */
12 #ifndef INSET_LATEXCOMMAND_H
13 #define INSET_LATEXCOMMAND_H
22 // Created by Alejandro 970222
23 /** Used to insert a LaTeX command automatically
25 * Similar to InsetLaTeX but having control of the basic structure of a
26 * LaTeX command: \name[options]{contents}.
28 class InsetCommand: public Inset {
33 InsetCommand(string const & name, string const & arg = string(),
34 string const & opt = string());
36 int ascent(Painter &, LyXFont const &) const;
38 int descent(Painter &, LyXFont const &) const;
40 int width(Painter &, LyXFont const &) const;
42 void draw(Painter &, LyXFont const &, int baseline, float & x) const;
44 void Write(ostream &) const;
45 /// Parse the command.
46 void scanCommand(string const & cmd);
47 /// Will not be used when lyxf3
48 void Read(LyXLex & lex);
50 virtual int Latex(ostream &, signed char fragile, bool free_spc) const;
51 #ifndef USE_OSTREAM_ONLY
53 virtual int Latex(string & file, signed char fragile, bool free_spc) const;
55 virtual int Linuxdoc(string & file) const;
57 virtual int DocBook(string & file) const;
60 virtual int Linuxdoc(ostream &) const;
62 virtual int DocBook(ostream &) const;
65 Inset * Clone() const;
67 Inset::Code LyxCode() const
69 return Inset::NO_CODE;
72 /** Get the label that appears at screen.
74 I thought it was enough to eliminate the argument to avoid
75 confusion with lyxinset::getLabel(int), but I've seen that
76 it wasn't. I hope you never confuse again both methods. (ale)
78 virtual string getScreenLabel() const
83 /// Build the complete LaTeX command
84 string getCommand() const;
86 string const & getCmdName() const {
90 string const & getOptions() const {
94 string const & getContents() const {
98 void setCmdName(string const & n) {
102 void setOptions(string const & o) {
106 virtual void setContents(string const & c) {