]> git.lyx.org Git - lyx.git/blob - src/insets/InsetTOC.h
ead482b2e839870ec93ed3886d12eb528669f517
[lyx.git] / src / insets / InsetTOC.h
1 // -*- C++ -*-
2 /**
3  * \file InsetTOC.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_TOC_H
13 #define INSET_TOC_H
14
15 #include "InsetCommand.h"
16
17
18 namespace lyx {
19
20 class Paragraph;
21 class Toc;
22
23 /// Used to insert table of contents and similar lists
24 /// at present, supports only \tableofcontents and \listoflistings.
25 /// Other such commands, such as \listoffigures, are supported
26 /// by InsetFloatList.
27 class InsetTOC : public InsetCommand {
28 public:
29         ///
30         InsetTOC(Buffer * buf, InsetCommandParams const &);
31
32         /// \name Public functions inherited from Inset class
33         //@{
34         ///
35         InsetCode lyxCode() const { return TOC_CODE; }
36         ///
37         docstring layoutName() const;
38         ///
39         DisplayType display() const { return AlignCenter; }
40         ///
41         virtual void validate(LaTeXFeatures &) const;
42         ///
43         int plaintext(odocstringstream & ods, OutputParams const & op,
44                       size_t max_length = INT_MAX) const;
45         ///
46         int docbook(odocstream &, OutputParams const &) const;
47         ///
48         docstring xhtml(XHTMLStream & xs, OutputParams const &) const;
49         ///
50         void doDispatch(Cursor & cur, FuncRequest & cmd);
51         ///
52         bool clickable(int, int) const { return true; }
53         //@}
54
55         /// \name Static public methods obligated for InsetCommand derived classes
56         //@{
57         ///
58         static ParamInfo const & findInfo(std::string const &);
59         ///
60         static std::string defaultCommand() { return "tableofcontents"; }
61         ///
62         static bool isCompatibleCommand(std::string const & cmd);
63         //@}
64
65 private:
66         ///
67         void makeTOCWithDepth(XHTMLStream xs, Toc toc, const OutputParams & op) const;
68         ///
69         void makeTOCNoDepth(XHTMLStream xs, Toc toc, const OutputParams & op) const;
70         ///
71         void makeTOCEntry(XHTMLStream & xs, Paragraph const & par, OutputParams const & op) const;
72         
73         /// \name Private functions inherited from Inset class
74         //@{
75         ///
76         Inset * clone() const { return new InsetTOC(*this); }
77         //@}
78
79         /// \name Private functions inherited from InsetCommand class
80         //@{
81         ///
82         docstring screenLabel() const;
83         //@}
84 };
85
86
87 } // namespace lyx
88
89 #endif