]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlToc.C
remove preamble dialog from the qt frontend
[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 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "ControlToc.h"
18 #include "toc.h"
19
20 #include "support/lstrings.h" // tostr
21
22 using std::vector;
23
24 class Buffer;
25
26
27 ControlToc::ControlToc(LyXView & lv, Dialogs & d)
28         : ControlCommand(lv, d, LFUN_TOC_INSERT)
29 {}
30
31
32 void ControlToc::goTo(toc::TocItem const & item) const
33 {
34         item.goTo(lv_);
35 }
36
37
38 vector<string> const ControlToc::getTypes() const
39 {
40         return toc::getTypes(buffer());
41 }
42
43
44 toc::Toc const ControlToc::getContents(string const & type) const
45 {
46         toc::Toc empty_list;
47
48         // This shouldn't be possible...
49         if (!bufferIsAvailable()) {
50                 return empty_list;
51         }
52
53         toc::TocList tmp = toc::getTocList(buffer());
54         toc::TocList::iterator it = tmp.find(type);
55         if (it == tmp.end()) {
56                 return empty_list;
57         }
58
59         return it->second;
60 }