summaryrefslogtreecommitdiff
path: root/include/formula
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.co.uk>2018-05-02 14:22:09 +0530
committerEike Rathke <erack@redhat.com>2018-06-26 15:41:54 +0200
commit60c5ca1b874ead7251653d01b0d50fdd42482e09 (patch)
tree0de305ced26b3d65f4419df6282562456c377fb5 /include/formula
parent6d22d02c321bc9f8f539865fd0fd3046e3ef3c6f (diff)
More Implicit intersection computation
Do implicit intersection computation for for single parameter functions while generating RPN token array when the argument is a doubleref with relative row references. This optimization is not done when under forced array mode or matrix formula mode. The computation logic was already present in ScInterpreter, so factored it out and reused. This also adds unit tests to ensure correctness of II computation for various cases. Change-Id: I509c3f6f811aa036b1dc3296e8f68904b26c3c49 Reviewed-on: https://gerrit.libreoffice.org/53885 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'include/formula')
-rw-r--r--include/formula/FormulaCompiler.hxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
index 321e288fcc55..1f0bb0d95c5b 100644
--- a/include/formula/FormulaCompiler.hxx
+++ b/include/formula/FormulaCompiler.hxx
@@ -76,8 +76,8 @@ private:
FormulaCompiler(const FormulaCompiler&) = delete;
FormulaCompiler& operator=(const FormulaCompiler&) = delete;
public:
- FormulaCompiler();
- FormulaCompiler(FormulaTokenArray& _rArr);
+ FormulaCompiler(bool bComputeII = false, bool bMatrixFlag = false);
+ FormulaCompiler(FormulaTokenArray& _rArr, bool bComputeII = false, bool bMatrixFlag = false);
virtual ~FormulaCompiler();
/** Mappings from strings to OpCodes and vice versa. */
@@ -269,6 +269,12 @@ public:
static void ResetNativeSymbols();
static void SetNativeSymbols( const OpCodeMapPtr& xMap );
+ /** Sets the implicit intersection compute flag */
+ void SetComputeIIFlag(bool bSet) { mbComputeII = bSet; }
+
+ /** Sets the matrix flag for the formula*/
+ void SetMatrixFlag(bool bSet) { mbMatrixFlag = bSet; }
+
/** Separators mapped when loading opcodes from the resource, values other
than RESOURCE_BASE may override the resource strings. Used by OpCodeList
implementation via loadSymbols().
@@ -327,7 +333,8 @@ protected:
// This is no-op for this class.
virtual bool IsIIOpCode(OpCode /*nOpCode*/) const { return false; }
// Handles II opcode and passes the parameter array and number of parameters.
- virtual void HandleIIOpCode(OpCode /*nOpCode*/, FormulaToken*** /*pppToken*/, sal_uInt8 /*nNumParams*/) {}
+ virtual void HandleIIOpCode(OpCode /*nOpCode*/, formula::ParamClass /*eClass*/,
+ FormulaToken*** /*pppToken*/, sal_uInt8 /*nNumParams*/) {}
OUString aCorrectedFormula; // autocorrected Formula
OUString aCorrectedSymbol; // autocorrected Symbol
@@ -359,6 +366,9 @@ protected:
bool mbJumpCommandReorder; /// Whether or not to reorder RPN for jump commands.
bool mbStopOnError; /// Whether to stop compilation on first encountered error.
+ bool mbComputeII; // whether to attempt computing implicit intersection ranges while building the RPN array.
+ bool mbMatrixFlag; // whether the formula is a matrix formula (needed for II computation)
+
private:
void InitSymbolsNative() const; /// only SymbolsNative, on first document creation
void InitSymbolsEnglish() const; /// only SymbolsEnglish, maybe later