Compile Formulas on Demand
From Apache OpenOffice Wiki
|About this template|
For a faster view of the active sheet after having loaded a document, only formulas that are needed to display results could be compiled.
Brainstorming things to be done:
- Upon load, store the raw ODFF string at the formula cell, similar to what is currently done, but a little different such that a subsequent request to obtain the result could determine the formula needs compilation.
- Introduce a new internal token to represent this.
- When saving to ODF again the raw string could be saved instead of composing it from individual tokens.
- Do not invoke the document-wide CompileXML() for all formula cells.
- As a consequence, no broadcasters/listeners are setup.
- For all formula results that need to be accessed, either displayed on the currently viewed sheet or via API:
- Compile ODFF string.
- Gather cells and ranges that are required by this formula.
- Setup listeners to those.
- Recursively compile referenced cells.
- The same needs to be done for conditional formatting to be displayed, as it can use a formula itself and/or refer to cell content.
- Chart ranges of charts in the active view need to be inspected the same.
- Defined names (ranges and formula expressions) should still be compiled after load to be accessible any time.
- Any change in positioning of cells, move/insert/delete cells/columns/rows/sheets as a precondition will require compilation of the entire document, as only then the formula cells will be known that are affected by the change, to be able to update their references.