diff --git a/source/java/writer2latex/xhtml/TextConverter.java b/source/java/writer2latex/xhtml/TextConverter.java index e50d92c..6d56864 100644 --- a/source/java/writer2latex/xhtml/TextConverter.java +++ b/source/java/writer2latex/xhtml/TextConverter.java @@ -27,11 +27,9 @@ package writer2latex.xhtml; import java.util.Hashtable; import java.util.Stack; + import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.w3c.dom.ls.DOMImplementationLS; -import org.w3c.dom.ls.LSSerializer; -import org.w3c.dom.Document; import org.w3c.dom.Element; import writer2latex.util.Misc; @@ -110,6 +108,7 @@ public class TextConverter extends ConverterHelper { private String pageTags = config.getPageTags(); private boolean breakBeforeNextNode = false; private boolean inTable = false; + private boolean inList = false; public TextConverter(OfficeReader ofr, XhtmlConfig config, Converter converter) { super(ofr,config,converter); @@ -154,9 +153,12 @@ public class TextConverter extends ConverterHelper { } //Split pages onode = (Element) PageSplitter.splitSoftPageBreak(onode,ofr); + // Convert content hnode = (Element)traverseBlockText(onode,hnode); + + // Add footnotes and endnotes footCv.insertFootnotes(hnode,true); addFooter(hnode); @@ -253,7 +255,7 @@ public class TextConverter extends ConverterHelper { String nodeName = child.getNodeName(); // Block splitting nDontSplitLevel++; - + if (OfficeReader.isDrawElement(child)) { getDrawCv().handleDrawElement((Element)child,(Element)hnode,null,nFloatMode); } @@ -318,7 +320,42 @@ public class TextConverter extends ConverterHelper { nodeName.equals(XMLString.TEXT_UNORDERED_LIST) || // old nodeName.equals(XMLString.TEXT_ORDERED_LIST)) // old { - hnode = processPageBreaks(child, hnode,null); + StyleWithProperties style = null; + String newPageNumberProperty = null; + Element para = null; + Element head = null; + Element item = Misc.getChildByTagName(child, XMLString.TEXT_LIST_ITEM); + if (item != null){ + NodeList paras = item.getElementsByTagName(XMLString.TEXT_P); + if (paras != null && paras.getLength() > 0){ + para = (Element) paras.item(0); + } + NodeList heads = item.getElementsByTagName(XMLString.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)); + if (paraStyle != null) { + newPageNumberProperty = paraStyle.getParProperty(XMLString.STYLE_PAGE_NUMBER, true); + } + newPageNumberProperty = paraStyle.getParProperty(XMLString.STYLE_PAGE_NUMBER, true); + if (checkMasterPageBreak(paraStyle) || newPageNumberProperty != null){ + style = paraStyle; + } + } + if (head != null && style == null){ + StyleWithProperties headStyle = ofr.getParStyle(Misc.getAttribute(para,XMLString.TEXT_STYLE_NAME)); + if (headStyle != null) { + newPageNumberProperty = headStyle.getParProperty(XMLString.STYLE_PAGE_NUMBER, true); + } + if (checkMasterPageBreak(headStyle) || newPageNumberProperty != null){ + style = headStyle; + } + } + } + hnode = processPageBreaks(child, hnode,style); + inList = true; hnode = maybeSplit(hnode,null); if (listIsOnlyHeadings(child)) { nDontSplitLevel--; @@ -328,6 +365,7 @@ public class TextConverter extends ConverterHelper { else { handleList(child,nLevel+1,styleName,hnode); } + inList = false; } else if (nodeName.equals(XMLString.TABLE_TABLE)) { StyleWithProperties style = ofr.getTableStyle(Misc.getAttribute(child, XMLString.TABLE_STYLE_NAME)); @@ -1616,7 +1654,7 @@ public class TextConverter extends ConverterHelper { Misc.getPosInteger(node.getAttribute(XMLString.TEXT_OUTLINE_LEVEL),1): Misc.getPosInteger(node.getAttribute(XMLString.TEXT_LEVEL),1); } - private Node processPageBreaks(Node currentNode, Node hnode,StyleWithProperties style){ + private Node processPageBreaks(Node currentNode, Node hnode, StyleWithProperties style){ //Check for paragraph in current node in case currentNode is table // If currentNode is table //check for first para inside @@ -1625,8 +1663,9 @@ public class TextConverter extends ConverterHelper { if (inTable){ return hnode; } - - + if (inList){ + return hnode; + } Integer newPageNumber = null; if (style != null) { // If style:paragraph-properties extists and contain