]> git.lyx.org Git - lyx.git/blob - src/insets/InsetIndexMacro.h
Move Lexer to support/ directory (and lyx::support namespace)
[lyx.git] / src / insets / InsetIndexMacro.h
1 // -*- C++ -*-
2 /**
3  * \file InsetIndexMacro.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Jürgen Spitzmüller
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_INSETMACRO_H
13 #define INSET_INSETMACRO_H
14
15
16 #include "Inset.h"
17 #include "InsetCollapsible.h"
18
19
20 namespace lyx {
21
22 class LaTeXFeatures;
23
24 class InsetIndexMacroParams
25 {
26 public:
27         enum Type {
28                 See,
29                 Seealso,
30                 Subentry,
31                 Sortkey
32         };
33         ///
34         InsetIndexMacroParams();
35         ///
36         void write(std::ostream & os) const;
37         ///
38         void read(support::Lexer & lex);
39         ///
40         Type type;
41 };
42
43 /////////////////////////////////////////////////////////////////////////
44 //
45 // InsetIndexMacro
46 //
47 /////////////////////////////////////////////////////////////////////////
48
49 /// Used to insert index references
50 class InsetIndexMacro : public InsetCollapsible
51 {
52 public:
53         ///
54         InsetIndexMacro(Buffer *, std::string const &);
55         ///
56         ~InsetIndexMacro();
57         ///
58         static std::string params2string(InsetIndexMacroParams const &);
59         ///
60         static void string2params(std::string const &, InsetIndexMacroParams &);
61         ///
62         InsetIndexMacroParams const & params() const { return params_; }
63         ///
64         void getLatex(otexstream &, OutputParams const &) const;
65         ///
66         int getPlaintext(odocstringstream &, OutputParams const &, size_t) const;
67         ///
68         void getDocbook(XMLStream &, OutputParams const &) const;
69         ///
70         bool hasNoContent() const;
71 private:
72         ///
73         InsetCode lyxCode() const override;
74         ///
75         docstring layoutName() const override;
76         ///
77         void write(std::ostream &) const override;
78         ///
79         void read(support::Lexer & lex) override;
80         ///
81         bool neverIndent() const override { return true; }
82         /// We do not output anything directly to the stream
83         void latex(otexstream &, OutputParams const &) const override {};
84         /// We do not output anything directly to the stream
85         int plaintext(odocstringstream &, OutputParams const &, size_t) const override { return 0; };
86         /// We do not output anything directly to the stream
87         void docbook(XMLStream &, OutputParams const &) const override {};
88         /// We do not output anything directly to the stream
89         docstring xhtml(XMLStream &, OutputParams const &) const override { return docstring(); };
90         ///
91         docstring getXhtml(XMLStream &, OutputParams const &) const;
92         ///
93         bool allowSpellCheck() const override { return false; }
94         ///
95         bool insetAllowed(InsetCode code) const override;
96         ///
97         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
98         ///
99         void doDispatch(Cursor & cur, FuncRequest & cmd) override;
100         ///
101         docstring toolTip(BufferView const & bv, int x, int y) const override;
102         ///
103         void processLatexSorting(otexstream &, OutputParams const &,
104                             docstring const, docstring const) const;
105         ///
106         bool hasSortKey() const;
107         ///
108         void getSortkey(otexstream &, OutputParams const &) const;
109         ///
110         std::string contextMenuName() const override;
111         ///
112         std::string contextMenu(BufferView const &, int, int) const override;
113         ///
114         Inset * clone() const override { return new InsetIndexMacro(*this); }
115         /// used by the constructors
116         void init();
117         ///
118         friend class InsetIndexMacroParams;
119
120         ///
121         InsetIndexMacroParams params_;
122 };
123
124
125 } // namespace lyx
126
127 #endif