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 <QSortFilterProxyModel>
20 #include <QStandardItemModel>
21 #include <QStringList>
33 class TocTypeModel : public QStandardItemModel
37 TocTypeModel(QObject * parent = 0);
47 TocModel(QObject * parent = 0);
49 void reset(Toc const & toc);
55 QAbstractItemModel * model();
57 QAbstractItemModel const * model() const;
59 void sort(bool sort_it);
61 bool isSorted() const { return is_sorted_; }
63 TocItem const & tocItem(QModelIndex const & index) const;
65 QModelIndex modelIndex(DocIterator const & dit) const;
67 int modelDepth() const;
71 void populate(unsigned int & index, QModelIndex const & parent);
73 TocTypeModel * model_;
75 QSortFilterProxyModel * sorted_model_;
79 QList<QModelIndex> toc_indexes_;
88 class TocModels: public QObject
95 void reset(BufferView const * bv);
97 int depth(QString const & type);
99 QAbstractItemModel * model(QString const & type);
101 QAbstractItemModel * nameModel();
103 QModelIndex currentIndex(QString const & type) const;
105 void goTo(QString const & type, QModelIndex const & index) const;
107 void init(Buffer const & buffer);
109 void updateBackend() const;
111 void sort(QString const & type, bool sort_it);
113 bool isSorted(QString const & type) const;
116 /// Signal that the internal toc_models_ has been reset.
120 typedef QHash<QString, TocModel *>::const_iterator const_iterator;
121 typedef QHash<QString, TocModel *>::iterator iterator;
125 BufferView const * bv_;
127 QHash<QString, TocModel *> models_;
129 TocTypeModel * names_;
131 QSortFilterProxyModel * names_sorted_;
134 } // namespace frontend