private ArrayList FindChildSplitPositions(CompositeNode node)
{
// A node may span across multiple pages so a list of split positions is returned.
// The split node is the first node on the next page.
ArrayList splitList = new ArrayList();
int startingPage = mPageNumberFinder.GetPage(node);
Node[] childNodes = node.NodeType == NodeType.Section ?
((Section)node).Body.ChildNodes.ToArray() : node.ChildNodes.ToArray();
foreach (Node childNode in childNodes)
{
int pageNum = mPageNumberFinder.GetPage(childNode);
// If the page of the child node has changed then this is the split position. Add
// This to the list.
if (pageNum > startingPage)
{
splitList.Add(childNode);
startingPage = pageNum;
}
if (mPageNumberFinder.PageSpan(childNode) > 1)
mPageNumberFinder.AddPageNumbersForNode(childNode, pageNum, pageNum);
}
// Split composites backward so the cloned nodes are inserted in the right order.
splitList.Reverse();
return splitList;
}