-void LyXTabular::ReadNew(Buffer const * buf, istream & is,
- LyXLex & lex, string const & l)
-{
- string line(l);
- int rows_arg;
- if (!getTokenValue(line, "rows", rows_arg))
- return;
- int columns_arg;
- if (!getTokenValue(line, "columns", columns_arg))
- return;
- Init(rows_arg, columns_arg);
- l_getline(is, line);
- if (!prefixIs(line, "<features")) {
- lyxerr << "Wrong tabular format (expected <features ...> got" <<
- line << ")" << endl;
- return;
- }
- getTokenValue(line, "rotate", rotate);
- getTokenValue(line, "islongtable", is_long_tabular);
- getTokenValue(line, "endhead", endhead);
- getTokenValue(line, "endfirsthead", endfirsthead);
- getTokenValue(line, "endfoot", endfoot);
- getTokenValue(line, "endlastfoot", endlastfoot);
-
- for (int j = 0; j < columns_; ++j) {
- l_getline(is,line);
- if (!prefixIs(line,"<column")) {
- lyxerr << "Wrong tabular format (expected <column ...> got" <<
- line << ")" << endl;
- return;
- }
- getTokenValue(line, "alignment", column_info[j].alignment);
- getTokenValue(line, "valignment", column_info[j].valignment);
- getTokenValue(line, "leftline", column_info[j].left_line);
- getTokenValue(line, "rightline", column_info[j].right_line);
- getTokenValue(line, "width", column_info[j].p_width);
- getTokenValue(line, "special", column_info[j].align_special);
- }
-
- for (int i = 0; i < rows_; ++i) {
- l_getline(is, line);
- if (!prefixIs(line, "<row")) {
- lyxerr << "Wrong tabular format (expected <row ...> got" <<
- line << ")" << endl;
- return;
- }
- getTokenValue(line, "topline", row_info[i].top_line);
- getTokenValue(line, "bottomline", row_info[i].bottom_line);
- getTokenValue(line, "newpage", row_info[i].newpage);
- for (int j = 0; j < columns_; ++j) {
- l_getline(is, line);
- if (!prefixIs(line, "<cell")) {
- lyxerr << "Wrong tabular format (expected <cell ...> got" <<
- line << ")" << endl;
- return;
- }
- getTokenValue(line, "multicolumn", cell_info[i][j].multicolumn);
- getTokenValue(line, "alignment", cell_info[i][j].alignment);
- getTokenValue(line, "valignment", cell_info[i][j].valignment);
- getTokenValue(line, "topline", cell_info[i][j].top_line);
- getTokenValue(line, "bottomline", cell_info[i][j].bottom_line);
- getTokenValue(line, "leftline", cell_info[i][j].left_line);
- getTokenValue(line, "rightline", cell_info[i][j].right_line);
- getTokenValue(line, "rotate", cell_info[i][j].rotate);
- getTokenValue(line, "usebox", cell_info[i][j].usebox);
- getTokenValue(line, "width", cell_info[i][j].p_width);
- getTokenValue(line, "special", cell_info[i][j].align_special);
- l_getline(is, line);
- if (prefixIs(line, "\\begin_inset")) {
- cell_info[i][j].inset.Read(buf, lex);
- l_getline(is, line);
- }
- if (!prefixIs(line, "</cell>")) {
- lyxerr << "Wrong tabular format (expected </cell> got" <<
- line << ")" << endl;
- return;
- }
- }
- l_getline(is, line);
- if (!prefixIs(line, "</row>")) {
- lyxerr << "Wrong tabular format (expected </row> got" <<
- line << ")" << endl;
- return;
- }
- }
- while (!prefixIs(line, "</lyxtabular>")) {
- l_getline(is, line);
- }
- set_row_column_number_info();
-}
-
-
-void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
-{
- int version;
- int i;
- int j;
- int rows_arg = 0;
- int columns_arg = 0;
- int is_long_tabular_arg = false;
- int rotate_arg = false;
- int a = -1;
- int b = -1;
- int c = -1;
- int d = -1;
- int e = 0;
- int f = 0;
- int g = 0;
-
- istream & is = lex.getStream();
- string s(fl);
- if (s.length() > 8)
- version = lyx::atoi(s.substr(8, string::npos));
- else
- version = 1;
-
- vector<int> cont_row_info;
-
- if (version < 5) {
- lyxerr << "Tabular format < 5 is not supported anymore\n"
- "Get an older version of LyX (< 1.1.x) for conversion!"
- << endl;
- WriteAlert(_("Warning:"),
- _("Tabular format < 5 is not supported anymore\n"),
- _("Get an older version of LyX (< 1.1.x) for conversion!"));
- if (version > 2) {
- is >> rows_arg >> columns_arg >> is_long_tabular_arg
- >> rotate_arg >> a >> b >> c >> d;
- } else
- is >> rows_arg >> columns_arg;
- Init(rows_arg, columns_arg);
- cont_row_info = vector<int>(rows_arg);
- SetLongTabular(is_long_tabular_arg);
- SetRotateTabular(rotate_arg);
- string tmp;
- for (i = 0; i < rows_; ++i) {
- getline(is, tmp);
- cont_row_info[i] = false;
- }
- for (i = 0; i < columns_; ++i) {
- getline(is, tmp);
- }
- for (i = 0; i < rows_; ++i) {
- for (j = 0; j < columns_; ++j) {
- getline(is, tmp);
- }
- }
- } else {
- is >> rows_arg >> columns_arg >> is_long_tabular_arg
- >> rotate_arg >> a >> b >> c >> d;
- Init(rows_arg, columns_arg);
- cont_row_info = vector<int>(rows_arg);
- SetLongTabular(is_long_tabular_arg);
- SetRotateTabular(rotate_arg);
- endhead = a + 1;
- endfirsthead = b + 1;
- endfoot = c + 1;
- endlastfoot = d + 1;
- for (i = 0; i < rows_; ++i) {
- a = b = c = d = e = f = g = 0;
- is >> a >> b >> c >> d;
- row_info[i].top_line = a;
- row_info[i].bottom_line = b;
- cont_row_info[i] = c;
- row_info[i].newpage = d;
- }
- for (i = 0; i < columns_; ++i) {
- string s1;
- string s2;
- is >> a >> b >> c;
+ istream & is = lex.getStream();
+ string s(fl);
+ if (s.length() > 8)
+ version = lyx::atoi(s.substr(8, string::npos));
+ else
+ version = 1;
+
+ vector<int> cont_row_info;
+
+ if (version < 5) {
+ lyxerr << "Tabular format < 5 is not supported anymore\n"
+ "Get an older version of LyX (< 1.1.x) for conversion!"
+ << endl;
+ Alert::alert(_("Warning:"),
+ _("Tabular format < 5 is not supported anymore\n"),
+ _("Get an older version of LyX (< 1.1.x) for conversion!"));
+ if (version > 2) {
+ is >> rows_arg >> columns_arg >> is_long_tabular_arg
+ >> rotate_arg >> a >> b >> c >> d;
+ } else
+ is >> rows_arg >> columns_arg;
+ Init(bp, rows_arg, columns_arg);
+ cont_row_info = vector<int>(rows_arg);
+ SetLongTabular(is_long_tabular_arg);
+ SetRotateTabular(rotate_arg);
+ string tmp;
+ for (i = 0; i < rows_; ++i) {
+ getline(is, tmp);
+ cont_row_info[i] = false;
+ }
+ for (i = 0; i < columns_; ++i) {
+ getline(is, tmp);
+ }
+ for (i = 0; i < rows_; ++i) {
+ for (j = 0; j < columns_; ++j) {
+ getline(is, tmp);
+ }
+ }
+ } else {
+ is >> rows_arg >> columns_arg >> is_long_tabular_arg
+ >> rotate_arg >> a >> b >> c >> d;
+ Init(bp, rows_arg, columns_arg);
+ cont_row_info = vector<int>(rows_arg);
+ SetLongTabular(is_long_tabular_arg);
+ SetRotateTabular(rotate_arg);
+ setHeaderFooterRows(a+1, b+1 , c+1, d+1);
+ for (i = 0; i < rows_; ++i) {
+ a = b = c = d = e = f = g = 0;
+ is >> a >> b >> c >> d;
+ row_info[i].top_line = a;
+ row_info[i].bottom_line = b;
+ cont_row_info[i] = c;
+ row_info[i].newpage = d;
+ }
+ for (i = 0; i < columns_; ++i) {
+ string s1;
+ string s2;
+ is >> a >> b >> c;