7 releases (breaking)
0.6.0 | Jan 3, 2024 |
---|---|
0.5.0 | Dec 29, 2023 |
0.4.0 | Sep 30, 2023 |
0.3.0 | Jun 2, 2022 |
0.1.0 | Apr 18, 2022 |
#868 in Data structures
37 downloads per month
Used in 2 crates
715KB
20K
SLoC
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 anavigator
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 toCalcEngine
. -
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.
Dependencies
~19MB
~359K SLoC