]> git.lyx.org Git - lyx.git/blob - src/Bullet.h
some tabular fixes for the problems reported by Helge
[lyx.git] / src / Bullet.h
1 // -*- C++ -*-
2 /**
3  * \file Bullet.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Allan Rae
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef BULLET_H
14 #define BULLET_H
15
16 #include <string>
17
18 ///
19 class Bullet {
20 public:
21         ///
22         Bullet(int f = -1, int c = -1, int s = -1);
23
24         ///
25         explicit Bullet(std::string const &);
26
27         ///
28         void setCharacter(int);
29         ///
30         void setFont(int);
31         ///
32         void setSize(int);
33         ///
34         void setText(std::string const &);
35         ///
36         int getCharacter() const;
37         ///
38         int getFont() const;
39         ///
40         int getSize() const;
41         ///
42         std::string const & getText() const;
43         ///
44         Bullet & operator=(Bullet const &);
45         ///
46         friend bool operator==(Bullet const &, Bullet const &);
47 protected:
48         ///
49         void testInvariant() const;
50 private:
51         /**
52            This enum makes adding additional panels or changing panel sizes
53            easier. Since you only need change these values for all tests to
54            be correct for the new values.
55
56            Note: MAX means the size of the array so to test you need:
57            (x < MAX)  *not* (x <= MAX)
58         */
59         enum {
60                 ///
61                 MIN = -1,
62                 ///
63                 FONTMAX = 6,
64                 ///
65                 CHARMAX = 36,
66                 ///
67                 SIZEMAX = 10
68         };
69
70         ///
71         void generateText() const;
72         ///
73         static std::string const bulletSize(int);
74         ///
75         static std::string const bulletEntry(int, int);
76
77         ///
78         int font;
79         ///
80         int character;
81         ///
82         int size;
83
84         // size, character and font are array indices to access
85         // the predefined arrays of LaTeX equivalent strings.
86
87         /** flag indicates if user has control of text (1)
88             or if I can use it to generate strings (0)
89             or have already (-1)
90         */
91         mutable short user_text;
92
93         //NOTE: Arranging these four shorts above to be together
94         //      like this should ensure they are in a single cache line
95
96         /** text may contain a user-defined LaTeX symbol command
97             or one generated internally from the font, character
98             and size settings.
99         */
100         mutable std::string text;
101 };
102
103
104 inline
105 bool operator!=(Bullet const & b1, Bullet const & b2)
106 {
107         return !(b1 == b2);
108 }
109
110 ///
111 extern
112 Bullet const ITEMIZE_DEFAULTS[];
113
114 #endif /* BULLET_H_ */