]> git.lyx.org Git - features.git/blob - src/frontends/controllers/ControlToc.h
Cleanup of the Toc model and controller: The objective is to let the View (TocWidget...
[features.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         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         ///
48         int selectedType() { return selected_type_; }
49
50         /// Return the first TocItem before the cursor
51         TocIterator const getCurrentTocItem(size_t type) const;
52
53         /// Apply the selected outlining operation
54         void outlineUp();
55         ///
56         void outlineDown();
57         ///
58         void outlineIn();
59         ///
60         void outlineOut();
61         /// Test if outlining operation is possible
62         bool canOutline(size_t type) const;
63         ///
64         void updateBackend();
65
66 public:
67         /// Update the model data if needed.
68         virtual void update() = 0;
69
70 private:
71         /// Return the guiname from a given cmdName of the TOC param
72         docstring const getGuiName(std::string const & type) const;
73
74         std::vector<std::string> types_;
75         std::vector<docstring> type_names_;
76         int selected_type_;
77 };
78
79 } // namespace frontend
80 } // namespace lyx
81
82 #endif // CONTROLTOC_H