#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
+#include "InsetIterator.h"
#include "InsetList.h"
#include "Language.h"
#include "LaTeXFeatures.h"
cur.pop();
}
-}
+} // namespace
void Tabular::setColumnPWidth(Cursor & cur, idx_type cell,
bool Tabular::needRotating() const
{
- if (rotate)
+ if (rotate && !is_long_tabular)
return true;
for (row_type r = 0; r < nrows(); ++r)
for (col_type c = 0; c < ncols(); ++c)
tail.setMacrocontextPositionRecursive(dit);
tail.latex(os, newrp);
}
+ } else if (ltCaption(row)) {
+ // Inside longtable caption rows, we must only output the caption inset
+ // with its content and omit anything outside of that (see #10791)
+ InsetIterator it = inset_iterator_begin(*const_cast<InsetTableCell *>(inset));
+ InsetIterator i_end = inset_iterator_end(*const_cast<InsetTableCell *>(inset));
+ for (; it != i_end; ++it) {
+ if (it->lyxCode() != CAPTION_CODE)
+ continue;
+ it->latex(os, runparams);
+ break;
+ }
} else if (!isPartOfMultiRow(row, c)) {
if (!runparams.nice)
os.texrow().start(par.id(), 0);
if (!TexRow::isNone(pos))
os.texrow().start(pos);
- if (rotate != 0)
+ if (rotate != 0 && !is_long_tabular)
os << "\\begin{turn}{" << convert<string>(rotate) << "}\n";
if (is_long_tabular) {
os << "\\end{tabular}";
}
- if (rotate != 0)
+ if (rotate != 0 && !is_long_tabular)
os << breakln << "\\end{turn}";
if (!TexRow::isNone(pos))
continue;
stringstream attr;
-
+
Length const cwidth = column_info[c].p_width;
if (!cwidth.zero()) {
string const hwidth = cwidth.asHTMLString();
attr << "style =\"width: " << hwidth << ";\" ";
}
-
+
attr << "align='";
switch (getAlignment(cell)) {
case LYX_ALIGN_LEFT:
if (getVAlignment(cell) != LYX_VALIGN_TOP
|| !getPWidth(cell).zero())
features.require("array");
+ // Tell footnote that we need a savenote
+ // environment in non-long tables or
+ // longtable headers/footers
+ else if (!is_long_tabular && !features.inFloat())
+ features.saveNoteEnv("tabular");
+ else if (!isValidRow(cellRow(cell)))
+ features.saveNoteEnv("longtable");
+
cellInset(cell)->validate(features);
+ features.saveNoteEnv(string());
}
}
MetricsInfo m = mi;
Length const p_width = tabular.getPWidth(cell);
if (!p_width.zero())
- m.base.textwidth = p_width.inPixels(mi.base);
+ m.base.textwidth = mi.base.inPixels(p_width);
tabular.cellInset(cell)->metrics(m, dim);
if (!p_width.zero())
dim.wid = m.base.textwidth;
maxdes = max(maxdes, dim.des + offset);
}
int const top_space = tabular.row_info[r].top_space_default ?
- default_line_space :
- tabular.row_info[r].top_space.inPixels(mi.base);
+ default_line_space :
+ mi.base.inPixels(tabular.row_info[r].top_space);
tabular.setRowAscent(r, maxasc + ADD_TO_HEIGHT + top_space);
int const bottom_space = tabular.row_info[r].bottom_space_default ?
- default_line_space :
- tabular.row_info[r].bottom_space.inPixels(mi.base);
+ default_line_space :
+ mi.base.inPixels(tabular.row_info[r].bottom_space);
tabular.setRowDescent(r, maxdes + ADD_TO_HEIGHT + bottom_space);
}
// therefore allow always left but right and center only if there is no width
case Tabular::M_ALIGN_LEFT:
flag = false;
+ // fall through
case Tabular::ALIGN_LEFT:
status.setOnOff(tabular.getAlignment(cur.idx(), flag) == LYX_ALIGN_LEFT);
break;
case Tabular::M_ALIGN_RIGHT:
flag = false;
+ // fall through
case Tabular::ALIGN_RIGHT:
status.setEnabled(!(tabular.isMultiRow(cur.idx())
&& !tabular.getPWidth(cur.idx()).zero()));
case Tabular::M_ALIGN_CENTER:
flag = false;
+ // fall through
case Tabular::ALIGN_CENTER:
status.setEnabled(!(tabular.isMultiRow(cur.idx())
&& !tabular.getPWidth(cur.idx()).zero()));
case Tabular::M_VALIGN_TOP:
flag = false;
+ // fall through
case Tabular::VALIGN_TOP:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero()
&& !tabular.isMultiRow(cur.idx()));
case Tabular::M_VALIGN_BOTTOM:
flag = false;
+ // fall through
case Tabular::VALIGN_BOTTOM:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero()
&& !tabular.isMultiRow(cur.idx()));
case Tabular::M_VALIGN_MIDDLE:
flag = false;
+ // fall through
case Tabular::VALIGN_MIDDLE:
status.setEnabled(!tabular.getPWidth(cur.idx()).zero()
&& !tabular.isMultiRow(cur.idx()));
if (&cur.inset() != this)
break;
string action = cmd.getArg(0);
- string arg = cmd.getLongArg(1);
+ string arg = cmd.getLongArg(1);
return getFeatureStatus(cur, action, arg, status);
}
status.setEnabled(false);
return true;
}
- // Fall back
+ // fall through
case LFUN_NEWLINE_INSERT: {
if (tabular.getPWidth(cur.idx()).zero()) {
status.setEnabled(false);
case Tabular::M_VALIGN_BOTTOM:
case Tabular::M_VALIGN_MIDDLE:
flag = false;
+ // fall through
case Tabular::VALIGN_TOP:
case Tabular::VALIGN_BOTTOM:
case Tabular::VALIGN_MIDDLE:
case Tabular::SET_ALL_LINES:
setLines = true;
+ // fall through
case Tabular::UNSET_ALL_LINES:
for (row_type r = sel_row_start; r <= sel_row_end; ++r)
for (col_type c = sel_col_start; c <= sel_col_end; ++c) {
case Tabular::UNSET_LTFIRSTHEAD:
flag = false;
+ // fall through
case Tabular::SET_LTFIRSTHEAD:
tabular.getRowOfLTFirstHead(row, ltt);
checkLongtableSpecial(ltt, value, flag);
case Tabular::UNSET_LTHEAD:
flag = false;
+ // fall through
case Tabular::SET_LTHEAD:
tabular.getRowOfLTHead(row, ltt);
checkLongtableSpecial(ltt, value, flag);
case Tabular::UNSET_LTFOOT:
flag = false;
+ // fall through
case Tabular::SET_LTFOOT:
tabular.getRowOfLTFoot(row, ltt);
checkLongtableSpecial(ltt, value, flag);
case Tabular::UNSET_LTLASTFOOT:
flag = false;
+ // fall through
case Tabular::SET_LTLASTFOOT:
tabular.getRowOfLTLastFoot(row, ltt);
checkLongtableSpecial(ltt, value, flag);
case Tabular::UNSET_LTNEWPAGE:
flag = false;
+ // fall through
case Tabular::SET_LTNEWPAGE:
tabular.setLTNewPage(row, flag);
break;