3 * \file InsetIndexMacro.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Jürgen Spitzmüller
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSET_INSETMACRO_H
13 #define INSET_INSETMACRO_H
17 #include "InsetCollapsible.h"
24 class InsetIndexMacroParams
34 InsetIndexMacroParams();
36 void write(std::ostream & os) const;
38 void read(Lexer & lex);
43 /////////////////////////////////////////////////////////////////////////
47 /////////////////////////////////////////////////////////////////////////
49 /// Used to insert index references
50 class InsetIndexMacro : public InsetCollapsible
54 InsetIndexMacro(Buffer *, std::string const &);
58 static std::string params2string(InsetIndexMacroParams const &);
60 static void string2params(std::string const &, InsetIndexMacroParams &);
62 InsetIndexMacroParams const & params() const { return params_; }
64 void getLatex(otexstream &, OutputParams const &) const;
66 int getPlaintext(odocstringstream &, OutputParams const &, size_t) const;
68 void getDocbook(XMLStream &, OutputParams const &) const;
70 bool hasNoContent() const;
73 InsetCode lyxCode() const override;
75 docstring layoutName() const override;
77 void write(std::ostream &) const override;
79 void read(Lexer & lex) override;
81 bool neverIndent() const override { return true; }
82 /// We do not output anything directly to the stream
83 void latex(otexstream &, OutputParams const &) const override {};
84 /// We do not output anything directly to the stream
85 int plaintext(odocstringstream &, OutputParams const &, size_t) const override { return 0; };
86 /// We do not output anything directly to the stream
87 void docbook(XMLStream &, OutputParams const &) const override {};
88 /// We do not output anything directly to the stream
89 docstring xhtml(XMLStream &, OutputParams const &) const override { return docstring(); };
91 docstring getXhtml(XMLStream &, OutputParams const &) const;
93 bool allowSpellCheck() const override { return false; }
95 bool insetAllowed(InsetCode code) const override;
97 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
99 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
101 docstring toolTip(BufferView const & bv, int x, int y) const override;
103 void processLatexSorting(otexstream &, OutputParams const &,
104 docstring const, docstring const) const;
106 bool hasSortKey() const;
108 void getSortkey(otexstream &, OutputParams const &) const;
110 std::string contextMenuName() const override;
112 std::string contextMenu(BufferView const &, int, int) const override;
114 Inset * clone() const override { return new InsetIndexMacro(*this); }
115 /// used by the constructors
118 friend class InsetIndexMacroParams;
121 InsetIndexMacroParams params_;