Stores layout boxes as a linked sequence with paired boundary nodes for container boxes, enabling tree traversal and edits.
Definition
Namespace:Telerik.WinForms.Documents.DocumentStructure
Assembly:Telerik.WinControls.RichTextEditor.dll
Syntax:
public class DocumentStructureCollection
Inheritance: objectDocumentStructureCollection
Constructors
Initializes a document structure collection rooted at the specified layout box. Container roots receive paired boundary nodes; leaf roots are stored as a single node.
public DocumentStructureCollection(LayoutBox rootBox)
The layout box at the root of the structure.
Initializes a document structure collection rooted at the specified layout element.
public DocumentStructureCollection(LayoutElement layoutElement)
The root element, which must be a LayoutBox.
Properties
Gets the stack of layout boxes active during the current structure traversal.
public BoxParentsStack EnumerationStack { get; }
Methods
Inserts a split inline box immediately after the specified box.
public void AddLeafSiblingAfter(LayoutBox layoutBox, LayoutBox newSibling)
The existing inline box that precedes the new box.
newSiblingLayoutBoxThe inline box to insert.
Exceptions: InvalidOperationExceptionnewSibling is not an InlineLayoutBox.
Inserts a split inline box immediately before the specified box. If both boxes represent the same document element, updates its first-layout-box reference when needed.
public void AddLeafSiblingBefore(LayoutBox layoutBox, LayoutBox newSibling)
The existing inline box that follows the new box.
newSiblingLayoutBoxThe inline box to insert.
Exceptions: InvalidOperationExceptionnewSibling is not an InlineLayoutBox.
Inserts a sibling after the specified box, using container or leaf node handling as appropriate.
Inserts a sibling before the specified box, using container or leaf node handling as appropriate.
Removes all direct children of the specified box and invalidates measurement up to the root.
public void ClearChildren(LayoutBox layoutBoxParent)
The box whose children are removed.
Gets the next layout box representing the specified document element. Flow-ordered boxes use their associated-box link; other boxes search same-level siblings.
public static LayoutBox GetNextAssociatedLayoutBox(LayoutBox box, DocumentElement associatedDocumentElement)
The box from which to continue the search.
associatedDocumentElementDocumentElementThe document element represented by the returned box.
Returns:The next associated box, or null when none is found.
Finds the next box assignable to the specified box's concrete runtime type.
Finds the next box in logical layout order whose runtime type is assignable to the specified type.
Gets the next same-type sibling in the owner scope; the sibling or its parent may represent that document element. Inline boxes are searched by the shared InlineLayoutBox type.
public static LayoutBox GetNextSiblingForDocumentElement(LayoutBox box, DocumentElement owner)
The box whose next sibling is requested.
ownerDocumentElementThe document element that constrains the search.
Returns:The matching next sibling, or null when none is found.
Finds the next box at the same logical level, accounting for container boundaries in the linked structure.
public static LayoutBox GetNextSiblingForDocumentElementOnSameLevel(LayoutBox box, DocumentElement owner)
The box from which to search forward.
ownerDocumentElementAn optional owner checked when searching across container boundaries; a direct sibling is returned without checking it.
Returns:The next box at the same level, or null when none matches.
Finds the previous box assignable to the specified box's concrete runtime type.
Finds the previous box in logical layout order whose runtime type is assignable to the specified type.
Gets the previous same-type sibling in the owner scope; the sibling or its parent may represent that document element. Inline boxes are searched by the shared InlineLayoutBox type.
public static LayoutBox GetPreviousSiblingForDocumentElement(LayoutBox box, DocumentElement owner)
The box whose previous sibling is requested.
ownerDocumentElementThe document element that constrains the search.
Returns:The matching previous sibling, or null when none is found.
Finds the previous box at the same logical level, accounting for container boundaries in the linked structure.
public static LayoutBox GetPreviousSiblingForDocumentElementOnSamelevel(LayoutBox box, DocumentElement owner)
The box from which to search backward.
ownerDocumentElementAn optional owner checked when searching across container boundaries; a direct sibling is returned without checking it.
Returns:The previous box at the same level, or null when none matches.
Gets the root box when it is a document layout box.
public DocumentLayoutBox GetRootBox()
The root DocumentLayoutBox, or null when the root has another type.
Merges compatible adjacent containers throughout the root document and invalidates the root layout.
public void MergeContainers()
Merges compatible adjacent containers beginning at the specified layout box.
public void MergeContainers(LayoutBox fromBox)
The container at which merging begins.
Merges adjacent span fragments in a paragraph when their layout boxes can be combined.
public void MergeLongWords(ParagraphLayoutBox paragraphLayoutBox)
The paragraph whose inline boxes are examined.
Merges adjacent compatible span fragments starting at the specified inline box. When an associated element is supplied, merging is limited to spans representing that element.
public void MergeLongWordsFromBox(InlineLayoutBox layoutBox, DocumentElement associatedDocumentElement)
The inline box from which the search begins.
associatedDocumentElementDocumentElementThe document element that limits the merge, or null to process subsequent spans.
Merges the content of a table-row slice into its preceding row box and removes the slice.
public void MergeTableRowBoxes(TableRowLayoutBox firstRow, TableRowLayoutBox secondRow)
The row box that receives matching cell content.
secondRowTableRowLayoutBoxThe adjacent row slice whose cell content is merged.
Merges the second container box into the first, reparents its remaining children, and invalidates layout.
public void MergeTwoLayoutBoxes(LayoutBox firstBox, LayoutBox secondBox, bool shouldFinalizeRemoval = true)
The container that receives the merged content.
secondBoxLayoutBoxThe container whose content is merged into firstBox.
true to finalize removal of the second box's associated document element.
Removes a box and, for a container, all of its descendants from the document structure. Updates the associated document element's first-layout-box reference when necessary.
Removes the last child entry from a container. For a container child, this implementation removes its start node and the following node, so it is safe only when that child has no descendants.
public void RemoveLastChild(LayoutBox parent)
The container whose last child is removed.
Removes the immediate next node unless it is a container-closing boundary.
public void RemoveLeafSiblingAfter(LayoutBox layoutBox)
The box before the node to remove.
Replaces a box's node value with a span layout box while preserving the node's position and parent. Raises the old box's structure-change notifications as it is removed.
public static void ReplaceLayoutBox(LayoutBox boxWithNodeToUpdate, SpanLayoutBox newNodeValue)
The box whose node is reused.
newNodeValueSpanLayoutBoxThe span layout box assigned to that node.
Splits a container at the specified child, placing that child and subsequent siblings in a new layout box.
Passing null for fromLayoutBox creates an empty fragment at the end.
public void SplitContainer(LayoutBox boxToSplit, LayoutBox fromLayoutBox, LayoutBox newLayoutBox)
The container to split.
fromLayoutBoxLayoutBoxThe first child moved to the new fragment, or null to create an empty fragment.
newLayoutBoxLayoutBoxThe new container that receives the fragment.
Returns a diagnostic representation of the linked layout structure, including node kinds and box indices.
public override string ToString()
A multiline description of the layout boxes in this collection.
Overrides: