Refactored list item split method
This commit is contained in:
parent
874aae1e80
commit
457caad4fc
1 changed files with 9 additions and 4 deletions
|
@ -199,12 +199,12 @@ public class ODFPageSplitter {
|
|||
|
||||
} else if (nodeName.equals(TEXT_LIST_ITEM)) {
|
||||
if (containsSPB(child)){
|
||||
Node listItemFirstPart = child.cloneNode(false);
|
||||
|
||||
//remove SPB, move previous nodes to firstPart.
|
||||
if (handleListItem(listItemFirstPart,child)){
|
||||
if (handleListItem(child)){
|
||||
dataMoved = true;
|
||||
//Add first part of list item to previous list item
|
||||
listFirstPart.appendChild(listItemFirstPart);
|
||||
listFirstPart.appendChild(child.getPreviousSibling());
|
||||
//Get list parent node and move cutted node
|
||||
//After First Part and SPB but before this list;
|
||||
//TODO!!!!!!!!!!
|
||||
|
@ -242,7 +242,9 @@ public class ODFPageSplitter {
|
|||
}
|
||||
//If SPB before first item - return false, remove SPB
|
||||
//Otherwise add childNodes before SPB to firstPart, return true
|
||||
private static boolean handleListItem(Node listItemFirstPart, Node listItem){
|
||||
private static boolean handleListItem(Node listItem){
|
||||
Node listItemFirstPart = listItem.cloneNode(false);
|
||||
Node parent = listItem.getParentNode();
|
||||
int i = 0;
|
||||
boolean dataMoved = false;
|
||||
NodeList listItemNodes = listItem.getChildNodes();
|
||||
|
@ -283,6 +285,9 @@ public class ODFPageSplitter {
|
|||
}
|
||||
//check internal nodes
|
||||
}
|
||||
if(dataMoved) {
|
||||
parent.insertBefore(listItemFirstPart, listItem);
|
||||
}
|
||||
return dataMoved;
|
||||
}
|
||||
//Needs finish
|
||||
|
|
Loading…
Add table
Reference in a new issue