pub struct DocState {Show 18 fields
pub wb: Arc<Workbook>,
pub calc: Calc,
pub selection: Selection,
pub undo: Vec<HistoryEntry>,
pub redo: Vec<HistoryEntry>,
pub path: Option<String>,
pub saved: Arc<Workbook>,
pub revision: u64,
pub uid: u64,
pub title: String,
pub sheet_selections: Vec<Selection>,
pub unlocked_ranges: Vec<(String, String)>,
pub content_kind: Option<FileKind>,
pub scripts_trusted: bool,
pub trust: Trust,
pub touched: Option<Vec<(String, CellRef)>>,
pub edits: Option<Vec<(String, Edit)>>,
pub go_to_recent: Vec<String>,
}Fields§
§wb: Arc<Workbook>§calc: Calc§selection: Selection§undo: Vec<HistoryEntry>§redo: Vec<HistoryEntry>§path: Option<String>§saved: Arc<Workbook>§revision: u64§uid: u64Identifies this open workbook for the rest of the session: it never changes while the workbook is open (saving, renaming, reordering) and is never reused for another one.
title: String§sheet_selections: Vec<Selection>Per-sheet selection memory.
unlocked_ranges: Vec<(String, String)>Allow Edit Ranges unlocked with their password in this session: (sheet name, title).
content_kind: Option<FileKind>The format path’s content was recognised as when its extension doesn’t name one (an
XLSX called budget.dat): Save writes it back in that format.
scripts_trusted: boolWhether the scripts stored in this workbook may run (automate.runScript). A workbook
that arrives already carrying scripts (opened from a file) starts untrusted until the
user trusts it in this session (automate.trustScripts); one with no scripts starts
trusted, since any script it gains later was written here.
trust: TrustWhere the workbook’s content came from: whether its active content may run without
asking. Unlike scripts_trusted, this is provenance, not consent: it is set when the
workbook is opened from a file, carried by content pasted from such a workbook, and never
changed by a trust decision.
touched: Option<Vec<(String, CellRef)>>While a macro’s footprint is measured: every cell a command wrote, by sheet name, even where it wrote what was already there.
edits: Option<Vec<(String, Edit)>>While a macro step runs: the structural edits its command made (the sheet’s name, the edit), so the macro’s inputs, output and Repeat ranges follow their cells as formulas do.
go_to_recent: Vec<String>The references edit.goTo with record: true went to in this document, newest first,
without names, each area written with its sheet (Sheet1!B14:C22,Sheet1!F19:G30).
Implementations§
Source§impl DocState
impl DocState
Sourcepub fn wb_switch_sheet(&mut self, i: usize)
pub fn wb_switch_sheet(&mut self, i: usize)
Switches the active sheet, remembering each sheet’s selection.
Source§impl DocState
impl DocState
Sourcepub fn new(
wb: Workbook,
path: Option<String>,
title: String,
trust: Trust,
) -> DocState
pub fn new( wb: Workbook, path: Option<String>, title: String, trust: Trust, ) -> DocState
A document for wb, which came from where trust says: Trust::FromFile for anything
read from bytes (a file, a download, a recovery copy), Trust::Local only for a workbook
made in this session.
Sourcepub fn from_saved(
wb: Workbook,
path: Option<String>,
title: String,
trust: Trust,
) -> DocState
pub fn from_saved( wb: Workbook, path: Option<String>, title: String, trust: Trust, ) -> DocState
A workbook as its file saved it: the dependency graph is built but nothing is
evaluated, so every value is the one the file holds until an edit reaches it. trust
is as for DocState::new.
pub fn is_dirty(&self) -> bool
pub fn sheet_index(&self) -> usize
Sourcepub fn store_view(&mut self, tops: &[(usize, CellRef)])
pub fn store_view(&mut self, tops: &[(usize, CellRef)])
Records the view state that is saved with the file (sheetView topLeftCell, the active
cell): the first visible cell of the scrolling area per sheet index in tops, and the
active sheet’s active cell. View state never makes the workbook dirty.