]> git.lyx.org Git - lyx.git/blobdiff - src/tabular-old.C
aarrrgghh
[lyx.git] / src / tabular-old.C
index 33d23c79efbaba85b9fb55cdea630aa527c96eb9..796f47b650412b96b13e88aac336cf29d090d764 100644 (file)
@@ -1,21 +1,25 @@
 /* This file is part of
- * ====================================================== 
- * 
+ * ======================================================
+ *
  *           LyX, The Document Processor
- *      
+ *
  *           Copyright 2000-2001 The LyX Team.
  *
  *           @author: Jürgen Vigna
  *
- * ====================================================== 
+ * ======================================================
  */
 
 #include <config.h>
 
 #include "tabular.h"
+#include "buffer.h"
 #include "debug.h"
+
 #include "support/lstrings.h"
+#include "support/textutils.h"
 
+using std::abs;
 using std::istream;
 using std::getline;
 using std::endl;
@@ -59,12 +63,12 @@ bool getTokenValue(string const & str, char const * token, int & num)
     pos += strlen(token) + 1;
     ch = str[pos];
     if ((ch != '"') && (ch != '\'')) { // only read till next space
-       if (!isdigit(ch))
+       if (!IsDigit(ch))
            return false;
        ret += ch;
     }
     ++pos;
-    while ((pos < str.length() - 1) && isdigit(str[pos]))
+    while ((pos < str.length() - 1) && IsDigit(str[pos]))
        ret += str[pos++];
 
     num = strToInt(ret);
@@ -112,12 +116,12 @@ bool getTokenValue(string const & str, char const * token, bool & flag)
     pos += strlen(token) + 1;
     ch = str[pos];
     if ((ch != '"') && (ch != '\'')) { // only read till next space
-       if (!isdigit(ch))
+       if (!IsDigit(ch))
            return false;
        ret += ch;
     }
     ++pos;
-    while ((pos < str.length() - 1) && isdigit(str[pos]))
+    while ((pos < str.length() - 1) && IsDigit(str[pos]))
        ret += str[pos++];
 
     flag = strToInt(ret);
@@ -131,7 +135,7 @@ bool getTokenValue(string const & str, const char * token, LyXLength & len)
        if (!getTokenValue(str, token, tmp))
                return false;
        return isValidLength(tmp, &len);
-}    
+}
 
 
 inline
@@ -158,7 +162,7 @@ void LyXTabular::ReadOld(Buffer const * buf, istream & is,
        return;
     if (!getTokenValue(line, "columns", columns_arg))
        return;
-    Init(rows_arg, columns_arg);
+    Init(buf->params, rows_arg, columns_arg);
     l_getline(is, line);
     if (!prefixIs(line, "<Features ")) {
        lyxerr << "Wrong tabular format (expected <Feture ...> got" <<
@@ -175,14 +179,7 @@ void LyXTabular::ReadOld(Buffer const * buf, istream & is,
        getTokenValue(line, "endfirsthead", fhrow);
        getTokenValue(line, "endfoot", frow);
        getTokenValue(line, "endlastfoot", lfrow);
-       if (abs(hrow) > 0)
-               row_info[abs(hrow)-1].endhead = true;
-       if (abs(fhrow))
-               row_info[abs(fhrow)-1].endfirsthead = true;
-       if (abs(frow))
-               row_info[abs(frow)-1].endfoot = true;
-       if (abs(lfrow))
-               row_info[abs(lfrow)-1].endlastfoot = true;
+       setHeaderFooterRows(abs(hrow), abs(fhrow), abs(frow), abs(lfrow));
 
     for (int i = 0; i < rows_; ++i) {
        l_getline(is, line);