4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
8 * \author Lars Gullik Bjønnes
10 * Full author contact details are available in file CREDITS
13 #ifndef INSET_LATEXCOMMAND_H
14 #define INSET_LATEXCOMMAND_H
17 #include "insetbutton.h"
18 #include "insetcommandparams.h"
19 #include "mailinset.h"
20 #include <boost/utility.hpp>
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}.
30 class InsetCommand : public InsetButton, boost::noncopyable {
34 InsetCommand(InsetCommandParams const &, bool same_id = false);
36 void write(Buffer const *, std::ostream & os) const
39 virtual void read(Buffer const *, LyXLex & lex)
41 /// Can remove one InsetBibKey is modified
42 void scanCommand(string const & c) { p_.scanCommand(c); };
44 virtual int latex(Buffer const *, std::ostream &,
45 LatexRunParams const &,
48 int ascii(Buffer const *, std::ostream &, int linelen) const;
50 virtual int linuxdoc(Buffer const *, std::ostream &) const;
52 virtual int docbook(Buffer const *, std::ostream &, bool) const;
54 Inset::Code lyxCode() const { return Inset::NO_CODE; }
57 string const getCommand() const { return p_.getCommand(); }
59 string const & getCmdName() const { return p_.getCmdName(); }
61 string const & getOptions() const { return p_.getOptions(); }
63 string const & getContents() const { return p_.getContents(); }
65 void setCmdName(string const & n) { p_.setCmdName(n); }
67 void setOptions(string const & o) { p_.setOptions(o); }
69 void setContents(string const & c) { p_.setContents(c); }
71 InsetCommandParams const & params() const { return p_; }
73 void setParams(InsetCommandParams const &);
75 virtual dispatch_result localDispatch(FuncRequest const & cmd);
79 InsetCommandParams p_;
83 class InsetCommandMailer : public MailInset {
86 InsetCommandMailer(string const & name, InsetCommand & inset);
88 virtual InsetBase & inset() const { return inset_; }
90 virtual string const & name() const { return name_; }
92 virtual string const inset2string() const;
94 static void string2params(string const &, InsetCommandParams &);
96 static string const params2string(string const & name,
97 InsetCommandParams const &);
102 InsetCommand & inset_;