]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlToc.C
Move the external dialog to the new scheme.
[lyx.git] / src / frontends / controllers / ControlToc.C
1 /**
2  * \file ControlToc.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #include "ControlToc.h"
14 #include "support/lstrings.h" // tostr
15
16 using std::vector;
17
18 class Buffer;
19
20
21 ControlToc::ControlToc(Dialog & d)
22         : ControlCommand(d, "toc")
23 {}
24
25
26 void ControlToc::goTo(toc::TocItem const & item)
27 {
28         item.goTo(kernel().lyxview());
29 }
30
31
32 vector<string> const ControlToc::getTypes() const
33 {
34         return toc::getTypes(kernel().buffer());
35 }
36
37
38 toc::Toc const ControlToc::getContents(string const & type) const
39 {
40         toc::Toc empty_list;
41
42         // This shouldn't be possible...
43         if (!kernel().isBufferAvailable()) {
44                 return empty_list;
45         }
46
47         toc::TocList tmp = toc::getTocList(kernel().buffer());
48         toc::TocList::iterator it = tmp.find(type);
49         if (it == tmp.end()) {
50                 return empty_list;
51         }
52
53         return it->second;
54 }