setBottomLine(i, false);
setLeftLine(i, false);
setRightLine(i, false);
- // FIXME: when a row is set as caption, then also insert a caption
- // dispatch(FuncRequest(LFUN_CAPTION_INSERT));
+ // When a row is set as caption, then also insert a caption. Otherwise
+ // the LaTeX output is broken, when the user don't add a caption.
+ dispatch(FuncRequest(LFUN_CAPTION_INSERT));
} else {
unsetMultiColumn(i);
// FIXME: when unsetting a caption row, also all existing captions
return 0;
int ret = 0;
- // output header info
- if (haveLTHead()) {
- if (endhead.topDL) {
+ // caption handling
+ // the caption must be output befrore the headers
+ if (haveLTCaption()) {
+ for (row_type i = 0; i < row_info.size(); ++i) {
+ if (row_info[i].caption) {
+ ret += TeXRow(os, i, runparams);
+ }
+ }
+ }
+ // output first header info
+ // first header must be output before the header, otherwise the
+ // correct caption placement becomes really wierd
+ if (haveLTFirstHead()) {
+ if (endfirsthead.topDL) {
os << "\\hline\n";
++ret;
}
for (row_type i = 0; i < row_info.size(); ++i) {
- if (row_info[i].endhead) {
+ if (row_info[i].endfirsthead) {
ret += TeXRow(os, i, runparams);
}
}
- if (endhead.bottomDL) {
+ if (endfirsthead.bottomDL) {
os << "\\hline\n";
++ret;
}
- os << "\\endhead\n";
+ os << "\\endfirsthead\n";
++ret;
- if (endfirsthead.empty) {
+ }
+ // output header info
+ if (haveLTHead()) {
+ if (!haveLTFirstHead()) {
os << "\\endfirsthead\n";
++ret;
}
- }
- // output firstheader info
- if (haveLTFirstHead()) {
- if (endfirsthead.topDL) {
+ if (endhead.topDL) {
os << "\\hline\n";
++ret;
}
for (row_type i = 0; i < row_info.size(); ++i) {
- if (row_info[i].endfirsthead) {
+ if (row_info[i].endhead) {
ret += TeXRow(os, i, runparams);
}
}
- if (endfirsthead.bottomDL) {
+ if (endhead.bottomDL) {
os << "\\hline\n";
++ret;
}
- os << "\\endfirsthead\n";
+ os << "\\endhead\n";
++ret;
}
// output footer info
}
os << "\\endfoot\n";
++ret;
- if (endlastfoot.empty) {
+ if (!haveLTLastFoot()) {
os << "\\endlastfoot\n";
++ret;
}
{
if (!is_long_tabular)
return true;
- return !row_info[row].endhead && !row_info[row].endfirsthead &&
- !row_info[row].endfoot && !row_info[row].endlastfoot;
+ return !row_info[row].endhead && !row_info[row].endfirsthead
+ && !row_info[row].endfoot && !row_info[row].endlastfoot
+ && !row_info[row].caption;
}
//+---------------------------------------------------------------------
// output header info
- if (haveLTHead() || haveLTFirstHead()) {
+ if (haveLTHead() || haveLTFirstHead()|| haveLTCaption()) {
os << "<thead>\n";
++ret;
for (row_type i = 0; i < row_info.size(); ++i) {
- if (row_info[i].endhead || row_info[i].endfirsthead) {
+ if (row_info[i].endhead || row_info[i].endfirsthead
+ || row_info[i].caption) {
ret += docbookRow(os, i, runparams);
}
}
status.setOnOff(convert<int>(argument) == tabular.getUsebox(cur.idx()));
break;
- // when a header/footer/caption is set, no other row can be the same
- // furthermore, every row can only be one thing:
- // either a footer or header or caption
+ // every row can only be one thing:
+ // either a footer or header or caption
case Tabular::SET_LTFIRSTHEAD:
status.setEnabled(sel_row_start == sel_row_end
&& !tabular.getRowOfLTHead(sel_row_start, dummyltt)
&& !tabular.getRowOfLTFoot(sel_row_start, dummyltt)
&& !tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)
- && !tabular.ltCaption(sel_row_start)
- && (!tabular.haveLTFirstHead()
- || tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)));
- status.setOnOff(tabular.getRowOfLTHead(sel_row_start, dummyltt));
+ && !tabular.ltCaption(sel_row_start));
+ status.setOnOff(tabular.getRowOfLTFirstHead(sel_row_start, dummyltt));
break;
case Tabular::UNSET_LTFIRSTHEAD:
- status.setOnOff(!tabular.getRowOfLTHead(sel_row_start, dummyltt));
+ status.setOnOff(!tabular.getRowOfLTFirstHead(sel_row_start, dummyltt));
break;
case Tabular::SET_LTHEAD:
&& !tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)
&& !tabular.getRowOfLTFoot(sel_row_start, dummyltt)
&& !tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)
- && !tabular.ltCaption(sel_row_start)
- && (!tabular.haveLTHead()
- || tabular.getRowOfLTHead(sel_row_start, dummyltt)));
+ && !tabular.ltCaption(sel_row_start));
status.setOnOff(tabular.getRowOfLTHead(sel_row_start, dummyltt));
break;
&& !tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)
&& !tabular.getRowOfLTHead(sel_row_start, dummyltt)
&& !tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)
- && !tabular.ltCaption(sel_row_start)
- && (!tabular.haveLTFoot()
- || tabular.getRowOfLTFoot(sel_row_start, dummyltt)));
+ && !tabular.ltCaption(sel_row_start));
status.setOnOff(tabular.getRowOfLTFoot(sel_row_start, dummyltt));
break;
&& !tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)
&& !tabular.getRowOfLTHead(sel_row_start, dummyltt)
&& !tabular.getRowOfLTFoot(sel_row_start, dummyltt)
- && !tabular.ltCaption(sel_row_start)
- && (!tabular.haveLTLastFoot()
- || tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)));
- status.setOnOff(tabular.getRowOfLTFoot(sel_row_start, dummyltt));
+ && !tabular.ltCaption(sel_row_start));
+ status.setOnOff(tabular.getRowOfLTLastFoot(sel_row_start, dummyltt));
break;
case Tabular::UNSET_LTLASTFOOT:
- status.setOnOff(!tabular.getRowOfLTFoot(sel_row_start, dummyltt));
+ status.setOnOff(!tabular.getRowOfLTLastFoot(sel_row_start, dummyltt));
break;
case Tabular::SET_LTNEWPAGE:
&& !tabular.getRowOfLTFirstHead(sel_row_start, dummyltt)
&& !tabular.getRowOfLTHead(sel_row_start, dummyltt)
&& !tabular.getRowOfLTFoot(sel_row_start, dummyltt)
- && !tabular.getRowOfLTLastFoot(sel_row_start, dummyltt)
- // Only the first row can be the caption.
- && sel_row_start == 0
- && (!tabular.haveLTCaption()
- || tabular.ltCaption(sel_row_start)));
+ && !tabular.getRowOfLTLastFoot(sel_row_start, dummyltt));
status.setOnOff(tabular.ltCaption(sel_row_start));
break;