Tabular::idx_type Tabular::getLastCellInRow(row_type row) const
{
col_type c = ncols() - 1;
- while (cell_info[row][c].multirow == CELL_PART_OF_MULTIROW
- || cell_info[row][c].multicolumn == CELL_PART_OF_MULTICOLUMN)
+ while (c > 0
+ && (cell_info[row][c].multirow == CELL_PART_OF_MULTIROW
+ || cell_info[row][c].multicolumn == CELL_PART_OF_MULTICOLUMN))
--c;
return cell_info[row][c].cellno;
}
for (col_type c = 0; c < ncols(); ++c) {
if (isPartOfMultiColumn(row, c))
continue;
-
- if (isPartOfMultiRow(row, c) &&
- column_info[c].alignment != LYX_ALIGN_DECIMAL) {
- os << " & ";
+
+ cell = cellIndex(row, c);
+
+ if (isPartOfMultiRow(row, c)
+ && column_info[c].alignment != LYX_ALIGN_DECIMAL) {
+ if (cell != getLastCellInRow(row))
+ os << " & ";
continue;
}
- cell = cellIndex(row, c);
TeXCellPreamble(os, cell, ismulticol, ismultirow);
shared_ptr<InsetTableCell> inset = cellInset(cell);
head.latex(os, newrp);
os << '&';
tail.latex(os, newrp);
- } else if (!isPartOfMultiRow(row, c))
+ } else if (!isPartOfMultiRow(row, c)) {
+ if (!runparams.nice)
+ os.texrow().start(par.id(), 0);
inset->latex(os, newrp);
+ }
runparams.encoding = newrp.encoding;
if (rtl)
TeXCellPostamble(os, cell, ismulticol, ismultirow);
if (cell != getLastCellInRow(row)) { // not last cell in row
- os << " & ";
+ if (runparams.nice)
+ os << " & ";
+ else
+ os << " &\n";
}
}
if (row_info[row].caption && !endfirsthead.empty && !haveLTFirstHead())
//+ first the opening preamble +
//+---------------------------------------------------------------------
+ os << safebreakln;
+ if (runparams.lastid != -1)
+ os.texrow().start(runparams.lastid, runparams.lastpos);
+
if (rotate)
os << "\\begin{sideways}\n";
if (isMultiColumn(cell))
attr << " colspan='" << columnSpan(cell) << "'";
- xs << html::StartTag(celltag, attr.str());
+ xs << html::StartTag(celltag, attr.str()) << html::CR();
ret += cellInset(cell)->xhtml(xs, runparams);
- xs << html::EndTag(celltag);
+ xs << html::EndTag(celltag) << html::CR();
++cell;
}
xs << html::EndTag("tr");
align = "right";
break;
}
- xs << html::StartTag("div", "class='longtable' style='text-align: " + align + ";'");
+ xs << html::StartTag("div", "class='longtable' style='text-align: " + align + ";'")
+ << html::CR();
if (haveLTCaption()) {
- xs << html::StartTag("div", "class='longtable-caption' style='text-align: " + align + ";'");
+ xs << html::StartTag("div", "class='longtable-caption' style='text-align: " + align + ";'")
+ << html::CR();
for (row_type r = 0; r < nrows(); ++r)
if (row_info[r].caption)
ret += xhtmlRow(xs, r, runparams);
- xs << html::EndTag("div");
+ xs << html::EndTag("div") << html::CR();
}
}
- xs << html::StartTag("table");
+ xs << html::StartTag("table") << html::CR();
// output header info
bool const havefirsthead = haveLTFirstHead();
// in XHTML. this test accomplishes that.
bool const havehead = !havefirsthead && haveLTHead();
if (havehead || havefirsthead) {
- xs << html::StartTag("thead");
+ xs << html::StartTag("thead") << html::CR();
for (row_type r = 0; r < nrows(); ++r) {
if ((havefirsthead && row_info[r].endfirsthead)
|| (havehead && row_info[r].endhead)) {
ret += xhtmlRow(xs, r, runparams, true);
}
}
- xs << html::EndTag("thead");
+ xs << html::EndTag("thead") << html::CR();
}
// output footer info
bool const havelastfoot = haveLTLastFoot();
// as before.
bool const havefoot = !havelastfoot && haveLTFoot();
if (havefoot || havelastfoot) {
- xs << html::StartTag("tfoot");
+ xs << html::StartTag("tfoot") << html::CR();
for (row_type r = 0; r < nrows(); ++r) {
if ((havelastfoot && row_info[r].endlastfoot)
|| (havefoot && row_info[r].endfoot)) {
ret += xhtmlRow(xs, r, runparams);
}
}
- xs << html::EndTag("tfoot");
+ xs << html::EndTag("tfoot") << html::CR();
}
- xs << html::StartTag("tbody");
+ xs << html::StartTag("tbody") << html::CR();
for (row_type r = 0; r < nrows(); ++r) {
if (isValidRow(r)) {
ret += xhtmlRow(xs, r, runparams);
}
}
xs << html::EndTag("tbody")
- << html::EndTag("table");
+ << html::CR()
+ << html::EndTag("table")
+ << html::CR();
if (is_long_tabular)
- xs << html::EndTag("div");
+ xs << html::EndTag("div") << html::CR();
return ret;
}
cmd = FuncRequest(finish_lfun);
else
cur.dispatched();
+
+ cur.screenUpdateFlags(Update::Force | Update::FitCursor);
break;
}
cur.setCurrentFont();
return;
}
+ cur.screenUpdateFlags(Update::FitCursor);
break;
case LFUN_UP_SELECT:
cur.setCurrentFont();
return;
}
+ cur.screenUpdateFlags(Update::FitCursor);
break;
// case LFUN_SCREEN_DOWN: {
if (&cur.inset() != this || cmd.getArg(0) != "tabular")
break;
- string const s = cmd.getArg(1);
// FIXME: We only check for the very first argument...
+ string const s = cmd.getArg(1);
+ // We always enable the lfun if it is coming from the dialog
+ // because the dialog makes sure all the settings are valid,
+ // even though the first argument might not be valid now.
+ if (s == "from-dialog") {
+ status.setEnabled(true);
+ return true;
+ }
+
int action = Tabular::LAST_ACTION;
int i = 0;
for (; tabularFeature[i].action != Tabular::LAST_ACTION; ++i) {
}
// disable in non-fixed-width cells
- case LFUN_NEWLINE_INSERT:
- case LFUN_BREAK_PARAGRAPH: {
+ case LFUN_BREAK_PARAGRAPH:
+ // multirow does not allow paragraph breaks
+ if (tabular.isMultiRow(cur.idx())) {
+ status.setEnabled(false);
+ return true;
+ }
+ case LFUN_NEWLINE_INSERT: {
if (tabular.getPWidth(cur.idx()).zero()) {
status.setEnabled(false);
return true;
if (len.zero()
&& tabular.getAlignment(cur.idx(), true) == LYX_ALIGN_BLOCK)
tabularFeatures(cur, Tabular::ALIGN_CENTER, string());
- // check if there is a 1-column multicolumn cell
- // if so it must get the same width
- for (row_type r = 0; r < tabular.nrows(); ++r) {
- if (tabular.isMultiColumn(tabular.cellIndex(r, column))
- && tabular.columnSpan(tabular.cellIndex(r, column)) == 1)
- tabular.setMColumnPWidth(cur, tabular.cellIndex(r, column), len);
- }
break;
}
case Tabular::SET_MPWIDTH:
tabular.setMColumnPWidth(cur, cur.idx(), Length(value));
- // if the multicolumn only spans 1 column, the width of the whole column
- // must have the same width, see bug #7055
- if (tabular.columnSpan(cur.idx()) == 1)
- for (row_type r = 0; r < tabular.nrows(); ++r) {
- if (!tabular.isMultiColumn(tabular.cellIndex(r, column)))
- tabular.setColumnPWidth(cur, tabular.cellIndex(r, column), Length(value));
- else if (tabular.isMultiColumn(tabular.cellIndex(r, column))
- && tabular.columnSpan(tabular.cellIndex(r, column)) == 1)
- tabular.setMColumnPWidth(cur, tabular.cellIndex(r, column), Length(value));
- }
break;
case Tabular::SET_MROFFSET: