]> git.lyx.org Git - lyx.git/blob - src/mathed/math_parinset.h
mathed62.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         MathedRowContainer & getRowSt();
71         ///
72         virtual bool Permit(short f) const;
73         ///
74         int xo() const;
75         ///
76         int yo() const;
77         ///
78         void clear();
79 protected:
80         /// Paragraph data is stored here
81         MathedArray array;
82         /// 
83         short flag;
84         ///
85         void xo(int tx);
86         ///
87         void yo(int ty);
88         ///
89         MathedRowContainer row_;
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 int MathParInset::xo() const
154 {
155         return xo_;
156 }
157
158
159 inline
160 int MathParInset::yo() const
161 {
162         return yo_;
163 }
164
165
166 inline
167 void MathParInset::xo(int tx)
168 {
169         xo_ = tx;
170 }
171
172
173 inline
174 void MathParInset::yo(int ty)
175 {
176         yo_ = ty;
177 }
178 #endif