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