]> git.lyx.org Git - lyx.git/blob - src/insets/insettoc.C
toc support reorganization; changes to xform_helpers; aspect ratio patch from herbert
[lyx.git] / src / insets / insettoc.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "gettext.h"
8 #include "insettoc.h"
9 #include "BufferView.h"
10 #include "frontends/LyXView.h"
11 #include "frontends/Dialogs.h"
12 #include "debug.h"
13 #include "toc.h"
14
15 using std::vector;
16 using std::ostream;
17
18
19 string const InsetTOC::getScreenLabel(Buffer const *) const
20 {
21         string const cmdname(getCmdName());
22
23         if (cmdname == "tableofcontents")
24                 return _("Table of Contents");
25         return _("Unknown toc list");
26 }
27
28
29 Inset::Code InsetTOC::lyxCode() const
30 {
31         string const cmdname(getCmdName());
32         if (cmdname == "tableofcontents")
33                 return Inset::TOC_CODE;
34         return Inset::NO_CODE;
35 }
36
37
38 void InsetTOC::edit(BufferView * bv, int, int, mouse_button::state)
39 {
40         bv->owner()->getDialogs()->showTOC(this);
41 }
42
43
44 void InsetTOC::edit(BufferView * bv, bool)
45 {
46         edit(bv, 0, 0, mouse_button::none);
47 }
48
49
50 int InsetTOC::ascii(Buffer const * buffer, ostream & os, int) const
51 {
52         os << getScreenLabel(buffer) << "\n\n";
53
54         toc::asciiTocList(toc::getType(getCmdName()), buffer, os);
55
56         os << "\n";
57         return 0;
58 }
59
60
61 int InsetTOC::linuxdoc(Buffer const *, ostream & os) const
62 {
63         if (getCmdName() == "tableofcontents")
64                 os << "<toc>";
65         return 0;
66 }
67
68
69 int InsetTOC::docbook(Buffer const *, ostream & os, bool) const
70 {
71         if (getCmdName() == "tableofcontents")
72                 os << "<toc></toc>";
73         return 0;
74 }