Table of Contents

Class RichDocumentSnapshot

Namespace
RichEdit.Core
Assembly
RichEdit.Core.dll

An immutable structured rich-document graph with one body story and document-owned styles.

public sealed class RichDocumentSnapshot
Inheritance
RichDocumentSnapshot
Inherited Members

Properties

Assets

Gets immutable document-owned image resources.

public ImmutableDictionary<RichAssetId, RichImageAsset> Assets { get; }

Property Value

ImmutableDictionary<RichAssetId, RichImageAsset>

Body

Gets the body story identity.

public RichNodeId Body { get; }

Property Value

RichNodeId

Bookmarks

Gets persistent bookmarks, including orphaned records.

public ImmutableDictionary<RichAnnotationId, RichBookmark> Bookmarks { get; }

Property Value

ImmutableDictionary<RichAnnotationId, RichBookmark>

Comments

Gets persistent comments, including orphaned records.

public ImmutableDictionary<RichAnnotationId, RichComment> Comments { get; }

Property Value

ImmutableDictionary<RichAnnotationId, RichComment>

DefaultCharacter

Gets authored document character defaults. Unresolved values remain available for a view fallback.

public RichCharacterStyle DefaultCharacter { get; }

Property Value

RichCharacterStyle

DefaultParagraph

Gets authored document paragraph defaults.

public RichParagraphStyle DefaultParagraph { get; }

Property Value

RichParagraphStyle

Empty

Gets an immutable empty body containing one empty paragraph.

public static RichDocumentSnapshot Empty { get; }

Property Value

RichDocumentSnapshot

Nodes

Gets structural nodes indexed by their stable identities.

public ImmutableDictionary<RichNodeId, RichNode> Nodes { get; }

Property Value

ImmutableDictionary<RichNodeId, RichNode>

Revision

Gets the document revision, or an invalid revision for a standalone builder snapshot.

public DocumentRevision Revision { get; }

Property Value

DocumentRevision

Revisions

Gets pending authored revisions, independent of undo history.

public ImmutableDictionary<long, RichRevision> Revisions { get; }

Property Value

ImmutableDictionary<long, RichRevision>

Styles

Gets document-owned reusable styles.

public RichStyleSheet Styles { get; }

Property Value

RichStyleSheet

Methods

Build(Action<RichDocumentEdit>)

Constructs and validates a detached immutable snapshot, suitable for background construction before adoption.

public static RichDocumentSnapshot Build(Action<RichDocumentEdit> build)

Parameters

build Action<RichDocumentEdit>

Returns

RichDocumentSnapshot

ComparePoints(RichTextPoint, RichTextPoint)

Compares structural text points in document order without materializing a plain-text projection.

public int ComparePoints(RichTextPoint first, RichTextPoint second)

Parameters

first RichTextPoint
second RichTextPoint

Returns

int

CreateOriginalReviewSnapshot()

Creates a detached original-content projection by rejecting every pending revision without changing the document or history.

public RichDocumentSnapshot CreateOriginalReviewSnapshot()

Returns

RichDocumentSnapshot

CreateReviewProjection(RichReviewMode, CancellationToken)

Captures final or original review content and snapshot-bound address maps without editing the document or history.

public RichReviewProjection CreateReviewProjection(RichReviewMode mode, CancellationToken cancellationToken = default)

Parameters

mode RichReviewMode
cancellationToken CancellationToken

Returns

RichReviewProjection

FromPlainText(string)

Creates semantic paragraphs and soft breaks from plain text. Paragraph terminators normalize to rich structure.

public static RichDocumentSnapshot FromPlainText(string text)

Parameters

text string

Returns

RichDocumentSnapshot

GetParagraphLength(RichNodeId)

Gets the paragraph-local UTF-16 length, including one position for each soft break.

public int GetParagraphLength(RichNodeId id)

Parameters

id RichNodeId

Returns

int

GetRevisionResolution(Guid, bool)

Gets the exact pending transactions an atomic group resolution will include.

public ImmutableArray<RichRevision> GetRevisionResolution(Guid group, bool accept)

Parameters

group Guid
accept bool

Returns

ImmutableArray<RichRevision>

Remarks

Acceptance includes prerequisites. Rejection includes dependent groups. Whole groups are always resolved together.

GetSelectedBlocks(RichBlockSelection)

Gets complete selected blocks in document order, validating that both endpoints share a text container.

public ImmutableArray<RichNodeId> GetSelectedBlocks(RichBlockSelection selection)

Parameters

selection RichBlockSelection

Returns

ImmutableArray<RichNodeId>

GetSelectedCharacterFormats(RichSelection)

Returns resolved character values for selected runs and empty paragraphs, suitable for mixed-format queries.

public ImmutableArray<ResolvedCharacterStyle> GetSelectedCharacterFormats(RichSelection selection)

Parameters

selection RichSelection

Returns

ImmutableArray<ResolvedCharacterStyle>

GetSelectedText(RichSelection)

Enumerates selected paragraph-local ranges without flattening tables, lists, or object addresses.

public ImmutableArray<RichSelectedText> GetSelectedText(RichSelection selection)

Parameters

selection RichSelection

Returns

ImmutableArray<RichSelectedText>

Remarks

Cell rectangles include only their cells, including nested content. A boundary has no text ranges.

GetTableGrid(RichNodeId)

Gets a validated table grid, with every covered position referring to its owning cell identity.

public RichTableGrid GetTableGrid(RichNodeId table)

Parameters

table RichNodeId

Returns

RichTableGrid

Get<T>(RichNodeId)

Gets a typed node or rejects a missing node or mismatched structural kind.

public T Get<T>(RichNodeId id) where T : RichNode

Parameters

id RichNodeId

Returns

T

Type Parameters

T

ProjectBlocks(RichBlockSelection)

Projects a contiguous sequence of complete blocks while retaining their owning story and rich addresses.

public RichTextProjection ProjectBlocks(RichBlockSelection selection)

Parameters

selection RichBlockSelection

Returns

RichTextProjection

ProjectText(RichNodeId?)

Explicitly projects a story, block, cell, or list item to text with snapshot-bound rich addresses and structural separators.

public RichTextProjection ProjectText(RichNodeId? root = null)

Parameters

root RichNodeId?

Returns

RichTextProjection

Remarks

The default root is the complete body. A cell projection retains the same nodes and owning story; it is not an independent document.

ResolveCharacter(RichNodeId)

Resolves authored character appearance for one inline without rewriting its style references or direct overrides.

public ResolvedCharacterStyle ResolveCharacter(RichNodeId inline)

Parameters

inline RichNodeId

Returns

ResolvedCharacterStyle

ResolveParagraph(RichNodeId)

Resolves authored paragraph appearance, including semantic heading level.

public ResolvedParagraphStyle ResolveParagraph(RichNodeId paragraph)

Parameters

paragraph RichNodeId

Returns

ResolvedParagraphStyle

ValidatePoint(RichTextPoint)

Validates a rich point against its exact story, paragraph, UTF-16 length, and affinity.

public void ValidatePoint(RichTextPoint point)

Parameters

point RichTextPoint