]> git.lyx.org Git - lyx.git/blob - src/insets/InsetIndex.h
Fix another use of unqualified std::move
[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 "InsetCollapsible.h"
17 #include "InsetCommand.h"
18
19
20 namespace lyx {
21
22 class IndexEntry;
23
24 class InsetIndexParams {
25 public:
26         enum PageRange {
27                 None,
28                 Start,
29                 End
30         };
31         ///
32         explicit InsetIndexParams(docstring const & b = docstring())
33                 : index(b), range(None), pagefmt("default") {}
34         ///
35         void write(std::ostream & os) const;
36         ///
37         void read(Lexer & lex);
38         ///
39         docstring index;
40         ///
41         PageRange range;
42         ///
43         std::string pagefmt;
44 };
45
46
47 /** Used to insert index labels
48   */
49 class InsetIndex : public InsetCollapsible {
50 public:
51         ///
52         InsetIndex(Buffer *, InsetIndexParams const &);
53         ///
54         static std::string params2string(InsetIndexParams const &);
55         ///
56         static void string2params(std::string const &, InsetIndexParams &);
57         ///
58         const InsetIndexParams& params() const { return params_; }
59         ///
60         int rowFlags() const override { return CanBreakBefore | CanBreakAfter; }
61 private:
62         ///
63         bool hasSettings() const override;
64         ///
65         InsetCode lyxCode() const override { return INDEX_CODE; }
66         ///
67         docstring layoutName() const override { return from_ascii("Index"); }
68         ///
69         ColorCode labelColor() const override;
70         ///
71         void write(std::ostream & os) const override;
72         ///
73         void read(Lexer & lex) override;
74         ///
75         void docbook(XMLStream &, OutputParams const &) const override;
76         ///
77         docstring xhtml(XMLStream &, OutputParams const &) const override;
78         ///
79         void latex(otexstream &, OutputParams const &) const override;
80         ///
81         void processLatexSorting(otexstream &, OutputParams const &,
82                                  docstring const, docstring const) const;
83         ///
84         bool showInsetDialog(BufferView *) const override;
85         ///
86         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
87         ///
88         void doDispatch(Cursor & cur, FuncRequest & cmd) override;
89         /// should paragraph indentation be omitted in any case?
90         bool neverIndent() const override { return true; }
91         ///
92         void addToToc(DocIterator const & di, bool output_active,
93                                   UpdateType utype, TocBackend & backend) const override;
94         ///
95         docstring toolTip(BufferView const & bv, int x, int y) const override;
96         ///
97         docstring const buttonLabel(BufferView const & bv) const override;
98         /// Updates needed features for this inset.
99         void validate(LaTeXFeatures & features) const override;
100         ///
101         void getSortkey(otexstream &, OutputParams const &) const;
102         ///
103         docstring getSortkeyAsText(OutputParams const &) const;
104         ///
105         void emptySubentriesWarning(docstring const & mainentry) const;
106         ///
107         void getSubentries(otexstream &, OutputParams const &, docstring const &) const;
108         ///
109         std::vector<docstring> getSubentriesAsText(OutputParams const &,
110                                                    bool const asLabel = false) const;
111         ///
112         docstring getMainSubentryAsText(OutputParams const & runparams) const;
113         ///
114         void getSeeRefs(otexstream &, OutputParams const &) const;
115         ///
116         docstring getSeeAsText(OutputParams const & runparams,
117                                bool const asLabel = false) const;
118         ///
119         std::vector<docstring> getSeeAlsoesAsText(OutputParams const & runparams,
120                                                   bool const asLabel = false) const;
121         ///
122         bool hasSubentries() const;
123         ///
124         bool hasSeeRef() const;
125         ///
126         bool hasSortKey() const;
127         ///
128         bool macrosPossible(std::string const type) const;
129         ///
130         std::string contextMenuName() const override;
131         ///
132         std::string contextMenu(BufferView const &, int, int) const override;
133         ///
134         Inset * clone() const override { return new InsetIndex(*this); }
135         /// Is the content of this inset part of the immediate text sequence?
136         bool isPartOfTextSequence() const override { return false; }
137         ///
138         bool insetAllowed(InsetCode code) const override;
139
140         ///
141         friend class InsetIndexParams;
142         ///
143         friend class IndexEntry;
144         ///
145         InsetIndexParams params_;
146 };
147
148
149 class InsetPrintIndex : public InsetCommand {
150 public:
151         ///
152         InsetPrintIndex(Buffer * buf, InsetCommandParams const &);
153
154         /// \name Public functions inherited from Inset class
155         //@{
156         ///
157         InsetCode lyxCode() const override { return INDEX_PRINT_CODE; }
158         ///
159         void latex(otexstream &, OutputParams const &) const override;
160         ///
161         docstring xhtml(XMLStream &, OutputParams const &) const override;
162         ///
163         void doDispatch(Cursor & cur, FuncRequest & cmd) override;
164         ///
165         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
166         ///
167         void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false) override;
168         ///
169         std::string contextMenuName() const override;
170         /// Updates needed features for this inset.
171         void validate(LaTeXFeatures & features) const override;
172         ///
173         bool hasSettings() const override;
174         ///
175         int rowFlags() const override { return Display; }
176         //@}
177
178         /// \name Static public methods obligated for InsetCommand derived classes
179         //@{
180         ///
181         static ParamInfo const & findInfo(std::string const &);
182         ///
183         static std::string defaultCommand() { return "printindex"; }
184         ///
185         static bool isCompatibleCommand(std::string const & s);
186         //@}
187
188 private:
189         /// \name Private functions inherited from Inset class
190         //@{
191         ///
192         Inset * clone() const override { return new InsetPrintIndex(*this); }
193         //@}
194
195         /// \name Private functions inherited from InsetCommand class
196         //@{
197         ///
198         docstring screenLabel() const override;
199         //@}
200 };
201
202
203 } // namespace lyx
204
205 #endif