#include <algorithm>
#include <cstdlib>
+using namespace lyx::support;
+
using std::abs;
using std::ostream;
using std::istream;
// 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;
}
-// 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);
}
-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
}
}
-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;
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;
}
}
-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);
}