Continued working on notes conversion

This commit is contained in:
Georgy Litvinov 2020-01-21 18:18:01 +01:00
parent 6242ed2235
commit 90b31d6a5f

View file

@ -42,6 +42,7 @@ import writer2latex.office.ListCounter;
import writer2latex.office.ListStyle;
import writer2latex.office.StyleWithProperties;
import writer2latex.office.OfficeReader;
import static writer2latex.office.XMLString.*;
/** This class handles text content
@ -106,14 +107,16 @@ public class TextConverter extends ConverterHelper {
//Current master page name
private String nextMasterPage = null;
private String headingSeparator = config.getHeadingTags();
private String headingTags = config.getHeadingTags();
private String pageSeparator = config.getPageTags();
private boolean breakBeforeNextNode = false;
private boolean inTable = false;
private boolean inList = false;
private boolean inFootnote = false;
private boolean inEndnote = false;
private boolean inHeader = false;
private boolean inFooter = false;
private String currentSection = null;
public TextConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) {
super(ofr,config,converter);
@ -170,11 +173,11 @@ public class TextConverter extends ConverterHelper {
// Add footnotes and endnotes
footCv.insertFootnotes(hnode,true);
insertFootnotes(hnode,true);
if (!pageSeparator.equals("none")) {
addFooter(hnode);
}
endCv.insertEndnotes(hnode);
insertEndnotes(hnode, null);
hnode = (Element) docSep.endDocument(hnode);
// Generate all indexes
bInToc = true;
@ -188,16 +191,23 @@ public class TextConverter extends ConverterHelper {
tocCv.generatePanels(nSplit);
bInToc = false;
}
private void insertEndnotes(Element hnode, String section) {
inEndnote = true;
endCv.insertEndnotes(hnode,section);
inEndnote = false;
}
private void extractRealTOC(Element onode) {
NodeList tocs = onode.getElementsByTagName(XMLString.TEXT_TABLE_OF_CONTENT);
NodeList tocs = onode.getElementsByTagName(TEXT_TABLE_OF_CONTENT);
int i = 0;
if (tocs == null){
return;
}
while (i < tocs.getLength()){
Node toc = tocs.item(i);
NodeList indexBody = ((Element)toc).getElementsByTagName(XMLString.TEXT_INDEX_BODY);
NodeList indexBody = ((Element)toc).getElementsByTagName(TEXT_INDEX_BODY);
if (indexBody == null || indexBody.item(0) == null){
i++;
continue;
@ -206,7 +216,7 @@ public class TextConverter extends ConverterHelper {
Node child = indexBody.item(0).getFirstChild();
if (child.getNodeType() == Node.ELEMENT_NODE
&&
((Element) child).getTagName().equals(XMLString.TEXT_INDEX_TITLE)
((Element) child).getTagName().equals(TEXT_INDEX_TITLE)
){
while(child.hasChildNodes()){
@ -271,8 +281,8 @@ public class TextConverter extends ConverterHelper {
if (OfficeReader.isDrawElement(child)) {
getDrawCv().handleDrawElement((Element)child,(Element)hnode,null,nFloatMode);
}
else if (nodeName.equals(XMLString.TEXT_P)) {
StyleWithProperties style = ofr.getParStyle(Misc.getAttribute(child,XMLString.TEXT_STYLE_NAME));
else if (nodeName.equals(TEXT_P)) {
StyleWithProperties style = ofr.getParStyle(Misc.getAttribute(child,TEXT_STYLE_NAME));
hnode = processPageBreaks(child, hnode,style);
//hnode = maybeSplit(hnode, style);
nCharacterCount+=OfficeReader.getCharacterCount(child);
@ -300,8 +310,8 @@ public class TextConverter extends ConverterHelper {
if (++i<nLen) {
child = nList.item(i);
String cnodeName = child.getNodeName();
if (cnodeName.equals(XMLString.TEXT_P)) {
String sCurDisplayName = ofr.getParStyles().getDisplayName(Misc.getAttribute(child,XMLString.TEXT_STYLE_NAME));
if (cnodeName.equals(TEXT_P)) {
String sCurDisplayName = ofr.getParStyles().getDisplayName(Misc.getAttribute(child,TEXT_STYLE_NAME));
if (sCurDisplayName!=null && xpar.contains(sCurDisplayName)) {
XhtmlStyleMapItem newmap = xpar.get(sCurDisplayName);
if (sBlockElement.equals(newmap.sBlockElement) &&
@ -318,8 +328,8 @@ public class TextConverter extends ConverterHelper {
handleParagraph(child,hnode);
}
}
else if(nodeName.equals(XMLString.TEXT_H)) {
StyleWithProperties style = ofr.getParStyle(Misc.getAttribute(child,XMLString.TEXT_STYLE_NAME));
else if(nodeName.equals(TEXT_H)) {
StyleWithProperties style = ofr.getParStyle(Misc.getAttribute(child,TEXT_STYLE_NAME));
int nOutlineLevel = getOutlineLevel((Element)child);
Node rememberNode = hnode;
hnode = processPageBreaks(child, hnode, style);
@ -327,38 +337,38 @@ public class TextConverter extends ConverterHelper {
nCharacterCount+=OfficeReader.getCharacterCount(child);
handleHeading((Element)child,(Element)hnode,rememberNode!=hnode);
}
else if (nodeName.equals(XMLString.TEXT_LIST) || // oasis
nodeName.equals(XMLString.TEXT_UNORDERED_LIST) || // old
nodeName.equals(XMLString.TEXT_ORDERED_LIST)) // old
else if (nodeName.equals(TEXT_LIST) || // oasis
nodeName.equals(TEXT_UNORDERED_LIST) || // old
nodeName.equals(TEXT_ORDERED_LIST)) // old
{
StyleWithProperties style = null;
String newPageNumberProperty = null;
Element para = null;
Element head = null;
Element item = Misc.getChildByTagName(child, XMLString.TEXT_LIST_ITEM);
Element item = Misc.getChildByTagName(child, TEXT_LIST_ITEM);
if (item != null){
NodeList paras = item.getElementsByTagName(XMLString.TEXT_P);
NodeList paras = item.getElementsByTagName(TEXT_P);
if (paras != null && paras.getLength() > 0){
para = (Element) paras.item(0);
}
NodeList heads = item.getElementsByTagName(XMLString.TEXT_H);
NodeList heads = item.getElementsByTagName(TEXT_H);
if (heads != null && heads.getLength() > 0){
head = (Element) heads.item(0);
}
if (para != null ){
StyleWithProperties paraStyle = ofr.getParStyle(Misc.getAttribute(para,XMLString.TEXT_STYLE_NAME));
StyleWithProperties paraStyle = ofr.getParStyle(Misc.getAttribute(para,TEXT_STYLE_NAME));
if (paraStyle != null) {
newPageNumberProperty = paraStyle.getParProperty(XMLString.STYLE_PAGE_NUMBER, true);
newPageNumberProperty = paraStyle.getParProperty(STYLE_PAGE_NUMBER, true);
}
newPageNumberProperty = paraStyle.getParProperty(XMLString.STYLE_PAGE_NUMBER, true);
newPageNumberProperty = paraStyle.getParProperty(STYLE_PAGE_NUMBER, true);
if (checkMasterPageBreak(paraStyle) || newPageNumberProperty != null){
style = paraStyle;
}
}
if (head != null && style == null){
StyleWithProperties headStyle = ofr.getParStyle(Misc.getAttribute(head,XMLString.TEXT_STYLE_NAME));
StyleWithProperties headStyle = ofr.getParStyle(Misc.getAttribute(head,TEXT_STYLE_NAME));
if (headStyle != null) {
newPageNumberProperty = headStyle.getParProperty(XMLString.STYLE_PAGE_NUMBER, true);
newPageNumberProperty = headStyle.getParProperty(STYLE_PAGE_NUMBER, true);
}
if (checkMasterPageBreak(headStyle) || newPageNumberProperty != null){
style = headStyle;
@ -378,65 +388,65 @@ public class TextConverter extends ConverterHelper {
}
inList = false;
}
else if (nodeName.equals(XMLString.TABLE_TABLE)) {
StyleWithProperties style = ofr.getTableStyle(Misc.getAttribute(child, XMLString.TABLE_STYLE_NAME));
else if (nodeName.equals(TABLE_TABLE)) {
StyleWithProperties style = ofr.getTableStyle(Misc.getAttribute(child, TABLE_STYLE_NAME));
hnode = processPageBreaks(child, hnode,style);
//hnode = maybeSplit(hnode,style);
inTable = true;
getTableCv().handleTable(child,hnode);
inTable = false;
}
else if (nodeName.equals(XMLString.TABLE_SUB_TABLE)) {
else if (nodeName.equals(TABLE_SUB_TABLE)) {
getTableCv().handleTable(child,hnode);
}
else if (nodeName.equals(XMLString.TEXT_SECTION)) {
else if (nodeName.equals(TEXT_SECTION)) {
hnode = processPageBreaks(child, hnode,null);
// hnode = maybeSplit(hnode,null);
nDontSplitLevel--;
hnode = handleSection(child,hnode);
nDontSplitLevel++;
}
else if (nodeName.equals(XMLString.TEXT_TABLE_OF_CONTENT)) {
else if (nodeName.equals(TEXT_TABLE_OF_CONTENT)) {
if (!ofr.getTocReader((Element)child).isByChapter()) {
// hnode = maybeSplit(hnode,null,1);
}
tocCv.handleIndex((Element)child,(Element)hnode);
}
else if (nodeName.equals(XMLString.TEXT_ILLUSTRATION_INDEX)) {
else if (nodeName.equals(TEXT_ILLUSTRATION_INDEX)) {
lofCv.handleLOF(child,hnode);
}
else if (nodeName.equals(XMLString.TEXT_TABLE_INDEX)) {
else if (nodeName.equals(TEXT_TABLE_INDEX)) {
lotCv.handleLOT(child,hnode);
}
else if (nodeName.equals(XMLString.TEXT_OBJECT_INDEX)) {
else if (nodeName.equals(TEXT_OBJECT_INDEX)) {
// TODO
}
else if (nodeName.equals(XMLString.TEXT_USER_INDEX)) {
else if (nodeName.equals(TEXT_USER_INDEX)) {
// TODO
}
else if (nodeName.equals(XMLString.TEXT_ALPHABETICAL_INDEX)) {
else if (nodeName.equals(TEXT_ALPHABETICAL_INDEX)) {
//hnode = maybeSplit(hnode,null,1);
indexCv.handleIndex((Element)child,(Element)hnode);
}
else if (nodeName.equals(XMLString.TEXT_BIBLIOGRAPHY)) {
else if (nodeName.equals(TEXT_BIBLIOGRAPHY)) {
//hnode = maybeSplit(hnode,null,1);
bibCv.handleIndex((Element)child,(Element)hnode);
}
else if (nodeName.equals(XMLString.TEXT_SOFT_PAGE_BREAK)) {
else if (nodeName.equals(TEXT_SOFT_PAGE_BREAK)) {
breakBeforeNextNode = true;
if (nPageBreakSplit==XhtmlConfig.ALL) { bPendingPageBreak = true; }
}
else if (nodeName.equals(XMLString.OFFICE_ANNOTATION)) {
else if (nodeName.equals(OFFICE_ANNOTATION)) {
converter.handleOfficeAnnotation(child,hnode);
}
else if (nodeName.equals(XMLString.TEXT_SEQUENCE_DECLS)) {
else if (nodeName.equals(TEXT_SEQUENCE_DECLS)) {
//handleSeqeuenceDecls(child);
}
// Reenable splitting
nDontSplitLevel--;
// Remember if this was a heading
if (nDontSplitLevel==0) {
bAfterHeading = nodeName.equals(XMLString.TEXT_H);
bAfterHeading = nodeName.equals(TEXT_H);
hnode = getDrawCv().flushFullscreenFrames((Element)hnode);
}
}
@ -458,10 +468,10 @@ public class TextConverter extends ConverterHelper {
}
}
// A page break can be a simple page break before or after...
if ("page".equals(style.getProperty(XMLString.FO_BREAK_BEFORE))) {
if ("page".equals(style.getProperty(FO_BREAK_BEFORE))) {
return true;
}
if ("page".equals(style.getProperty(XMLString.FO_BREAK_AFTER))) {
if ("page".equals(style.getProperty(FO_BREAK_AFTER))) {
bPendingPageBreak = true;
return false;
}
@ -510,7 +520,9 @@ public class TextConverter extends ConverterHelper {
// No objections, this is a level that causes splitting
nCharacterCount = 0;
bPendingPageBreak = false;
if (converter.getOutFileIndex()>=0) { footCv.insertFootnotes(node,false); }
if (converter.getOutFileIndex()>=0) {
insertFootnotes(node,false);
}
return converter.nextOutFile();
}
return (Element) node;
@ -518,30 +530,39 @@ public class TextConverter extends ConverterHelper {
/* Process a text:section tag (returns current html node) */
private Node handleSection(Node onode, Node hnode) {
System.out.println("Handle section");
// Unlike headings, paragraphs and spans, text:display is not attached to the style:
if (!bDisplayHiddenText && "none".equals(Misc.getAttribute(onode,XMLString.TEXT_DISPLAY))) { return hnode; }
String sName = Misc.getAttribute(onode,XMLString.TEXT_NAME);
String sStyleName = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME);
Node result = null;
if (!bDisplayHiddenText && "none".equals(Misc.getAttribute(onode,TEXT_DISPLAY))) { return hnode; }
String sectionName = Misc.getAttribute(onode,TEXT_NAME);
String sStyleName = Misc.getAttribute(onode,TEXT_STYLE_NAME);
StyleInfo sectionInfo = new StyleInfo();
getSectionSc().applyStyle(sStyleName, sectionInfo);
////closePageSection
Element div = (Element) hnode;
if (headingSeparator == null) {
hnode = docSep.closePage(hnode);
Element div = (Element) hnode;
/* if (headingTags.equals("none")) {
div = converter.createElement("div");
// close page before enter
hnode = docSep.closePage(hnode);
hnode.appendChild(div);
converter.addTarget(div, sName + "|region");
StyleInfo sectionInfo = new StyleInfo();
getSectionSc().applyStyle(sStyleName, sectionInfo);
applyStyle(sectionInfo, div);
converter.addTarget(div, sectionName + "|region");
applyStyle(sectionInfo, div);
System.out.println("sectionInfo \n" + sectionInfo);
sections.push(onode);
//open page after enter
div = (Element) docSep.openPage(div, pageNum);
}
}*/
Node newhnode = traverseBlockText(onode, div);
Node result = null;
if (headingSeparator == null) {
/* if (headingTags.equals("none")) {
//close page before exit
newhnode = docSep.closePage(newhnode);
result = newhnode.getParentNode();
@ -550,15 +571,16 @@ public class TextConverter extends ConverterHelper {
sections.pop();
} else {
result = newhnode;
}
}*/
result = newhnode;
return result;
}
private void handleHeading(Element onode, Element hnode, boolean bAfterSplit) {
int nListLevel = getOutlineLevel((Element)onode);
boolean bUnNumbered = "true".equals(Misc.getAttribute(onode,XMLString.TEXT_IS_LIST_HEADER));
boolean bRestart = "true".equals(Misc.getAttribute(onode,XMLString.TEXT_RESTART_NUMBERING));
int nStartValue = Misc.getPosInteger(Misc.getAttribute(onode,XMLString.TEXT_START_VALUE),1)-1;
boolean bUnNumbered = "true".equals(Misc.getAttribute(onode,TEXT_IS_LIST_HEADER));
boolean bRestart = "true".equals(Misc.getAttribute(onode,TEXT_RESTART_NUMBERING));
int nStartValue = Misc.getPosInteger(Misc.getAttribute(onode,TEXT_START_VALUE),1)-1;
handleHeading(onode, hnode, bAfterSplit, ofr.getOutlineStyle(),
nListLevel, bUnNumbered, bRestart, nStartValue);
}
@ -580,11 +602,11 @@ public class TextConverter extends ConverterHelper {
// Note: Conditional styles are not supported
int nLevel = getOutlineLevel(onode);
if (nLevel<=6) { // Export as heading
String sStyleName = onode.getAttribute(XMLString.TEXT_STYLE_NAME);
String sStyleName = onode.getAttribute(TEXT_STYLE_NAME);
StyleWithProperties style = ofr.getParStyle(sStyleName);
// Check for hidden text
if (!bDisplayHiddenText && style!=null && "none".equals(style.getProperty(XMLString.TEXT_DISPLAY))) { return; }
if (!bDisplayHiddenText && style!=null && "none".equals(style.getProperty(TEXT_DISPLAY))) { return; }
// Numbering
if (!bUnNumbered) {
@ -607,7 +629,7 @@ public class TextConverter extends ConverterHelper {
// In EPUB export, a striked out heading will only appear in the external toc
boolean bTocOnly = false;
if (converter.isOPS() && style!=null) {
String sStrikeOut = style.getProperty(XMLString.STYLE_TEXT_LINE_THROUGH_STYLE, true);
String sStrikeOut = style.getProperty(STYLE_TEXT_LINE_THROUGH_STYLE, true);
if (sStrikeOut!=null && !"none".equals(sStrikeOut)) {
bTocOnly = true;
}
@ -637,7 +659,7 @@ public class TextConverter extends ConverterHelper {
applyStyle(info,heading);
traverseFloats(onode,hnode,heading);
// Apply writing direction
/*String sStyleName = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME);
/*String sStyleName = Misc.getAttribute(onode,TEXT_STYLE_NAME);
StyleWithProperties style = ofr.getParStyle(sStyleName);
if (style!=null) {
StyleInfo headInfo = new StyleInfo();
@ -701,9 +723,9 @@ public class TextConverter extends ConverterHelper {
private void handleParagraph(Node onode, Node hnode) {
boolean bIsEmpty = OfficeReader.isWhitespaceContent(onode);
if (config.ignoreEmptyParagraphs() && bIsEmpty) { return; }
String sStyleName = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME);
String sStyleName = Misc.getAttribute(onode,TEXT_STYLE_NAME);
StyleWithProperties style = ofr.getParStyle(sStyleName);
if (!bDisplayHiddenText && style!=null && "none".equals(style.getProperty(XMLString.TEXT_DISPLAY))) { return; }
if (!bDisplayHiddenText && style!=null && "none".equals(style.getProperty(TEXT_DISPLAY))) { return; }
Element par;
if (ofr.isSpreadsheet()) { // attach inline text directly to parent (always a table cell)
@ -795,7 +817,7 @@ public class TextConverter extends ConverterHelper {
}
StyleInfo info = new StyleInfo();
if (style!=null) {
String sTextStyleName = style.getLevelProperty(nLevel,XMLString.TEXT_STYLE_NAME);
String sTextStyleName = style.getLevelProperty(nLevel,TEXT_STYLE_NAME);
getTextSc().applyStyle(sTextStyleName, info);
}
@ -813,8 +835,8 @@ public class TextConverter extends ConverterHelper {
private boolean hasItems(Node onode) {
Node child = onode.getFirstChild();
while (child!=null) {
if (Misc.isElement(child,XMLString.TEXT_LIST_ITEM) ||
Misc.isElement(child,XMLString.TEXT_LIST_HEADER)) {
if (Misc.isElement(child,TEXT_LIST_ITEM) ||
Misc.isElement(child,TEXT_LIST_HEADER)) {
return true;
}
child = child.getNextSibling();
@ -856,7 +878,7 @@ public class TextConverter extends ConverterHelper {
private void handleList(Node onode, int nLevel, String sStyleName, Node hnode) {
// In OpenDocument, we should use the style to determine the type of list
String sStyleName1 = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME);
String sStyleName1 = Misc.getAttribute(onode,TEXT_STYLE_NAME);
if (sStyleName1!=null) { sStyleName = sStyleName1; }
ListStyle style = ofr.getListStyle(sStyleName);
if (style!=null && style.isNumber(nLevel)) {
@ -885,7 +907,7 @@ public class TextConverter extends ConverterHelper {
// Restart numbering, if required
//if (counter!=null) {
boolean bContinueNumbering = "true".equals(Misc.getAttribute(onode,XMLString.TEXT_CONTINUE_NUMBERING));
boolean bContinueNumbering = "true".equals(Misc.getAttribute(onode,TEXT_CONTINUE_NUMBERING));
if (!bContinueNumbering && counter!=null) {
counter.restart(nLevel);
}
@ -904,13 +926,13 @@ public class TextConverter extends ConverterHelper {
if (child.getNodeType() == Node.ELEMENT_NODE) {
String nodeName = child.getNodeName();
if (nodeName.equals(XMLString.TEXT_LIST_ITEM)) {
if (nodeName.equals(TEXT_LIST_ITEM)) {
// Check to see if first child is a new list
boolean bIsImmediateNestedList = false;
Element child1 = Misc.getFirstChildElement(child);
if (child1.getTagName().equals(XMLString.TEXT_ORDERED_LIST) || // old
child1.getTagName().equals(XMLString.TEXT_UNORDERED_LIST) || // old
child1.getTagName().equals(XMLString.TEXT_LIST)) { // oasis
if (child1.getTagName().equals(TEXT_ORDERED_LIST) || // old
child1.getTagName().equals(TEXT_UNORDERED_LIST) || // old
child1.getTagName().equals(TEXT_LIST)) { // oasis
bIsImmediateNestedList = true;
}
@ -931,9 +953,9 @@ public class TextConverter extends ConverterHelper {
hnode.appendChild(item);
if (config.listFormatting()==XhtmlConfig.CSS1_HACK) {
boolean bRestart = "true".equals(Misc.getAttribute(child,
XMLString.TEXT_RESTART_NUMBERING));
TEXT_RESTART_NUMBERING));
int nStartValue = Misc.getPosInteger(Misc.getAttribute(child,
XMLString.TEXT_START_VALUE),1);
TEXT_START_VALUE),1);
if (bRestart) {
item.setAttribute("value",Integer.toString(nStartValue));
//if (counter!=null) {
@ -944,7 +966,7 @@ public class TextConverter extends ConverterHelper {
traverseListItem(child,nLevel,styleName,item);
}
}
if (nodeName.equals(XMLString.TEXT_LIST_HEADER)) {
if (nodeName.equals(TEXT_LIST_HEADER)) {
// add an li element
Element item = converter.createElement("li");
hnode.appendChild(item);
@ -972,10 +994,10 @@ public class TextConverter extends ConverterHelper {
boolean bNoPTag = true;
for (int i=0; i<nLen; i++) {
if (list.item(i).getNodeType()==Node.ELEMENT_NODE) {
if (list.item(i).getNodeName().equals(XMLString.TEXT_P)) {
if (list.item(i).getNodeName().equals(TEXT_P)) {
nParCount++;
if (bNoPTag) {
String sDisplayName = ofr.getParStyles().getDisplayName(Misc.getAttribute(list.item(0),XMLString.TEXT_STYLE_NAME));
String sDisplayName = ofr.getParStyles().getDisplayName(Misc.getAttribute(list.item(0),TEXT_STYLE_NAME));
if (config.getXParStyleMap().contains(sDisplayName)) {
bNoPTag = false;
}
@ -994,16 +1016,16 @@ public class TextConverter extends ConverterHelper {
if (child.getNodeType() == Node.ELEMENT_NODE) {
String nodeName = child.getNodeName();
if (nodeName.equals(XMLString.TEXT_P)) {
if (nodeName.equals(TEXT_P)) {
traverseInlineText(child,hnode);
}
if (nodeName.equals(XMLString.TEXT_LIST)) { // oasis
if (nodeName.equals(TEXT_LIST)) { // oasis
handleList(child,nLevel+1,styleName,hnode);
}
if (nodeName.equals(XMLString.TEXT_ORDERED_LIST)) { // old
if (nodeName.equals(TEXT_ORDERED_LIST)) { // old
handleOL(child,nLevel+1,styleName,hnode);
}
if (nodeName.equals(XMLString.TEXT_UNORDERED_LIST)) { // old
if (nodeName.equals(TEXT_UNORDERED_LIST)) { // old
handleUL(child,nLevel+1,styleName,hnode);
}
}
@ -1030,10 +1052,10 @@ public class TextConverter extends ConverterHelper {
while (child!=null) {
if (child.getNodeType() == Node.ELEMENT_NODE) {
String nodeName = child.getNodeName();
if (nodeName.equals(XMLString.TEXT_LIST_ITEM)) {
if (nodeName.equals(TEXT_LIST_ITEM)) {
if (!itemIsOnlyHeadings(child)) return false;
}
else if (nodeName.equals(XMLString.TEXT_LIST_HEADER)) {
else if (nodeName.equals(TEXT_LIST_HEADER)) {
if (!itemIsOnlyHeadings(child)) return false;
}
}
@ -1047,16 +1069,16 @@ public class TextConverter extends ConverterHelper {
while (child!=null) {
if (child.getNodeType() == Node.ELEMENT_NODE) {
String nodeName = child.getNodeName();
if (nodeName.equals(XMLString.TEXT_LIST)) {
if (nodeName.equals(TEXT_LIST)) {
if (!listIsOnlyHeadings(child)) return false;
}
else if (nodeName.equals(XMLString.TEXT_ORDERED_LIST)) {
else if (nodeName.equals(TEXT_ORDERED_LIST)) {
if (!listIsOnlyHeadings(child)) return false;
}
else if (nodeName.equals(XMLString.TEXT_UNORDERED_LIST)) {
else if (nodeName.equals(TEXT_UNORDERED_LIST)) {
if (!listIsOnlyHeadings(child)) return false;
}
else if(!nodeName.equals(XMLString.TEXT_H)) {
else if(!nodeName.equals(TEXT_H)) {
return false;
}
}
@ -1067,7 +1089,7 @@ public class TextConverter extends ConverterHelper {
// Splitting may occur inside a fake list, so we return the (new) hnode
private Node handleFakeList(Node onode, int nLevel, String sStyleName, Node hnode) {
String sStyleName1 = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME);
String sStyleName1 = Misc.getAttribute(onode,TEXT_STYLE_NAME);
if (sStyleName1!=null) { sStyleName = sStyleName1; }
return traverseFakeList(onode,hnode,nLevel,sStyleName);
}
@ -1077,7 +1099,7 @@ public class TextConverter extends ConverterHelper {
private Node traverseFakeList (Node onode, Node hnode, int nLevel, String sStyleName) {
// Restart numbering?
boolean bContinueNumbering ="true".equals(
Misc.getAttribute(onode,XMLString.TEXT_CONTINUE_NUMBERING));
Misc.getAttribute(onode,TEXT_CONTINUE_NUMBERING));
if (!bContinueNumbering) {
getListCounter(ofr.getListStyle(sStyleName)).restart(nLevel);
}
@ -1087,14 +1109,14 @@ public class TextConverter extends ConverterHelper {
if (child.getNodeType() == Node.ELEMENT_NODE) {
String sNodeName = child.getNodeName();
if (sNodeName.equals(XMLString.TEXT_LIST_ITEM)) {
if (sNodeName.equals(TEXT_LIST_ITEM)) {
boolean bRestart = "true".equals(Misc.getAttribute(child,
XMLString.TEXT_RESTART_NUMBERING));
TEXT_RESTART_NUMBERING));
int nStartValue = Misc.getPosInteger(Misc.getAttribute(child,
XMLString.TEXT_START_VALUE),1);
TEXT_START_VALUE),1);
hnode = traverseFakeListItem(child, hnode, nLevel, sStyleName, false, bRestart, nStartValue);
}
else if (sNodeName.equals(XMLString.TEXT_LIST_HEADER)) {
else if (sNodeName.equals(TEXT_LIST_HEADER)) {
hnode = traverseFakeListItem(child, hnode, nLevel, sStyleName, true, false, 0);
}
}
@ -1112,11 +1134,11 @@ public class TextConverter extends ConverterHelper {
if (child.getNodeType() == Node.ELEMENT_NODE) {
String sNodeName = child.getNodeName();
if (sNodeName.equals(XMLString.TEXT_H)) {
if (sNodeName.equals(TEXT_H)) {
nDontSplitLevel++;
int nOutlineLevel = getOutlineLevel((Element)onode);
Node rememberNode = hnode;
StyleWithProperties style = ofr.getParStyle(Misc.getAttribute(child, XMLString.TEXT_STYLE_NAME));
StyleWithProperties style = ofr.getParStyle(Misc.getAttribute(child, TEXT_STYLE_NAME));
//hnode = maybeSplit(hnode,style,nOutlineLevel);
handleHeading((Element)child, (Element)hnode, rememberNode!=hnode,
ofr.getListStyle(sStyleName), nLevel,
@ -1124,16 +1146,16 @@ public class TextConverter extends ConverterHelper {
nDontSplitLevel--;
if (nDontSplitLevel==0) { bAfterHeading=true; }
}
else if (sNodeName.equals(XMLString.TEXT_P)) {
else if (sNodeName.equals(TEXT_P)) {
// Currently we only handle fakes lists containing headings
}
else if (sNodeName.equals(XMLString.TEXT_LIST)) { // oasis
else if (sNodeName.equals(TEXT_LIST)) { // oasis
return traverseFakeList(child, hnode, nLevel+1, sStyleName);
}
else if (sNodeName.equals(XMLString.TEXT_ORDERED_LIST)) { // old
else if (sNodeName.equals(TEXT_ORDERED_LIST)) { // old
return traverseFakeList(child, hnode, nLevel+1, sStyleName);
}
else if (sNodeName.equals(XMLString.TEXT_UNORDERED_LIST)) { // old
else if (sNodeName.equals(TEXT_UNORDERED_LIST)) { // old
return traverseFakeList(child, hnode, nLevel+1, sStyleName);
}
}
@ -1154,8 +1176,8 @@ public class TextConverter extends ConverterHelper {
Element elm = (Element) child;
if (OfficeReader.isDrawElement(elm)) {
elm = getDrawCv().getRealDrawElement(elm);
String sAnchor = elm.getAttribute(XMLString.TEXT_ANCHOR_TYPE);
if (Misc.isElement(elm, XMLString.DRAW_FRAME)) {
String sAnchor = elm.getAttribute(TEXT_ANCHOR_TYPE);
if (Misc.isElement(elm, DRAW_FRAME)) {
elm = Misc.getFirstChildElement(elm);
}
if (elm!=null) {
@ -1165,7 +1187,7 @@ public class TextConverter extends ConverterHelper {
getDrawCv().handleDrawElement(elm,(Element)hnodeBlock,
(Element)hnodeInline,nFloatMode);
}
else if (XMLString.DRAW_TEXT_BOX.equals(sTag)) {
else if (DRAW_TEXT_BOX.equals(sTag)) {
getDrawCv().handleDrawElement(elm,(Element)hnodeBlock,
(Element)hnodeInline,DrawConverter.INLINE);
}
@ -1186,7 +1208,7 @@ public class TextConverter extends ConverterHelper {
* Process inline text
*/
protected void traverseInlineText (Node onode,Node hnode) {
//String styleName = Misc.getAttribute(onode, XMLString.TEXT_STYLE_NAME);
//String styleName = Misc.getAttribute(onode, TEXT_STYLE_NAME);
if (onode.hasChildNodes()) {
NodeList nList = onode.getChildNodes();
@ -1210,112 +1232,112 @@ public class TextConverter extends ConverterHelper {
if (OfficeReader.isDrawElement(child)) {
Element elm = getDrawCv().getRealDrawElement((Element)child);
if (elm!=null) {
String sAnchor = (elm.getAttribute(XMLString.TEXT_ANCHOR_TYPE));
String sAnchor = (elm.getAttribute(TEXT_ANCHOR_TYPE));
if ("as-char".equals(sAnchor)) {
getDrawCv().handleDrawElement(elm,null,(Element)hnode,DrawConverter.INLINE);
}
}
}
else if (child.getNodeName().equals(XMLString.TEXT_S)) {
else if (child.getNodeName().equals(TEXT_S)) {
if (config.ignoreDoubleSpaces()) {
hnode.appendChild( converter.createTextNode(" ") );
}
else {
int count= Misc.getPosInteger(Misc.getAttribute(child,XMLString.TEXT_C),1);
int count= Misc.getPosInteger(Misc.getAttribute(child,TEXT_C),1);
for ( ; count > 0; count--) {
hnode.appendChild( converter.createTextNode("\u00A0") );
}
}
}
else if (sName.equals(XMLString.TEXT_TAB_STOP)) {
else if (sName.equals(TEXT_TAB_STOP)) {
handleTabStop(child,hnode);
}
else if (sName.equals(XMLString.TEXT_TAB)) { // oasis
else if (sName.equals(TEXT_TAB)) { // oasis
handleTabStop(child,hnode);
}
else if (sName.equals(XMLString.TEXT_LINE_BREAK)) {
else if (sName.equals(TEXT_LINE_BREAK)) {
if (!config.ignoreHardLineBreaks()) {
hnode.appendChild( converter.createElement("br") );
}
}
else if (sName.equals(XMLString.TEXT_SPAN)) {
else if (sName.equals(TEXT_SPAN)) {
handleSpan(child,hnode);
}
else if (sName.equals(XMLString.TEXT_A)) {
else if (sName.equals(TEXT_A)) {
handleAnchor(child,hnode);
}
else if (sName.equals(XMLString.TEXT_FOOTNOTE)) {
footCv.handleNote(child,hnode);
else if (sName.equals(TEXT_FOOTNOTE)) {
footCv.handleNote(child,hnode,currentSection);
}
else if (sName.equals(XMLString.TEXT_ENDNOTE)) {
endCv.handleNote(child,hnode);
else if (sName.equals(TEXT_ENDNOTE)) {
endCv.handleNote(child,hnode,currentSection);
}
else if (sName.equals(XMLString.TEXT_NOTE)) { // oasis
if ("endnote".equals(Misc.getAttribute(child,XMLString.TEXT_NOTE_CLASS))) {
endCv.handleNote(child,hnode);
else if (sName.equals(TEXT_NOTE)) { // oasis
if ("endnote".equals(Misc.getAttribute(child,TEXT_NOTE_CLASS))) {
endCv.handleNote(child,hnode,currentSection);
}
else {
footCv.handleNote(child,hnode);
footCv.handleNote(child,hnode,currentSection);
}
}
else if (sName.equals(XMLString.TEXT_SEQUENCE)) {
else if (sName.equals(TEXT_SEQUENCE)) {
handleSequence(child,hnode);
}
else if (sName.equals(XMLString.TEXT_PAGE_NUMBER)) {
else if (sName.equals(TEXT_PAGE_NUMBER)) {
handlePageNumber(child,hnode);
}
else if (sName.equals(XMLString.TEXT_PAGE_COUNT)) {
else if (sName.equals(TEXT_PAGE_COUNT)) {
handlePageCount(child,hnode);
}
else if (sName.equals(XMLString.TEXT_SEQUENCE_REF)) {
else if (sName.equals(TEXT_SEQUENCE_REF)) {
handleSequenceRef(child,hnode);
}
else if (sName.equals(XMLString.TEXT_FOOTNOTE_REF)) {
else if (sName.equals(TEXT_FOOTNOTE_REF)) {
handleNoteRef(child,hnode);
}
else if (sName.equals(XMLString.TEXT_ENDNOTE_REF)) {
else if (sName.equals(TEXT_ENDNOTE_REF)) {
handleNoteRef(child,hnode);
}
else if (sName.equals(XMLString.TEXT_NOTE_REF)) { // oasis
else if (sName.equals(TEXT_NOTE_REF)) { // oasis
handleNoteRef(child,hnode);
}
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK)) {
else if (sName.equals(TEXT_REFERENCE_MARK)) {
handleReferenceMark(child,hnode);
}
else if (sName.equals(XMLString.TEXT_REFERENCE_MARK_START)) {
else if (sName.equals(TEXT_REFERENCE_MARK_START)) {
handleReferenceMark(child,hnode);
}
else if (sName.equals(XMLString.TEXT_REFERENCE_REF)) {
else if (sName.equals(TEXT_REFERENCE_REF)) {
handleReferenceRef(child,hnode);
}
else if (sName.equals(XMLString.TEXT_BOOKMARK)) {
else if (sName.equals(TEXT_BOOKMARK)) {
handleBookmark(child,hnode);
}
else if (sName.equals(XMLString.TEXT_BOOKMARK_START)) {
else if (sName.equals(TEXT_BOOKMARK_START)) {
handleBookmark(child,hnode);
}
else if (sName.equals(XMLString.TEXT_BOOKMARK_REF)) {
else if (sName.equals(TEXT_BOOKMARK_REF)) {
handleBookmarkRef(child,hnode);
}
else if (sName.equals(XMLString.TEXT_ALPHABETICAL_INDEX_MARK)) {
else if (sName.equals(TEXT_ALPHABETICAL_INDEX_MARK)) {
if (!bInToc) { indexCv.handleIndexMark(child,hnode); }
}
else if (sName.equals(XMLString.TEXT_ALPHABETICAL_INDEX_MARK_START)) {
else if (sName.equals(TEXT_ALPHABETICAL_INDEX_MARK_START)) {
if (!bInToc) { indexCv.handleIndexMarkStart(child,hnode); }
}
else if (sName.equals(XMLString.TEXT_TOC_MARK)) {
else if (sName.equals(TEXT_TOC_MARK)) {
tocCv.handleTocMark(child,hnode);
}
else if (sName.equals(XMLString.TEXT_TOC_MARK_START)) {
else if (sName.equals(TEXT_TOC_MARK_START)) {
tocCv.handleTocMark(child,hnode);
}
else if (sName.equals(XMLString.TEXT_BIBLIOGRAPHY_MARK)) {
else if (sName.equals(TEXT_BIBLIOGRAPHY_MARK)) {
handleBibliographyMark(child,hnode);
}
else if (sName.equals(XMLString.TEXT_SOFT_PAGE_BREAK)) {
else if (sName.equals(TEXT_SOFT_PAGE_BREAK)) {
if (nPageBreakSplit==XhtmlConfig.ALL) { bPendingPageBreak = true; }
}
else if (sName.equals(XMLString.OFFICE_ANNOTATION)) {
else if (sName.equals(OFFICE_ANNOTATION)) {
converter.handleOfficeAnnotation(child,hnode);
}
else if (sName.startsWith("text:")) {
@ -1345,11 +1367,11 @@ public class TextConverter extends ConverterHelper {
}
private void handleSpan(Node onode, Node hnode) {
StyleWithProperties style = ofr.getTextStyle(Misc.getAttribute(onode, XMLString.TEXT_STYLE_NAME));
if (!bDisplayHiddenText && style!=null && "none".equals(style.getProperty(XMLString.TEXT_DISPLAY))) { return; }
StyleWithProperties style = ofr.getTextStyle(Misc.getAttribute(onode, TEXT_STYLE_NAME));
if (!bDisplayHiddenText && style!=null && "none".equals(style.getProperty(TEXT_DISPLAY))) { return; }
if (!bInToc) {
String sStyleName = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME);
String sStyleName = Misc.getAttribute(onode,TEXT_STYLE_NAME);
Element span = createInline((Element) hnode,sStyleName);
traverseInlineText(onode,span);
}
@ -1377,7 +1399,7 @@ public class TextConverter extends ConverterHelper {
}
private void handlePageNumber(Node onode, Node hnode) {
String adjust = Misc.getAttribute(onode, XMLString.TEXT_PAGE_ADJUST);
String adjust = Misc.getAttribute(onode, TEXT_PAGE_ADJUST);
//Set current page number
Integer pageNumber = pageNum;
//If there is adjustment apply it
@ -1395,7 +1417,7 @@ public class TextConverter extends ConverterHelper {
private void handleSequence(Node onode, Node hnode) {
// Use current value, but turn references into hyperlinks
String sName = Misc.getAttribute(onode,XMLString.TEXT_REF_NAME);
String sName = Misc.getAttribute(onode,TEXT_REF_NAME);
if (sName!=null && !bInToc && ofr.hasSequenceRefTo(sName)) {
Element anchor = converter.createTarget("seq"+sName);
hnode.appendChild(anchor);
@ -1408,8 +1430,8 @@ public class TextConverter extends ConverterHelper {
private void createReference(Node onode, Node hnode, String sPrefix) {
// Turn reference into hyperlink
String sFormat = Misc.getAttribute(onode,XMLString.TEXT_REFERENCE_FORMAT);
String sName = Misc.getAttribute(onode,XMLString.TEXT_REF_NAME);
String sFormat = Misc.getAttribute(onode,TEXT_REFERENCE_FORMAT);
String sName = Misc.getAttribute(onode,TEXT_REF_NAME);
Element anchor = converter.createLink(sPrefix+sName);
hnode.appendChild(anchor);
if ("page".equals(sFormat)) { // all page numbers are 1 :-)
@ -1429,7 +1451,7 @@ public class TextConverter extends ConverterHelper {
}
private void handleReferenceMark(Node onode, Node hnode) {
String sName = Misc.getAttribute(onode,XMLString.TEXT_NAME);
String sName = Misc.getAttribute(onode,TEXT_NAME);
if (sName!=null && !bInToc && ofr.hasReferenceRefTo(sName)) {
hnode.appendChild(converter.createTarget("ref"+sName));
}
@ -1441,7 +1463,7 @@ public class TextConverter extends ConverterHelper {
private void handleBookmark(Node onode, Node hnode) {
// Note: Two targets (may be the target of a hyperlink or a reference)
String sName = Misc.getAttribute(onode,XMLString.TEXT_NAME);
String sName = Misc.getAttribute(onode,TEXT_NAME);
if (sName!=null && !bInToc) {
hnode.appendChild(converter.createTarget(sName));
if (ofr.hasBookmarkRefTo(sName)) {
@ -1491,19 +1513,19 @@ public class TextConverter extends ConverterHelper {
// Does this style contain the bold attribute?
private boolean isBold(StyleWithProperties style) {
String s = style.getProperty(XMLString.FO_FONT_WEIGHT,false);
String s = style.getProperty(FO_FONT_WEIGHT,false);
return s!=null && "bold".equals(s);
}
// Does this style contain the italics/oblique attribute?
private boolean isItalics(StyleWithProperties style) {
String s = style.getProperty(XMLString.FO_FONT_STYLE,false);
String s = style.getProperty(FO_FONT_STYLE,false);
return s!=null && !"normal".equals(s);
}
// Does this style contain a fixed pitch font?
private boolean isFixed(StyleWithProperties style) {
String s = style.getProperty(XMLString.STYLE_FONT_NAME,false);
String s = style.getProperty(STYLE_FONT_NAME,false);
String s2 = null;
String s3 = null;
if (s!=null) {
@ -1514,9 +1536,9 @@ public class TextConverter extends ConverterHelper {
}
}
else {
s = style.getProperty(XMLString.FO_FONT_FAMILY,false);
s2 = style.getProperty(XMLString.STYLE_FONT_FAMILY_GENERIC,false);
s3 = style.getProperty(XMLString.STYLE_FONT_PITCH,false);
s = style.getProperty(FO_FONT_FAMILY,false);
s2 = style.getProperty(STYLE_FONT_FAMILY_GENERIC,false);
s3 = style.getProperty(STYLE_FONT_PITCH,false);
}
if ("fixed".equals(s3)) { return true; }
if ("modern".equals(s2)) { return true; }
@ -1525,7 +1547,7 @@ public class TextConverter extends ConverterHelper {
// Does this style specify superscript?
private boolean isSuperscript(StyleWithProperties style) {
String sPos = style.getProperty(XMLString.STYLE_TEXT_POSITION,false);
String sPos = style.getProperty(STYLE_TEXT_POSITION,false);
if (sPos==null) return false;
if (sPos.startsWith("sub")) return false;
if (sPos.startsWith("-")) return false;
@ -1535,7 +1557,7 @@ public class TextConverter extends ConverterHelper {
// Does this style specify subscript?
private boolean isSubscript(StyleWithProperties style) {
String sPos = style.getProperty(XMLString.STYLE_TEXT_POSITION,false);
String sPos = style.getProperty(STYLE_TEXT_POSITION,false);
if (sPos==null) return false;
if (sPos.startsWith("sub")) return true;
if (sPos.startsWith("-")) return true;
@ -1546,10 +1568,10 @@ public class TextConverter extends ConverterHelper {
private boolean isUnderline(StyleWithProperties style) {
String s;
if (ofr.isOpenDocument()) {
s = style.getProperty(XMLString.STYLE_TEXT_UNDERLINE_STYLE,false);
s = style.getProperty(STYLE_TEXT_UNDERLINE_STYLE,false);
}
else {
s = style.getProperty(XMLString.STYLE_TEXT_UNDERLINE,false);
s = style.getProperty(STYLE_TEXT_UNDERLINE,false);
}
return s!=null && !"none".equals(s);
}
@ -1558,10 +1580,10 @@ public class TextConverter extends ConverterHelper {
private boolean isOverstrike(StyleWithProperties style) {
String s;
if (ofr.isOpenDocument()) {
s = style.getProperty(XMLString.STYLE_TEXT_LINE_THROUGH_STYLE,false);
s = style.getProperty(STYLE_TEXT_LINE_THROUGH_STYLE,false);
}
else {
s = style.getProperty(XMLString.STYLE_TEXT_CROSSING_OUT,false);
s = style.getProperty(STYLE_TEXT_CROSSING_OUT,false);
}
return s!=null && !"none".equals(s);
}
@ -1662,8 +1684,8 @@ public class TextConverter extends ConverterHelper {
protected int getOutlineLevel(Element node) {
return ofr.isOpenDocument() ?
Misc.getPosInteger(node.getAttribute(XMLString.TEXT_OUTLINE_LEVEL),1):
Misc.getPosInteger(node.getAttribute(XMLString.TEXT_LEVEL),1);
Misc.getPosInteger(node.getAttribute(TEXT_OUTLINE_LEVEL),1):
Misc.getPosInteger(node.getAttribute(TEXT_LEVEL),1);
}
private Node processPageBreaks(Node currentNode, Node hnode, StyleWithProperties style){
//Check for paragraph in current node in case currentNode is table
@ -1671,7 +1693,7 @@ public class TextConverter extends ConverterHelper {
//check for first para inside
// Check it's master page, pageNumber, Page break before - if we already set MP - throw it away
// And make a note to pass this paragraph next time you'll meet it.
if (inHeader || inFooter || inTable || inList || inFootnote ) {
if (inHeader || inFooter || inTable || inList || inFootnote || inEndnote ) {
return hnode;
}
@ -1682,9 +1704,7 @@ public class TextConverter extends ConverterHelper {
hnode = docSep.processOutlineLevel(currentNode, hnode, pageNum);
} else if (checkMasterPageBreak(style) || checkHardBreakBefore(style) || breakBeforeNextNode) {
// Insert footnotes
inFootnote = true;
footCv.insertFootnotes(hnode, true);
inFootnote = false;
insertFootnotes(hnode,false);
// Add previous MP footer
addFooter(hnode);
// Update MP
@ -1721,11 +1741,17 @@ public class TextConverter extends ConverterHelper {
return hnode;
}
private void insertFootnotes(Node hnode, boolean lastCall) {
inFootnote = true;
footCv.insertFootnotes(hnode, lastCall);
inFootnote = false;
}
private Integer getPageNumber(StyleWithProperties style, Integer newPageNumber) {
if (style != null) {
// If style:paragraph-properties extists and contain
// style:page-number
String newPageNumberProperty = style.getParProperty(XMLString.STYLE_PAGE_NUMBER, true);
String newPageNumberProperty = style.getParProperty(STYLE_PAGE_NUMBER, true);
if (newPageNumberProperty != null) {
// Truncate auto and other string values
newPageNumberProperty = newPageNumberProperty.replaceAll("[^0-9]", "");
@ -1813,26 +1839,26 @@ public class TextConverter extends ConverterHelper {
currentMasterPage = sMasterPage;
// Set next master page
MasterPage masterPage = ofr.getFullMasterPage(currentMasterPage);
nextMasterPage = masterPage.getProperty(XMLString.STYLE_NEXT_STYLE_NAME);
nextMasterPage = masterPage.getProperty(STYLE_NEXT_STYLE_NAME);
}
} else if (nextMasterPage != null){
currentMasterPage = nextMasterPage;
MasterPage masterPage = ofr.getFullMasterPage(currentMasterPage);
nextMasterPage = masterPage.getProperty(XMLString.STYLE_NEXT_STYLE_NAME);
nextMasterPage = masterPage.getProperty(STYLE_NEXT_STYLE_NAME);
// System.out.println("Next master page is " + nextMasterPage);
}
}
private boolean checkHardBreakBefore(StyleWithProperties style) {
if (style != null && "page".equals(style.getProperty(XMLString.FO_BREAK_BEFORE))) {
if (style != null && "page".equals(style.getProperty(FO_BREAK_BEFORE))) {
return true;
}
return false;
}
private boolean checkHardBreakAfter(StyleWithProperties style) {
if (style != null && "page".equals(style.getProperty(XMLString.FO_BREAK_AFTER))) {
if (style != null && "page".equals(style.getProperty(FO_BREAK_AFTER))) {
return true;
}
return false;
@ -1887,8 +1913,8 @@ public class TextConverter extends ConverterHelper {
}
private boolean hasOutlineLevel(Node node) {
if (Misc.isElement(node)
&& Misc.getAttribute(node, XMLString.TEXT_OUTLINE_LEVEL) != null
&& !Misc.getAttribute(node, XMLString.TEXT_OUTLINE_LEVEL).isEmpty()) {
&& Misc.getAttribute(node, TEXT_OUTLINE_LEVEL) != null
&& !Misc.getAttribute(node, TEXT_OUTLINE_LEVEL).isEmpty()) {
String title = docSep.getTitle(node).trim();
if (title == null || title.isEmpty()) {
return false;