rowofcell.resize(numberofcells);
columnofcell.resize(numberofcells);
idx_type i = 0;
- // reset column and row of cells and update their width, alignment and ct status
+ // reset column and row of cells and update their width, alignment, caption, and ct status
for (row_type row = 0; row < nrows(); ++row) {
for (col_type column = 0; column < ncols(); ++column) {
+ cell_info[row][column].inset->toggleCaptionRow(is_long_tabular && ltCaption(row));
if (isPartOfMultiColumn(row, column)) {
cell_info[row][column].inset->toggleMultiCol(true);
continue;
<< line << ')' << endl;
return;
}
+ cell_info[i][j].inset->toggleCaptionRow(is_long_tabular && row_info[i].caption);
getTokenValue(line, "multicolumn", cell_info[i][j].multicolumn);
getTokenValue(line, "multirow", cell_info[i][j].multirow);
getTokenValue(line, "mroffset", cell_info[i][j].mroffset);
InsetTableCell::InsetTableCell(Buffer * buf)
: InsetText(buf, InsetText::PlainLayout), isFixedWidth(false), isVarwidth(false),
- isMultiColumn(false), isMultiRow(false), contentAlign(LYX_ALIGN_CENTER)
+ isMultiColumn(false), isMultiRow(false), isCaptionRow(false),
+ contentAlign(LYX_ALIGN_CENTER)
{}
bool InsetTableCell::allowParagraphCustomization(idx_type) const
}
+bool InsetTableCell::insetAllowed(InsetCode code) const
+{
+ switch (code) {
+ case FLOAT_CODE:
+ case MARGIN_CODE:
+ case MATHMACRO_CODE:
+ case WRAP_CODE:
+ return false;
+
+ case CAPTION_CODE:
+ return isCaptionRow;
+
+ default:
+ return true;
+ }
+}
+
+
/////////////////////////////////////////////////////////////////////
//
// InsetTabular
}
-bool InsetTabular::insetAllowed(InsetCode code) const
-{
- switch (code) {
- case FLOAT_CODE:
- case MARGIN_CODE:
- case MATHMACRO_CODE:
- case WRAP_CODE:
- return false;
-
- case CAPTION_CODE:
- return tabular.is_long_tabular;
-
- default:
- return true;
- }
-}
-
-
bool InsetTabular::allowMultiPar() const
{
for (col_type c = 0; c < tabular.ncols(); ++c) {
cur.pit() = 0;
cur.pos() = 0;
cur.selection(false);
+ // update the captionRow status of all cells
+ tabular.updateIndexes();
// If a row is set as caption, then also insert
// a caption. Otherwise the LaTeX output is broken.
// Select cell if it is non-empty
FuncRequest fr(LFUN_INSET_DISSOLVE, "caption");
if (lyx::getStatus(fr).enabled())
lyx::dispatch(fr);
+ // update the captionRow status of all cells
+ tabular.updateIndexes();
break;
}
///
void toggleMultiRow(bool m) { isMultiRow = m; }
///
+ void toggleCaptionRow(bool m) { isCaptionRow = m; }
+ ///
void setContentAlignment(LyXAlignment al) { contentAlign = al; }
/// writes the contents of the cell as a string, optionally
/// descending into insets
bool isMultiColumn;
///
bool isMultiRow;
- // FIXME: Here the thoughts from the comment above also apply.
+ // FIXME: For the next two items the thoughts from the comment above also apply.
+ ///
+ bool isCaptionRow;
///
LyXAlignment contentAlign;
/// should paragraph indentation be omitted in any case?
bool forceLocalFontSwitch() const override;
/// Is the width forced to some value?
bool hasFixedWidth() const override { return isFixedWidth; }
+ ///
+ bool insetAllowed(InsetCode code) const override;
};
///
bool hasSettings() const override { return true; }
///
- bool insetAllowed(InsetCode code) const override;
- ///
bool allowSpellCheck() const override { return true; }
///
bool canTrackChanges() const override { return true; }