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>
20 class QSortFilterProxyModel;
32 class TocTypeModel : public QStandardItemModel
36 TocTypeModel(QObject * parent);
46 TocModel(QObject * parent);
48 void reset(Toc const & toc);
54 QAbstractItemModel * model();
56 QAbstractItemModel const * model() const;
58 void sort(bool sort_it);
60 bool isSorted() const { return is_sorted_; }
62 TocItem const & tocItem(QModelIndex const & index) const;
64 QModelIndex modelIndex(DocIterator const & dit) const;
66 int modelDepth() const;
70 void populate(unsigned int & index, QModelIndex const & parent);
72 TocTypeModel * model_;
74 QSortFilterProxyModel * sorted_model_;
86 class TocModels : public QObject
93 void reset(BufferView const * bv);
95 int depth(QString const & type);
97 QAbstractItemModel * model(QString const & type);
99 QAbstractItemModel * nameModel();
101 QModelIndex currentIndex(QString const & type) const;
103 void goTo(QString const & type, QModelIndex const & index) const;
105 void init(Buffer const & buffer);
107 void updateBackend() const;
109 void sort(QString const & type, bool sort_it);
111 bool isSorted(QString const & type) const;
114 /// Signal that the internal toc_models_ has been reset.
118 typedef QHash<QString, TocModel *>::const_iterator const_iterator;
119 typedef QHash<QString, TocModel *>::iterator iterator;
123 BufferView const * bv_;
125 QHash<QString, TocModel *> models_;
127 TocTypeModel * names_;
129 QSortFilterProxyModel * names_sorted_;
132 } // namespace frontend