- setWindowTitle(widget_->windowTitle());
-}
-
-
-GuiToc::~GuiToc()
-{
- delete widget_;
-}
-
-
-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 " << endl;
- return 0;
- }
-
- LYXERR(Debug::GUI)
- << "GuiToc: type " << type
- << " toc_models_.size() " << toc_models_.size()
- << endl;
-
- 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!"
- << endl;
- 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()) << endl;
-
- string const tmp = convert<string>(it->id());
- lyxview().dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp));