]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_hullinset.C
STRCONV
[lyx.git] / src / mathed / math_hullinset.C
index 5c99996614b94bf685bd16441fffc0acce0b487e..b6f743e32a9b987da3a441a4e2efde5940c82cc9 100644 (file)
@@ -7,6 +7,7 @@
 #include "math_hullinset.h"
 #include "math_mathmlstream.h"
 #include "math_streamstr.h"
+#include "math_cursor.h"
 #include "math_support.h"
 #include "math_extern.h"
 #include "math_charinset.h"
@@ -392,12 +393,12 @@ void MathHullInset::footer_write(WriteStream & os) const
                else
                        os << "\\]\n";
 
-       else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign"  
+       else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign"
             || type_ == "alignat" || type_ == "xalignat")
-               os << "\n\\end{" << type_ << star(n) << "}\n";
+               os << "\\end{" << type_ << star(n) << "}\n";
 
        else if (type_ == "xxalignat" || type_ == "multline" || type_ == "gather")
-               os << "\n\\end{" << type_ << "}\n";
+               os << "\\end{" << type_ << "}\n";
 
        else
                os << "\\end{unknown" << star(n) << "}";
@@ -432,7 +433,7 @@ void MathHullInset::delRow(row_type row)
 
 void MathHullInset::addCol(col_type col)
 {
-       if (colChangeOK()) 
+       if (colChangeOK())
                MathGridInset::addCol(col);
        else
                lyxerr << "Can't change number of columns in '" << type_ << "'\n";
@@ -441,7 +442,7 @@ void MathHullInset::addCol(col_type col)
 
 void MathHullInset::delCol(col_type col)
 {
-       if (colChangeOK()) 
+       if (colChangeOK())
                MathGridInset::delCol(col);
        else
                lyxerr << "Can't change number of columns in '" << type_ << "'\n";
@@ -591,7 +592,7 @@ void MathHullInset::mutate(string const & newtype)
        }
 
        else if (type_ == "multline") {
-               if (newtype == "gather" || newtype == "align" ||        
+               if (newtype == "gather" || newtype == "align" ||
                    newtype == "xalignat" || newtype == "xxalignat" || newtype == "flalign")
                        setType(newtype);
                else if (newtype == "eqnarray") {
@@ -624,7 +625,7 @@ string MathHullInset::eolString(row_type row, bool fragile) const
 {
        string res;
        if (numberedType()) {
-               if (!label_[row].empty())
+               if (!label_[row].empty() && !nonum_[row])
                        res += "\\label{" + label_[row] + "}";
                if (nonum_[row])
                        res += "\\nonumber ";
@@ -699,7 +700,9 @@ void MathHullInset::doExtern
        if (getType() == "simple") {
                size_type pos = cell(idx).find_last(eq);
                MathArray ar;
-               if (pos == cell(idx).size()) {
+               if (mathcursor && mathcursor->selection()) {
+                       ar = asArray(mathcursor->grabAndEraseSelection());
+               } else if (pos == cell(idx).size()) {
                        ar = cell(idx);
                        lyxerr << "use whole cell: " << ar << "\n";
                } else {
@@ -823,7 +826,7 @@ MathInset::result_type MathHullInset::dispatch
                        idx = r * ncols() + c;
                        if (idx >= nargs())
                                idx = nargs() - 1;
-                       if (pos > cell(idx).size()) 
+                       if (pos > cell(idx).size())
                                pos = cell(idx).size();
                        return DISPATCHED_POP;
                }