wxMaxima
Loading...
Searching...
No Matches
Public Member Functions
WorksheetDocument Class Reference

The view-independent state and commands of an edited worksheet document. More...

#include <WorksheetDocument.h>

Public Member Functions

EvaluationQueueGetEvaluationQueue ()
 The list of cells scheduled to be sent to Maxima for evaluation.
 
const EvaluationQueueGetEvaluationQueue () const
 The list of cells scheduled for evaluation (read-only view).
 
TreeUndoManagerGetTreeUndo ()
 The document's undo/redo history of tree-structure edits.
 
const TreeUndoManagerGetTreeUndo () const
 The document's tree-edit undo/redo history (read-only view).
 
WorksheetCursorGetCursor ()
 The between-cells cursor (the h-caret) and its group-level selection.
 
const WorksheetCursorGetCursor () const
 The between-cells cursor (read-only view).
 
GroupCellGetTree () const
 The first GroupCell of the document (null when the document is empty).
 
std::unique_ptr< GroupCell > & TreeOwner ()
 Mutable access to the owning pointer of the cell tree.
 
CellPtr< GroupCell > & LastCache () const
 The cached pointer to the document's last GroupCell (<0 = unknown).
 
void SetDocumentView (WorksheetDocumentView *view)
 Register the view the document notifies when it edits its own structure.
 
GroupCellGetLastCell () const
 The document's last GroupCell, memoised in m_last (null if empty).
 
void NumberSections () const
 Renumber all sectioning cells (titles, sections, ...) from the top.
 
GroupCellInsertCells (std::unique_ptr< GroupCell > &&cells, GroupCell *where)
 Insert a list of group cells into the document after where.
 
const wxString & GetCurrentFile () const
 The file this document was last loaded from / saved to (empty if none).
 
void SetCurrentFile (const wxString &file)
 Record the file this document is associated with.
 
const wxString & GetLastQuestion () const
 The text of the Maxima question the user is currently being asked.
 
void SetLastQuestion (const wxString &lastQuestion)
 Remember the text of the question Maxima is currently asking.
 
bool QuestionPending () const
 Is Maxima currently waiting for an answer to a question?
 
void SetQuestionPending (bool pending)
 Record whether Maxima is waiting for an answer to a question.
 
DocumentCellPointersGetCellPointers ()
 The document-model half of the cell-pointer registry (selection, the active/answer/current-text cell, working group and error list).
 
const DocumentCellPointersGetCellPointers () const
 The document-model half of the cell-pointer registry (read-only view).
 
bool IsSaved () const
 True while the document has no unsaved changes.
 
void SetSaved (bool saved)
 Record whether the document is in its saved state.
 
void OutputChanged ()
 Note that a cell's output changed.
 

Detailed Description

The view-independent state and commands of an edited worksheet document.

Currently a small aggregate that Worksheet delegates to; it grows as further document state is migrated off Worksheet. Held by value by Worksheet.

Member Function Documentation

◆ InsertCells()

GroupCell * WorksheetDocument::InsertCells ( std::unique_ptr< GroupCell > &&  cells,
GroupCell where 
)

Insert a list of group cells into the document after where.

where == null inserts at the very top. Splices the cells into the tree, renumbers sections if needed and notifies the view (recalc/redraw/adjust size/modified) through the registered WorksheetDocumentView. Returns the last inserted cell. The caller (Worksheet) records the undo action, which needs a Configuration and so stays on the view side.

◆ LastCache()

CellPtr< GroupCell > & WorksheetDocument::LastCache ( ) const
inline

The cached pointer to the document's last GroupCell (<0 = unknown).

Mutable so the const "find the last cell" lookup can memoise its result; the surgery code also updates it directly when it reseats the tail.

◆ OutputChanged()

void WorksheetDocument::OutputChanged ( )
inline

Note that a cell's output changed.

For a .wxmx (which caches output on disk) changed output means the file is no longer saved. Sets the flag directly, without a control refresh, to match the historical behaviour: this is called often during evaluation and must stay cheap.

◆ SetSaved()

void WorksheetDocument::SetSaved ( bool  saved)

Record whether the document is in its saved state.

On an actual change of the flag the view is told via WorksheetDocumentView::NotifySavedStateChanged() so it can refresh the controls that depend on the saved-state. Defined in the .cpp because it needs the complete WorksheetDocumentView type.

◆ TreeOwner()

std::unique_ptr< GroupCell > & WorksheetDocument::TreeOwner ( )
inline

Mutable access to the owning pointer of the cell tree.

Transitional: while the tree-editing surgery still lives in Worksheet, it reseats the head of the list (moves a new tree in, resets it, splices), so it needs the unique_ptr itself, not just GetTree(). Moves onto WorksheetDocument with the tree-surgery methods in a later increment.


The documentation for this class was generated from the following files: