]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/TocModel.h
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[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 "TocBackend.h"
16
17 #include "qt_helpers.h"
18
19 #include <QStandardItemModel>
20
21 #include <map>
22
23 namespace lyx {
24 namespace frontend {
25
26 class TocModel : public QStandardItemModel
27 {
28         Q_OBJECT
29
30 public:
31         ///
32         TocModel() {}
33         ///
34         TocModel(Toc const & toc) { populate(toc); }
35         ///
36         void clear();
37         ///
38         void populate(Toc const & toc);
39         ///
40         TocIterator tocIterator(QModelIndex const & index) const;
41         ///
42         QModelIndex modelIndex(TocIterator const & it) const;
43         ///
44         int modelDepth() const;
45
46 private:
47         ///
48         void populate(TocIterator & it, TocIterator const & end,
49                 QModelIndex const & parent);
50         ///
51         typedef std::map<QModelIndex, TocIterator> TocMap;
52         ///
53         typedef std::map<TocIterator, QModelIndex> ModelMap;
54         ///
55         TocMap toc_map_;
56         ///
57         ModelMap model_map_;
58         ///
59         int maxdepth_;
60         int mindepth_;
61 };
62
63 } // namespace frontend
64 } // namespace lyx
65
66 #endif // TOCMODEL_H