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 {
25 explicit InsetIndexParams(docstring const & b = docstring())
28 void write(std::ostream & os) const;
30 void read(Lexer & lex);
36 /** Used to insert index labels
38 class InsetIndex : public InsetCollapsible {
41 InsetIndex(Buffer *, InsetIndexParams const &);
43 static std::string params2string(InsetIndexParams const &);
45 static void string2params(std::string const &, InsetIndexParams &);
47 int rowFlags() const override { return CanBreakBefore | CanBreakAfter; }
50 bool hasSettings() const override;
52 InsetCode lyxCode() const override { return INDEX_CODE; }
54 docstring layoutName() const override { return from_ascii("Index"); }
56 ColorCode labelColor() const override;
58 void write(std::ostream & os) const override;
60 void read(Lexer & lex) override;
62 void docbook(XMLStream &, OutputParams const &) const override;
64 docstring xhtml(XMLStream &, OutputParams const &) const override;
66 void latex(otexstream &, OutputParams const &) const override;
68 bool showInsetDialog(BufferView *) const override;
70 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
72 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
73 /// should paragraph indentation be omitted in any case?
74 bool neverIndent() const override { return true; }
76 void addToToc(DocIterator const & di, bool output_active,
77 UpdateType utype, TocBackend & backend) const override;
79 docstring toolTip(BufferView const & bv, int x, int y) const override;
81 docstring const buttonLabel(BufferView const & bv) const override;
82 /// Updates needed features for this inset.
83 void validate(LaTeXFeatures & features) const override;
85 std::string contextMenuName() const override;
87 Inset * clone() const override { return new InsetIndex(*this); }
88 /// Is the content of this inset part of the immediate text sequence?
89 bool isPartOfTextSequence() const override { return false; }
92 friend class InsetIndexParams;
94 InsetIndexParams params_;
98 class InsetPrintIndex : public InsetCommand {
101 InsetPrintIndex(Buffer * buf, InsetCommandParams const &);
103 /// \name Public functions inherited from Inset class
106 InsetCode lyxCode() const override { return INDEX_PRINT_CODE; }
108 void latex(otexstream &, OutputParams const &) const override;
110 docstring xhtml(XMLStream &, OutputParams const &) const override;
112 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
114 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
116 void updateBuffer(ParIterator const & it, UpdateType, bool const deleted = false) override;
118 std::string contextMenuName() const override;
119 /// Updates needed features for this inset.
120 void validate(LaTeXFeatures & features) const override;
122 bool hasSettings() const override;
124 int rowFlags() const override { return Display; }
127 /// \name Static public methods obligated for InsetCommand derived classes
130 static ParamInfo const & findInfo(std::string const &);
132 static std::string defaultCommand() { return "printindex"; }
134 static bool isCompatibleCommand(std::string const & s);
138 /// \name Private functions inherited from Inset class
141 Inset * clone() const override { return new InsetPrintIndex(*this); }
144 /// \name Private functions inherited from InsetCommand class
147 docstring screenLabel() const override;