]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/TocModel.h
delete unused interface.
[lyx.git] / src / frontends / qt4 / TocModel.h
1 // -*- C++ -*-
2 /**
3  * \file TocModel.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Abdelrazak Younes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef TOCMODEL_H
13 #define TOCMODEL_H
14
15 #include "qt_helpers.h"
16
17 #include <QList>
18 #include <QStandardItemModel>
19 #include <QStringList>
20
21 namespace lyx {
22
23 class Buffer;
24 class BufferView;
25 class DocIterator;
26 class Toc;
27 class TocItem;
28
29 namespace frontend {
30
31 class TocTypeModel : public QStandardItemModel
32 {
33 public:
34         ///
35         TocTypeModel(QObject * parent = 0);
36         ///
37         void reset();
38 };
39
40
41 class TocModel : public QStandardItemModel
42 {
43 public:
44         ///
45         TocModel(QObject * parent = 0);
46         ///
47         void reset(Toc const & toc);
48         ///
49         void reset();
50         ///
51         TocItem const & tocItem(QModelIndex const & index) const;
52         ///
53         QModelIndex modelIndex(DocIterator const & dit) const;
54         ///
55         int modelDepth() const;
56
57 private:
58         ///
59         void populate(unsigned int & index, QModelIndex const & parent);
60         ///
61         QList<QModelIndex> toc_indexes_;
62         ///
63         Toc const * toc_;
64         ///
65         int maxdepth_;
66         int mindepth_;
67 };
68
69
70 class TocModels: public QObject
71 {
72         Q_OBJECT
73 public:
74         ///
75         TocModels();
76         ///
77         void reset(BufferView const * bv);
78         ///
79         int depth(QString const & type);
80         ///
81         QStandardItemModel * model(QString const & type);
82         ///
83         QStandardItemModel * nameModel() { return names_; }
84         ///
85         QModelIndex currentIndex(QString const & type) const;
86         ///
87         void goTo(QString const & type, QModelIndex const & index) const;
88         ///
89         void init(Buffer const & buffer);
90         ///
91         void updateBackend() const;
92
93 Q_SIGNALS:
94         /// Signal that the internal toc_models_ has been reset.
95         void modelReset();
96
97 private:
98         typedef QHash<QString, TocModel *>::const_iterator const_iterator;
99         typedef QHash<QString, TocModel *>::iterator iterator;
100         ///
101         void clear();
102         ///
103         BufferView const * bv_;
104         ///
105         QHash<QString, TocModel *> models_;
106         ///
107         TocTypeModel * names_;
108 };
109
110 } // namespace frontend
111 } // namespace lyx
112
113 #endif // TOCMODEL_H