#include "InsetCommand.h"
+#include "Toc.h"
+
namespace lyx {
+class Paragraph;
/// Used to insert table of contents and similar lists
-/// at present, supports only \tableofcontents. Other
-/// such commands, such as \listoffigures, are supported
+/// at present, supports only \tableofcontents and \listoflistings.
+/// Other such commands, such as \listoffigures, are supported
/// by InsetFloatList.
class InsetTOC : public InsetCommand {
public:
/// \name Public functions inherited from Inset class
//@{
///
- InsetCode lyxCode() const { return TOC_CODE; }
+ InsetCode lyxCode() const override { return TOC_CODE; }
+ ///
+ docstring layoutName() const override;
///
- DisplayType display() const { return AlignCenter; }
+ int rowFlags() const override { return Display; }
///
- int plaintext(odocstream &, OutputParams const &) const;
+ void validate(LaTeXFeatures &) const override;
///
- int docbook(odocstream &, OutputParams const &) const;
+ int plaintext(odocstringstream & ods, OutputParams const & op,
+ size_t max_length = INT_MAX) const override;
///
- docstring xhtml(XHTMLStream & xs, OutputParams const &) const;
+ void docbook(XMLStream &, OutputParams const &) const override;
///
- void doDispatch(Cursor & cur, FuncRequest & cmd);
+ docstring xhtml(XMLStream & xs, OutputParams const &) const override;
///
- bool clickable(int, int) const { return true; }
+ void doDispatch(Cursor & cur, FuncRequest & cmd) override;
+ ///
+ bool clickable(BufferView const &, int, int) const override { return true; }
//@}
/// \name Static public methods obligated for InsetCommand derived classes
///
static std::string defaultCommand() { return "tableofcontents"; }
///
- static bool isCompatibleCommand(std::string const & cmd)
- { return cmd == defaultCommand(); }
+ static bool isCompatibleCommand(std::string const & cmd);
//@}
private:
+ ///
+ void makeTOCWithDepth(XMLStream & xs, Toc const & toc, const OutputParams & op) const;
+ ///
+ void makeTOCNoDepth(XMLStream & xs, Toc const & toc, const OutputParams & op) const;
+ ///
+ void makeTOCEntry(XMLStream & xs, Paragraph const & par, OutputParams const & op) const;
+
/// \name Private functions inherited from Inset class
//@{
///
- Inset * clone() const { return new InsetTOC(*this); }
+ Inset * clone() const override { return new InsetTOC(*this); }
//@}
/// \name Private functions inherited from InsetCommand class
//@{
///
- docstring screenLabel() const;
+ docstring screenLabel() const override;
//@}
};