New to Telerik UI for WinForms? Start a free 30-day trial

Represents a measured fragment of a document span, with text positions used by paragraph layout and navigation.

Definition

Namespace:Telerik.WinForms.Documents.Layout

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

C#
public class SpanLayoutBox : InlineLayoutBox, IDisposable, ICustomTypeDescriptor, INotifyPropertyChanged

Inheritance: objectDisposableObjectRadObjectLayoutElementLayoutBoxInlineLayoutBoxSpanLayoutBox...

Derived Classes: FormattingSymbolLayoutBox

Implements: ICustomTypeDescriptorIDisposableINotifyPropertyChanged

Inherited Members InlineLayoutBox.Remove()InlineLayoutBox.LineInfoInlineLayoutBox.LineSegmentInfoInlineLayoutBox.IsRtlInlineLayoutBox.AssociatedInlineInlineLayoutBox.IsStartOfLineSegmentLayoutBox.currentYLayoutBox.AssociatedLayoutBoxPropertyLayoutBox.NodeLayoutBox.GetAssociatedLayoutBox(UIElement)LayoutBox.SetAssociatedLayoutBox(UIElement, LayoutBox)LayoutBox.OnElementStructureChanging()LayoutBox.OnElementStructureChanged()LayoutBox.CreateChildrenCollection(DocumentStructureCollection)LayoutBox.InvalidateMeasureUpToTheRoot()LayoutBox.InvalidateMeasureUpToTheRootStable()LayoutBox.InvalidateArrangeUpToTheRoot()LayoutBox.InvalidateLayoutAfterEdit()LayoutBox.ValidateChild(LayoutBox)LayoutBox.GetRootDocument()LayoutBox.CanGrowVerticallyOverride(float)LayoutBox.CanGrowVertically(float)LayoutBox.GetBoxDesiredGrow()LayoutBox.CreateNewFragment(LayoutBox)LayoutBox.InvalidateMeasure()LayoutBox.IsRemovedLayoutBox.IsFragmentLayoutBox.AssociatedDocumentElementLayoutBox.ChildLayoutBoxesLayoutBox.HasVisualRepresentationLayoutBox.IsFormattingSymbolLayoutBox.BoundsChildBoxesLayoutBox.IsFirstBoxLayoutBox.IsLastBoxLayoutBox.IsFirstChildLayoutBox.IsLastChildLayoutBox.IsValidPositionLayoutBox.ParentLayoutBox.ChildIndexLayoutBox.BoundingRectangleLayoutBox.ElementStructureChangingLayoutBox.ElementStructureChangedLayoutElement.EnsureChildrenCreated()LayoutElement.CreateChildren()LayoutElement.OnBitStateChanged(DocumentElementStates, bool, bool)LayoutElement.SetBitState(DocumentElementStates, bool)LayoutElement.ValidateParent(LayoutElement)LayoutElement.SetParent(LayoutElement, LayoutElement)LayoutElement.SetParentCore(LayoutElement)LayoutElement.IsInValidState(bool)LayoutElement.OnInvalidateMeasure()LayoutElement.InvalidateMeasure(bool)LayoutElement.InvalidateArrange()LayoutElement.OnInvalidateArrange()LayoutElement.InvalidateArrange(bool)LayoutElement.Arrange(RectangleF)LayoutElement.ArrangeCore(RectangleF)LayoutElement.ArrangeOverride(SizeF)LayoutElement.Measure(SizeF)LayoutElement.MeasureCore(SizeF)LayoutElement.OnChildDesiredSizeChanged(LayoutElement)LayoutElement.OnParentChanging()LayoutElement.OnParentChanged()LayoutElement.LayoutOffsetLayoutElement.IsTopContainerLayoutElement.LocalBoundingRectangleLayoutElement.ControlBoundingRectangleLayoutElement.ClippedControlBoundingRectangleLayoutElement.TotalTransformLayoutElement.ChildrenLayoutElement.BitStateLayoutElement.DesiredSizeLayoutElement.IsMeasureInProgressLayoutElement.BypassLayoutPoliciesLayoutElement.MeasureWithoutParentNotificationLayoutElement.SizeLayoutElement.IsArrangeValidLayoutElement.IsMeasureValidLayoutElement.TreeLevelLayoutElement.PreviousArrangeRectLayoutElement.AlignmentLayoutElement.AutoSizeLayoutElement.TransformLayoutElement.ParentChangingLayoutElement.ParentChangedRadObject.BindingContextPropertyRadObject.RadTypeRadObject.ReplaceDefaultDescriptors(PropertyDescriptorCollection)RadObject.DisposeManagedResources()RadObject.ClearPropertyStore()RadObject.SuspendPropertyNotifications()RadObject.ResumePropertyNotifications()RadObject.GetPropertyValue(RadProperty)RadObject.SetDefaultValueOverride(RadProperty, object)RadObject.GetValue(RadProperty)RadObject.SetValue(RadProperty, object)RadObject.ResetValue(RadProperty)RadObject.ResetLocalValue(RadProperty)RadObject.ResetValue(RadProperty, ValueResetFlags)RadObject.UpdateValue(RadProperty)RadObject.GetValueSource(RadProperty)RadObject.GetRegisteredRadProperty(string)RadObject.UpdateValueCore(RadPropertyValue)RadObject.SetValueCore(RadPropertyValue, object, object, ValueSource)RadObject.ResetValueCore(RadPropertyValue, ValueResetFlags)RadObject.GetDefaultValue(RadPropertyValue, object)RadObject.CoerceValue(RadPropertyValue, object)RadObject.ShouldSerializeProperty(RadProperty)RadObject.CanRaisePropertyChangeNotifications(RadPropertyValue)RadObject.BindProperty(RadProperty, RadObject, RadProperty, PropertyBindingOptions)RadObject.UnbindProperty(RadProperty)RadObject.AddStylePropertySetting(IPropertySetting)RadObject.GetInheritedValue(RadProperty)RadObject.OnPropertyChanging(RadPropertyChangingEventArgs)RadObject.OnPropertyChanged(RadPropertyChangedEventArgs)RadObject.OnNotifyPropertyChanged(string)RadObject.OnNotifyPropertyChanged(PropertyChangedEventArgs)RadObject.OnShouldSerializeProperty(ShouldSerializePropertyEventArgs)RadObject.IsPropertyCancelable(RadPropertyMetadata)RadObject.PropertyValuesRadObject.PropertyFilterRadObject.RadObjectTypeRadObject.BindingContextRadObject.RadPropertyChangedRadObject.RadPropertyChangingDisposableObject.GetBitState(long)DisposableObject.SetBitState(long, bool)DisposableObject.OnBitStateChanged(long, bool, bool)DisposableObject.Dispose()DisposableObject.Dispose(bool)DisposableObject.PerformDispose(bool)DisposableObject.DisposeUnmanagedResources()DisposableObject.EventsDisposableObject.IsDisposingDisposableObject.IsDisposedDisposableObject.DisposedDisposableObject.Disposing...

