]> git.lyx.org Git - lyx.git/blob - src/insets/insetcommand.h
get rid of same_id from function signatures
[lyx.git] / src / insets / insetcommand.h
1 // -*- C++ -*-
2 /**
3  * \file insetcommand.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  * \author Lars Gullik Bjønnes
9  *
10  * Full author contact details are available in file CREDITS
11  */
12
13 #ifndef INSET_LATEXCOMMAND_H
14 #define INSET_LATEXCOMMAND_H
15
16
17 #include "insetbutton.h"
18 #include "insetcommandparams.h"
19 #include "mailinset.h"
20 #include <boost/utility.hpp>
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
29 ///
30 class InsetCommand : public InsetButton, boost::noncopyable {
31 public:
32         ///
33         explicit
34         InsetCommand(InsetCommandParams const &);
35         ///
36         //explicit
37         //InsetCommand(InsetCommandParams const &, bool same_id);
38         ///
39         void write(Buffer const *, std::ostream & os) const
40                 { p_.write(os); }
41         ///
42         virtual void read(Buffer const *, LyXLex & lex)
43                 { p_.read(lex); }
44         /// Can remove one InsetBibKey is modified
45         void scanCommand(string const & c) { p_.scanCommand(c); };
46         ///
47         virtual int latex(Buffer const *, std::ostream &,
48                           LatexRunParams const &) const;
49         ///
50         int ascii(Buffer const *, std::ostream &, int linelen) const;
51         ///
52         virtual int linuxdoc(Buffer const *, std::ostream &) const;
53         ///
54         virtual int docbook(Buffer const *, std::ostream &, bool) const;
55         ///
56         Inset::Code lyxCode() const { return Inset::NO_CODE; }
57
58         ///
59         string const getCommand() const { return p_.getCommand(); }
60         ///
61         string const & getCmdName() const { return p_.getCmdName(); }
62         ///
63         string const & getOptions() const { return p_.getOptions(); }
64         ///
65         string const & getContents() const { return p_.getContents(); }
66         ///
67         void setCmdName(string const & n) { p_.setCmdName(n); }
68         ///
69         void setOptions(string const & o) { p_.setOptions(o); }
70         ///
71         void setContents(string const & c) { p_.setContents(c); }
72         ///
73         InsetCommandParams const & params() const { return p_; }
74         ///
75         void setParams(InsetCommandParams const &);
76         ///
77         virtual dispatch_result localDispatch(FuncRequest const & cmd);
78
79 private:
80         ///
81         InsetCommandParams p_;
82 };
83
84
85 class InsetCommandMailer : public MailInset {
86 public:
87         ///
88         InsetCommandMailer(string const & name, InsetCommand & inset);
89         ///
90         virtual InsetBase & inset() const { return inset_; }
91         ///
92         virtual string const & name() const { return name_; }
93         ///
94         virtual string const inset2string() const;
95         ///
96         static void string2params(string const &, InsetCommandParams &);
97         ///
98         static string const params2string(string const & name,
99                                           InsetCommandParams const &);
100 private:
101         ///
102         string const name_;
103         ///
104         InsetCommand & inset_;
105 };
106
107
108 #endif