Class DocumentStructureCollection
Represents a collection of document structure elements for managing and manipulating document layouts.
Inheritance
Namespace: Telerik.Windows.Documents.DocumentStructure
Assembly: Telerik.Windows.Controls.RichTextBox.dll
Syntax
public class DocumentStructureCollection : Object
Constructors
DocumentStructureCollection(LayoutBox)
DocumentStructureCollection(LayoutElement)
Declaration
public DocumentStructureCollection(LayoutElement layoutElement)
Parameters
LayoutElement
layoutElement
|
Properties
EnumerationStack
Represents a stack used for enumerating the document structure collection.
Declaration
public BoxParentsStack EnumerationStack { get; }
Property Value
BoxParentsStack
|
Methods
AddChild(LayoutBox, LayoutBox)
Adds a child LayoutBox to the collection.
Declaration
public void AddChild(LayoutBox parent, LayoutBox child)
Parameters
LayoutBox
parent
The parent LayoutBox to which the child will be added. |
LayoutBox
child
The child LayoutBox to be added. |
AddContainerChildBefore(LayoutBox, LayoutBox)
Adds a container child before a specified layout box in the document structure collection.
Declaration
public void AddContainerChildBefore(LayoutBox parent, LayoutBox newBox)
Parameters
LayoutBox
parent
The layout box before which the childBox will be added. |
LayoutBox
newBox
The layout box to be added as a child container. |
AddContainerChildBox(LayoutBox, LayoutBox)
Adds a container child box to the DocumentStructureCollection.
Declaration
public void AddContainerChildBox(LayoutBox parent, LayoutBox child)
Parameters
LayoutBox
parent
The parent LayoutBox to which the child will be added. |
LayoutBox
child
The child LayoutBox to be added to the parent. |
AddContainerSiblingAfter(LayoutBox, LayoutBox)
Adds a new container sibling after the specified layout box in the document structure collection.
Declaration
public void AddContainerSiblingAfter(LayoutBox layoutBox, LayoutBox newSibling)
Parameters
LayoutBox
layoutBox
The layout box after which the new container sibling will be added. |
LayoutBox
newSibling
The layout box that will be added as a sibling. |
AddContainerSiblingBefore(LayoutBox, LayoutBox)
Adds a container sibling before the specified layout box in the document structure collection.
Declaration
public void AddContainerSiblingBefore(LayoutBox layoutBox, LayoutBox newSibling)
Parameters
LayoutBox
layoutBox
The layout box before which the new container sibling will be added. |
LayoutBox
newSibling
The new container layout box to be added as a sibling. |
AddLeafChildBox(LayoutBox, LayoutBox)
Adds a leaf child box to the specified parent box within the document structure collection.
Declaration
public void AddLeafChildBox(LayoutBox parent, LayoutBox child)
Parameters
LayoutBox
parent
The parent layout box to which the child box will be added. |
LayoutBox
child
The child layout box to be added as a leaf. |
AddLeafSiblingAfter(LayoutBox, LayoutBox)
Adds a leaf sibling after the specified layout box in the document structure collection.
Declaration
public void AddLeafSiblingAfter(LayoutBox layoutBox, LayoutBox newSibling)
Parameters
LayoutBox
layoutBox
The layout box to which the new sibling will be added after. |
LayoutBox
newSibling
The layout box that will be added as a sibling. |
AddLeafSiblingBefore(LayoutBox, LayoutBox)
Adds a leaf sibling element before the specified layout box in the document structure collection.
Declaration
public void AddLeafSiblingBefore(LayoutBox layoutBox, LayoutBox newSibling)
Parameters
LayoutBox
layoutBox
The layout box before which the new sibling will be added. |
LayoutBox
newSibling
The layout box to be added as a sibling. |
AddSiblingAfter(LayoutBox, LayoutBox)
Adds a sibling layout box after the specified layout box in the document structure collection.
Declaration
public void AddSiblingAfter(LayoutBox layoutBox, LayoutBox newSibling)
Parameters
LayoutBox
layoutBox
The layout box to which the new sibling will be added after. |
LayoutBox
newSibling
The new layout box to be added as a sibling. |
AddSiblingBefore(LayoutBox, LayoutBox)
Declaration
public void AddSiblingBefore(LayoutBox layoutBox, LayoutBox newSibling)
Parameters
LayoutBox
layoutBox
The existing LayoutBox before which the new sibling will be added. |
LayoutBox
newSibling
The new LayoutBox to be added as a sibling. |
ClearChildren(LayoutBox)
Clears the children of the specified layout box from the document structure collection.
Declaration
public void ClearChildren(LayoutBox layoutBoxParent)
Parameters
LayoutBox
layoutBoxParent
The layout box whose children will be cleared from the collection. |
GetChildrenCount(LayoutBox)
Retrieves the number of child elements contained within the specified layout box.
Declaration
public static int GetChildrenCount(LayoutBox box)
Parameters
LayoutBox
box
The layout box for which to count the child elements. |
Returns
System.Int32
The number of child elements within the specified layout box. |
GetFirstChild(LayoutBox)
Retrieves the first child DocumentStructureCollection of the specified LayoutBox.
Declaration
public static LayoutBox GetFirstChild(LayoutBox box)
Parameters
LayoutBox
box
The layout box from which to retrieve the first child document. |
Returns
LayoutBox
The first child LayoutBox within the specified layout box, or null if no children exist. |
GetLastChild(LayoutBox)
Retrieves the last child element of the specified layout box in the document structure collection.
Declaration
public static LayoutBox GetLastChild(LayoutBox box)
Parameters
LayoutBox
box
The layout box from which to retrieve the last child. |
Returns
LayoutBox
The last child element of the specified layout box, or null if the layout box has no children. |
GetNextAssociatedLayoutBox(LayoutBox, DocumentElement)
Retrieves the next associated layout box for the specified layout box and document element.
Declaration
public static LayoutBox GetNextAssociatedLayoutBox(LayoutBox box, DocumentElement associatedDocumentElement)
Parameters
LayoutBox
box
The layout box for which to find the next associated layout box. |
DocumentElement
associatedDocumentElement
The document element that is associated with the layout box. |
Returns
LayoutBox
The next associated layout box, or null if no associated layout box is found. |
GetNextElementOfSameType(LayoutBox)
Retrieves the next element of the same type as the specified layout box within the document structure collection.
Declaration
public static LayoutBox GetNextElementOfSameType(LayoutBox box)
Parameters
LayoutBox
box
The layout box for which the next element of the same type is to be found. |
Returns
LayoutBox
Returns the next element of the same type as the specified layout box, or null if no such element exists. |
GetNextElementOfType(LayoutBox, Type)
Retrieves the next element of the specified type from the document structure collection, starting from the given layout box.
Declaration
public static LayoutBox GetNextElementOfType(LayoutBox box, Type type)
Parameters
LayoutBox
box
The starting layout box from which to search for the next element. |
System.Type
type
The type of the element to find within the document structure collection. |
Returns
LayoutBox
The next element of the specified type if found; otherwise, null. |
GetNextSibling(LayoutBox)
Retrieves the next sibling element in the document structure for the specified layout box.
Declaration
public static LayoutBox GetNextSibling(LayoutBox box)
Parameters
LayoutBox
box
The layout box for which to find the next sibling in the document structure. |
Returns
LayoutBox
A LayoutBox representing the next sibling, or null if there is no next sibling. |
GetNextSiblingForDocumentElement(LayoutBox, DocumentElement)
Retrieves the next sibling element for a specified document element within a layout box.
Declaration
public static LayoutBox GetNextSiblingForDocumentElement(LayoutBox box, DocumentElement owner)
Parameters
LayoutBox
box
The layout box in which the document element is located. |
DocumentElement
owner
The document element for which to find the next sibling. |
Returns
LayoutBox
The next sibling document element if it exists; otherwise, null. |
GetNextSiblingForDocumentElementOnSameLevel(LayoutBox, DocumentElement)
Retrieves the next sibling document element that is on the same level in the document structure as the specified document element.
Declaration
public static LayoutBox GetNextSiblingForDocumentElementOnSameLevel(LayoutBox box, DocumentElement owner)
Parameters
LayoutBox
box
The layout box in which the document element resides. |
DocumentElement
owner
The document element for which the next sibling is to be found. |
Returns
LayoutBox
The next sibling document element on the same level, or null if there is no such sibling. |
GetParent(LayoutBox)
Retrieves the parent element of the specified layout box within the document structure collection.
Declaration
public static LayoutBox GetParent(LayoutBox child)
Parameters
LayoutBox
child
The layout box for which to find the parent element. |
Returns
LayoutBox
The parent element of the specified layout box, or null if the layout box does not have a parent. |
GetPreviousElementOfSameType(LayoutBox)
Retrieves the previous element of the same type as the specified layout box within the document structure collection.
Declaration
public static LayoutBox GetPreviousElementOfSameType(LayoutBox box)
Parameters
LayoutBox
box
The layout box for which to find the previous element of the same type. |
Returns
LayoutBox
Returns the previous element of the same type if found; otherwise, returns null. |
GetPreviousElementOfType(LayoutBox, Type)
Retrieves the previous element of the specified type from a given layout box.
Declaration
public static LayoutBox GetPreviousElementOfType(LayoutBox box, Type type)
Parameters
LayoutBox
box
The layout box from which to retrieve the previous element. |
System.Type
type
The type of element to find. |
Returns
LayoutBox
The previous element of the specified type if found; otherwise, null. |
GetPreviousSibling(LayoutBox)
Retrieves the previous sibling of the specified layout box within the document structure collection.
Declaration
public static LayoutBox GetPreviousSibling(LayoutBox box)
Parameters
LayoutBox
box
The layout box for which to find the previous sibling. |
Returns
LayoutBox
The previous sibling layout box if it exists; otherwise, null. |
GetPreviousSiblingForDocumentElement(LayoutBox, DocumentElement)
Retrieves the previous sibling of the specified document element within the document structure collection.
Declaration
public static LayoutBox GetPreviousSiblingForDocumentElement(LayoutBox box, DocumentElement owner)
Parameters
LayoutBox
box
The layout box associated with the document element. |
DocumentElement
owner
The document element for which the previous sibling is to be retrieved. |
Returns
LayoutBox
Returns the previous sibling document element if it exists; otherwise, returns null. |
GetPreviousSiblingForDocumentElementOnSamelevel(LayoutBox, DocumentElement)
Retrieves the previous sibling of the specified document element at the same level in the document structure.
Declaration
public static LayoutBox GetPreviousSiblingForDocumentElementOnSamelevel(LayoutBox box, DocumentElement owner)
Parameters
LayoutBox
box
The layout box associated with the document element. |
DocumentElement
owner
The document element for which to find the previous sibling. |
Returns
LayoutBox
The previous sibling document element at the same level if found; otherwise, null. |
GetRootBox()
Retrieves the root box of the document structure collection.
Declaration
public DocumentLayoutBox GetRootBox()
Returns
DocumentLayoutBox
A DocumentLayoutBox representing the root box. |
HasChildren(LayoutBox)
Determines whether the specified layout box has any child elements in the document structure collection.
Declaration
public static bool HasChildren(LayoutBox box)
Parameters
LayoutBox
box
The layout box to check for child elements. |
Returns
System.Boolean
Returns true if the layout box has children; otherwise, false. |
MergeContainers()
Merges the container elements within the document structure collection.
Declaration
public void MergeContainers()
MergeContainers(LayoutBox)
Merges the specified layout box into the document structure collection.
Declaration
public void MergeContainers(LayoutBox fromBox)
Parameters
LayoutBox
fromBox
The layout box to be merged into the document structure collection. |
MergeLongWords(ParagraphLayoutBox)
Merges long words in the specified paragraph layout box within the document structure collection.
Declaration
public void MergeLongWords(ParagraphLayoutBox paragraphLayoutBox)
Parameters
ParagraphLayoutBox
paragraphLayoutBox
The paragraph layout box that contains the long words to be merged. |
MergeLongWordsFromBox(InlineLayoutBox, DocumentElement)
Merges long words from the specified layout box into the provided document element.
Declaration
public void MergeLongWordsFromBox(InlineLayoutBox layoutBox, DocumentElement associatedDocumentElement)
Parameters
InlineLayoutBox
layoutBox
The inline layout box containing the words to be merged. |
DocumentElement
associatedDocumentElement
The document element where the merged words will be incorporated. |
MergeTableRowBoxes(TableRowLayoutBox, TableRowLayoutBox)
Merges two table row layout boxes into a single row layout box.
Declaration
public void MergeTableRowBoxes(TableRowLayoutBox firstRow, TableRowLayoutBox secondRow)
Parameters
TableRowLayoutBox
firstRow
The first table row layout box to merge. |
TableRowLayoutBox
secondRow
The second table row layout box to merge. |
MergeTwoLayoutBoxes(LayoutBox, LayoutBox, Boolean)
Merges two layout boxes into a single layout box.
Declaration
public void MergeTwoLayoutBoxes(LayoutBox firstBox, LayoutBox secondBox, bool shouldFinalizeRemoval = true)
Parameters
LayoutBox
firstBox
The first layout box to be merged. |
LayoutBox
secondBox
The second layout box to be merged. |
System.Boolean
shouldFinalizeRemoval
Indicates whether to adjust the layout after merging. |
RemoveChild(LayoutBox)
Removes the specified child LayoutBox from the collection.
Declaration
public void RemoveChild(LayoutBox child)
Parameters
LayoutBox
child
The LayoutBox to be removed from the collection. |
RemoveLastChild(LayoutBox)
Removes the last child element from the DocumentStructureCollection.
Declaration
public void RemoveLastChild(LayoutBox parent)
Parameters
LayoutBox
parent
The LayoutBox to be removed from the collection. |
RemoveLeafSiblingAfter(LayoutBox)
Removes the leaf sibling that appears after the specified layout box in the document structure collection.
Declaration
public void RemoveLeafSiblingAfter(LayoutBox layoutBox)
Parameters
LayoutBox
layoutBox
The layout box after which the leaf sibling will be removed. |
ReplaceLayoutBox(LayoutBox, SpanLayoutBox)
Replaces an existing layout box in the document structure collection with a new span layout box.
Declaration
public static void ReplaceLayoutBox(LayoutBox boxWithNodeToUpdate, SpanLayoutBox newNodeValue)
Parameters
LayoutBox
boxWithNodeToUpdate
The layout box that will be replaced. |
SpanLayoutBox
newNodeValue
The span layout box that will replace the old layout box. |
SplitContainer(LayoutBox, LayoutBox, LayoutBox)
Splits a container into multiple layout boxes based on the specified layout boxes.
Declaration
public void SplitContainer(LayoutBox boxToSplit, LayoutBox fromLayoutBox, LayoutBox newLayoutBox)
Parameters
LayoutBox
boxToSplit
The layout box to be split. |
LayoutBox
fromLayoutBox
The layout box that will represent the first part after the split. |
LayoutBox
newLayoutBox
The layout box that will represent the second part after the split. |
ToString()
Returns a string representation of the DocumentStructureCollection instance.
Declaration
public override string ToString()
Returns
System.String
A string that represents the current DocumentStructureCollection object. |