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