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());
37 int ascent(Painter &, LyXFont const &) const;
39 int descent(Painter &, LyXFont const &) const;
41 int width(Painter &, LyXFont const &) const;
43 void draw(Painter &, LyXFont const &, int baseline, float & x) const;
46 int Ascent(LyXFont const & font) const;
48 int Descent(LyXFont const & font) const;
50 int Width(LyXFont const & font) const;
52 void Draw(LyXFont, LyXScreen & scr, int baseline, float & x);
55 void Write(ostream &);
56 /// Parse the command.
57 void scanCommand(string const & cmd);
58 /// Will not be used when lyxf3
59 void Read(LyXLex & lex);
61 virtual int Latex(ostream &, signed char fragile);
63 virtual int Latex(string & file, signed char fragile);
65 virtual int Linuxdoc(string & file);
67 virtual int DocBook(string & file);
69 Inset * Clone() const;
71 Inset::Code LyxCode() const
73 return Inset::NO_CODE;
76 /** Get the label that appears at screen.
78 I thought it was enough to eliminate the argument to avoid
79 confusion with lyxinset::getLabel(int), but I've seen that
80 it wasn't. I hope you never confuse again both methods. (ale)
82 virtual string getScreenLabel() const
87 /// Build the complete LaTeX command
88 string getCommand() const;
90 string const & getCmdName() const {
94 string const & getOptions() const {
98 string const & getContents() const {
102 void setCmdName(string const & n) {
106 void setOptions(string const & o) {
110 virtual void setContents(string const & c) {