]> git.lyx.org Git - lyx.git/blobdiff - src/tabular-old.C
whichFont down to 5.3%
[lyx.git] / src / tabular-old.C
index 4a014d35015780a0bc86c5412743c518ef6642fe..1ab944317f1bb06b43bec7bffbe08f3978431311 100644 (file)
@@ -15,6 +15,7 @@
 #include "tabular.h"
 #include "debug.h"
 #include "support/lstrings.h"
+#include "support/textutils.h"
 
 using std::istream;
 using std::getline;
@@ -59,12 +60,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 +113,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);
@@ -125,6 +126,15 @@ bool getTokenValue(string const & str, char const * token, bool & flag)
 }
 
 
+bool getTokenValue(string const & str, const char * token, LyXLength & len)
+{
+       string tmp;
+       if (!getTokenValue(str, token, tmp))
+               return false;
+       return isValidLength(tmp, &len);
+}    
+
+
 inline
 void l_getline(istream & is, string & str)
 {
@@ -157,10 +167,16 @@ void LyXTabular::ReadOld(Buffer const * buf, istream & is,
        return;
     }
     getTokenValue(line, "islongtable", is_long_tabular);
-    getTokenValue(line, "endhead", endhead.row);
-    getTokenValue(line, "endfirsthead", endfirsthead.row);
-    getTokenValue(line, "endfoot", endfoot.row);
-    getTokenValue(line, "endlastfoot", endlastfoot.row);
+       int hrow;
+       int fhrow;
+       int frow;
+       int lfrow;
+
+       getTokenValue(line, "endhead", hrow);
+       getTokenValue(line, "endfirsthead", fhrow);
+       getTokenValue(line, "endfoot", frow);
+       getTokenValue(line, "endlastfoot", lfrow);
+       setHeaderFooterRows(abs(hrow), abs(fhrow), abs(frow), abs(lfrow));
 
     for (int i = 0; i < rows_; ++i) {
        l_getline(is, line);