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