Formula Engine Classes
Objective Grid treats the formula engine as a separate entity. You might consider Objective Grid as a front end to this engine that loads values from the engine when cells need to be drawn and that stores values or formulas back into the engine whenever cells are changed.
The formula engine is discussed in detail in Chapter 14, “The Formula Engine.”
Figure 39 – Objective Grid formula class hierarchy
The CGXFormulaSheet class provides an interface to the Objective Grid formula engine. CGXFormulaSheet can be attached to a CGXGridCore object and replace the CGXData object that holds all the cell data. CGXFormulaSheet has special overrides for GetStyleRowCol() and StoreStyleRowCol() so that whenever cells are changed in the grid the actual change will be directly stored in the formula engine. Also other operations like moving, removing and inserting cells will be forwarded to the engine by overrides in CGXFormulaSheet.
The CGXWorksheetFunctions class provides an extensible interface to the formula engine. You can specify what worksheet functions should get linked into your application. You can also add your own custom worksheet functions to the engine.
The CGXDefaultWorksheetFunctions class has a lookup table with all built-in worksheet functions.
CGXFormula is used by the CGXFormulaSheet::ParseExpression() method to store a compiled formula expression in binary form. You can later pass this CGXFormula object to EvaluateExpression().