]> git.lyx.org Git - lyx.git/blob - src/mathed/math_parinset.h
mathed44.diff
[lyx.git] / src / mathed / math_parinset.h
1 // -*- C++ -*-
2 #ifndef MATH_PARINSET_H
3 #define MATH_PARINSET_H
4
5 #include "array.h"
6 #include "math_inset.h"
7 #include "math_defs.h"
8 #include "math_rowst.h"
9
10 #ifdef __GNUG__
11 #pragma interface
12 #endif
13
14 class MathedArray;
15
16
17 /** The math paragraph base class, base to all editable math objects
18     \author Alejandro Aguilar Sierra
19  */
20 class MathParInset : public MathedInset  {
21 public: 
22         ///
23         MathParInset(short st = LM_ST_TEXT, string const & nm = string(),
24                      short ot = LM_OT_MIN);
25         ///
26         virtual MathedInset * Clone();
27         /// Draw the object on a drawable
28         virtual void draw(Painter &, int x, int baseline);
29         /// Write LaTeX code
30         virtual void Write(std::ostream &, bool fragile);
31         ///
32         virtual void Metrics();
33         ///
34         virtual void UserSetSize(short);
35         /// Data is stored in a LyXArray
36         virtual void setData(MathedArray const &);
37         ///
38         virtual MathedArray & GetData();
39         ///
40         virtual MathedArray const & GetData() const;
41         /// Paragraph position
42         virtual void GetXY(int &, int &) const;
43         ///
44         virtual void setXY(int x, int y);
45         ///
46         virtual void SetFocus(int, int) {}
47         ///
48         virtual bool Inside(int, int);   
49         // Tab stuff used by Matrix.
50         ///
51         virtual void SetAlign(char, string const &);
52         ///
53         virtual int GetColumns() const;
54         ///
55         virtual int GetRows() const;
56         ///
57         virtual bool isMatrix() const;
58         // Vertical switching
59         ///
60         virtual bool setArgumentIdx(int i);
61         ///
62         virtual bool setNextArgIdx();
63         ///
64         virtual int getArgumentIdx() const;
65         ///
66         virtual int getMaxArgumentIdx() const;
67         ///
68         virtual void SetStyle(short);
69         ///
70         virtual MathedRowSt * getRowSt() const;
71         ///
72         virtual void setRowSt(MathedRowSt *);
73         ///
74         virtual bool Permit(short f) const;
75         ///
76         int xo() const;
77         ///
78         int yo() const;
79         ///
80         void clear();
81 protected:
82         /// Paragraph data is stored here
83         MathedArray array;
84         /// 
85         short flag;
86         ///
87         void xo(int tx);
88         ///
89         void yo(int ty);
90 private:
91         /// Cursor start position
92         int xo_;
93         ///
94         int yo_;
95 };
96
97
98 inline
99 void MathParInset::SetAlign(char, string const &)
100 {}
101
102
103 inline
104 int MathParInset::GetColumns() const
105 {
106         return 1;
107 }
108
109
110 inline
111 int MathParInset::GetRows() const
112 {
113         return 1;
114 }
115
116
117 inline
118 bool MathParInset::isMatrix() const
119 {
120         return false;
121 }
122
123
124 inline
125 bool MathParInset::setArgumentIdx(int i)
126 {
127         return (i == 0);
128 }
129
130
131 inline
132 bool MathParInset::setNextArgIdx()
133 {
134         return false;
135 }
136
137
138 inline
139 int MathParInset::getArgumentIdx() const
140 {
141         return 0;
142 }
143
144
145 inline
146 int MathParInset::getMaxArgumentIdx() const
147 {
148         return 0;
149 }
150
151
152 inline
153 void MathParInset::setRowSt(MathedRowSt *)
154 {}
155
156
157 inline
158 int MathParInset::xo() const
159 {
160         return xo_;
161 }
162
163
164 inline
165 int MathParInset::yo() const
166 {
167         return yo_;
168 }
169
170
171 inline
172 void MathParInset::xo(int tx)
173 {
174         xo_ = tx;
175 }
176
177
178 inline
179 void MathParInset::yo(int ty)
180 {
181         yo_ = ty;
182 }
183 #endif