1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2001 The LyX Team.
8 * ======================================================
11 * \author Angus Leeming <a.leeming@ic.ac.uk>
17 #pragma implementation
20 #include "ControlToc.h"
25 #include "BufferView.h"
27 #include "support/lstrings.h" // tostr
32 ControlToc::ControlToc(LyXView & lv, Dialogs & d)
33 : ControlCommand(lv, d, LFUN_TOC_INSERT)
37 void ControlToc::Goto(int const & id) const
39 string const tmp = tostr(id);
40 lv_.getLyXFunc()->dispatch(LFUN_GOTO_PARAGRAPH, tmp);
44 vector<string> const ControlToc::getTypes() const
48 Buffer::Lists const tmp = lv_.view()->buffer()->getLists();
50 Buffer::Lists::const_iterator cit = tmp.begin();
51 Buffer::Lists::const_iterator end = tmp.end();
53 for (; cit != end; ++cit) {
54 types.push_back(cit->first);
61 Buffer::SingleList const ControlToc::getContents(string const & type) const
63 Buffer::SingleList empty_list;
65 // This shouldn't be possible...
66 if (!lv_.view()->available()) {
70 Buffer::Lists tmp = lv_.view()->buffer()->getLists();
72 Buffer::Lists::iterator it = tmp.find(type);
74 if (it == tmp.end()) {
85 string const getType(string const & cmdName)
87 string type = cmdName;
90 if (cmdName == "tableofcontents")