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"
19 #include <QStandardItemModel>
20 #include <QStringList>
22 class QAbstractItemModel;
23 class QSortFilterProxyModel;
35 class TocTypeModel : public QStandardItemModel
39 TocTypeModel(QObject * parent = 0);
45 class TocModel : public QStandardItemModel
49 TocModel(QObject * parent = 0);
51 void reset(Toc const & toc);
55 TocItem const & tocItem(QModelIndex const & index) const;
57 QModelIndex modelIndex(DocIterator const & dit) const;
59 int modelDepth() const;
63 void populate(unsigned int & index, QModelIndex const & parent);
65 QList<QModelIndex> toc_indexes_;
74 class TocModels: public QObject
81 void reset(BufferView const * bv);
83 int depth(QString const & type);
85 QStandardItemModel * model(QString const & type);
87 QAbstractItemModel * nameModel();
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 *>::const_iterator const_iterator;
103 typedef QHash<QString, TocModel *>::iterator iterator;
107 BufferView const * bv_;
109 QHash<QString, TocModel *> models_;
111 TocTypeModel * names_;
113 QSortFilterProxyModel * names_sorted_;
116 } // namespace frontend