mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 05:33:33 +00:00
ede9561daa
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6293 a592a061-630c-0410-9148-cb99ea01b6c8
55 lines
963 B
C
55 lines
963 B
C
/**
|
|
* \file ControlToc.C
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author Angus Leeming
|
|
*
|
|
* Full author contact details are available in file CREDITS
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include "ControlToc.h"
|
|
#include "support/lstrings.h" // tostr
|
|
|
|
using std::vector;
|
|
|
|
class Buffer;
|
|
|
|
|
|
ControlToc::ControlToc(Dialog & d)
|
|
: ControlCommand(d, "toc")
|
|
{}
|
|
|
|
|
|
void ControlToc::goTo(toc::TocItem const & item)
|
|
{
|
|
item.goTo(kernel().lyxview());
|
|
}
|
|
|
|
|
|
vector<string> const ControlToc::getTypes() const
|
|
{
|
|
return toc::getTypes(kernel().buffer());
|
|
}
|
|
|
|
|
|
toc::Toc const ControlToc::getContents(string const & type) const
|
|
{
|
|
toc::Toc empty_list;
|
|
|
|
// This shouldn't be possible...
|
|
if (!kernel().isBufferAvailable()) {
|
|
return empty_list;
|
|
}
|
|
|
|
toc::TocList tmp = toc::getTocList(kernel().buffer());
|
|
toc::TocList::iterator it = tmp.find(type);
|
|
if (it == tmp.end()) {
|
|
return empty_list;
|
|
}
|
|
|
|
return it->second;
|
|
}
|