]> git.lyx.org Git - lyx.git/blob - src/insets/insettoc.C
Make it compile when USE_BOOST_FORMAT is unset
[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 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "gettext.h"
17 #include "insettoc.h"
18 #include "BufferView.h"
19 #include "frontends/LyXView.h"
20 #include "frontends/Dialogs.h"
21 #include "debug.h"
22 #include "toc.h"
23
24 using std::vector;
25 using std::ostream;
26
27
28 string const InsetTOC::getScreenLabel(Buffer const *) const
29 {
30         string const cmdname(getCmdName());
31
32         if (cmdname == "tableofcontents")
33                 return _("Table of Contents");
34         return _("Unknown toc list");
35 }
36
37
38 Inset::Code InsetTOC::lyxCode() const
39 {
40         string const cmdname(getCmdName());
41         if (cmdname == "tableofcontents")
42                 return Inset::TOC_CODE;
43         return Inset::NO_CODE;
44 }
45
46
47 void InsetTOC::edit(BufferView * bv, int, int, mouse_button::state)
48 {
49         bv->owner()->getDialogs().showTOC(this);
50 }
51
52
53 void InsetTOC::edit(BufferView * bv, bool)
54 {
55         edit(bv, 0, 0, mouse_button::none);
56 }
57
58
59 int InsetTOC::ascii(Buffer const * buffer, ostream & os, int) const
60 {
61         os << getScreenLabel(buffer) << "\n\n";
62
63         toc::asciiTocList(toc::getType(getCmdName()), buffer, os);
64
65         os << "\n";
66         return 0;
67 }
68
69
70 int InsetTOC::linuxdoc(Buffer const *, ostream & os) const
71 {
72         if (getCmdName() == "tableofcontents")
73                 os << "<toc>";
74         return 0;
75 }
76
77
78 int InsetTOC::docbook(Buffer const *, ostream & os, bool) const
79 {
80         if (getCmdName() == "tableofcontents")
81                 os << "<toc></toc>";
82         return 0;
83 }