]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathArray.cpp
Fix bug 5802 (http://bugzilla.lyx.org/show_bug.cgi?id=5802)
[lyx.git] / src / mathed / InsetMathArray.cpp
index 31b5f4f9b3dc3f9e53dcbee0f66019b34536fbf2..a543a036f61de6aa9c6d9179bf10647db85a96bc 100644 (file)
@@ -3,33 +3,30 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
-#include "LaTeXFeatures.h"
 #include "InsetMathArray.h"
+
+#include "LaTeXFeatures.h"
 #include "MathData.h"
 #include "MathParser.h"
 #include "MathStream.h"
+#include "MetricsInfo.h"
 
 #include "support/lstrings.h"
 
 #include <iterator>
 #include <sstream>
 
+using namespace std;
 
 namespace lyx {
 
-using std::getline;
-using std::istringstream;
-using std::istream_iterator;
-using std::vector;
-using std::string;
-
 
 InsetMathArray::InsetMathArray(docstring const & name, int m, int n)
        : InsetMathGrid(m, n), name_(name)
@@ -42,12 +39,6 @@ InsetMathArray::InsetMathArray(docstring const & name, int m, int n,
 {}
 
 
-InsetMathArray::InsetMathArray(docstring const & name, char valign,
-               docstring const & halign)
-       : InsetMathGrid(valign, halign), name_(name)
-{}
-
-
 InsetMathArray::InsetMathArray(docstring const & name, docstring const & str)
        : InsetMathGrid(1, 1), name_(name)
 {
@@ -63,7 +54,7 @@ InsetMathArray::InsetMathArray(docstring const & name, docstring const & str)
        }
 
        for (row_type row = 1; row < dat.size(); ++row)
-               appendRow(0);
+               addRow(0);
        for (col_type col = 1; col < dat[0].size(); ++col)
                addCol(0);
        for (row_type row = 0; row < dat.size(); ++row)
@@ -104,13 +95,16 @@ void InsetMathArray::draw(PainterInfo & pi, int x, int y) const
 
 void InsetMathArray::write(WriteStream & os) const
 {
+       MathEnsurer ensurer(os);
+
        if (os.fragile())
                os << "\\protect";
        os << "\\begin{" << name_ << '}';
 
-       if (v_align_ == 't' || v_align_ == 'b')
-               os << '[' << char(v_align_) << ']';
-       os << '{' << halign() << "}\n";
+       char const v = verticalAlignment();
+       if (v == 't' || v == 'b')
+               os << '[' << v << ']';
+       os << '{' << horizontalAlignments() << "}\n";
 
        InsetMathGrid::write(os);