4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
16 #include "InsetCollapsible.h"
17 #include "InsetCommand.h"
22 class InsetIndexParams {
30 explicit InsetIndexParams(docstring const & b = docstring())
31 : index(b), range(None), pagefmt("default") {}
33 void write(std::ostream & os) const;
35 void read(Lexer & lex);
45 /** Used to insert index labels
47 class InsetIndex : public InsetCollapsible {
50 InsetIndex(Buffer *, InsetIndexParams const &);
52 static std::string params2string(InsetIndexParams const &);
54 static void string2params(std::string const &, InsetIndexParams &);
57 bool hasSettings() const override;
59 InsetCode lyxCode() const override { return INDEX_CODE; }
61 docstring layoutName() const override { return from_ascii("Index"); }
63 ColorCode labelColor() const override;
65 void write(std::ostream & os) const override;
67 void read(Lexer & lex) override;
69 void docbook(XMLStream &, OutputParams const &) const override;
71 docstring xhtml(XMLStream &, OutputParams const &) const override;
73 void latex(otexstream &, OutputParams const &) const override;
75 void processLatexSorting(otexstream &, OutputParams const &,
76 docstring const, docstring const) const;
78 bool showInsetDialog(BufferView *) const override;
80 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
82 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
83 /// should paragraph indentation be omitted in any case?
84 bool neverIndent() const override { return true; }
86 void addToToc(DocIterator const & di, bool output_active,
87 UpdateType utype, TocBackend & backend) const override;
89 docstring toolTip(BufferView const & bv, int x, int y) const override;
91 docstring const buttonLabel(BufferView const & bv) const override;
92 /// Updates needed features for this inset.
93 void validate(LaTeXFeatures & features) const override;
95 void getSortkey(otexstream &, OutputParams const &) const;
97 docstring getSortkeyAsText(OutputParams const &) const;
99 void getSubentries(otexstream &, OutputParams const &) const;
101 std::vector<docstring> getSubentriesAsText(OutputParams const &) const;
103 void getSeeRefs(otexstream &, OutputParams const &) const;
105 docstring getSeeAsText(OutputParams const & runparams) const;
107 std::vector<docstring> getSeeAlsoesAsText(OutputParams const & runparams) const;
109 bool hasSeeRef() const;
111 bool hasSortKey() const;
113 bool macrosPossible(std::string const type) const;
115 std::string contextMenuName() const override;
117 std::string contextMenu(BufferView const &, int, int) const override;
119 Inset * clone() const override { return new InsetIndex(*this); }
120 /// Is the content of this inset part of the immediate text sequence?
121 bool isPartOfTextSequence() const override { return false; }
123 bool insetAllowed(InsetCode code) const override;
126 friend class InsetIndexParams;
128 InsetIndexParams params_;
132 class InsetPrintIndex : public InsetCommand {
135 InsetPrintIndex(Buffer * buf, InsetCommandParams const &);
137 /// \name Public functions inherited from Inset class
140 InsetCode lyxCode() const override { return INDEX_PRINT_CODE; }
142 void latex(otexstream &, OutputParams const &) const override;
144 docstring xhtml(XMLStream &, OutputParams const &) const override;
146 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
148 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
150 void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false) override;
152 std::string contextMenuName() const override;
153 /// Updates needed features for this inset.
154 void validate(LaTeXFeatures & features) const override;
156 bool hasSettings() const override;
158 int rowFlags() const override { return Display; }
161 /// \name Static public methods obligated for InsetCommand derived classes
164 static ParamInfo const & findInfo(std::string const &);
166 static std::string defaultCommand() { return "printindex"; }
168 static bool isCompatibleCommand(std::string const & s);
172 /// \name Private functions inherited from Inset class
175 Inset * clone() const override { return new InsetPrintIndex(*this); }
178 /// \name Private functions inherited from InsetCommand class
181 docstring screenLabel() const override;