From f482e1a0549b9b0a46b5acfb3bdece599762147c Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Wed, 31 Aug 2016 10:14:49 +0300 Subject: [PATCH] added space in case empty paragraph with SPB at page slicing --- source/java/writer2latex/xhtml/PageSplitter.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/source/java/writer2latex/xhtml/PageSplitter.java b/source/java/writer2latex/xhtml/PageSplitter.java index 4acf852..3012fc4 100644 --- a/source/java/writer2latex/xhtml/PageSplitter.java +++ b/source/java/writer2latex/xhtml/PageSplitter.java @@ -513,11 +513,11 @@ public class PageSplitter { //SPB FOUND if (checkSoftPageBreak(paraChildNode, false)){ if (nodeName.equals(XMLString.TEXT_SOFT_PAGE_BREAK)){ - // remove inner soft page break node - paraNode.removeChild(paraChildNode); + + //Next node in paragraph. If it is text node go further - Node paraNextNode = paraChildNodes.item(i); + Node paraNextNode = paraChildNodes.item(i+1); Node paraPrevNode = paraFirstPart.getLastChild(); String nextText = null; String prevText = null; @@ -550,6 +550,15 @@ public class PageSplitter { } } } + // In case paragraph is empty add space to prevent it's removing + if (paraNextNode == null && paraPrevNode == null){ + Document doc = paraNode.getOwnerDocument(); + Node space = doc.createTextNode(" "); + paraNode.insertBefore(space, paraChildNode); + } + + // remove inner soft page break node + paraNode.removeChild(paraChildNode); /* Check if next node in para is text and first char is a letter * Check if last node in paraFirstPart is text and last char is a letter