break;
case Tabular::UNSET_LONGTABULAR:
+ for (row_type i = 0; i < tabular.row_info.size(); ++i) {
+ if (tabular.ltCaption(i)) {
+ cur.idx() = tabular.cellIndex(i, 0);
+ cur.pit() = 0;
+ cur.pos() = 0;
+ tabularFeatures(cur, Tabular::TOGGLE_LTCAPTION);
+ }
+ }
tabular.is_long_tabular = false;
break;
cur.pos() = 0;
cur.setSelection(false);
- if (set)
+ if (set) {
// When a row is set as caption, then also insert
// a caption. Otherwise the LaTeX output is broken.
+ lyx::dispatch(FuncRequest(LFUN_INSET_SELECT_ALL));
lyx::dispatch(FuncRequest(LFUN_CAPTION_INSERT));
- else {
+ } else {
FuncRequest fr(LFUN_INSET_DISSOLVE, "caption");
if (lyx::getStatus(fr).enabled())
lyx::dispatch(fr);
}
-void InsetTabular::addPreview(PreviewLoader & loader) const
+void InsetTabular::addPreview(DocIterator const & inset_pos,
+ PreviewLoader & loader) const
{
row_type const rows = tabular.row_info.size();
col_type const columns = tabular.column_info.size();
+ DocIterator cell_pos = inset_pos;
+
+ cell_pos.push_back(CursorSlice(*const_cast<InsetTabular *>(this)));
for (row_type i = 0; i < rows; ++i) {
- for (col_type j = 0; j < columns; ++j)
- tabular.cellInset(i, j)->addPreview(loader);
+ for (col_type j = 0; j < columns; ++j) {
+ cell_pos.top().idx() = index(i, j);
+ tabular.cellInset(i, j)->addPreview(cell_pos, loader);
+ }
}
}