3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS.
15 #include "ControlToc.h"
16 #include "funcrequest.h"
18 #include "BufferView.h"
31 ControlToc::ControlToc(Dialog & d)
32 : ControlCommand(d, "toc")
36 void ControlToc::goTo(toc::TocItem const & item)
38 item.goTo(kernel().lyxview());
42 bool ControlToc::canOutline(string const & type)
48 void ControlToc::outlineUp()
50 kernel().dispatch(FuncRequest(LFUN_OUTLINE_UP));
54 void ControlToc::outlineDown()
56 kernel().dispatch(FuncRequest(LFUN_OUTLINE_DOWN));
60 void ControlToc::outlineIn()
62 kernel().dispatch(FuncRequest(LFUN_OUTLINE_IN));
66 void ControlToc::outlineOut()
68 kernel().dispatch(FuncRequest(LFUN_OUTLINE_OUT));
72 vector<string> const & ControlToc::getTypes() const
74 return toc::getTypes(kernel().buffer());
78 toc::TocIterator const ControlToc::getCurrentTocItem(
79 string const & type) const
81 BOOST_ASSERT(kernel().bufferview());
83 return toc::getCurrentTocItem(kernel().buffer(),
84 kernel().bufferview()->cursor(), type);
88 string const ControlToc::getGuiName(string const & type) const
91 return lyx::to_utf8(_("Table of Contents"));
93 return lyx::to_utf8(_(toc::getGuiName(type, kernel().buffer())));
97 toc::Toc const empty_list;
99 toc::Toc const & ControlToc::getContents(string const & type) const
101 // This shouldn't be possible...
102 if (!kernel().isBufferAvailable()) {
106 return toc::getToc(kernel().buffer(), type);
109 } // namespace frontend