]> git.lyx.org Git - lyx.git/blob - src/insets/insettoc.C
Introduce wide streams. This fixes the remaining problems of plain text
[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 lyx::docstring;
24
25 using std::string;
26 using std::ostream;
27
28
29
30 InsetTOC::InsetTOC(InsetCommandParams const & p)
31         : InsetCommand(p, "toc")
32 {}
33
34
35 std::auto_ptr<InsetBase> InsetTOC::doClone() const
36 {
37         return std::auto_ptr<InsetBase>(new InsetTOC(*this));
38 }
39
40
41 docstring const InsetTOC::getScreenLabel(Buffer const &) const
42 {
43         if (getCmdName() == "tableofcontents")
44                 return _("Table of Contents");
45         return _("Unknown toc list");
46 }
47
48
49 InsetBase::Code InsetTOC::lyxCode() const
50 {
51         if (getCmdName() == "tableofcontents")
52                 return InsetBase::TOC_CODE;
53         return InsetBase::NO_CODE;
54 }
55
56
57 int InsetTOC::plaintext(Buffer const & buffer, lyx::odocstream & os,
58                     OutputParams const &) const
59 {
60         os << getScreenLabel(buffer) << "\n\n";
61
62         lyx::toc::asciiTocList(lyx::toc::getType(getCmdName()), buffer, os);
63
64         os << "\n";
65         return 0;
66 }
67
68
69 int InsetTOC::docbook(Buffer const &, ostream & os,
70                       OutputParams const &) const
71 {
72         if (getCmdName() == "tableofcontents")
73                 os << "<toc></toc>";
74         return 0;
75 }