]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlToc.h
fix scrolling bug: 3320 and 3652, maybe not perfect
[lyx.git] / src / frontends / controllers / ControlToc.h
1 // -*- C++ -*-
2 /**
3  * \file ControlToc.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef CONTROLTOC_H
14 #define CONTROLTOC_H
15
16
17 #include "ControlCommand.h"
18 #include "TocBackend.h"
19
20 #include <vector>
21
22 namespace lyx {
23 namespace frontend {
24
25 /** A controller for TOC dialogs.
26  */
27 class ControlToc : public ControlCommand {
28 public:
29         ///
30         ControlToc(Dialog &);
31         ///
32         virtual ~ControlToc() {}
33
34         /// \c ControlCommand inherited method.
35         virtual bool initialiseParams(std::string const & data);
36
37         ///
38         TocList const & tocs() const;
39
40         /// Goto this paragraph id
41         void goTo(TocItem const &);
42
43         /// Return the list of types available
44         std::vector<docstring> const & typeNames() const
45         { return type_names_; }
46
47         /// Return the guiname from a given cmdName of the TOC param
48         docstring const getGuiName(std::string const & type) const;
49
50         ///
51         int selectedType() { return selected_type_; }
52
53         /// Return the first TocItem before the cursor
54         TocIterator const getCurrentTocItem(size_t type) const;
55
56         /// Apply the selected outlining operation
57         void outlineUp();
58         ///
59         void outlineDown();
60         ///
61         void outlineIn();
62         ///
63         void outlineOut();
64         /// Test if outlining operation is possible
65         bool canOutline(size_t type) const;
66         ///
67         void updateBackend();
68
69 private:
70         std::vector<std::string> types_;
71         std::vector<docstring> type_names_;
72         int selected_type_;
73 };
74
75 } // namespace frontend
76 } // namespace lyx
77
78 #endif // CONTROLTOC_H