4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Abdelrazak Younes
9 * Full author contact details are available in file CREDITS.
15 #include "qt_helpers.h"
18 #include <QStandardItemModel>
19 #include <QStringList>
31 class TocTypeModel : public QStandardItemModel
35 TocTypeModel(QObject * parent = 0);
41 class TocModel : public QStandardItemModel
45 TocModel(QObject * parent = 0);
47 void reset(Toc const & toc);
51 TocItem const & tocItem(QModelIndex const & index) const;
53 QModelIndex modelIndex(DocIterator const & dit) const;
55 int modelDepth() const;
59 void populate(unsigned int & index, QModelIndex const & parent);
61 QList<QModelIndex> toc_indexes_;
70 class TocModels: public QObject
77 typedef QHash<QString, TocModel *>::const_iterator const_iterator;
78 const_iterator begin() const { return models_.begin(); }
79 const_iterator end() const { return models_.end(); }
81 void reset(BufferView const * bv);
83 int depth(QString const & type);
85 QStandardItemModel * model(QString const & type);
87 QStandardItemModel * nameModel() { return names_; }
89 QModelIndex currentIndex(QString const & type) const;
91 void goTo(QString const & type, QModelIndex const & index) const;
93 void init(Buffer const & buffer);
95 void updateBackend() const;
98 /// Signal that the internal toc_models_ has been reset.
102 typedef QHash<QString, TocModel *>::iterator iterator;
108 BufferView const * bv_;
110 QHash<QString, TocModel *> models_;
112 TocTypeModel * names_;
115 } // namespace frontend