]> git.lyx.org Git - lyx.git/blob - src/mathed/math_rowst.h
fix "make dist" target
[lyx.git] / src / mathed / math_rowst.h
1 // -*- C++ -*-
2 #ifndef MATH_ROWST_H
3 #define MATH_ROWST_H
4
5 #include "support/LAssert.h"
6 #include <vector>
7
8 /** The physical structure of a row and aditional information is stored here.
9     It allows to manage the extra info independently of the paragraph data.  
10     Only used for multiline paragraphs.
11  */
12
13 class MathedRowStruct
14 {
15 public:
16         ///
17         typedef std::vector<int> Widths;
18         
19         ///
20         MathedRowStruct();
21         ///
22         string const & getLabel() const;
23         ///
24         bool isNumbered() const;
25         ///
26         int  getBaseline() const;
27         ///
28         void setBaseline(int b);
29         ///
30         int ascent() const;
31         ///
32         int descent() const;
33         ///
34         void ascent(int a);
35         ///
36         void descent(int d);
37         ///
38         int  getTab(unsigned int i) const;
39         /// 
40         void setLabel(string const & l);
41         ///
42         void setNumbered(bool nf);
43         ///
44         void setTab(unsigned int i, int t);
45         ///
46         friend class MathedRowSt;
47 protected:
48         /// Vericals 
49         int asc_;
50         ///
51         int desc_;
52         ///
53         int y_;
54         /// widths 
55         Widths widths_;
56         /// 
57         string label_;
58         ///
59         bool numbered_;
60 };
61
62
63 class MathedRowContainer {
64 public:
65         ///
66         typedef std::vector<MathedRowStruct>   data_type;
67         ///
68         typedef data_type::size_type           size_type;
69         ///
70         struct iterator {
71                 ///
72                 iterator();
73                 ///
74                 explicit iterator(MathedRowContainer * m);
75                 /// "better" conversion to bool
76                 operator void *() const;
77                 ///
78                 MathedRowStruct * operator->();
79                 ///
80                 MathedRowStruct const * operator->() const;
81                 ///
82                 void operator++();
83                 ///
84                 bool is_last() const;
85                 ///
86                 bool operator==(const iterator & it) const;
87
88         //private:
89                 MathedRowContainer * st_;
90                 ///
91                 unsigned int pos_;
92         };
93
94 public:
95         /// 
96         iterator begin();
97         /// 
98         iterator end();
99         ///
100         bool empty() const;
101
102         /// insert item before 'it'
103         void insert(iterator const & it);
104         /// erase item pointed to by 'it'
105         void erase(iterator & it);
106         /// access to last row
107         MathedRowStruct & back();
108         /// access to last row
109         MathedRowStruct const & back() const;
110         /// append empty element
111         void push_back();
112         ///
113         size_type size() const;
114         
115 //private:
116         ///
117         std::vector<MathedRowStruct> data_;
118 };
119
120 #endif