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
24 // Created by Alejandro 970222
25 /** Used to insert a LaTeX command automatically
27 * Similar to InsetLaTeX but having control of the basic structure of a
28 * LaTeX command: \name[options]{contents}.
30 class InsetCommand: public Inset {
35 InsetCommand(string const & name, string const & arg = string(),
36 string const & opt = string());
38 int ascent(Painter &, LyXFont const &) const;
40 int descent(Painter &, LyXFont const &) const;
42 int width(Painter &, LyXFont const &) const;
44 void draw(Painter &, LyXFont const &, int baseline, float & x) const;
46 void Write(ostream &) const;
47 /// Parse the command.
48 void scanCommand(string const & cmd);
49 /// Will not be used when lyxf3
50 void Read(LyXLex & lex);
52 virtual int Latex(ostream &, signed char fragile, bool free_spc) const;
54 virtual int Linuxdoc(ostream &) const;
56 virtual int DocBook(ostream &) const;
58 Inset * Clone() const;
60 Inset::Code LyxCode() const
62 return Inset::NO_CODE;
65 /** Get the label that appears at screen.
67 I thought it was enough to eliminate the argument to avoid
68 confusion with lyxinset::getLabel(int), but I've seen that
69 it wasn't. I hope you never confuse again both methods. (ale)
71 virtual string getScreenLabel() const
76 /// Build the complete LaTeX command
77 string getCommand() const;
79 string const & getCmdName() const {
83 string const & getOptions() const {
87 string const & getContents() const {
91 void setCmdName(string const & n) {
95 void setOptions(string const & o) {
99 virtual void setContents(string const & c) {