]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiToc.h
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[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 "DockView.h"
19
20 #include "insets/InsetCommandParams.h"
21
22 #include "TocBackend.h"
23
24 #include <QStandardItemModel>
25
26 #include <vector>
27
28 namespace lyx {
29 namespace frontend {
30
31 class TocModel;
32 class TocWidget;
33
34 class GuiToc : public DockView
35 {
36         Q_OBJECT
37
38 public:
39         ///
40         GuiToc(
41                 GuiView & parent, ///< the main window where to dock.
42                 Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer)
43                 Qt::WindowFlags flags = 0);
44
45         ~GuiToc();
46
47         ///
48         bool initialiseParams(std::string const & data);
49         ///
50         void updateView();
51         /// Test if outlining operation is possible
52         bool canOutline(int type) const;
53
54         QStandardItemModel * tocModel(int type);
55         ///
56         QModelIndex currentIndex(int type) const;
57         ///
58         void goTo(int type, QModelIndex const & index);
59         ///
60         int getType();
61         ///
62         int getTocDepth(int type);
63
64 Q_SIGNALS:
65         /// Signal that the internal toc_models_ has been reset.
66         void modelReset();
67
68 private:
69         ///
70         TocWidget * widget_;
71         ///
72         std::vector<TocModel *> toc_models_;
73         ///             
74         void clearTocModels();
75
76 public:
77         ///
78         TocList const & tocs() const;
79
80         /// Return the list of types available
81         QStringList const & typeNames() const { return type_names_; }
82
83         /// Return the first TocItem before the cursor
84         TocIterator currentTocItem(int type) const;
85
86         /// Apply the selected outlining operation
87         void outlineUp();
88         ///
89         void outlineDown();
90         ///
91         void outlineIn();
92         ///
93         void outlineOut();
94         ///
95         void updateBackend();
96
97         /// Return the guiname from a given cmdName of the TOC param
98         docstring guiName(std::string const & type) const;
99
100         /// clean-up on hide.
101         void clearParams() {}
102         ///
103         void dispatchParams();
104         ///
105         bool isBufferDependent() const { return true; }
106
107         ///
108         QStringList types_;
109         ///
110         QStringList type_names_;
111 };
112
113 } // namespace frontend
114 } // namespace lyx
115
116 #endif // GUITOC_H