From 1c4f21c8f0fd35035bec563d1cf02e0fed8f4f90 Mon Sep 17 00:00:00 2001 From: George Litvinov Date: Thu, 22 Jun 2017 15:20:45 +0300 Subject: [PATCH] Split internal sections added. --- source/java/writer2latex/xhtml/Debug.java | 34 ++++++------------- .../java/writer2latex/xhtml/PageSplitter.java | 8 ++++- .../writer2latex/xhtml/TextConverter.java | 2 +- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/source/java/writer2latex/xhtml/Debug.java b/source/java/writer2latex/xhtml/Debug.java index ba4f162..67bdd02 100644 --- a/source/java/writer2latex/xhtml/Debug.java +++ b/source/java/writer2latex/xhtml/Debug.java @@ -1,34 +1,22 @@ package writer2latex.xhtml; -import java.io.StringWriter; - -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; +import org.w3c.dom.Document; import org.w3c.dom.Node; +import org.w3c.dom.ls.DOMImplementationLS; +import org.w3c.dom.ls.LSSerializer; + public class Debug { public static void printNode(Node node){ - TransformerFactory transFactory = TransformerFactory.newInstance(); - Transformer transformer; - try { - transformer = transFactory.newTransformer(); - StringWriter buffer = new StringWriter(); - transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - transformer.transform(new DOMSource(node), new StreamResult(buffer)); - String str = buffer.toString(); - System.out.println(str); - } catch (TransformerConfigurationException e1) { - e1.printStackTrace(); - } catch (TransformerException e) { - e.printStackTrace(); - } + + Document document = node.getOwnerDocument(); + DOMImplementationLS domImplLS = (DOMImplementationLS) document + .getImplementation(); + LSSerializer serializer = domImplLS.createLSSerializer(); + String str = serializer.writeToString(node); + System.out.println(str); } diff --git a/source/java/writer2latex/xhtml/PageSplitter.java b/source/java/writer2latex/xhtml/PageSplitter.java index 147f55b..28a64a2 100644 --- a/source/java/writer2latex/xhtml/PageSplitter.java +++ b/source/java/writer2latex/xhtml/PageSplitter.java @@ -484,7 +484,13 @@ public class PageSplitter { removeSPB(sectionNode); i++; continue; - } + } else if (nodeName.equals(XMLString.TEXT_SECTION)) { + if (handleSection(sectionChildFirstPart, sectionChildNode)){ + sectionFirstPart.appendChild(sectionChildFirstPart); + dataMoved=true; + } + } + //split node with spb and exit break; } else { sectionFirstPart.appendChild(sectionChildNode); diff --git a/source/java/writer2latex/xhtml/TextConverter.java b/source/java/writer2latex/xhtml/TextConverter.java index f3dfebe..6f7c83b 100644 --- a/source/java/writer2latex/xhtml/TextConverter.java +++ b/source/java/writer2latex/xhtml/TextConverter.java @@ -154,7 +154,7 @@ public class TextConverter extends ConverterHelper { } //Split pages onode = (Element) PageSplitter.splitSoftPageBreak(onode,ofr); - + //Debug.printNode(onode); // Convert content hnode = (Element)traverseBlockText(onode,hnode);