Constructors

Initializes a span layout box and specifies whether it is a fragment of the document element.

C#
public SpanLayoutBox(DocumentElement parentElement, DocumentStructureCollection collection, bool isFragment)
Parameters:parentElementDocumentElement

The span document element represented by the box.

collectionDocumentStructureCollection

The document structure collection that owns the box.

isFragmentbool

true when the box is a fragment of the span.

Initializes a non-fragment span layout box with the specified text.

C#
public SpanLayoutBox(DocumentElement parentElement, DocumentStructureCollection collection, string text)
Parameters:parentElementDocumentElement

The span document element represented by the box.

collectionDocumentStructureCollection

The document structure collection that owns the box.

textstring

The text stored in the box.

Initializes a non-fragment span layout box.

C#
public SpanLayoutBox(DocumentElement parentElement, DocumentStructureCollection collection)
Parameters:parentElementDocumentElement

The span document element represented by the box.

collectionDocumentStructureCollection

The document structure collection that owns the box.

Properties

Gets or sets the document span represented by this box.

C#
public Span AssociatedSpan { get; set; }

Gets the measured text baseline offset, or zero before text measurement is available.

C#
public override float BaselineOffset { get; }

Overrides: InlineLayoutBox.BaselineOffset

Gets whether this box creates child layout boxes directly from its content. Span boxes do not create such children.

C#
protected override bool CanCreateLayoutBoxesFromContent { get; }

Overrides: LayoutBox.CanCreateLayoutBoxesFromContent

Gets the size returned by measuring this fragment's text.

C#
public SizeF DesiredTextSize { get; }

Gets whether the text width participates in line-end width calculations.

C#
public override bool HasWidthAtTheEndOfLine { get; }

Overrides: InlineLayoutBox.HasWidthAtTheEndOfLine

Gets whether this span box is a leaf rather than a container in the layout tree.

C#
public override bool IsContainerBox { get; }

Overrides: InlineLayoutBox.IsContainerBox

Gets or sets whether paragraph layout classified this span fragment as part of a decimal number. This flag affects right-to-left positioning and whether adjacent fragments can be merged.

C#
public bool IsDecimal { get; set; }

Gets whether this box represents a paragraph-ending Enter symbol.

C#
public bool IsParagraphSymbol { get; }

Gets whether the span text can be edited; ordinary text fragments are not read-only.

C#
public override bool IsReadonly { get; }

Overrides: InlineLayoutBox.IsReadonly

Gets whether this box contains more than one character and can therefore be split.

C#
public override bool IsSplittable { get; }

