]> git.lyx.org Git - lyx.git/blob - src/insets/insettoc.C
changelogs
[lyx.git] / src / insets / insettoc.C
1 /**
2  * \file insettoc.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "insettoc.h"
14
15 #include "dispatchresult.h"
16 #include "funcrequest.h"
17 #include "gettext.h"
18 #include "metricsinfo.h"
19 #include "toc.h"
20
21 #include "support/std_ostream.h"
22
23 using std::string;
24 using std::ostream;
25
26
27
28 InsetTOC::InsetTOC(InsetCommandParams const & p)
29         : InsetCommand(p, "toc")
30 {}
31
32
33 std::auto_ptr<InsetBase> InsetTOC::doClone() const
34 {
35         return std::auto_ptr<InsetBase>(new InsetTOC(*this));
36 }
37
38
39 string const InsetTOC::getScreenLabel(Buffer const &) const
40 {
41         if (getCmdName() == "tableofcontents")
42                 return _("Table of Contents");
43         return _("Unknown toc list");
44 }
45
46
47 InsetOld::Code InsetTOC::lyxCode() const
48 {
49         if (getCmdName() == "tableofcontents")
50                 return InsetOld::TOC_CODE;
51         return InsetOld::NO_CODE;
52 }
53
54
55 int InsetTOC::plaintext(Buffer const & buffer, ostream & os,
56                     OutputParams const &) const
57 {
58         os << getScreenLabel(buffer) << "\n\n";
59
60         lyx::toc::asciiTocList(lyx::toc::getType(getCmdName()), buffer, os);
61
62         os << "\n";
63         return 0;
64 }
65
66
67 int InsetTOC::linuxdoc(Buffer const &, ostream & os,
68                        OutputParams const &) const
69 {
70         if (getCmdName() == "tableofcontents")
71                 os << "<toc>";
72         return 0;
73 }
74
75
76 int InsetTOC::docbook(Buffer const &, ostream & os,
77                       OutputParams const &) const
78 {
79         if (getCmdName() == "tableofcontents")
80                 os << "<toc></toc>";
81         return 0;
82 }