]> git.lyx.org Git - features.git/commitdiff
re-use code...
authorAndré Pönitz <poenitz@gmx.net>
Thu, 15 Aug 2002 17:41:24 +0000 (17:41 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 15 Aug 2002 17:41:24 +0000 (17:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5002 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_gridinset.C
src/mathed/math_gridinset.h
src/mathed/math_hullinset.C
src/mathed/math_hullinset.h

index b1108f6d1252670e714144cc21e1c4c0baefdaf9..7de23595a153b40c034162bf5174e8842e953c4c 100644 (file)
@@ -863,6 +863,7 @@ void MathGridInset::write(WriteStream & os) const
 {
        for (row_type row = 0; row < nrows(); ++row) {
                os << verboseHLine(rowinfo_[row].lines_);
+               // don't write & and empty cells at end of line
                for (col_type col = 0; col < ncols(); ++col)
                        os << cell(index(row, col)) << eocString(col);
                os << eolString(row, os.fragile());
index 79c8ad45fc54f56c9f3ea0b8895f58db9fc72887..cef894035a2b3da9d4f489e9511e3a77974aafa0 100644 (file)
@@ -216,9 +216,9 @@ protected:
        /// returns y offset of cell compared to inset
        int cellYOffset(idx_type idx) const;
        /// returns proper 'end of line' code for LaTeX
-       string eolString(row_type row, bool fragile = false) const;
+       virtual string eolString(row_type row, bool fragile = false) const;
        /// returns proper 'end of column' code for LaTeX
-       string eocString(col_type col) const;
+       virtual string eocString(col_type col) const;
        /// extract number of columns from alignment string
        col_type guessColumns(string const & halign) const;
        /// splits cells and shifts right part to the next cell
index 8b1c556c5cadec47afe3418261e16fc5f3e71062..039eef924c049f6366b5180f1d779e6e83ff5ae8 100644 (file)
@@ -607,24 +607,23 @@ void MathHullInset::mutate(string const & newtype)
 }
 
 
-void MathHullInset::write(WriteStream & os) const
+string MathHullInset::eolString(row_type row, bool fragile) const
 {
-       header_write(os);
-
-       bool n = numberedType();
-
-       for (row_type row = 0; row < nrows(); ++row) {
-               for (col_type col = 0; col < ncols(); ++col)
-                       os << cell(index(row, col)) << eocString(col);
-               if (n) {
-                       if (!label_[row].empty())
-                               os << "\\label{" << label_[row] << "}";
-                       if (nonum_[row])
-                               os << "\\nonumber ";
-               }
-               os << eolString(row);
+       string res;
+       if (numberedType()) {
+               if (!label_[row].empty())
+                       res += "\\label{" + label_[row] + "}";
+               if (nonum_[row])
+                       res += "\\nonumber ";
        }
+       return res + MathGridInset::eolString(row, fragile);
+}
+
 
+void MathHullInset::write(WriteStream & os) const
+{
+       header_write(os);
+       MathGridInset::write(os);
        footer_write(os);
 }
 
index b45c4f8872e7f99da92fff5d82487b01f8c451c7..1c84e36ff66a8d9cb64473235ace9e1151430340 100644 (file)
@@ -89,6 +89,10 @@ public:
        ///
        void infoize(std::ostream & os) const;
 
+protected:
+       ///     
+       string eolString(row_type row, bool fragile) const;
+
 private:
        ///
        void setType(string const & type);