]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/TocModel.h
do what the FIXME suggested
[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);
35         ///
36         ~TocModel() {}
37         ///
38         TocModel const & operator=(Toc const & toc);
39         ///
40         void clear();
41         ///
42         void populate(Toc const & toc);
43         ///
44         TocIterator const tocIterator(QModelIndex const & index) const;
45         ///
46         QModelIndex const modelIndex(TocIterator const & it) const;
47         ///
48         int modelDepth() const;
49
50 private:
51         ///
52         void populate(TocIterator & it, TocIterator const & end,
53                 QModelIndex const & parent);
54         ///
55         typedef std::map<QModelIndex, TocIterator> TocMap;
56         ///
57         typedef std::pair<QModelIndex, TocIterator> TocPair;
58         ///
59         typedef std::map<TocIterator, QModelIndex> ModelMap;
60         ///
61         TocMap toc_map_;
62         ///
63         ModelMap model_map_;
64         ///
65         int maxdepth_;
66         int mindepth_;
67 };
68
69 } // namespace frontend
70 } // namespace lyx
71
72 #endif // TOCMODEL_H