2 /* This file is part of*
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2001 The LyX Team.
10 * ====================================================== */
12 #ifndef INSET_LATEXCOMMAND_H
13 #define INSET_LATEXCOMMAND_H
19 #include "insetbutton.h"
20 #include "insetcommandparams.h"
21 #include <boost/signals/signal0.hpp>
22 #include <boost/utility.hpp>
24 // Created by Alejandro 970222
25 /** Used to insert a LaTeX command automatically
27 * Similar to InsetLaTeX but having control of the basic structure of a
28 * LaTeX command: \name[options]{contents}.
32 class InsetCommand : public InsetButton, boost::noncopyable {
36 InsetCommand(InsetCommandParams const &, bool same_id = false);
38 virtual ~InsetCommand() { hideDialog(); }
40 void write(Buffer const *, std::ostream & os) const
43 virtual void read(Buffer const *, LyXLex & lex)
45 /// Can remove one InsetBibKey is modified
46 void scanCommand(string const & c) { p_.scanCommand(c); };
48 virtual int latex(Buffer const *, std::ostream &,
49 bool fragile, bool free_spc) const;
51 int ascii(Buffer const *, std::ostream &, int linelen) const;
53 virtual int linuxdoc(Buffer const *, std::ostream &) const;
55 virtual int docbook(Buffer const *, std::ostream &, bool) const;
57 Inset::Code lyxCode() const { return Inset::NO_CODE; }
60 string const getCommand() const { return p_.getCommand(); }
62 string const & getCmdName() const { return p_.getCmdName(); }
64 string const & getOptions() const { return p_.getOptions(); }
66 string const & getContents() const { return p_.getContents(); }
68 void setCmdName(string const & n) { p_.setCmdName(n); }
70 void setOptions(string const & o) { p_.setOptions(o); }
72 void setContents(string const & c) { p_.setContents(c); }
74 InsetCommandParams const & params() const { return p_; }
76 void setParams(InsetCommandParams const &);
78 boost::signal0<void> hideDialog;
82 InsetCommandParams p_;