]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlToc.C
some support for pch
[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
15 using std::vector;
16 using std::string;
17
18
19 class Buffer;
20
21 namespace lyx {
22 namespace frontend {
23
24 ControlToc::ControlToc(Dialog & d)
25         : ControlCommand(d, "toc")
26 {}
27
28
29 void ControlToc::goTo(toc::TocItem const & item)
30 {
31         item.goTo(kernel().lyxview());
32 }
33
34
35 vector<string> const ControlToc::getTypes() const
36 {
37         return toc::getTypes(kernel().buffer());
38 }
39
40
41 toc::Toc const ControlToc::getContents(string const & type) const
42 {
43         toc::Toc empty_list;
44
45         // This shouldn't be possible...
46         if (!kernel().isBufferAvailable()) {
47                 return empty_list;
48         }
49
50         toc::TocList tmp = toc::getTocList(kernel().buffer());
51         toc::TocList::iterator it = tmp.find(type);
52         if (it == tmp.end()) {
53                 return empty_list;
54         }
55
56         return it->second;
57 }
58
59 } // namespace frontend
60 } // namespace lyx