]> git.lyx.org Git - lyx.git/blob - src/mathed/math_parinset.h
c8e2784d1632500c467c012e382fee7f631a77ce
[lyx.git] / src / mathed / math_parinset.h
1 // -*- C++ -*-
2 #ifndef MATH_PARINSET_H
3 #define MATH_PARINSET_H
4
5 #include "math_inset.h"
6 #include "math_defs.h"
7
8 struct MathedRowSt;
9 class MathedArray;
10
11
12 /** The math paragraph base class, base to all editable math objects */
13 class MathParInset: public MathedInset  {
14 public: 
15         ///
16         MathParInset(short st = LM_ST_TEXT, string const & nm = string(),
17                      short ot = LM_OT_MIN);
18         ///
19         explicit
20         MathParInset(MathParInset *);
21         ///
22         virtual ~MathParInset();
23         ///
24         virtual MathedInset * Clone();
25         /// Draw the object on a drawable
26         virtual void draw(Painter &, int x, int baseline);
27         /// Write LaTeX code
28         virtual void Write(std::ostream &, bool fragile);
29         ///
30         virtual void Metrics();
31         ///
32         virtual void UserSetSize(short);
33         /// Data is stored in a LyXArray
34         virtual void SetData(MathedArray *);
35         ///
36         virtual MathedArray * GetData();
37         /// Paragraph position
38         virtual void GetXY(int &, int &) const;
39         ///
40         virtual void setXY(int x, int y);
41         ///
42         virtual void SetFocus(int, int) {}
43         ///
44         virtual bool Inside(int, int);   
45         // Tab stuff used by Matrix.
46         ///
47         virtual void SetAlign(char, string const &) {}
48         ///
49         virtual int GetColumns() const { return 1; }
50         ///
51         virtual int GetRows() const { return 1; }
52         ///
53         virtual bool isMatrix() const { return false; }
54         // Vertical switching
55         ///
56         virtual bool setArgumentIdx(int i) { return (i == 0); }
57         ///
58         virtual bool setNextArgIdx() { return false; }
59         ///
60         virtual int getArgumentIdx() const { return 0; }
61         ///
62         virtual int getMaxArgumentIdx() const { return 0; }
63         ///
64         virtual void SetStyle(short);
65         ///
66         virtual MathedRowSt * getRowSt() const;
67         ///
68         virtual void setRowSt(MathedRowSt *) {}
69         ///
70         virtual bool Permit(short f) const;
71         ///
72         int xo() const {
73                 return xo_;
74         }
75         ///
76         int yo() const {
77                 return yo_;
78         }
79 protected:
80         /// Paragraph data is stored here
81         MathedArray * array;
82         /// 
83         short flag;
84         ///
85         void xo(int tx) {
86                 xo_ = tx;
87         }
88         ///
89         void yo(int ty) {
90                 yo_ = ty;
91         }
92 private:
93         /// Cursor start position
94         int xo_;
95         ///
96         int yo_;
97 };
98 #endif