]> git.lyx.org Git - lyx.git/blob - src/mathed/math_matrixinset.h
fix the matrix reading other small cleanup
[lyx.git] / src / mathed / math_matrixinset.h
1 // -*- C++ -*-
2 #ifndef MATH_MATRIXINSET_H
3 #define MATH_MATRIXINSET_H
4
5 #include <vector>
6
7 #include "math_parinset.h"
8
9 #ifdef __GNUG__
10 #pragma interface
11 #endif
12
13 /** Multiline math paragraph base class.
14     This is the base to all multiline editable math objects
15     like array and eqnarray.
16     \author Alejandro Aguilar Sierra
17 */
18 class MathMatrixInset : public MathParInset {
19 public: 
20         ///
21         explicit
22         MathMatrixInset(int m, int n, short st = LM_ST_TEXT);
23         ///
24         explicit
25         MathMatrixInset(MathMatrixInset const &);
26         ///
27         ~MathMatrixInset();
28         ///
29         MathedInset * Clone();
30         ///
31         void draw(Painter &, int, int);
32         ///
33         void Write(std::ostream &, bool fragile);
34         ///
35         void Metrics();
36         ///
37         void setData(MathedArray const &);
38         ///
39         void SetAlign(char, string const &);
40         ///
41         int GetColumns() const;
42         ///
43         int GetRows() const;
44         ///
45         virtual bool isMatrix() const;
46         
47         /// Use this to manage the extra information independently of paragraph
48         MathedRowSt * getRowSt() const;
49         ///
50         void setRowSt(MathedRowSt * r);
51 private:
52         ///  Number of columns & rows
53         int nc_;
54         ///
55         int nr_;
56         /// tab sizes
57         std::vector<int> ws_;   
58         /// 
59         char v_align_; // add approp. type
60         ///
61         //std::vector<char> h_align;
62         string h_align_; // a vector would perhaps be more correct
63         /// Vertical structure
64         MathedRowSt * row_;
65 };
66
67
68 inline
69 int MathMatrixInset::GetColumns() const
70 {
71         return nc_;
72 }
73
74
75 inline
76 int MathMatrixInset::GetRows() const
77 {
78         return nr_;
79 }
80
81
82 inline
83 bool MathMatrixInset::isMatrix() const
84 {
85         return true;
86 }
87         
88
89 inline
90 MathedRowSt * MathMatrixInset::getRowSt() const
91 {
92         return row_;
93 }
94
95
96 inline
97 void MathMatrixInset::setRowSt(MathedRowSt * r)
98 {
99         row_ = r;
100 }
101 #endif