-}
-
-
-GuiToc::~GuiToc()
-{
- clearTocModels();
- delete widget_;
-}
-
-
-void GuiToc::clearTocModels()
-{
- const unsigned int size = toc_models_.size();
- for (unsigned int i = 0; i < size; ++i) {
- delete toc_models_[i];
- }
- toc_models_.clear();
-}
-
-
-int GuiToc::getTocDepth(int type)
-{
- if (type < 0)
- return 0;
- return toc_models_[type]->modelDepth();
-}
-
-
-QStandardItemModel * GuiToc::tocModel(int type)
-{
- if (type < 0)
- return 0;
-
- if (toc_models_.empty()) {
- LYXERR(Debug::GUI, "GuiToc::tocModel(): no types available ");
- return 0;
- }
-
- LYXERR(Debug::GUI, "GuiToc: type " << type
- << " toc_models_.size() " << toc_models_.size());
-
- BOOST_ASSERT(type >= 0 && type < int(toc_models_.size()));
- return toc_models_[type];
-}
-
-
-QModelIndex GuiToc::currentIndex(int type) const
-{
- if (type < 0)
- return QModelIndex();
-
- // FIXME: The TocBackend infrastructure is not ready for LOF and LOT
- // This is because a proper ParConstIterator is not constructed in
- // InsetCaption::addToToc()
- if(!canOutline(type))
- return QModelIndex();
-
- return toc_models_[type]->modelIndex(currentTocItem(type));
-}
-
-
-void GuiToc::goTo(int type, QModelIndex const & index)
-{
- if (type < 0 || !index.isValid()
- || index.model() != toc_models_[type]) {
- LYXERR(Debug::GUI, "GuiToc::goTo(): QModelIndex is invalid!");
- return;
- }
-
- BOOST_ASSERT(type >= 0 && type < int(toc_models_.size()));
-
- TocIterator const it = toc_models_[type]->tocIterator(index);
-
- LYXERR(Debug::GUI, "GuiToc::goTo " << to_utf8(it->str()));
-
- string const tmp = convert<string>(it->id());
- dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp));