Improved hierarchy extraction
This commit is contained in:
@@ -87,7 +87,7 @@ namespace QuestPDF.Drawing
|
||||
RenderPass(pageContext, canvas, content);
|
||||
|
||||
if (applyInspection)
|
||||
inspectionResultHandler(DocumentHierarchyProcessor.ExtractDocumentHierarchy(content));
|
||||
inspectionResultHandler(content.ExtractDocumentHierarchy());
|
||||
}
|
||||
|
||||
internal static void RenderPass<TCanvas>(PageContext pageContext, TCanvas canvas, Container content)
|
||||
@@ -183,7 +183,7 @@ namespace QuestPDF.Drawing
|
||||
{
|
||||
content.VisitChildren(x =>
|
||||
{
|
||||
x.CreateProxy(y => y is ElementProxy ? y : new InspectionProxy(y));
|
||||
x.CreateProxy(y => y is ElementProxy or Container ? y : new InspectionProxy(y));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace QuestPDF.Drawing.Proxy
|
||||
{
|
||||
internal class InspectionProxy : ElementProxy
|
||||
{
|
||||
|
||||
public Dictionary<int, InspectionStateItem> Statistics { get; set; } = new();
|
||||
|
||||
public InspectionProxy(Element child)
|
||||
|
||||
@@ -6,7 +6,7 @@ using QuestPDF.Infrastructure;
|
||||
|
||||
namespace QuestPDF.Elements
|
||||
{
|
||||
internal class ColumnItem : Container
|
||||
internal class ColumnItem : ContainerElement
|
||||
{
|
||||
public bool IsRendered { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System.ComponentModel;
|
||||
using QuestPDF.Infrastructure;
|
||||
|
||||
namespace QuestPDF.Elements
|
||||
{
|
||||
internal class DebugPointer : Container
|
||||
internal class DebugPointer : ContainerElement
|
||||
{
|
||||
public string Target { get; set; }
|
||||
public bool Highlight { get; set; }
|
||||
|
||||
@@ -6,7 +6,7 @@ using QuestPDF.Infrastructure;
|
||||
|
||||
namespace QuestPDF.Elements
|
||||
{
|
||||
internal class InlinedElement : Container
|
||||
internal class InlinedElement : ContainerElement
|
||||
{
|
||||
|
||||
}
|
||||
@@ -49,6 +49,11 @@ namespace QuestPDF.Elements
|
||||
return Elements;
|
||||
}
|
||||
|
||||
internal override void CreateProxy(Func<Element?, Element?> create)
|
||||
{
|
||||
Elements.ForEach(x => x.Child = create(x.Child));
|
||||
}
|
||||
|
||||
internal override SpacePlan Measure(Size availableSpace)
|
||||
{
|
||||
SetDefaultAlignment();
|
||||
|
||||
@@ -20,6 +20,11 @@ namespace QuestPDF.Elements
|
||||
return Children;
|
||||
}
|
||||
|
||||
internal override void CreateProxy(Func<Element?, Element?> create)
|
||||
{
|
||||
Children.ForEach(x => x.Child = create(x.Child));
|
||||
}
|
||||
|
||||
internal override SpacePlan Measure(Size availableSpace)
|
||||
{
|
||||
return Children
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace QuestPDF.Elements
|
||||
Relative
|
||||
}
|
||||
|
||||
internal class RowItem : Container
|
||||
internal class RowItem : ContainerElement
|
||||
{
|
||||
public bool IsRendered { get; set; }
|
||||
public float Width { get; set; }
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace QuestPDF.Elements.Table
|
||||
return Cells;
|
||||
}
|
||||
|
||||
internal override void CreateProxy(Func<Element?, Element?> create)
|
||||
{
|
||||
Cells.ForEach(x => x.Child = create(x.Child));
|
||||
}
|
||||
|
||||
public void ResetState()
|
||||
{
|
||||
Initialize();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using QuestPDF.Infrastructure;
|
||||
|
||||
namespace QuestPDF.Elements.Table
|
||||
{
|
||||
internal class TableCell : Container, ITableCellContainer
|
||||
internal class TableCell : ContainerElement, ITableCellContainer
|
||||
{
|
||||
public int Row { get; set; } = 0;
|
||||
public int RowSpan { get; set; } = 1;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace QuestPDF.Infrastructure
|
||||
|
||||
}
|
||||
|
||||
class Slot : Container, ISlot
|
||||
class Slot : ContainerElement, ISlot
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ public static class DocumentHierarchyProcessor
|
||||
{
|
||||
internal static InspectionElement ExtractDocumentHierarchy(this Container content)
|
||||
{
|
||||
content.RemoveExistingContainers();
|
||||
|
||||
var proxies = content.ExtractProxyOfType<InspectionProxy>();
|
||||
return Map(proxies);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user