]> git.lyx.org Git - lyx.git/blob - src/mathed/math_parinset.h
more mathed cleanup
[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  protected:
72     /// Paragraph data is stored here
73     MathedArray * array;
74     /// Cursor start position
75     int xo;
76     ///
77     int yo;
78     /// 
79     short flag;
80  private:
81     ///
82     virtual void setFlag(MathedParFlag f);
83     ///
84     friend class InsetFormula;
85     ///
86     friend class MathedXIter;
87     ///
88     friend class MathedCursor;
89     ///
90     friend MathedArray * mathed_parse(unsigned flags = 0,
91                                        MathedArray * a = 0,
92                                        MathParInset ** p = 0);
93 };
94
95
96 #endif