3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Abdelrazak Younes
9 * Full author contact details are available in file CREDITS.
17 #include "qt_helpers.h"
29 GuiToc::GuiToc(Dialog & dialog)
35 bool GuiToc::canOutline(int type) const
40 return canOutline(type);
44 int GuiToc::getTocDepth(int type)
48 return toc_models_[type]->modelDepth();
52 QStandardItemModel * GuiToc::tocModel(int type)
57 if (toc_models_.empty()) {
58 LYXERR(Debug::GUI) << "GuiToc::tocModel(): no types available " << endl;
63 << "GuiToc: type " << type
64 << " toc_models_.size() " << toc_models_.size()
67 BOOST_ASSERT(type >= 0 && type < int(toc_models_.size()));
68 return toc_models_[type];
72 QModelIndex const GuiToc::getCurrentIndex(int type) const
77 // FIXME: The TocBackend infrastructure is not ready for LOF and LOT
78 // This is because a proper ParConstIterator is not constructed in
79 // InsetCaption::addToToc()
83 return toc_models_[type]->modelIndex(getCurrentTocItem(type));
87 void GuiToc::goTo(int type, QModelIndex const & index)
89 if (type < 0 || !index.isValid()
90 || index.model() != toc_models_[type]) {
92 << "GuiToc::goTo(): QModelIndex is invalid!"
97 BOOST_ASSERT(type >= 0 && type < int(toc_models_.size()));
99 TocIterator const it = toc_models_[type]->tocIterator(index);
101 LYXERR(Debug::GUI) << "GuiToc::goTo " << to_utf8(it->str()) << endl;
103 ControlToc::goTo(*it);
107 bool GuiToc::initialiseParams(std::string const & data)
109 if (!ControlToc::initialiseParams(data))
117 void GuiToc::updateView()
120 TocList::const_iterator it = tocs().begin();
121 TocList::const_iterator end = tocs().end();
122 for (; it != end; ++it)
123 toc_models_.push_back(new TocModel(it->second));
127 } // namespace frontend
130 #include "GuiToc_moc.cpp"