Skip to main content

DocState

Struct DocState 

Source
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: u64

Identifies 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: bool

Whether 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: Trust

Where 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

Source

pub fn wb_switch_sheet(&mut self, i: usize)

Switches the active sheet, remembering each sheet’s selection.

Source§

impl DocState

Source

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.

Source

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.

Source

pub fn is_dirty(&self) -> bool

Source

pub fn sheet_index(&self) -> usize

Source

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.

Source

pub fn display_title(&self) -> String

Trait Implementations§

Source§

impl Clone for DocState

Source§

fn clone(&self) -> DocState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DocState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.