+ // Distribute lines from rows/columns to cells
+ // The code was stolen from convert_tablines() in lyx2lyx/lyx_1_6.py.
+ // Each standard cell inherits the settings of the corresponding
+ // rowinfo/colinfo. This works because all cells with individual
+ // settings were converted to multicolumn cells above.
+ // Each multicolumn cell inherits the settings of the rowinfo/colinfo
+ // corresponding to the first column of the multicolumn cell (default
+ // of the multicol package). This works because the special field
+ // overrides the line fields.
+ for (size_t row = 0; row < rowinfo.size(); ++row) {
+ for (size_t col = 0; col < cellinfo[row].size(); ++col) {
+ if (cellinfo[row][col].multi == CELL_NORMAL) {
+ cellinfo[row][col].topline = rowinfo[row].topline;
+ cellinfo[row][col].bottomline = rowinfo[row].bottomline;
+ cellinfo[row][col].leftlines = colinfo[col].leftlines;
+ cellinfo[row][col].rightlines = colinfo[col].rightlines;
+ } else if (cellinfo[row][col].multi == CELL_BEGIN_OF_MULTICOLUMN) {
+ size_t s = col + 1;
+ while (s < cellinfo[row].size() &&
+ cellinfo[row][s].multi == CELL_PART_OF_MULTICOLUMN)
+ s++;
+ if (s < cellinfo[row].size() &&
+ cellinfo[row][s].multi != CELL_BEGIN_OF_MULTICOLUMN)
+ cellinfo[row][col].rightlines = colinfo[col].rightlines;
+ if (col > 0 && cellinfo[row][col-1].multi == CELL_NORMAL)
+ cellinfo[row][col].leftlines = colinfo[col].leftlines;
+ }
+ }
+ }
+
+ if (booktabs)
+ preamble.registerAutomaticallyLoadedPackage("booktabs");
+ if (is_long_tabular)
+ preamble.registerAutomaticallyLoadedPackage("longtable");
+