]> git.lyx.org Git - lyx.git/blob - src/toc.h
remove mention of lyxrc from the splash
[lyx.git] / src / toc.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2002 The LyX Team.
8  *
9  * ======================================================
10  *
11  * \file toc.h
12  * \author Angus Leeming <a.leeming@ic.ac.uk>
13  * \author Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
14  */
15
16 #ifndef TOC_H
17 #define TOC_H
18
19 #include <config.h>
20
21 #include "support/LOstream.h"
22 #include "LString.h"
23
24 #include <map>
25 #include <vector>
26
27 class Buffer;
28 class LyXView;
29 class Paragraph;
30
31 /** Nice functions and objects to handle TOCs
32  */
33 namespace toc
34 {
35
36 ///
37 struct TocItem {
38         TocItem(int par_id, int d, string const & s)
39                 : id_(par_id), depth(d), str(s) {}
40         ///
41         string const asString() const;
42         /// set cursor in LyXView to this TocItem
43         void goTo(LyXView & lv_) const;
44         /// the action corresponding to the goTo above
45         int action() const;
46         /// Paragraph ID containing this item
47         int id_;
48         /// nesting depth
49         int depth;
50         ///
51         string str;
52 };
53
54 ///
55 typedef std::vector<TocItem> Toc;
56 ///
57 typedef std::map<string, Toc> TocList;
58
59 ///
60 TocList const getTocList(Buffer const *);
61
62 ///
63 std::vector<string> const getTypes(Buffer const *);
64
65 ///
66 void asciiTocList(string const &, Buffer const *, std::ostream &);
67
68 /** Given the cmdName of the TOC param, returns the type used
69     by ControlToc::getContents() */
70 string const getType(string const & cmdName);
71
72 inline
73 bool operator==(TocItem const & a, TocItem const & b)
74 {
75         return a.id_ == b.id_ && a.str == b.str;
76         // No need to compare depth.
77 }
78
79
80 inline
81 bool operator!=(TocItem const & a, TocItem const & b)
82 {
83         return !(a == b);
84 }
85
86
87 } // namespace toc
88
89 #endif // CONTROLTOC_H