]> git.lyx.org Git - lyx.git/blob - src/mathed/math_rowst.h
mathed39.diff
[lyx.git] / src / mathed / math_rowst.h
1 // -*- C++ -*-
2 #ifndef MATH_ROWST_H
3 #define MATH_ROWST_H
4
5 #include <vector>
6
7 /** The physical structure of a row and aditional information is stored here.
8     It allows to manage the extra info independently of the paragraph data.  
9     Only used for multiline paragraphs.
10  */
11
12 class MathedRowStruct
13 {
14 public:
15         ///
16         typedef std::vector<int> Widths;
17         
18         ///
19         explicit
20         MathedRowStruct(int n)
21                 : asc_(0), desc_(0), y_(0), widths_(n + 1, 0),
22                   numbered_(true)
23                 {}
24         ///
25         string const & getLabel() const;
26         ///
27         bool isNumbered() const;
28         ///
29         int  getBaseline() const;
30         ///
31         void setBaseline(int b);
32         ///
33         int ascent() const;
34         ///
35         int descent() const;
36         ///
37         void ascent(int a);
38         ///
39         void descent(int d);
40         ///
41         int  getTab(int i) const;
42         /// 
43         void setLabel(string const & l);
44         ///
45         void setNumbered(bool nf);
46         ///
47         void setTab(int i, int t);
48         ///
49         friend class MathedRowSt;
50 protected:
51         /// Vericals 
52         int asc_;
53         ///
54         int desc_;
55         ///
56         int y_;
57         /// widths 
58         Widths widths_;
59         /// 
60         string label_;
61         ///
62         bool numbered_;
63 };
64
65 class MathedRowSt : public MathedRowStruct {
66 public:
67         ///
68         explicit MathedRowSt(int n)
69                         : MathedRowStruct(n), next_(0)
70                 {}
71         /// Should be const but...
72         MathedRowSt * getNext() const;
73         /// ...we couldn't use this.
74         void setNext(MathedRowSt * n);
75 private:
76         ///
77         MathedRowSt * next_;
78 };
79
80
81 inline
82 MathedRowSt * MathedRowSt::getNext() const
83 {
84         return next_;
85 }
86
87
88 inline
89 void MathedRowSt::setNext(MathedRowSt * n)
90 {
91         next_ = n;
92 }
93
94
95 inline
96 string const & MathedRowStruct::getLabel() const
97 {
98         return label_;
99 }
100
101
102 inline
103 bool MathedRowStruct::isNumbered() const
104 {
105         return numbered_;
106 }
107
108
109 inline
110 int MathedRowStruct::getBaseline() const
111 {
112         return y_;
113 }
114
115
116 inline
117 void MathedRowStruct::setBaseline(int b)
118 {
119         y_ = b;
120 }
121
122
123 inline
124 int MathedRowStruct::ascent() const
125 {
126         return asc_;
127 }
128
129
130 inline
131 int MathedRowStruct::descent() const
132 {
133         return desc_;
134 }
135
136
137 inline
138 void MathedRowStruct::ascent(int a)
139 {
140         asc_ = a;
141 }
142
143
144 inline
145 void MathedRowStruct::descent(int d)
146 {
147         desc_ = d;
148 }
149
150
151 inline
152 int MathedRowStruct::getTab(int i) const
153 {
154         return widths_[i];
155 }
156
157
158 inline
159 void MathedRowStruct::setLabel(string const & l)
160 {
161         label_ = l;
162 }
163
164
165 inline
166 void MathedRowStruct::setNumbered(bool nf)
167 {
168         numbered_ = nf;
169 }
170
171
172 inline
173 void MathedRowStruct::setTab(int i, int t)
174 {
175         widths_[i] = t;
176 }
177 #endif