]> git.lyx.org Git - features.git/blobdiff - 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
index 3285e38e26055bc487cf54ed29d850378ff964d9..987df9707d80002b82972701b4d62dfde7a60625 100644 (file)
@@ -5,6 +5,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Angus Leeming
+ * \author Abdelrazak Younes
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -14,7 +15,8 @@
 
 
 #include "ControlCommand.h"
-#include "toc.h"
+#include "TocBackend.h"
+
 #include <vector>
 
 namespace lyx {
@@ -26,15 +28,52 @@ class ControlToc : public ControlCommand {
 public:
        ///
        ControlToc(Dialog &);
+       ///
+       virtual ~ControlToc() {}
+
+       /// \c ControlCommand inherited method.
+       bool initialiseParams(std::string const & data);
+
+       ///
+       TocList const & tocs() const;
 
        /// Goto this paragraph id
-       void goTo(toc::TocItem const &);
+       void goTo(TocItem const &);
 
        /// Return the list of types available
-       std::vector<std::string> const getTypes() const;
+       std::vector<docstring> const & typeNames() const
+       { return type_names_; }
+
+       ///
+       int selectedType() { return selected_type_; }
+
+       /// Return the first TocItem before the cursor
+       TocIterator const getCurrentTocItem(size_t type) const;
+
+       /// Apply the selected outlining operation
+       void outlineUp();
+       ///
+       void outlineDown();
+       ///
+       void outlineIn();
+       ///
+       void outlineOut();
+       /// Test if outlining operation is possible
+       bool canOutline(size_t type) const;
+       ///
+       void updateBackend();
+
+public:
+       /// Update the model data if needed.
+       virtual void update() = 0;
+
+private:
+       /// Return the guiname from a given cmdName of the TOC param
+       docstring const getGuiName(std::string const & type) const;
 
-       /// Given a type, returns the contents
-       toc::Toc const getContents(std::string const & type) const;
+       std::vector<std::string> types_;
+       std::vector<docstring> type_names_;
+       int selected_type_;
 };
 
 } // namespace frontend