]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/TocModel.h
* ControlToc.[Ch]
[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 "toc.h"
16
17 #include "qt_helpers.h"
18
19 #include <QStandardItemModel>
20
21 #include <map>
22 #include <string>
23
24 namespace lyx {
25 namespace frontend {
26
27 class TocModel: public QStandardItemModel {
28         Q_OBJECT
29 public:
30         ///
31         TocModel() {}
32         ///
33         TocModel(toc::Toc const & toc_list);
34         ///
35         ~TocModel() {}
36         ///
37         TocModel const & operator=(toc::Toc const & toc_list);
38         ///
39         void clear();
40         ///
41         void populate(toc::Toc const & toc_list);
42         ///
43         toc::TocItem const item(QModelIndex const & index) const;
44         ///
45         QModelIndex const index(std::string const & toc_str) const;
46
47 private:
48         ///
49         void populate(toc::Toc::const_iterator & iter,
50                 toc::Toc::const_iterator const & end,
51                 QModelIndex const & parent);
52
53         typedef std::map<QModelIndex, toc::TocItem> ItemMap;
54         ///
55         typedef std::map<std::string, QModelIndex> IndexMap;
56         ///
57         ItemMap item_map_;
58         IndexMap index_map_;
59 };
60
61 } // namespace frontend
62 } // namespace lyx
63
64 #endif // TOCMODEL_H