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 TocModel : public QStandardItemModel
35 TocModel(Toc const & toc);
37 TocItem const & tocItem(QModelIndex const & index) const;
39 QModelIndex modelIndex(DocIterator const & dit) const;
41 int modelDepth() const;
45 void populate(size_t & index, QModelIndex const & parent);
47 QList<QModelIndex> toc_indexes_;
56 class TocModels: public QObject
61 TocModels(): bv_(0) {}
63 ~TocModels() { clear(); }
65 void reset(BufferView const * bv);
69 QStandardItemModel * model(int type);
71 QModelIndex currentIndex(int type) const;
73 void goTo(int type, QModelIndex const & index) const;
75 void init(Buffer const & buffer);
76 /// Test if outlining operation is possible
77 bool canOutline(int type) const;
78 /// Return the list of types available
79 QStringList const & typeNames() const { return type_names_; }
81 void updateBackend() const;
83 int decodeType(QString const & str) const;
86 /// Signal that the internal toc_models_ has been reset.
93 BufferView const * bv_;
95 QList<TocModel *> models_;
99 QStringList type_names_;
102 } // namespace frontend