// ------------------------------------------------------------------ // Dump text paragraph result. // ------------------------------------------------------------------ private static void DumpTextParagraphResult(XmlNode writer, TextParagraphResultW paragraph, Visual visualParent) { if (writer == null) { throw new ArgumentNullException("writer"); } if (paragraph == null) { throw new ArgumentNullException("paragraph"); } if (visualParent == null) { throw new ArgumentNullException("visualParent"); } XmlNode node = PropertyDumpCore.xmldoc.CreateElement("TextParagraph"); writer.AppendChild(node); DumpRect(node, "LayoutBox", paragraph.LayoutBox); DumpTextRange(node, paragraph.StartPosition, paragraph.EndPosition); DumpLineResults(node, paragraph.Lines, visualParent); ParagraphResultListW floatedObjects = paragraph.Floaters; if (floatedObjects != null) { DumpParagraphResults(writer, floatedObjects, visualParent); } floatedObjects = paragraph.Figures; if (floatedObjects != null) { DumpParagraphResults(writer, floatedObjects, visualParent); } }
// ------------------------------------------------------------------ // Dump paragraph results array. // ------------------------------------------------------------------ private static void DumpParagraphResults(XmlNode writer, ParagraphResultListW paragraphs, Visual visualParent) { if (writer == null) { throw new ArgumentNullException("writer"); } if (visualParent == null) { throw new ArgumentNullException("visualParent"); } if (paragraphs != null) { // Dump paragraphs array XmlNode node = PropertyDumpCore.xmldoc.CreateElement("Paragraphs"); writer.AppendChild(node); XmlAttribute attr = PropertyDumpCore.xmldoc.CreateAttribute("Count"); node.Attributes.Append(attr); int paragraphCount = 0; foreach (ParagraphResultW paragraph in paragraphs) { paragraphCount++; if (paragraph is TextParagraphResultW) { DumpTextParagraphResult(node, (TextParagraphResultW)paragraph, visualParent); } else if (paragraph is ContainerParagraphResultW) { DumpContainerParagraphResult(node, (ContainerParagraphResultW)paragraph, visualParent); } else if (paragraph is UIElementParagraphResultW) { DumpUIElementParagraphResult(node, (UIElementParagraphResultW)paragraph, visualParent); } else if (paragraph is TableParagraphResultW) { DumpTableParagraphResult(node, (TableParagraphResultW)paragraph, visualParent); } else if (paragraph is RowParagraphResultW) { DumpRowParagraphResult(node, (RowParagraphResultW)paragraph, visualParent); } else if (paragraph is FloaterParagraphResultW) { DumpFloaterParagraphResult(node, (FloaterParagraphResultW)paragraph, visualParent); } else if (paragraph is FigureParagraphResultW) { DumpFigureParagraphResult(node, (FigureParagraphResultW)paragraph, visualParent); } else if (paragraph is SubpageParagraphResultW) { DumpSubpageParagraphResult(node, (SubpageParagraphResultW)paragraph, visualParent); } else { //Hack: need to itentify if test code should be using the Debug Class /*Debug.Assert * ( * false, * String.Format * ( * "Dont know how to dump ParagraphResult wrapper of type {0} wrapping object of type {1}", * paragraph.GetType(), * paragraph.InnerObject.GetType() * ) * );*/ } } attr.Value = paragraphCount.ToString(CultureInfo.InvariantCulture); } }