]> git.lyx.org Git - lyx.git/blob - src/insets/InsetOptArg.h
This should be the last of the commits refactoring the InsetLayout code.
[lyx.git] / src / insets / InsetOptArg.h
1 // -*- C++ -*-
2 /**
3  * \file InsetOptArg.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Martin Vermeer
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSETOPTARG_H
13 #define INSETOPTARG_H
14
15
16 #include "InsetCollapsable.h"
17
18
19 namespace lyx {
20
21
22 /**
23  * InsetOptArg. Used to insert a short version of sectioning header etc.
24  * automatically, or other optional LaTeX arguments
25  */
26 class InsetOptArg : public InsetCollapsable {
27 public:
28         InsetOptArg(BufferParams const &);
29
30         /// code of the inset
31         InsetCode lyxCode() const { return OPTARG_CODE; }
32         ///
33         docstring name() const { return from_ascii("OptArg"); }
34         /// return an message upon editing
35         virtual docstring const editMessage() const;
36
37         /// Standard LaTeX output -- short-circuited
38         int latex(Buffer const &, odocstream &,
39                   OutputParams const &) const;
40         /// Standard plain text output -- short-circuited
41         int plaintext(Buffer const &, odocstream &,
42                       OutputParams const &) const;
43         /// Standard DocBook output -- short-circuited
44         int docbook(Buffer const &, odocstream &,
45                     OutputParams const &) const;
46
47         /// Outputting the optional parameter of a LaTeX command
48         int latexOptional(Buffer const &, odocstream &,
49                           OutputParams const &) const;
50         /// Write out to the .lyx file
51         void write(Buffer const & buf, std::ostream & os) const;
52
53         /// should paragraph indendation be ommitted in any case?
54         virtual bool neverIndent(Buffer const &) const { return true; }
55 protected:
56         InsetOptArg(InsetOptArg const &);
57 private:
58         virtual Inset * clone() const;
59 };
60
61
62 } // namespace lyx
63
64 #endif // INSETOPTARG_H