Skip to main content

Module engine

Module engine 

Source
Expand description

The GridCraft engine façade.

Every user-visible action is a command with a stable id (cell.set, home.bold, data.sortAscending…) and JSON parameters. The egui UI, the CLI, the control channel and MCP all go through Session::execute, so every action is scriptable and journaled.

Re-exports§

pub use crate::base as core;
pub use crate::calc;
pub use crate::formula;
pub use crate::math;
pub use crate::model;
pub use crate::numfmt;
pub use cmd::CommandInfo;
pub use cmd::CommandSpec;
pub use cmd::command_specs;
pub use cmd::find_command;
pub use selection::Selection;
pub use windows::Target;
pub use windows::TargetGuard;
pub use windows::WindowState;
pub use windows::WindowView;

Modules§

catalog
Excel’s ribbon and menu tree (feature names only), used as the parity metric: a catalog entry counts as done when a command with its id is registered. cargo xtask parity writes docs/parity-checklist.md from this list.
cf
Conditional formatting evaluation: what extra style, data bar, colour scale or icon a cell gets.
cmd
The command registry. Ids follow Excel’s ribbon (home.bold, insert.chart, data.sortAscending) plus primitive editing commands (cell.set, selection.set).
display
How cells look as text: number formats applied, for the grid, clipboard, CSV and agents.
fill
Fill: copy, AutoFill series (numbers, dates, weekdays, months, text with numbers, custom lists), Series dialog and Flash Fill.
io
Opening and saving files: XLSX, legacy XLS import, XLSB and ODS data import, SYLK import, CSV/TSV, JSON (debug), HTML export.
links
Which hyperlink targets may be opened. A cell’s link comes from the document (often a file somebody sent), so it is hostile input: only http, https and mailto ever leave the workbook for the system; file:, smb:, UNC paths, custom URL handlers, javascript: and the like are refused. Everything without a scheme stays an in-workbook reference.
macros
GridCraft macros: typed, declarative command lists, not VBA. The model is plain data in crate::model::Macro; this module reads and writes it and keeps it within its limits.
outline
Outline groups (Data ▸ Group) of a sheet’s rows or columns: the runs of lines at or above each outline level, as the grid draws them (brackets, − / + buttons, level buttons) and the Show / Hide Detail commands act on them. Summary rows sit below their detail and summary columns right of it, or above / left of it when the sheet’s outline settings say so (Sheet::summary_below, Sheet::summary_right).
paper
Page Layout view geometry: a sheet shown as printed pages side by side.
pivot
PivotTables: reading the source list, grouping and aggregating, laying out the report and writing it onto the sheet as static, styled cells.
pivot_calc
Calculated PivotTable fields: a formula over other fields (=Sales*0.1, ='Unit Price'*Units, =IF(Units>0,Sales/Units,0)).
recent
Formulas › Recently Used: the functions most recently entered in a formula.
record
The recording buffer: the commands a person (or an agent) ran while recording, each with the document, sheet and selection it ran in.
sample
Sample workbooks built in code (original content), for the start screen, demos, README screenshots and tests.
selection
Cell selection: one or more ranges with an active cell.
tables
Table styles: how a cell inside a table looks (our own palettes, keyed by the familiar TableStyleLight1…21 / Medium1…28 / Dark1…11 names so files round-trip).
windows
Windows on open workbooks.

Structs§

Clipboard
The clipboard: a block of cells (with formulas and styles) or marching-ants reference.
DocState
GroupToken
An undo group opened with Session::group_begin. Hand it back to Session::group_end (keep the changes as one undo step) or Session::group_rollback (undo them all).
HistoryEntry
Prefs
Engine-side preferences.
Session
StatusBarStats
The selection statistics shown on the status bar, set with view.statusBar. Excel turns on Average, Count and Sum by default.

Enums§

EngineError
Mode
In-cell edit mode as shown in the status bar.
Trust
Whether a document’s active content (macros) may run without asking the person first. There is no default: whoever makes a document says where it came from (DocState::new), so a new way of building one from bytes can’t come out trusted by omission.
UiRequest
Requests from commands to the UI (open a dialog, show a message…).

Functions§

active_sheet
Convenience: the active workbook’s active sheet.
cell

Type Aliases§

Result
TextWidth
Width in points of one line of text drawn in a cell font, measured by a front end that has the font the grid draws with. With exact false the front end may answer with a cheaper measure that is never narrower (AutoFit asks for it on columns with many distinct values). Commands call it while they run, so a front end must not run commands while holding a lock the measure takes (egui’s: see theme::cell_text_width in the UI crate).