]> git.lyx.org Git - lyx.git/blob - src/toc.h
remove noload/don't typeset
[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 #ifdef __GNUG__
20 #pragma interface
21 #endif
22
23 #include <config.h>
24  
25 #include "support/LOstream.h"
26 #include "LString.h"
27
28 #include <map>
29 #include <vector>
30
31 class Buffer;
32 class LyXView;
33 class Paragraph;
34
35 /** Nice functions and objects to handle TOCs
36  */
37 namespace toc 
38 {
39
40 ///
41 struct TocItem {
42         TocItem(Paragraph * p, int d, string const & s)
43                 : par(p), depth(d), str(s) {}
44         ///
45         string const asString() const;
46         /// set cursor in LyXView to this TocItem
47         void goTo(LyXView & lv_) const;
48         /// the action corresponding to the goTo above
49         int action() const;
50         ///
51         Paragraph * par;
52         ///
53         int depth;
54         ///
55         string str;
56 };
57
58 ///
59 typedef std::vector<TocItem> Toc;
60 ///
61 typedef std::map<string, Toc> TocList;
62
63 ///
64 TocList const getTocList(Buffer const *);
65
66 ///
67 std::vector<string> const getTypes(Buffer const *);
68
69 ///
70 void asciiTocList(string const &, Buffer const *, std::ostream &);
71         
72 /** Given the cmdName of the TOC param, returns the type used
73     by ControlToc::getContents() */
74 string const getType(string const & cmdName);
75
76 ///
77 inline
78 bool operator==(TocItem const & a, TocItem const & b)
79 {
80         return a.par == b.par && a.str == b.str;
81         // No need to compare depth.
82 }
83
84
85 ///
86 inline
87 bool operator!=(TocItem const & a, TocItem const & b)
88 {
89         return !(a == b);
90         // No need to compare depth.
91 }
92
93
94 } // namespace toc
95
96 #endif // CONTROLTOC_H