Esempio n. 1
0
        // ------------------------------------------------------------------
        // Dump content of DocumentPage.
        // ------------------------------------------------------------------
        internal static void DumpDocumentPage(XmlTextWriter writer, DocumentPage page, Visual parent)
        {
            writer.WriteStartElement("DocumentPage");
            writer.WriteAttributeString("Type", page.GetType().FullName);

            if (page != DocumentPage.Missing)
            {
                DumpSize(writer, "Size", page.Size);

                // Dump transform relative to its parent
                GeneralTransform g = page.Visual.TransformToAncestor(parent);
                Point point = new Point(0, 0);
                g.TryTransform(point, out point);
                if (point.X != 0 || point.Y != 0)
                {
                    DumpPoint(writer, "Position", point);
                }

                // Dump page specific information
                Type t = page.GetType();
                DumpCustomDocumentPage dumpDocumentPage = null;
                while(dumpDocumentPage==null && t!=null)
                {                
                    dumpDocumentPage = _documentPageToDumpHandler[t] as DumpCustomDocumentPage;
                    t = t.BaseType;
                }
                if (dumpDocumentPage != null)
                {
                    dumpDocumentPage(writer, page);
                }                
            }

            writer.WriteEndElement();
        }