]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathAMSArray.cpp
Allow automatic text direction in Painter::text()
[lyx.git] / src / mathed / InsetMathAMSArray.cpp
index b9efc3d0e2853631d2c20c98e3cf0e97312cdb60..13d7a9425e5244a77a2cb226d1b060fcb66fe7f0 100644 (file)
 
 #include "support/lstrings.h"
 
+#include <sstream>
 #include <ostream>
 
 
-namespace lyx {
+using namespace std;
+using namespace lyx::support;
 
-using support::bformat;
+namespace lyx {
 
 
 InsetMathAMSArray::InsetMathAMSArray(Buffer * buf, docstring const & name,
@@ -104,20 +106,22 @@ void InsetMathAMSArray::draw(PainterInfo & pi, int x, int y) const
 bool InsetMathAMSArray::getStatus(Cursor & cur, FuncRequest const & cmd,
                FuncStatus & flag) const
 {
-       switch (cmd.action) {
+       switch (cmd.action()) {
        case LFUN_TABULAR_FEATURE: {
-               docstring const & s = cmd.argument();
+               string s = cmd.getArg(0);
                if (s == "add-vline-left" || s == "add-vline-right") {
                        flag.message(bformat(
-                               from_utf8(N_("Can't add vertical grid lines in '%1$s'")),       name_));
+                               from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
+                               name_));
                        flag.setEnabled(false);
                        return true;
                }
-               return InsetMathGrid::getStatus(cur, cmd, flag);
+               break;
        }
        default:
-               return InsetMathGrid::getStatus(cur, cmd, flag);
+               break;
        }
+       return InsetMathGrid::getStatus(cur, cmd, flag);
 }
 
 
@@ -125,8 +129,11 @@ void InsetMathAMSArray::write(WriteStream & os) const
 {
        MathEnsurer ensurer(os);
        os << "\\begin{" << name_ << '}';
+       bool open = os.startOuterRow();
        InsetMathGrid::write(os);
        os << "\\end{" << name_ << '}';
+       if (open)
+               os.startOuterRow();
 }