]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiToc.h
81a9a65b539b99e0c69ec822ad53d3175690590e
[lyx.git] / src / frontends / qt4 / GuiToc.h
1 // -*- C++ -*-
2 /**
3  * \file GuiToc.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Kalle Dalheimer
9  * \author Angus Leeming
10  * \author Abdelrazak Younes
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef GUITOC_H
16 #define GUITOC_H
17
18 #include "ControlCommand.h"
19 #include "TocBackend.h"
20
21 #include <QObject>
22 #include <QStandardItemModel>
23 #include <QStringListModel>
24
25 #include <vector>
26
27 namespace lyx {
28 namespace frontend {
29
30 class TocModel;
31
32 class GuiToc : public QObject, public ControlCommand
33 {
34         Q_OBJECT
35
36 public:
37         ///
38         GuiToc(Dialog &);
39
40         ///
41         bool initialiseParams(std::string const & data);
42         ///
43         void updateView();
44         /// Test if outlining operation is possible
45         bool canOutline(int type) const;
46
47         QStandardItemModel * tocModel(int type);
48         ///
49         QModelIndex currentIndex(int type) const;
50         ///
51         void goTo(int type, QModelIndex const & index);
52         ///
53         int getType();
54         ///
55         int getTocDepth(int type);
56
57 Q_SIGNALS:
58         /// Signal that the internal toc_models_ has been reset.
59         void modelReset();
60
61 private:
62         friend class TocWidget;
63         ///
64         std::vector<TocModel *> toc_models_;
65
66         ///
67         TocList const & tocs() const;
68
69         /// Return the list of types available
70         std::vector<docstring> const & typeNames() const
71         { return type_names_; }
72
73         ///
74         int selectedType() { return selected_type_; }
75
76         /// Return the first TocItem before the cursor
77         TocIterator currentTocItem(int type) const;
78
79         /// Apply the selected outlining operation
80         void outlineUp();
81         ///
82         void outlineDown();
83         ///
84         void outlineIn();
85         ///
86         void outlineOut();
87         ///
88         void updateBackend();
89
90 private:
91         std::vector<std::string> types_;
92         std::vector<docstring> type_names_;
93         int selected_type_;
94
95         /// Return the guiname from a given cmdName of the TOC param
96         docstring guiName(std::string const & type) const;
97 };
98
99 } // namespace frontend
100 } // namespace lyx
101
102 #endif // GUITOC_H