bool top = true;
bool bottom = true;
- for (int column = 0; column < columns_ - 1 && bottom; ++column) {
+ for (int column = 0; column < columns_ && bottom; ++column) {
switch (cell_info[row - 1][column].multicolumn) {
case LyXTabular::CELL_BEGIN_OF_MULTICOLUMN:
bottom = cell_info[row - 1][column].bottom_line;
bottom = row_info[row - 1].bottom_line;
}
}
- for (int column = 0; column < columns_ - 1 && top; ++column) {
+ for (int column = 0; column < columns_ && top; ++column) {
switch (cell_info[row][column].multicolumn){
case LyXTabular::CELL_BEGIN_OF_MULTICOLUMN:
top = cell_info[row][column].top_line;
}
+int LyXTabular::GetCellFromInset(Inset const * inset, int maybe_cell) const
+{
+ // is this inset part of the tabular?
+ if (!inset || inset->owner() != owner_) {
+ lyxerr[Debug::INSETTEXT]
+ << "this is not a cell of the tabular!" << endl;
+ return -1;
+ }
+
+ const int save_cur_cell = cur_cell;
+ int cell = cur_cell;
+ if (GetCellInset(cell) != inset) {
+ cell = maybe_cell;
+ if (cell == -1 || GetCellInset(cell) != inset) {
+ cell = -1;
+ }
+ }
+
+ if (cell == -1) {
+ for (cell = GetNumberOfCells(); cell >= 0; --cell) {
+ if (GetCellInset(cell) == inset)
+ break;
+ }
+ lyxerr[Debug::INSETTEXT]
+ << "LyXTabular::GetCellFromInset: "
+ << "cell=" << cell
+ << ", cur_cell=" << save_cur_cell
+ << ", maybe_cell=" << maybe_cell
+ << endl;
+ // We should have found a cell at this point
+ if (cell == -1) {
+ lyxerr << "LyXTabular::GetCellFromInset: "
+ << "Cell not found!" << endl;
+ }
+ }
+
+ return cell;
+}
+
+
void LyXTabular::Validate(LaTeXFeatures & features) const
{
if (IsLongTabular())
features.require("longtable");
if (NeedRotating())
features.require("rotating");
- for (int cell = 0; !features.isRequired("array") && (cell < numberofcells); ++cell) {
+ for (int cell = 0; cell < numberofcells; ++cell) {
if (GetVAlignment(cell) != LYX_VALIGN_TOP)
features.require("array");
GetCellInset(cell)->validate(features);