Table of Contents

Class MathPosition

Namespace
DocWright.Dom.Equations
Assembly
DocWright.Dom.dll

A place inside an equation (Phase 166): a slot, named by a path from the equation, and an offset into it.

public sealed class MathPosition : IEquatable<MathPosition>
Inheritance
MathPosition
Implements
Inherited Members

Remarks

The path starts with the index of the line in Equations, then one pair per level down: the index of a structure in the slot's Elements, and the index of one of its Slots. [0] is an inline equation's own line; [0, 2, 1] is the second slot (a denominator, say) of the third element of that line.

Offsets count as a paragraph's do: each UTF-16 character of a MathRun one, each structure one. A slot of length n has the offsets 0 to n.

A position is a value: it does not follow edits. An edit returns the position the caret goes to next.

Constructors

MathPosition(OfficeMath, IReadOnlyList<int>, int)

Initializes a position and checks that it names a slot of the equation as it is now.

Fields

MaxPathLength

The longest path a position takes: an equation nested as deep as the reader reads one.

Properties

Equation

Gets the equation.

IsTopLevel

Gets whether the slot is a line of the equation rather than a slot of a structure.

Offset

Gets the offset into the slot.

Path

Gets the slot's path.

Methods

Child(int, int)

A position in a slot of a structure: the start of one of its slots.

Equals(MathPosition?)
Equals(object?)
GetHashCode()
Length(MathArgument)

The number of offsets past the slot's start: its runs' characters and one per structure.

OffsetOf(MathArgument, int)

The offset at which an element of a slot starts.

Parent()

Where the structure that holds this slot is, in its own slot: the offset just before it. Null for a line of the equation.

Resolve()

The slot the position names, in the equation as it is now.

Start(OfficeMath)

The start of an equation's first line.

ToString()

The position as text: the path's indexes with dots, a colon, the offset (0.2.1:3).

WithOffset(int)

The same slot at another offset.