Example #1
0
        // ------------------------------------------------------------------
        // Dump paragraph offset.
        // ------------------------------------------------------------------
        private static Visual DumpParagraphOffset(XmlTextWriter writer, ParagraphResult paragraph, Visual visualParent)
        {
            Type paragraphResultType = paragraph.GetType();

            System.Reflection.FieldInfo field = paragraphResultType.GetField("_paraClient", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
            object paraClient     = field.GetValue(paragraph);
            Type   paraClientType = paraClient.GetType();

            System.Reflection.PropertyInfo prop = paraClientType.GetProperty("Visual", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
            Visual visual = (Visual)prop.GetValue(paraClient, null);

            // Dump transform relative to its parent
            if (visualParent.IsAncestorOf(visual))
            {
                GeneralTransform g     = visual.TransformToAncestor(visualParent);
                Point            point = new Point(0.0f, 0.0f);
                g.TryTransform(point, out point);

                if (point.X != 0 || point.Y != 0)
                {
                    DumpPoint(writer, "Origin", point);
                }
            }

            return(visual);
        }
Example #2
0
        // ------------------------------------------------------------------
        // Dump Cell specific data.
        // ------------------------------------------------------------------
        private static void DumpTableCell(XmlTextWriter writer, ParagraphResult paragraph, Visual cellVisual, Visual tableVisual)
        {
            Type paragraphResultType = paragraph.GetType();

            System.Reflection.FieldInfo fieldOfParaClient = paragraphResultType.GetField("_paraClient",
                                                                                         System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);

            if (fieldOfParaClient == null)
            {
                return;
            }

            CellParaClient cellParaClient = (CellParaClient)fieldOfParaClient.GetValue(paragraph);
            CellParagraph  cellParagraph  = cellParaClient.CellParagraph;
            TableCell      cell           = cellParagraph.Cell;

            writer.WriteStartElement("Cell");

            Type typeOfCell = cell.GetType();

            System.Reflection.PropertyInfo propOfColumnIndex = typeOfCell.GetProperty("ColumnIndex",
                                                                                      System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.DeclaredOnly);
            if (propOfColumnIndex != null)
            {
                int columnIndex = (int)propOfColumnIndex.GetValue(cell, null);
                writer.WriteAttributeString("ColumnIndex", columnIndex.ToString(CultureInfo.InvariantCulture));
            }

            System.Reflection.PropertyInfo propOfRowIndex = typeOfCell.GetProperty("RowIndex",
                                                                                   System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.DeclaredOnly);
            if (propOfRowIndex != null)
            {
                int rowIndex = (int)propOfRowIndex.GetValue(cell, null);
                writer.WriteAttributeString("RowIndex", rowIndex.ToString(CultureInfo.InvariantCulture));
            }

            writer.WriteAttributeString("ColumnSpan", cell.ColumnSpan.ToString(CultureInfo.InvariantCulture));
            writer.WriteAttributeString("RowSpan", cell.RowSpan.ToString(CultureInfo.InvariantCulture));

            Rect rect = cellParaClient.Rect.FromTextDpi();

            DumpRect(writer, "LayoutBox", rect);

            bool hasTextContent;

            DumpParagraphResults(writer, "Paragraphs", cellParaClient.GetColumnResults(out hasTextContent)[0].Paragraphs, cellParaClient.Visual);

            writer.WriteEndElement();
        }
Example #3
0
        // Token: 0x0600651C RID: 25884 RVA: 0x001C63D8 File Offset: 0x001C45D8
        private static Visual DumpParagraphOffset(XmlTextWriter writer, ParagraphResult paragraph, Visual visualParent)
        {
            Type         type     = paragraph.GetType();
            FieldInfo    field    = type.GetField("_paraClient", BindingFlags.Instance | BindingFlags.NonPublic);
            object       value    = field.GetValue(paragraph);
            Type         type2    = value.GetType();
            PropertyInfo property = type2.GetProperty("Visual", BindingFlags.Instance | BindingFlags.NonPublic);
            Visual       visual   = (Visual)property.GetValue(value, null);

            if (visualParent.IsAncestorOf(visual))
            {
                GeneralTransform generalTransform = visual.TransformToAncestor(visualParent);
                Point            point            = new Point(0.0, 0.0);
                generalTransform.TryTransform(point, out point);
                if (point.X != 0.0 || point.Y != 0.0)
                {
                    LayoutDump.DumpPoint(writer, "Origin", point);
                }
            }
            return(visual);
        }
Example #4
0
        // Token: 0x0600651E RID: 25886 RVA: 0x001C64F8 File Offset: 0x001C46F8
        private static void DumpTableCell(XmlTextWriter writer, ParagraphResult paragraph, Visual cellVisual, Visual tableVisual)
        {
            Type      type  = paragraph.GetType();
            FieldInfo field = type.GetField("_paraClient", BindingFlags.Instance | BindingFlags.NonPublic);

            if (field == null)
            {
                return;
            }
            CellParaClient cellParaClient = (CellParaClient)field.GetValue(paragraph);
            CellParagraph  cellParagraph  = cellParaClient.CellParagraph;
            TableCell      cell           = cellParagraph.Cell;

            writer.WriteStartElement("Cell");
            Type         type2    = cell.GetType();
            PropertyInfo property = type2.GetProperty("ColumnIndex", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic);

            if (property != null)
            {
                writer.WriteAttributeString("ColumnIndex", ((int)property.GetValue(cell, null)).ToString(CultureInfo.InvariantCulture));
            }
            PropertyInfo property2 = type2.GetProperty("RowIndex", BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic);

            if (property2 != null)
            {
                writer.WriteAttributeString("RowIndex", ((int)property2.GetValue(cell, null)).ToString(CultureInfo.InvariantCulture));
            }
            writer.WriteAttributeString("ColumnSpan", cell.ColumnSpan.ToString(CultureInfo.InvariantCulture));
            writer.WriteAttributeString("RowSpan", cell.RowSpan.ToString(CultureInfo.InvariantCulture));
            Rect rect = cellParaClient.Rect.FromTextDpi();

            LayoutDump.DumpRect(writer, "LayoutBox", rect);
            bool flag;

            LayoutDump.DumpParagraphResults(writer, "Paragraphs", cellParaClient.GetColumnResults(out flag)[0].Paragraphs, cellParaClient.Visual);
            writer.WriteEndElement();
        }