]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.C
last Friday's text*.C -> text_func shuffle
[lyx.git] / src / tabular.C
index 7f68de627c81e93146562b9a9826f906c1ce337d..6496fbae99482a4212ef36c048697dd774ddb247 100644 (file)
@@ -37,6 +37,8 @@
 #include <algorithm>
 #include <cstdlib>
 
+using namespace lyx::support;
+
 using std::abs;
 using std::ostream;
 using std::istream;
@@ -149,7 +151,7 @@ LyXTabular & LyXTabular::operator=(LyXTabular const & lt)
        // If this and lt is not of the same size we have a serious bug
        // So then it is ok to throw an exception, or for now
        // call abort()
-       lyx::Assert(rows_ == lt.rows_ && columns_ == lt.columns_);
+       Assert(rows_ == lt.rows_ && columns_ == lt.columns_);
        cur_cell = -1;
        cell_info = lt.cell_info;
        row_info = lt.row_info;
@@ -426,7 +428,7 @@ int LyXTabular::numberOfCellsInRow(int cell) const
 }
 
 
-// returns 1 if there is a topline, returns 0 if not 
+// returns 1 if there is a topline, returns 0 if not
 bool LyXTabular::topLine(int cell, bool onlycolumn) const
 {
        int const row = row_of_cell(cell);
@@ -1083,25 +1085,6 @@ void LyXTabular::write(Buffer const * buf, ostream & os) const
 }
 
 
-void LyXTabular::read(Buffer const * buf, LyXLex & lex)
-{
-       string line;
-       istream & is = lex.getStream();
-
-       l_getline(is, line);
-       if (!prefixIs(line, "<lyxtabular ")
-               && !prefixIs(line, "<LyXTabular ")) {
-               lyx::Assert(false);
-               return;
-       }
-
-       int version;
-       if (!getTokenValue(line, "version", version))
-               return;
-       lyx::Assert(version >= 2);
-       read(buf, is, lex, line, version);
-}
-
 void LyXTabular::setHeaderFooterRows(int hr, int fhr, int fr, int lfr)
 {
        // set header info
@@ -1179,10 +1162,24 @@ void LyXTabular::setHeaderFooterRows(int hr, int fhr, int fr, int lfr)
        }
 }
 
-void LyXTabular::read(Buffer const * buf, istream & is,
-                      LyXLex & lex, string const & l, int const version)
+
+void LyXTabular::read(Buffer const * buf, LyXLex & lex)
 {
-       string line(l);
+       string line;
+       istream & is = lex.getStream();
+
+       l_getline(is, line);
+       if (!prefixIs(line, "<lyxtabular ")
+               && !prefixIs(line, "<LyXTabular ")) {
+               Assert(false);
+               return;
+       }
+
+       int version;
+       if (!getTokenValue(line, "version", version))
+               return;
+       Assert(version >= 2);
+
        int rows_arg;
        if (!getTokenValue(line, "rows", rows_arg))
                return;
@@ -1484,7 +1481,7 @@ int LyXTabular::getCellNumber(int row, int column) const
        else if (row < 0)
                row = 0;
 #else
-       lyx::Assert(column >= 0 || column < columns_ || row >= 0 || row < rows_);
+       Assert(column >= 0 || column < columns_ || row >= 0 || row < rows_);
 #endif
        return cell_info[row][column].cellno;
 }
@@ -2519,17 +2516,11 @@ void LyXTabular::validate(LaTeXFeatures & features) const
 }
 
 
-vector<string> const LyXTabular::getLabelList() const
+void LyXTabular::getLabelList(std::vector<string> & list) const
 {
-       vector<string> label_list;
        for (int i = 0; i < rows_; ++i)
-               for (int j = 0; j < columns_; ++j) {
-                       vector<string> const l =
-                               getCellInset(i, j)->getLabelList();
-                       label_list.insert(label_list.end(),
-                                         l.begin(), l.end());
-               }
-       return label_list;
+               for (int j = 0; j < columns_; ++j)
+                       getCellInset(i, j)->getLabelList(list);
 }