]> git.lyx.org Git - lyx.git/blob - src/insets/InsetIndex.h
* LaTeX.cpp: some debug output.
[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 private:
43         ///
44         EDITABLE editable() const { return HIGHLY_EDITABLE; }
45         ///
46         InsetCode lyxCode() const { return INDEX_CODE; }
47         ///
48         docstring name() const { return from_ascii("Index"); }
49         ///
50         void write(std::ostream & os) const;
51         ///
52         void read(Lexer & lex);
53         ///
54         int docbook(odocstream &, OutputParams const &) const;
55         ///
56         int latex(odocstream &, OutputParams const &) const;
57         ///
58         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
59         ///
60         void doDispatch(Cursor & cur, FuncRequest & cmd);
61         /// should paragraph indendation be omitted in any case?
62         bool neverIndent() const { return true; }
63         ///
64         void addToToc(DocIterator const &);
65         ///
66         docstring const buttonLabel(BufferView const & bv) const;
67         ///
68         docstring toolTip(BufferView const & bv, int x, int y) const;
69         /// Updates needed features for this inset.
70         void validate(LaTeXFeatures & features) const;
71         ///
72         docstring contextMenu(BufferView const & bv, int x, int y) const;
73         ///
74         Inset * clone() const { return new InsetIndex(*this); }
75
76         ///
77         friend class InsetIndexParams;
78         ///
79         InsetIndexParams params_;
80 };
81
82
83 class InsetPrintIndex : public InsetCommand {
84 public:
85         ///
86         InsetPrintIndex(InsetCommandParams const &);
87         ///
88         InsetCode lyxCode() const { return INDEX_PRINT_CODE; }
89
90         ///
91         static ParamInfo const & findInfo(std::string const &);
92         ///
93         static std::string defaultCommand() { return "printindex"; };
94         ///
95         static bool isCompatibleCommand(std::string const & s) 
96                 { return s == "printindex"; }
97         ///
98         int latex(odocstream &, OutputParams const &) const;
99         ///
100         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
101         ///
102         virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
103 private:
104         /// Updates needed features for this inset.
105         void validate(LaTeXFeatures & features) const;
106         ///
107         EDITABLE editable() const { return NOT_EDITABLE; }
108         ///
109         DisplayType display() const { return AlignCenter; }
110         ///
111         docstring screenLabel() const;
112         ///
113         Inset * clone() const { return new InsetPrintIndex(*this); }
114 };
115
116
117 } // namespace lyx
118
119 #endif