* LaTeX code should be added
* @param <code>oc</code> the current context
*/
public void traverseBlockText(Element node, LaTeXDocumentPortion ldp, Context oc) {
// The current paragraph block:
StyleMap blockMap = config.getParBlockStyleMap();
String sBlockName = null;
if (node.hasChildNodes()) {
NodeList list = node.getChildNodes();
int nLen = list.getLength();
for (int i = 0; i < nLen; i++) {
Node childNode = list.item(i);
if (childNode.getNodeType() == Node.ELEMENT_NODE) {
Element child = (Element)childNode;
String sTagName = child.getTagName();
palette.getInfo().addDebugInfo(child,ldp);
// Start/End a paragraph block
if (sTagName.equals(XMLString.TEXT_P)) {
String sStyleName = child.getAttribute(XMLString.TEXT_STYLE_NAME);
if (sBlockName!=null && !blockMap.isNext(sBlockName,sStyleName)) {
// end current block
String sAfter = blockMap.getAfter(sBlockName);
if (sAfter.length()>0) ldp.append(sAfter).nl();
sBlockName = null;
}
if (sBlockName==null && blockMap.contains(sStyleName)) {
// start a new block
sBlockName = sStyleName;
String sBefore = blockMap.getBefore(sBlockName);
if (sBefore.length()>0) ldp.append(sBefore).nl();
}
}
else if (sBlockName!=null) {
// non-paragraph: end current block
String sAfter = blockMap.getAfter(sBlockName);
if (sAfter.length()>0) ldp.append(sAfter).nl();
sBlockName = null;
}
// Basic block content; handle by this class
if (sTagName.equals(XMLString.TEXT_P)) {
handleParagraph(child,ldp,oc,i==nLen-1);
}
else if(sTagName.equals(XMLString.TEXT_H)) {
handleHeading(child,ldp,oc);
}
else if (sTagName.equals(XMLString.TEXT_UNORDERED_LIST)) {
handleList(child,ldp,oc,false);
}
else if (sTagName.equals(XMLString.TEXT_ORDERED_LIST)) {
handleList(child,ldp,oc,true);
}
else if (sTagName.equals(XMLString.TABLE_TABLE)) {
handleTable(child,ldp,oc);
}
else if (sTagName.equals(XMLString.TABLE_SUB_TABLE)) {
handleTable(child,ldp,oc);
}
else if (sTagName.equals(XMLString.TEXT_SECTION)) {
handleSection(child,ldp,oc);
}
// Draw elements may appear in block context if they are
// anchored to page
else if (sTagName.startsWith("draw:")) {
palette.getDrawCv().handleDrawElement(child,ldp,oc);
}
// Indexes
else if (sTagName.equals(XMLString.TEXT_TABLE_OF_CONTENT)) {
palette.getIndexCv().handleTOC(child,ldp,oc);
}
else if (sTagName.equals(XMLString.TEXT_ILLUSTRATION_INDEX)) {
palette.getIndexCv().handleLOF(child,ldp,oc);
}
else if (sTagName.equals(XMLString.TEXT_TABLE_INDEX)) {
palette.getIndexCv().handleLOT(child,ldp,oc);
}
else if (sTagName.equals(XMLString.TEXT_OBJECT_INDEX)) {
palette.getIndexCv().handleObjectIndex(child,ldp,oc);
}
else if (sTagName.equals(XMLString.TEXT_USER_INDEX)) {
palette.getIndexCv().handleUserIndex(child,ldp,oc);
}
else if (sTagName.equals(XMLString.TEXT_ALPHABETICAL_INDEX)) {
palette.getIndexCv().handleAlphabeticalIndex(child,ldp,oc);
}
else if (sTagName.equals(XMLString.TEXT_BIBLIOGRAPHY)) {
palette.getIndexCv().handleBibliography(child,ldp,oc);
}
// Sequence declarations appear in the main text body
else if (sTagName.equals(XMLString.TEXT_SEQUENCE_DECLS)) {
//handleSeqeuenceDecls(child);
}
// other tags are ignored
}
}
}
if (sBlockName!=null) {
// end current block
String sAfter = blockMap.getAfter(sBlockName);
if (sAfter.length()>0) ldp.append(sAfter).nl();
sBlockName = null;
}
}