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
39 return ControlToc::canOutline(type);
43 int GuiToc::getTocDepth(int type)
47 return toc_models_[type]->modelDepth();
51 QStandardItemModel * GuiToc::tocModel(int type)
56 if (toc_models_.empty()) {
57 LYXERR(Debug::GUI) << "GuiToc::tocModel(): no types available " << endl;
62 << "GuiToc: type " << type
63 << " toc_models_.size() " << toc_models_.size()
66 BOOST_ASSERT(type >= 0 && type < int(toc_models_.size()));
67 return toc_models_[type];
71 QModelIndex const GuiToc::getCurrentIndex(int type) const
76 // FIXME: The TocBackend infrastructure is not ready for LOF and LOT
77 // This is because a proper ParConstIterator is not constructed in
78 // InsetCaption::addToToc()
82 return toc_models_[type]->modelIndex(getCurrentTocItem(type));
86 void GuiToc::goTo(int type, QModelIndex const & index)
88 if (type < 0 || !index.isValid()
89 || index.model() != toc_models_[type]) {
91 << "GuiToc::goTo(): QModelIndex is invalid!"
96 BOOST_ASSERT(type >= 0 && type < int(toc_models_.size()));
98 TocIterator const it = toc_models_[type]->tocIterator(index);
100 LYXERR(Debug::GUI) << "GuiToc::goTo " << to_utf8(it->str()) << endl;
102 ControlToc::goTo(*it);
106 bool GuiToc::initialiseParams(std::string const & data)
108 if (!ControlToc::initialiseParams(data))
116 void GuiToc::updateView()
119 TocList::const_iterator it = tocs().begin();
120 TocList::const_iterator end = tocs().end();
121 for (; it != end; ++it)
122 toc_models_.push_back(new TocModel(it->second));
126 } // namespace frontend
129 #include "GuiToc_moc.cpp"