Don't create new SPB in List splitter

This commit is contained in:
Georgy Litvinov 2021-03-12 20:45:25 +01:00
parent e2d03d7f93
commit d7d4b4083e

View file

@ -25,7 +25,7 @@ public class ListSplitter extends BasicSplitter implements ISplitter {
public SplitResults Split(Node list) { public SplitResults Split(Node list) {
Node parent = list.getParentNode(); Node parent = list.getParentNode();
// System.out.println("----Start ListSplitter------"); // System.out.println("----Start ListSplitter------");
// Debug.prettyPrintXml(parent); //Debug.prettyPrintXml(list.getOwnerDocument());
Node listFirstPart = list.cloneNode(false); Node listFirstPart = list.cloneNode(false);
NodeList listNodes = list.getChildNodes(); NodeList listNodes = list.getChildNodes();
Document document = list.getOwnerDocument(); Document document = list.getOwnerDocument();
@ -76,14 +76,16 @@ public class ListSplitter extends BasicSplitter implements ISplitter {
} }
} }
if (results.isDataMoved()) { if (results.isDataMoved()) {
//Debug.prettyPrintXml(list.getOwnerDocument());
((Element) list).setAttribute(TEXT_CONTINUE_NUMBERING, "true"); ((Element) list).setAttribute(TEXT_CONTINUE_NUMBERING, "true");
parent.insertBefore(listFirstPart, list); parent.insertBefore(listFirstPart, list);
parent.insertBefore(softPageBreak, list); //parent.insertBefore(softPageBreak, list);
results.setSPB(softPageBreak); results.setSPB(softPageBreak);
// System.out.println("LIST FIRST PART"); // System.out.println("LIST FIRST PART");
// Debug.printNode(listFirstPart); // Debug.printNode(listFirstPart);
// TODO: Create dummy list style to override list item to not teleport // TODO: Create dummy list style to override list item to not teleport
// second part but making it list item without list mark // second part but making it list item without list mark
//Debug.prettyPrintXml(list.getOwnerDocument());
if (nextPageItemPart != null) { if (nextPageItemPart != null) {
Node nextPageFirstNode = nextPageItemPart.getFirstChild(); Node nextPageFirstNode = nextPageItemPart.getFirstChild();
@ -97,9 +99,11 @@ public class ListSplitter extends BasicSplitter implements ISplitter {
} }
parent.insertBefore(freeNode, list); parent.insertBefore(freeNode, list);
} }
//Debug.prettyPrintXml(list.getOwnerDocument());
if (!nextPageItemPart.hasChildNodes()) { if (!nextPageItemPart.hasChildNodes()) {
list.removeChild(nextPageItemPart); list.removeChild(nextPageItemPart);
} }
//Debug.prettyPrintXml(list.getOwnerDocument());
} }
} else { } else {
@ -108,8 +112,7 @@ public class ListSplitter extends BasicSplitter implements ISplitter {
} }
// System.out.println("----Finish ListSplitter------"); // System.out.println("----Finish ListSplitter------");
// Debug.prettyPrintXml(parent); //Debug.prettyPrintXml(list.getOwnerDocument());
return results; return results;
} }