]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlToc.C
Really dull and boring header shit
[lyx.git] / src / frontends / controllers / ControlToc.C
1 /**
2  * \file ControlToc.C
3  * See the file COPYING.
4  *
5  * \author Angus Leeming
6  *
7  * Full author contact details are available in file CREDITS
8  */
9
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "ControlToc.h"
17 #include "toc.h"
18
19 #include "support/lstrings.h" // tostr
20
21 using std::vector;
22
23 class Buffer;
24
25 ControlToc::ControlToc(LyXView & lv, Dialogs & d)
26         : ControlCommand(lv, d, LFUN_TOC_INSERT)
27 {}
28
29
30 void ControlToc::goTo(toc::TocItem const & item) const
31 {
32         item.goTo(lv_);
33 }
34
35
36 vector<string> const ControlToc::getTypes() const
37 {
38         return toc::getTypes(buffer());
39 }
40
41
42 toc::Toc const ControlToc::getContents(string const & type) const
43 {
44         toc::Toc empty_list;
45
46         // This shouldn't be possible...
47         if (!bufferIsAvailable()) {
48                 return empty_list;
49         }
50
51         toc::TocList tmp = toc::getTocList(buffer());
52         toc::TocList::iterator it = tmp.find(type);
53         if (it == tmp.end()) {
54                 return empty_list;
55         }
56
57         return it->second;
58 }