Expand description
Format-neutral logical grid derivation for tables.
A table’s cells carry only spans (col_span/row_span); their absolute
grid positions are implicit in row/cell order. This module derives the
pre-merge logical grid — the same coordinate system used by document
formats on the wire — from Core data alone, using a row-major greedy
placement scan (cursor per row, skipping positions occupied by spans from
previous rows).
Two surfaces share one placement algorithm:
TableGrid::from_table— strict: fails on any tiling violation (overlap, hole, bottom overhang, oversized grid). Addressing surfaces (export, cell editing) use this so addresses are only ever derived from well-formed grids.grid_placements— lenient: mirrors the historical encoder behaviour exactly, performing no validation. Format encoders use this so byte output for existing documents (including malformed tables) never changes.
The grid validates only what Core can see. Wire-level addresses that a source format may have carried are not compared here (decoders normalize into Core before this module runs).
Structs§
- Grid
Cell - An anchor cell placed on the logical grid.
- Grid
Coord - Absolute position on the pre-merge logical grid, zero-based.
- Grid
Placements - Result of the lenient placement scan (see
grid_placements). - Placed
Cell - One placement produced by the lenient scan: where a cell landed.
- Table
Grid - The derived logical grid of a table (strict; see module docs).
Enums§
- Grid
Error - Why a table’s cells do not tile a well-formed logical grid.
Constants§
- MAX_
GRID_ POSITIONS - Maximum number of logical grid positions (
rows × cols) a grid may have.
Functions§
- grid_
placements - Places every cell on the logical grid without validating the result.