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