diff --git a/QuestPDF/Drawing/DocumentGenerator.cs b/QuestPDF/Drawing/DocumentGenerator.cs index be8d0ac..c9b4707 100644 --- a/QuestPDF/Drawing/DocumentGenerator.cs +++ b/QuestPDF/Drawing/DocumentGenerator.cs @@ -87,7 +87,7 @@ namespace QuestPDF.Drawing RenderPass(pageContext, canvas, content); if (applyInspection) - inspectionResultHandler(DocumentHierarchyProcessor.ExtractDocumentHierarchy(content)); + inspectionResultHandler(content.ExtractDocumentHierarchy()); } internal static void RenderPass(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)); }); } diff --git a/QuestPDF/Drawing/Proxy/InspectionProxy.cs b/QuestPDF/Drawing/Proxy/InspectionProxy.cs index 07767ea..6f66a33 100644 --- a/QuestPDF/Drawing/Proxy/InspectionProxy.cs +++ b/QuestPDF/Drawing/Proxy/InspectionProxy.cs @@ -7,7 +7,6 @@ namespace QuestPDF.Drawing.Proxy { internal class InspectionProxy : ElementProxy { - public Dictionary Statistics { get; set; } = new(); public InspectionProxy(Element child) diff --git a/QuestPDF/Elements/Column.cs b/QuestPDF/Elements/Column.cs index 03ebcc1..f981c66 100644 --- a/QuestPDF/Elements/Column.cs +++ b/QuestPDF/Elements/Column.cs @@ -6,7 +6,7 @@ using QuestPDF.Infrastructure; namespace QuestPDF.Elements { - internal class ColumnItem : Container + internal class ColumnItem : ContainerElement { public bool IsRendered { get; set; } } diff --git a/QuestPDF/Elements/DebugPointer.cs b/QuestPDF/Elements/DebugPointer.cs index ea7d342..d25743c 100644 --- a/QuestPDF/Elements/DebugPointer.cs +++ b/QuestPDF/Elements/DebugPointer.cs @@ -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; } diff --git a/QuestPDF/Elements/Inlined.cs b/QuestPDF/Elements/Inlined.cs index dabab48..8635b43 100644 --- a/QuestPDF/Elements/Inlined.cs +++ b/QuestPDF/Elements/Inlined.cs @@ -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 create) + { + Elements.ForEach(x => x.Child = create(x.Child)); + } + internal override SpacePlan Measure(Size availableSpace) { SetDefaultAlignment(); diff --git a/QuestPDF/Elements/Layers.cs b/QuestPDF/Elements/Layers.cs index bde5ba6..a5b615f 100644 --- a/QuestPDF/Elements/Layers.cs +++ b/QuestPDF/Elements/Layers.cs @@ -20,6 +20,11 @@ namespace QuestPDF.Elements return Children; } + internal override void CreateProxy(Func create) + { + Children.ForEach(x => x.Child = create(x.Child)); + } + internal override SpacePlan Measure(Size availableSpace) { return Children diff --git a/QuestPDF/Elements/Row.cs b/QuestPDF/Elements/Row.cs index bcbe89e..e6efa5e 100644 --- a/QuestPDF/Elements/Row.cs +++ b/QuestPDF/Elements/Row.cs @@ -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; } diff --git a/QuestPDF/Elements/Table/Table.cs b/QuestPDF/Elements/Table/Table.cs index 8decf6c..7aa4a59 100644 --- a/QuestPDF/Elements/Table/Table.cs +++ b/QuestPDF/Elements/Table/Table.cs @@ -34,6 +34,11 @@ namespace QuestPDF.Elements.Table return Cells; } + internal override void CreateProxy(Func create) + { + Cells.ForEach(x => x.Child = create(x.Child)); + } + public void ResetState() { Initialize(); diff --git a/QuestPDF/Elements/Table/TableCell.cs b/QuestPDF/Elements/Table/TableCell.cs index 52d88a1..c70039c 100644 --- a/QuestPDF/Elements/Table/TableCell.cs +++ b/QuestPDF/Elements/Table/TableCell.cs @@ -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; diff --git a/QuestPDF/Infrastructure/IComponent.cs b/QuestPDF/Infrastructure/IComponent.cs index dc03736..1a2ee28 100644 --- a/QuestPDF/Infrastructure/IComponent.cs +++ b/QuestPDF/Infrastructure/IComponent.cs @@ -7,7 +7,7 @@ namespace QuestPDF.Infrastructure } - class Slot : Container, ISlot + class Slot : ContainerElement, ISlot { } diff --git a/QuestPDF/Previewer/Inspection/DocumentHierarchyProcessor.cs b/QuestPDF/Previewer/Inspection/DocumentHierarchyProcessor.cs index 20553ec..6329b87 100644 --- a/QuestPDF/Previewer/Inspection/DocumentHierarchyProcessor.cs +++ b/QuestPDF/Previewer/Inspection/DocumentHierarchyProcessor.cs @@ -13,6 +13,8 @@ public static class DocumentHierarchyProcessor { internal static InspectionElement ExtractDocumentHierarchy(this Container content) { + content.RemoveExistingContainers(); + var proxies = content.ExtractProxyOfType(); return Map(proxies);