]> git.lyx.org Git - lyx.git/blob - src/insets/InsetIndex.h
83bf4beaa8cc39b113d537e09bacdff1f66519b0
[lyx.git] / src / insets / InsetIndex.h
1 // -*- C++ -*-
2 /**
3  * \file InsetIndex.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_INDEX_H
13 #define INSET_INDEX_H
14
15
16 #include "InsetCollapsable.h"
17 #include "InsetCommand.h"
18
19
20 namespace lyx {
21
22 class InsetIndexParams {
23 public:
24         ///
25         explicit InsetIndexParams(docstring const & b = docstring())
26                 : index(b) {}
27         ///
28         void write(std::ostream & os) const;
29         ///
30         void read(Lexer & lex);
31         ///
32         docstring index;
33 };
34
35
36 /** Used to insert index labels
37   */
38 class InsetIndex : public InsetCollapsable {
39 public:
40         ///
41         InsetIndex(Buffer const &, InsetIndexParams const &);
42         ///
43         static std::string params2string(InsetIndexParams const &);
44         ///
45         static void string2params(std::string const &, InsetIndexParams &);
46 private:
47         ///
48         bool hasSettings() const;
49         ///
50         InsetCode lyxCode() const { return INDEX_CODE; }
51         ///
52         docstring name() const { return from_ascii("Index"); }
53         ///
54         void write(std::ostream & os) const;
55         ///
56         void read(Lexer & lex);
57         ///
58         int docbook(odocstream &, OutputParams const &) const;
59         ///
60         int latex(odocstream &, OutputParams const &) const;
61         ///
62         bool showInsetDialog(BufferView *) const;
63         ///
64         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
65         ///
66         void doDispatch(Cursor & cur, FuncRequest & cmd);
67         /// should paragraph indendation be omitted in any case?
68         bool neverIndent() const { return true; }
69         ///
70         void addToToc(DocIterator const &);
71         ///
72         docstring const buttonLabel(BufferView const & bv) const;
73         ///
74         docstring toolTip(BufferView const & bv, int x, int y) const;
75         /// Updates needed features for this inset.
76         void validate(LaTeXFeatures & features) const;
77         ///
78         docstring contextMenu(BufferView const & bv, int x, int y) const;
79         ///
80         Inset * clone() const { return new InsetIndex(*this); }
81
82         ///
83         friend class InsetIndexParams;
84         ///
85         InsetIndexParams params_;
86 };
87
88
89 class InsetPrintIndex : public InsetCommand {
90 public:
91         ///
92         InsetPrintIndex(InsetCommandParams const &);
93         ///
94         InsetCode lyxCode() const { return INDEX_PRINT_CODE; }
95
96         ///
97         static ParamInfo const & findInfo(std::string const &);
98         ///
99         static std::string defaultCommand() { return "printindex"; };
100         ///
101         static bool isCompatibleCommand(std::string const & s)
102                 { return s == "printindex" || s == "printsubindex"; }
103         ///
104         int latex(odocstream &, OutputParams const &) const;
105         ///
106         void doDispatch(Cursor & cur, FuncRequest & cmd);
107         ///
108         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
109         ///
110         virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
111 private:
112         /// Updates needed features for this inset.
113         void validate(LaTeXFeatures & features) const;
114         ///
115         bool hasSettings() const;
116
117         ///
118         DisplayType display() const { return AlignCenter; }
119         ///
120         docstring screenLabel() const;
121         ///
122         Inset * clone() const { return new InsetPrintIndex(*this); }
123 };
124
125
126 } // namespace lyx
127
128 #endif