]> git.lyx.org Git - lyx.git/blob - src/insets/insettoc.C
Change _() to return a docstring. Fixup callers with the help of lyx::to_utf8.
[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         // FIXME UNICODE
42         if (getCmdName() == "tableofcontents")
43                 return lyx::to_utf8(_("Table of Contents"));
44         return lyx::to_utf8(_("Unknown toc list"));
45 }
46
47
48 InsetBase::Code InsetTOC::lyxCode() const
49 {
50         if (getCmdName() == "tableofcontents")
51                 return InsetBase::TOC_CODE;
52         return InsetBase::NO_CODE;
53 }
54
55
56 int InsetTOC::plaintext(Buffer const & buffer, ostream & os,
57                     OutputParams const &) const
58 {
59         os << getScreenLabel(buffer) << "\n\n";
60
61         lyx::toc::asciiTocList(lyx::toc::getType(getCmdName()), buffer, os);
62
63         os << "\n";
64         return 0;
65 }
66
67
68 int InsetTOC::docbook(Buffer const &, ostream & os,
69                       OutputParams const &) const
70 {
71         if (getCmdName() == "tableofcontents")
72                 os << "<toc></toc>";
73         return 0;
74 }