X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetTOC.h;h=045ae07e6d0f3c0729ab83c7384c2a453c3e0119;hb=eeb36e808c9726fd3689926a3c20457e3b801341;hp=cb32c66ac3f18c85b1df6313a151c12f3cba773f;hpb=b90de3dc5cb7d69218ca94525d12d255f2ffee42;p=lyx.git diff --git a/src/insets/InsetTOC.h b/src/insets/InsetTOC.h index cb32c66ac3..045ae07e6d 100644 --- a/src/insets/InsetTOC.h +++ b/src/insets/InsetTOC.h @@ -14,13 +14,16 @@ #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: @@ -30,17 +33,24 @@ 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; + /// + RowFlags rowFlags() const override { return Display; } + /// + void validate(LaTeXFeatures &) const override; /// - DisplayType display() const { return AlignCenter; } + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const override; /// - int plaintext(odocstream &, OutputParams const &) const; + void docbook(XMLStream &, OutputParams const &) const override; /// - int docbook(odocstream &, OutputParams const &) const; + docstring xhtml(XMLStream & xs, OutputParams const &) const override; /// - docstring xhtml(XHTMLStream & xs, OutputParams const &) const; + void doDispatch(Cursor & cur, FuncRequest & cmd) override; /// - void doDispatch(Cursor & cur, FuncRequest & cmd); + bool clickable(BufferView const &, int, int) const override { return true; } //@} /// \name Static public methods obligated for InsetCommand derived classes @@ -50,21 +60,27 @@ public: /// 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; //@} };