]> git.lyx.org Git - lyx.git/blob - src/insets/insetcommand.h
fix lyxalgo.h, dra pagebreak with text on line, change the math_deco_search a bit
[lyx.git] / src / insets / insetcommand.h
1 // -*- C++ -*-
2 /* This file is part of*
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *       
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef INSET_LATEXCOMMAND_H
13 #define INSET_LATEXCOMMAND_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "lyxinset.h"
20 #include "LString.h"
21
22 // Created by Alejandro 970222
23 /** Used to insert a LaTeX command automatically
24  *
25  * Similar to InsetLaTeX but having control of the basic structure of a
26  *   LaTeX command: \name[options]{contents}. 
27  */
28 class InsetCommand: public Inset {
29 public:
30         ///
31         InsetCommand();
32         ///
33         InsetCommand(string const & name, string const & arg = string(), 
34                      string const & opt = string());
35         ///
36         int ascent(Painter &, LyXFont const &) const;
37         ///
38         int descent(Painter &, LyXFont const &) const;
39         ///
40         int width(Painter &, LyXFont const &) const;
41         ///
42         void draw(Painter &, LyXFont const &, int baseline, float & x) const;
43         ///
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);
49         /// 
50         virtual int Latex(ostream &, signed char fragile, bool free_spc) const;
51         ///
52         virtual int Linuxdoc(ostream &) const;
53         ///
54         virtual int DocBook(ostream &) const;
55         ///
56         Inset * Clone() const;
57         ///  
58         Inset::Code LyxCode() const
59         {
60                 return Inset::NO_CODE;
61         }
62         
63         /** Get the label that appears at screen.
64           
65          I thought it was enough to eliminate the argument to avoid
66          confusion with lyxinset::getLabel(int), but I've seen that
67          it wasn't. I hope you never confuse again both methods.  (ale)
68          */
69         virtual string getScreenLabel() const
70         {
71                 return getCommand();
72         }
73         
74         /// Build the complete LaTeX command
75         string getCommand() const;
76         ///
77         string const & getCmdName() const {
78                 return command;
79         }
80         ///
81         string const & getOptions() const {
82                 return options;
83         }
84         ///
85         string const & getContents() const {
86                 return contents;
87         }
88         ///
89         void setCmdName(string const & n) {
90                 command = n;
91         }
92         ///
93         void setOptions(string const & o) {
94                 options = o;
95         }
96         ///
97         virtual void setContents(string const & c) {
98                 contents = c;
99         }
100 protected:
101         ///    
102         string command;
103         ///    
104         string options;
105         ///    
106         string contents;
107 };
108
109 #endif