* LaTeX code should be added
* @param <code>oc</code> the current context
*/
public void handleTable(Element node, LaTeXDocumentPortion ldp, Context oc) {
// Get a grid model of the table
TableGridModel table = new TableGridModel(node);
// Update the context
Context ic = (Context) oc.clone();
ic.setInTable(true);
// Apply table style
boolean bApplyCellFormat = config.formatting()>=Config.CONVERT_MOST;
TableFormatter formatter = palette.getTableSc().getTableFormatter(table,
!ic.isInMulticols(), bApplyCellFormat);
// We may need a hyperlink target
if (!formatter.isSubtable()) {
palette.getFieldCv().addTarget(node,"|table",ldp);
}
// Export table declaration
BeforeAfter baTable = new BeforeAfter();
formatter.applyTableStyle(baTable);
ldp.append(baTable.getBefore()).nl();
// Export rows
if (bApplyCellFormat || !formatter.isLongtable()) { ic.setNoFootnotes(true); }
int nRowCount = table.getRowCount();
int nColCount = table.getColCount();
boolean bInHeader = false;
// Add interrow material before first row:
ldp.append(formatter.getInterrowMaterial(0)).nl();
for (int nRow=0; nRow<nRowCount; nRow++){
// Longtables may have headers:
if (formatter.isLongtable()) {
if (nRow==0 && table.getRow(nRow).isHeader()) {
bInHeader = true;
if (!bApplyCellFormat) { ic.setNoFootnotes(true); }
}
else if (bInHeader && !table.getRow(nRow).isHeader()) {
bInHeader = false;
if (!bApplyCellFormat) { ic.setNoFootnotes(false); }
palette.getNoteCv().flushFootnotes(ldp,oc);
ldp.append("\\endhead").nl();
}
}
// Export columns in this row
int nCol = 0;
while (nCol<nColCount) {
Element cell = (Element) table.getCell(nRow,nCol);
if (XMLString.TABLE_TABLE_CELL.equals(cell.getNodeName())) {
BeforeAfter baCell = new BeforeAfter();
formatter.applyCellStyle(nRow,nCol,baCell);
ldp.append(baCell.getBefore());
traverseBlockText(cell,ldp,ic);