4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Jean-Marc Lasgouttes
8 * \author Angus Leeming
10 * Full author contact details are available in file CREDITS.
12 * Nice functions and objects to handle TOCs
23 #include "pariterator.h"
37 TocItem(int par_id, int d, std::string const & s)
38 : id_(par_id), depth(d), str(s) {}
40 std::string const asString() const;
41 /// set cursor in LyXView to this TocItem
42 void goTo(LyXView & lv_) const;
43 /// the action corresponding to the goTo above
44 FuncRequest action() const;
45 /// Paragraph ID containing this item
54 typedef std::vector<TocItem> Toc;
56 typedef std::map<std::string, Toc> TocList;
59 TocList const getTocList(Buffer const &);
62 std::vector<std::string> const getTypes(Buffer const &);
64 /// Return the first TocItem before the cursor
65 TocItem const getCurrentTocItem(Buffer const &, LCursor const &,
66 std::string const & type);
69 void asciiTocList(std::string const &, Buffer const &, std::ostream &);
71 /** Given the cmdName of the TOC param, returns the type used
72 by ControlToc::getContents() */
73 std::string const getType(std::string const & cmdName);
75 /** Returns the guiname from a given @c type
76 The localization of the names will be done in the frontends */
77 std::string const getGuiName(std::string const & type, Buffer const &);
80 bool operator==(TocItem const & a, TocItem const & b)
82 return a.id_ == b.id_ && a.str == b.str;
83 // No need to compare depth.
88 bool operator!=(TocItem const & a, TocItem const & b)
94 /// the type of outline operation
96 UP, // Move this header with text down
97 DOWN, // Move this header with text up
98 IN, // Make this header deeper
99 OUT // Make this header shallower
103 void outline(OutlineOp, Buffer *, pit_type &);
109 #endif // CONTROLTOC_H