Overrides: InlineLayoutBox.IsSplittable

Gets the number of text positions in this fragment, equal to Text.Length.

C#
public override int PositionsCountInBox { get; }

Overrides: InlineLayoutBox.PositionsCountInBox

Gets or sets the text in this fragment. Setting a changed value clears the cached spell-check result and invalidates text measurement and layout.

C#
public override string Text { get; set; }

Overrides: InlineLayoutBox.Text

Methods

Gets whether the specified text contains a recognized formatting symbol.

C#
public static bool ContainsFormattingSymbol(string text)
Parameters:textstring

The text to inspect.

Returns:

bool

true when a formatting symbol is present; otherwise, false.

Creates a layout fragment for the same document span.

C#
public override LayoutElement CreateLayoutElement()
Returns:

LayoutElement

A new span layout box marked as a fragment.

Overrides: LayoutBox.CreateLayoutElement()

Splits this span after the longest prefix that fits the available width, keeping that prefix in this box and returning a new box for the remaining text. If this is the first box in a line and no character fits, one character is kept in this box so layout can continue.

C#
public override LayoutBox CreateNewFragment(float availableWidth, bool isFirstBoxInLine)
Parameters:availableWidthfloat

The maximum width for the prefix retained in this box; the returned suffix is not constrained to this width.

isFirstBoxInLinebool

true when this is the first box in the line.

Returns:

LayoutBox

A new box containing the remaining suffix, or null when no split is produced.

Overrides: InlineLayoutBox.CreateNewFragment(float, bool)

Creates a span box, using a formatting-symbol box when text encodes a supported symbol.

C#
public static SpanLayoutBox CreateSpanLayoutBox(DocumentElement parentElement, DocumentStructureCollection collection, string text)
Parameters:parentElementDocumentElement

The document element represented by the new box.

collectionDocumentStructureCollection

The document structure collection that owns the new box.

textstring

The text or formatting-symbol representation to store.

Returns:

SpanLayoutBox

A span layout box or a formatting-symbol layout box.

Creates a position handler that maps document positions to character positions in this span.

C#
public override PositionHandler GetPositionHandler()
Returns:

PositionHandler

A span-box position handler.

Overrides: InlineLayoutBox.GetPositionHandler()

Marks the cached text measurement invalid so it is recalculated on the next measurement request.

C#
public void InvalidateTextMeasure()

Gets whether this box begins a word according to its formatting-symbol status and preceding inline box. Formatting symbols always count as word starts.

C#
public bool IsWordStart()
Returns:

bool

true when this box begins a word; otherwise, false.

Measures the span text and returns its measured text size as the desired size.

C#
protected override SizeF MeasureOverride(SizeF availableSize)
Parameters:availableSizeSizeF

The size available to the span box.

Returns:

SizeF

The measured text size.

Overrides: LayoutElement.MeasureOverride(SizeF)

Measures the associated span text using its document formatting.

C#
protected virtual BoxMeasurementInfo MeasureTextOverride(SubStringPosition subStringPosition = SubStringPosition.None)
Parameters:subStringPositionSubStringPosition

The substring position context passed to the text measurer.

Returns:

BoxMeasurementInfo

The measurement result for the span text.

Appends the next span box's text to this box.

C#
public override void MergeWithNext(LayoutBox nextSpanBox)
Parameters:nextSpanBoxLayoutBox

The adjacent span box whose text is appended.

Overrides: InlineLayoutBox.MergeWithNext(LayoutBox)

Invalidates cached text measurement when the associated document element changes.

C#
protected override void OnAssociateDocumentElementChanged()

Overrides: LayoutBox.OnAssociateDocumentElementChanged()

Raises PropertyChanged for the specified property. The Text setter invokes this method when the text changes.

C#
protected virtual void OnPropertyChanged(string propName)
Parameters:propNamestring

The name of the changed property.

Splits this text box at a character index and inserts the new fragment before or after it.

C#
public void SplitSpanByIndex(int splitIndex, bool isBefore)
Parameters:splitIndexint

The index between the two resulting text fragments; it must be greater than zero and less than the text length.

isBeforebool

true to insert the prefix before this box; otherwise, insert the suffix after it.

Exceptions: ArgumentOutOfRangeException

splitIndex is not strictly inside the text.

Returns the text surrounded by quotation marks.

C#
public override string ToString()
Returns:

string

Overrides: LayoutBox.ToString()

Rebuilds this span's layout boxes from the specified text, then invalidates its layout and word-fragmentation state.

C#
public void Update(string text)
Parameters:textstring

The replacement text used to create the span's layout boxes.

Events

Occurs when this box raises a property-change notification. The Text setter raises it when the text changes.

C#
public event PropertyChangedEventHandler PropertyChanged

Implements: INotifyPropertyChanged.PropertyChanged