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 void getSubentries(otexstream &, OutputParams const &) const;
99 void getSeeRefs(otexstream &, OutputParams const &) const;
101 bool hasSeeRef() const;
103 bool hasSortKey() const;
105 bool macrosPossible(std::string const type) const;
107 std::string contextMenuName() const override;
109 std::string contextMenu(BufferView const &, int, int) const override;
111 Inset * clone() const override { return new InsetIndex(*this); }
112 /// Is the content of this inset part of the immediate text sequence?
113 bool isPartOfTextSequence() const override { return false; }
115 bool insetAllowed(InsetCode code) const override;
118 friend class InsetIndexParams;
120 InsetIndexParams params_;
124 class InsetPrintIndex : public InsetCommand {
127 InsetPrintIndex(Buffer * buf, InsetCommandParams const &);
129 /// \name Public functions inherited from Inset class
132 InsetCode lyxCode() const override { return INDEX_PRINT_CODE; }
134 void latex(otexstream &, OutputParams const &) const override;
136 docstring xhtml(XMLStream &, OutputParams const &) const override;
138 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
140 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
142 void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false) override;
144 std::string contextMenuName() const override;
145 /// Updates needed features for this inset.
146 void validate(LaTeXFeatures & features) const override;
148 bool hasSettings() const override;
150 int rowFlags() const override { return Display; }
153 /// \name Static public methods obligated for InsetCommand derived classes
156 static ParamInfo const & findInfo(std::string const &);
158 static std::string defaultCommand() { return "printindex"; }
160 static bool isCompatibleCommand(std::string const & s);
164 /// \name Private functions inherited from Inset class
167 Inset * clone() const override { return new InsetPrintIndex(*this); }
170 /// \name Private functions inherited from InsetCommand class
173 docstring screenLabel() const override;