]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/TocModel.h
Toc Slider fixes from Ugras Baran.
[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         Q_OBJECT
28
29 public:
30         ///
31         TocModel() {}
32         ///
33         TocModel(Toc const & toc);
34         ///
35         ~TocModel() {}
36         ///
37         TocModel const & operator=(Toc const & toc);
38         ///
39         void clear();
40         ///
41         void populate(Toc const & toc);
42         ///
43         TocIterator const tocIterator(QModelIndex const & index) const;
44         ///
45         QModelIndex const modelIndex(TocIterator const & it) const;
46         ///
47         int modelDepth();
48
49 private:
50         ///
51         void populate(TocIterator & it,
52                 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