]> git.lyx.org Git - lyx.git/blob - src/insets/insetcommand.h
separate insetcommand.[Ch] into two files
[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-2001 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 "insetbutton.h"
20 #include "insetcommandparams.h"
21 #include <boost/signals/signal0.hpp>
22 #include <boost/utility.hpp>
23
24 // Created by Alejandro 970222
25 /** Used to insert a LaTeX command automatically
26  *
27  * Similar to InsetLaTeX but having control of the basic structure of a
28  *   LaTeX command: \name[options]{contents}.
29  */
30
31 ///
32 class InsetCommand : public InsetButton, boost::noncopyable {
33 public:
34         ///
35         explicit
36         InsetCommand(InsetCommandParams const &, bool same_id = false);
37         ///
38         virtual ~InsetCommand() { hideDialog(); }
39         ///
40         void write(Buffer const *, std::ostream & os) const
41                 { p_.write(os); }
42         ///
43         virtual void read(Buffer const *, LyXLex & lex)
44                 { p_.read(lex); }
45         /// Can remove one InsetBibKey is modified
46         void scanCommand(string const & c) { p_.scanCommand(c); };
47         ///
48         virtual int latex(Buffer const *, std::ostream &,
49                           bool fragile, bool free_spc) const;
50         ///
51         int ascii(Buffer const *, std::ostream &, int linelen) const;
52         ///
53         virtual int linuxdoc(Buffer const *, std::ostream &) const;
54         ///
55         virtual int docbook(Buffer const *, std::ostream &, bool) const;
56         ///
57         Inset::Code lyxCode() const { return Inset::NO_CODE; }
58
59         ///
60         string const getCommand() const { return p_.getCommand(); }
61         ///
62         string const & getCmdName() const { return p_.getCmdName(); }
63         ///
64         string const & getOptions() const { return p_.getOptions(); }
65         ///
66         string const & getContents() const { return p_.getContents(); }
67         ///
68         void setCmdName(string const & n) { p_.setCmdName(n); }
69         ///
70         void setOptions(string const & o) { p_.setOptions(o); }
71         ///
72         void setContents(string const & c) { p_.setContents(c); }
73         ///
74         InsetCommandParams const & params() const { return p_; }
75         ///
76         void setParams(InsetCommandParams const &);
77         ///
78         boost::signal0<void> hideDialog;
79
80 private:
81         ///
82         InsetCommandParams p_;
83 };
84
85 #endif