/// Define a few methods for the inner structs
-LyXTabular::cellstruct::cellstruct(BufferParams const & bp,
- BufferView const * bv)
+LyXTabular::cellstruct::cellstruct(BufferParams const & bp)
: cellno(0),
width_of_cell(0),
multicolumn(LyXTabular::CELL_NORMAL),
usebox(BOX_NONE),
rotate(false),
inset(new InsetText(bp))
-{
- inset->setViewCache(bv);
-}
+{}
LyXTabular::cellstruct::cellstruct(cellstruct const & cs)
LyXTabular::LyXTabular(BufferParams const & bp, row_type rows_arg,
- col_type columns_arg, BufferView const * bv)
+ col_type columns_arg)
{
- init(bp, rows_arg, columns_arg, bv);
+ init(bp, rows_arg, columns_arg);
}
// activates all lines and sets all widths to 0
void LyXTabular::init(BufferParams const & bp, row_type rows_arg,
- col_type columns_arg, BufferView const * bv)
+ col_type columns_arg)
{
rows_ = rows_arg;
columns_ = columns_arg;
row_info = row_vector(rows_);
column_info = column_vector(columns_);
- cell_info = cell_vvector(rows_, cell_vector(columns_, cellstruct(bp, bv)));
+ cell_info = cell_vvector(rows_, cell_vector(columns_, cellstruct(bp)));
row_info.reserve(10);
column_info.reserve(10);
cell_info.reserve(100);
void LyXTabular::appendRow(BufferParams const & bp, idx_type const cell)
{
- BufferView const * const bv = getCellInset(0)->getText(0)->bv();
++rows_;
row_type const row = row_of_cell(cell);
for (row_type i = 0; i < rows_ - 1; ++i)
swap(cell_info[i], old[i]);
- cell_info = cell_vvector(rows_, cell_vector(columns_, cellstruct(bp, bv)));
+ cell_info = cell_vvector(rows_, cell_vector(columns_, cellstruct(bp)));
for (row_type i = 0; i <= row; ++i)
swap(cell_info[i], old[i]);
void LyXTabular::appendColumn(BufferParams const & bp, idx_type const cell)
{
- BufferView const * const bv = getCellInset(0)->getText(0)->bv();
++columns_;
col_type const column = column_of_cell(cell);
column_info[column + 1] = column_info[column];
for (row_type i = 0; i < rows_; ++i) {
- cell_info[i].insert(cell_info[i].begin() + column + 1, cellstruct(bp, bv));
+ cell_info[i].insert(cell_info[i].begin() + column + 1, cellstruct(bp));
// care about multicolumns
if (cell_info[i][column + 1].multicolumn == CELL_BEGIN_OF_MULTICOLUMN)
void LyXTabular::setAlignment(idx_type cell, LyXAlignment align,
- bool onlycolumn)
+ bool onlycolumn)
{
if (!isMultiColumn(cell) || onlycolumn)
column_info[column_of_cell(cell)].alignment = align;
void LyXTabular::setVAlignment(idx_type cell, VAlignment align,
- bool onlycolumn)
+ bool onlycolumn)
{
if (!isMultiColumn(cell) || onlycolumn)
column_info[column_of_cell(cell)].valignment = align;
idx_type const cell = getCellNumber(i, j);
// because of multicolumns
toggleFixedWidth(cur, getCellInset(cell).get(),
- !getPWidth(cell).zero());
+ !getPWidth(cell).zero());
}
// cur paragraph can become invalid after paragraphs were merged
if (cur.pit() > cur.lastpit())
int columns_arg;
if (!getTokenValue(line, "columns", columns_arg))
return;
- init(buf.params(), rows_arg, columns_arg, buf.text().bv());
+ init(buf.params(), rows_arg, columns_arg);
l_getline(is, line);
if (!prefixIs(line, "<features")) {
lyxerr << "Wrong tabular format (expected <features ...> got"
void LyXTabular::setMultiColumn(Buffer * buffer, idx_type cell,
- idx_type number)
+ idx_type number)
{
cellstruct & cs = cellinfo_of_cell(cell);
cs.multicolumn = CELL_BEGIN_OF_MULTICOLUMN;
LyXTabular::idx_type LyXTabular::getCellNumber(row_type row,
- col_type column) const
+ col_type column) const
{
BOOST_ASSERT(column != npos && column < columns_ &&
- row != npos && row < rows_);
+ row != npos && row < rows_);
return cell_info[row][column].cellno;
}
// This are functions used for the longtable support
///
void LyXTabular::setLTHead(row_type row, bool flag, ltType const & hd,
- bool first)
+ bool first)
{
if (first) {
endfirsthead = hd;
void LyXTabular::setLTFoot(row_type row, bool flag, ltType const & fd,
- bool last)
+ bool last)
{
if (last) {
endlastfoot = fd;
shared_ptr<InsetText> LyXTabular::getCellInset(row_type row,
- col_type column) const
+ col_type column) const
{
return cell_info[row][column].inset;
}