]> git.lyx.org Git - lyx.git/blob - src/mathed/math_parinset.h
mathed65.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         ///
28         virtual void substitute(MathMacro *);
29         /// Draw the object on a drawable
30         virtual void draw(Painter &, int x, int baseline);
31         /// Write LaTeX code
32         virtual void Write(std::ostream &, bool fragile);
33         /// Write normalized content
34         virtual void WriteNormal(std::ostream &);
35         ///
36         virtual void Metrics();
37         ///
38         virtual void UserSetSize(short);
39         /// Data is stored in a LyXArray
40         virtual void setData(MathedArray const &);
41         ///
42         virtual MathedArray & GetData();
43         ///
44         virtual MathedArray const & GetData() const;
45         /// Paragraph position
46         virtual void GetXY(int &, int &) const;
47         ///
48         virtual void setXY(int x, int y);
49         ///
50         virtual void SetFocus(int, int) {}
51         ///
52         virtual bool Inside(int, int);   
53         // Tab stuff used by Matrix.
54         ///
55         virtual void SetAlign(char, string const &);
56         ///
57         virtual int GetColumns() const;
58         ///
59         virtual int GetRows() const;
60         ///
61         virtual bool isMatrix() const;
62         // Vertical switching
63         ///
64         virtual bool setArgumentIdx(int i);
65         ///
66         virtual bool setNextArgIdx();
67         ///
68         virtual int getArgumentIdx() const;
69         ///
70         virtual int getMaxArgumentIdx() const;
71         ///
72         virtual void SetStyle(short);
73         ///
74         MathedRowContainer & getRowSt();
75         ///
76         virtual bool Permit(short f) const;
77         ///
78         int xo() const;
79         ///
80         int yo() const;
81         ///
82         void clear();
83         ///
84         string label() const;
85 //protected:
86         /// Paragraph data is stored here
87         MathedArray array;
88         /// 
89         short flag;
90         ///
91         void xo(int tx);
92         ///
93         void yo(int ty);
94         ///
95         MathedRowContainer row_;
96 private:
97         /// Cursor start position
98         int xo_;
99         ///
100         int yo_;
101 };
102
103
104 inline
105 void MathParInset::SetAlign(char, string const &)
106 {}
107
108
109 inline
110 int MathParInset::GetColumns() const
111 {
112         return 1;
113 }
114
115
116 inline
117 int MathParInset::GetRows() const
118 {
119         return 1;
120 }
121
122
123 inline
124 bool MathParInset::isMatrix() const
125 {
126         return false;
127 }
128
129
130 inline
131 bool MathParInset::setArgumentIdx(int i)
132 {
133         return (i == 0);
134 }
135
136
137 inline
138 bool MathParInset::setNextArgIdx()
139 {
140         return false;
141 }
142
143
144 inline
145 int MathParInset::getArgumentIdx() const
146 {
147         return 0;
148 }
149
150
151 inline
152 int MathParInset::getMaxArgumentIdx() const
153 {
154         return 0;
155 }
156
157
158 inline
159 int MathParInset::xo() const
160 {
161         return xo_;
162 }
163
164
165 inline
166 int MathParInset::yo() const
167 {
168         return yo_;
169 }
170
171
172 inline
173 void MathParInset::xo(int tx)
174 {
175         xo_ = tx;
176 }
177
178
179 inline
180 void MathParInset::yo(int ty)
181 {
182         yo_ = ty;
183 }
184 #endif