logisheets_controller

Crates.iologisheets_controller
lib.rslogisheets_controller
version0.6.0
sourcesrc
created_at2022-04-18 09:50:55.377331
updated_at2024-01-03 08:05:04.825527
descriptionthe core of LogiSheets
homepage
repository
max_upload_size
id569778
size712,770
(ImJeremyHe)

documentation

README

LogiSheets Controller

Controller is the core crate for LogiSheets. Controller handles the user actions and returns the display information.

Here we will introduce some implementations.

Important Components

  • Cell Id Manager assigns Cell Id for every cell. Cell Id identifies a cell even this cell is removed. Cell Id is different from the cell position which would be changed after inserting or removing some rows or columns. You may find that we also use Sheetid to identify a worksheet, and use NameId to identify a name. That's because in a spreadsheet application, almost everything can be renamed or moved. Id Manager is the foundation.

  • Container stores the CellId and Cell map. The content of a cell should be visited by its CellId.

  • Navigator is responsible for making convertion between cell id and cell position. For now, LogiSheets do only support inserting or removing rows and columns, we use a simple algorithm to realize this. Navigator stores a vector of RowId and a vector of ColId, and we use a tuple (RowId, ColId) as a CellId. After a navigator of a sheet is initialized, every row and column has an Id and therefore, every cell can be identified by (RowId, ColId). For example, when indexing a cell by position, like B4 or r4c2, Navigator takes the 4th RowId and 2nd ColId, and you can then get the CellId. Users' inserting or removing rows/cols will do some effect on the RowId vector or ColId vector.

  • VertexManager is responsible for recording the dependencies for calculating, updating the fomula ast and providing the dirty vertices and ast to CalcEngine.

  • Connectors implements the traits that helps communicate between components. We define some traits to make abstraction barrier between components, which helps to decouple them and makes it easier to write unittests.

Undo / Redo

We use persistent data structure to store the state of a workbook, which helps us easyily implement an undo/redo system.

We use the im crate to do this. It would be nice if you have similar background to maintain this crate.

Commit count: 0

cargo fmt