/////////////////////////////////////////////////////////////////////
-Tabular::CellData::CellData(Buffer const & buf)
+Tabular::CellData::CellData(Buffer & buf)
: cellno(0),
width(0),
multicolumn(Tabular::CELL_NORMAL),
align_special(cs.align_special),
p_width(cs.p_width),
inset(dynamic_cast<InsetTableCell *>(cs.inset->clone()))
-{}
+{
+}
Tabular::CellData & Tabular::CellData::operator=(CellData cs)
{
{}
-Tabular::Tabular(Buffer const & buffer, row_type rows_arg, col_type columns_arg)
+Tabular::Tabular(Buffer & buffer, row_type rows_arg, col_type columns_arg)
{
init(buffer, rows_arg, columns_arg);
}
+void Tabular::setBuffer(Buffer & buffer)
+{
+ buffer_ = &buffer;
+ size_t row_count = row_info.size();
+ size_t column_count = column_info.size();
+ // set silly default lines
+ for (row_type i = 0; i < row_count; ++i)
+ for (col_type j = 0; j < column_count; ++j)
+ cell_info[i][j].inset->setBuffer(*buffer_);
+}
+
+
// activates all lines and sets all widths to 0
-void Tabular::init(Buffer const & buf, row_type rows_arg,
+void Tabular::init(Buffer & buf, row_type rows_arg,
col_type columns_arg)
{
buffer_ = &buf;
// set silly default lines
for (row_type i = 0; i < row_count; ++i)
for (col_type j = 0; j < column_count; ++j) {
+ cell_info[i][j].inset->setBuffer(*buffer_);
cell_info[i][j].top_line = true;
cell_info[i][j].left_line = true;
cell_info[i][j].bottom_line = i == 0 || i == row_count - 1;
getTokenValue(line, "special", cell_info[i][j].align_special);
l_getline(is, line);
if (prefixIs(line, "\\begin_inset")) {
+ cell_info[i][j].inset->setBuffer(*buffer_);
cell_info[i][j].inset->read(lex);
l_getline(is, line);
}
//
/////////////////////////////////////////////////////////////////////
-InsetTableCell::InsetTableCell(Buffer const & buf)
+InsetTableCell::InsetTableCell(Buffer & buf)
: InsetText(buf), isFixedWidth(false)
{}
//
/////////////////////////////////////////////////////////////////////
-InsetTabular::InsetTabular(Buffer const & buf, row_type rows,
+InsetTabular::InsetTabular(Buffer & buf, row_type rows,
col_type columns)
: tabular(buf, max(rows, row_type(1)), max(columns, col_type(1))), scx_(0),
rowselect_(false), colselect_(false)
{
- setBuffer(const_cast<Buffer &>(buf)); // FIXME: remove later
+ setBuffer(buf); // FIXME: remove later
}
InsetTabular::InsetTabular(InsetTabular const & tab)
: Inset(tab), tabular(tab.tabular), scx_(0)
{
- setBuffer(const_cast<Buffer &>(tab.buffer())); // FIXME: remove later
}
while (paste_tabular->column_info.size() > columns)
paste_tabular->deleteColumn(columns);
+ paste_tabular->setBuffer(tabular.buffer());
+
odocstringstream os;
OutputParams const runparams(0);
paste_tabular->plaintext(os, runparams, 0, true, '\t');