diff options
author | Dennis Francis <dennis.francis@collabora.co.uk> | 2018-05-02 14:22:09 +0530 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-06-26 15:41:54 +0200 |
commit | 60c5ca1b874ead7251653d01b0d50fdd42482e09 (patch) | |
tree | 0de305ced26b3d65f4419df6282562456c377fb5 /sc/inc | |
parent | 6d22d02c321bc9f8f539865fd0fd3046e3ef3c6f (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 'sc/inc')
-rw-r--r-- | sc/inc/compiler.hxx | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index ffd783a32506..767d08b36e62 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -335,24 +335,25 @@ private: static void InitCharClassEnglish(); public: - ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos, const ScInterpreterContext* pContext = nullptr ); + ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos, + bool bComputeII = false, bool bMatrixFlag = false, const ScInterpreterContext* pContext = nullptr ); /** If eGrammar == GRAM_UNSPECIFIED then the grammar of pDocument is used, if pDocument==nullptr then GRAM_DEFAULT. */ ScCompiler( ScDocument* pDocument, const ScAddress&, formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_UNSPECIFIED, - const ScInterpreterContext* pContext = nullptr ); + bool bComputeII = false, bool bMatrixFlag = false, const ScInterpreterContext* pContext = nullptr ); ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos, ScTokenArray& rArr, - const ScInterpreterContext* pContext = nullptr ); + bool bComputeII = false, bool bMatrixFlag = false, const ScInterpreterContext* pContext = nullptr ); /** If eGrammar == GRAM_UNSPECIFIED then the grammar of pDocument is used, if pDocument==nullptr then GRAM_DEFAULT. */ ScCompiler( ScDocument* pDocument, const ScAddress&, ScTokenArray& rArr, formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_UNSPECIFIED, - const ScInterpreterContext* pContext = nullptr ); + bool bComputeII = false, bool bMatrixFlag = false, const ScInterpreterContext* pContext = nullptr ); virtual ~ScCompiler() override; @@ -451,6 +452,10 @@ public: static bool IsCharFlagAllConventions( OUString const & rStr, sal_Int32 nPos, ScCharFlags nFlags ); + /** TODO : Move this to somewhere appropriate. */ + static bool DoubleRefToPosSingleRefScalarCase(const ScRange& rRange, ScAddress& rAdr, + const ScAddress& rFormulaPos); + private: // FormulaCompiler virtual OUString FindAddInFunction( const OUString& rUpperName, bool bLocalFirst ) const override; @@ -480,7 +485,8 @@ private: { return c < 128 ? pConv->getCharTableFlags(c, cLast) : ScCharFlags::NONE; } bool IsIIOpCode(OpCode nOpCode) const override; - void HandleIIOpCode(OpCode nOpCode, formula::FormulaToken*** pppToken, sal_uInt8 nNumParams) override; + void HandleIIOpCode(OpCode nOpCode, formula::ParamClass eClass, formula::FormulaToken*** pppToken, sal_uInt8 nNumParams) override; + void ReplaceDoubleRefII(formula::FormulaToken** ppDoubleRefTok); bool AdjustSumRangeShape(const ScComplexRefData& rBaseRange, ScComplexRefData& rSumRange); void CorrectSumRange(const ScComplexRefData& rBaseRange, ScComplexRefData& rSumRange, formula::FormulaToken** ppSumRangeToken); }; |