+bool Tabular::outsideBorders(
+ row_type const sel_row_start, row_type const sel_row_end,
+ col_type const sel_col_start, col_type const sel_col_end) const
+{
+ if (!use_booktabs)
+ for (row_type r = sel_row_start; r <= sel_row_end; ++r) {
+ if (!leftLine(cellIndex(r, sel_col_start))
+ || !rightLine(cellIndex(r, sel_col_end)))
+ return false;
+ }
+ for (col_type c = sel_col_start; c <= sel_col_end; ++c) {
+ if (!topLine(cellIndex(sel_row_start, c))
+ || !bottomLine(cellIndex(sel_row_end, c)))
+ return false;
+ }
+ return true;
+}
+
+
+bool Tabular::innerBorders(
+ row_type const sel_row_start, row_type const sel_row_end,
+ col_type const sel_col_start, col_type const sel_col_end) const
+{
+ // Single cell has no inner borders
+ if (sel_row_start == sel_row_end && sel_col_start == sel_col_end)
+ return false;
+ for (row_type r = sel_row_start; r <= sel_row_end; ++r)
+ for (col_type c = sel_col_start; c <= sel_col_end; ++c) {
+ idx_type const cell = cellIndex(r, c);
+ if ((r != sel_row_start && !topLine(cell)
+ && cell_info[r][c].multirow != CELL_PART_OF_MULTIROW)
+ || (!use_booktabs
+ && c != sel_col_start && !leftLine(cell)
+ && cell_info[r][c].multicolumn != CELL_PART_OF_MULTICOLUMN))
+ return false;
+ }
+ return true;
+}
+
+
+void Tabular::setLines(
+ row_type const sel_row_start, row_type const sel_row_end,
+ col_type const sel_col_start, col_type const sel_col_end,
+ bool setLinesInnerOnly, bool setLines)
+{
+ for (row_type r = sel_row_start; r <= sel_row_end; ++r)
+ for (col_type c = sel_col_start; c <= sel_col_end; ++c) {
+ idx_type const cell = cellIndex(r, c);
+ if (!(setLinesInnerOnly && r == sel_row_start)
+ // for multirows, cell is taken care of at beginning
+ && cell_info[r][c].multirow != CELL_PART_OF_MULTIROW)
+ setTopLine(cell, setLines);
+ if (!(setLinesInnerOnly && r == sel_row_end)
+ && (r == sel_row_end || (!setLines
+ // for multirows, cell is taken care of at the last part
+ && cell_info[r + 1][c].multirow != CELL_PART_OF_MULTIROW)))
+ setBottomLine(cell, setLines);
+ if (!(setLinesInnerOnly && c == sel_col_start)
+ // for multicolumns, cell is taken care of at beginning
+ && cell_info[r][c].multicolumn != CELL_PART_OF_MULTICOLUMN)
+ setLeftLine(cell, setLines);
+ if (!(setLinesInnerOnly && c == sel_col_end)
+ && (c == sel_col_end || (!setLines
+ // for multicolumns, cell is taken care of at the last part
+ && cell_info[r][c + 1].multicolumn != CELL_PART_OF_MULTICOLUMN)))
+ setRightLine(cell, setLines);
+ }
+}
+
+