+}
+
+} // namespace
+
+/// Define a few methods for the inner structs
+
+LyXTabular::cellstruct::cellstruct(BufferParams const & bp)
+ : cellno(0),
+ width_of_cell(0),
+ multicolumn(LyXTabular::CELL_NORMAL),
+ alignment(LYX_ALIGN_CENTER),
+ valignment(LYX_VALIGN_TOP),
+ top_line(true),
+ bottom_line(false),
+ left_line(true),
+ right_line(false),
+ usebox(BOX_NONE),
+ rotate(false),
+ inset(new InsetText(bp))
+{}
+
+
+LyXTabular::cellstruct::cellstruct(cellstruct const & cs)
+ : cellno(cs.cellno),
+ width_of_cell(cs.width_of_cell),
+ multicolumn(cs.multicolumn),
+ alignment(cs.alignment),
+ valignment(cs.valignment),
+ top_line(cs.top_line),
+ bottom_line(cs.bottom_line),
+ left_line(cs.left_line),
+ right_line(cs.right_line),
+ usebox(cs.usebox),
+ rotate(cs.rotate),
+ align_special(cs.align_special),
+ p_width(cs.p_width),
+ inset(dynamic_cast<InsetText*>(cs.inset->clone().release()))
+{}
+
+
+LyXTabular::cellstruct &
+LyXTabular::cellstruct::operator=(cellstruct cs)
+{
+ swap(cs);
+ return *this;
+}
+
+
+void
+LyXTabular::cellstruct::swap(cellstruct & rhs)
+{
+ std::swap(cellno, rhs.cellno);
+ std::swap(width_of_cell, rhs.width_of_cell);
+ std::swap(multicolumn, rhs.multicolumn);
+ std::swap(alignment, rhs.alignment);
+ std::swap(valignment, rhs.valignment);
+ std::swap(top_line, rhs.top_line);
+ std::swap(bottom_line, rhs.bottom_line);
+ std::swap(left_line, rhs.left_line);
+ std::swap(right_line, rhs.right_line);
+ std::swap(usebox, rhs.usebox);
+ std::swap(rotate, rhs.rotate);
+ std::swap(align_special, rhs.align_special);
+ p_width.swap(rhs.p_width);
+ inset.swap(rhs.inset);
+}
+
+
+LyXTabular::rowstruct::rowstruct()
+ : ascent_of_row(0),
+ descent_of_row(0),
+ top_line(true),
+ bottom_line(false),
+ top_space_default(false),
+ bottom_space_default(false),
+ interline_space_default(false),
+ endhead(false),
+ endfirsthead(false),
+ endfoot(false),
+ endlastfoot(false),
+ newpage(false)
+{}
+
+
+LyXTabular::columnstruct::columnstruct()
+ : alignment(LYX_ALIGN_CENTER),
+ valignment(LYX_VALIGN_TOP),
+ left_line(true),
+ right_line(false),
+ width_of_column(0)
+{
+}
+
+
+LyXTabular::ltType::ltType()
+ : topDL(false),
+ bottomDL(false),
+ empty(false)
+{}
+
+
+LyXTabular::LyXTabular(BufferParams const & bp, row_type rows_arg,
+ col_type columns_arg)
+{
+ 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)
+{
+ 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)));
+ row_info.reserve(10);
+ column_info.reserve(10);
+ cell_info.reserve(100);
+ fixCellNums();
+ for (row_type i = 0; i < rows_; ++i)
+ cell_info[i].back().right_line = true;