mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
c265d16ed0
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4998 a592a061-630c-0410-9148-cb99ea01b6c8
63 lines
1.1 KiB
C
63 lines
1.1 KiB
C
/* This file is part of
|
|
* ======================================================
|
|
*
|
|
* LyX, The Document Processor
|
|
*
|
|
* Copyright 2001 The LyX Team.
|
|
*
|
|
* ======================================================
|
|
*
|
|
* \file ControlToc.C
|
|
* \author Angus Leeming <leeming@lyx.org>
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#ifdef __GNUG__
|
|
#pragma implementation
|
|
#endif
|
|
|
|
#include "ControlToc.h"
|
|
#include "toc.h"
|
|
|
|
#include "support/lstrings.h" // tostr
|
|
|
|
using std::vector;
|
|
|
|
class Buffer;
|
|
|
|
ControlToc::ControlToc(LyXView & lv, Dialogs & d)
|
|
: ControlCommand(lv, d, LFUN_TOC_INSERT)
|
|
{}
|
|
|
|
|
|
void ControlToc::goTo(toc::TocItem const & item) const
|
|
{
|
|
item.goTo(lv_);
|
|
}
|
|
|
|
|
|
vector<string> const ControlToc::getTypes() const
|
|
{
|
|
return toc::getTypes(buffer());
|
|
}
|
|
|
|
|
|
toc::Toc const ControlToc::getContents(string const & type) const
|
|
{
|
|
toc::Toc empty_list;
|
|
|
|
// This shouldn't be possible...
|
|
if (!bufferIsAvailable()) {
|
|
return empty_list;
|
|
}
|
|
|
|
toc::TocList tmp = toc::getTocList(buffer());
|
|
toc::TocList::iterator it = tmp.find(type);
|
|
if (it == tmp.end()) {
|
|
return empty_list;
|
|
}
|
|
|
|
return it->second;
|
|
}
|