]> git.lyx.org Git - lyx.git/blob - src/mathed/math_parinset.h
mathed49.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 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 private:
89         /// Cursor start position
90         int xo_;
91         ///
92         int yo_;
93 };
94
95
96 inline
97 void MathParInset::SetAlign(char, string const &)
98 {}
99
100
101 inline
102 int MathParInset::GetColumns() const
103 {
104         return 1;
105 }
106
107
108 inline
109 int MathParInset::GetRows() const
110 {
111         return 1;
112 }
113
114
115 inline
116 bool MathParInset::isMatrix() const
117 {
118         return false;
119 }
120
121
122 inline
123 bool MathParInset::setArgumentIdx(int i)
124 {
125         return (i == 0);
126 }
127
128
129 inline
130 bool MathParInset::setNextArgIdx()
131 {
132         return false;
133 }
134
135
136 inline
137 int MathParInset::getArgumentIdx() const
138 {
139         return 0;
140 }
141
142
143 inline
144 int MathParInset::getMaxArgumentIdx() const
145 {
146         return 0;
147 }
148
149
150 inline
151 int MathParInset::xo() const
152 {
153         return xo_;
154 }
155
156
157 inline
158 int MathParInset::yo() const
159 {
160         return yo_;
161 }
162
163
164 inline
165 void MathParInset::xo(int tx)
166 {
167         xo_ = tx;
168 }
169
170
171 inline
172 void MathParInset::yo(int ty)
173 {
174         yo_ = ty;
175 }
176 #endif