void getRows(ref FlowRowElement parentElement, IHaveChild block) { FlowRow currentRow = new FlowRow(); foreach (PrintElementBase current in block.Childs) { FlowRowElement currentRowElement = new FlowRowElement(current); if (current is LineBreak) { parentElement.ChildsRows.Add(currentRow); currentRow = new FlowRow(); currentRow.Elements.Add(currentRowElement); parentElement.ChildsRows.Add(currentRow); currentRow = new FlowRow(); } else { currentRow.Elements.Add(currentRowElement); if (current is IHaveChild) { getRows(ref currentRowElement, (IHaveChild)current); } } } }
void Reset(PrintElementBase element) { this.currentX = 0; this.currentY = 0; element.Bounds = Rect.Empty; IHaveChild haveChilds = element as IHaveChild; if (haveChilds != null) { foreach (PrintElementBase current in haveChilds.Childs) { Reset(current); } } }