summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-04-24 00:07:24 +0200
committerEike Rathke <erack@redhat.com>2016-04-24 00:11:08 +0200
commit0c5663cfb13f4f55e246d42ac464d5e2c2f23099 (patch)
treecc1fb73ad9915eba71d3ad680e1e99ddd0c6e3ce
parentf5523a6ef40197164a2bb56a5f58abc73757568d (diff)
first range can be anywhere before second at RPN end, tdf#96426 follow-up
... not just adjacent to the one at the end. So we actually can handle INDIRECT("A2:C2") INDIRECT("B1:B3") Change-Id: Ie8030ebc13bb1ae2246611f5722da97970b8c544
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 61c0f829965a..08300f535f81 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -355,6 +355,16 @@ bool isAdjacentRpnEnd( sal_uInt16 nPC,
(*pCode1 != nullptr) && (*pCode2 != nullptr);
}
+bool isAdjacentOrGapRpnEnd( sal_uInt16 nPC,
+ FormulaToken const * const * const pCode,
+ FormulaToken const * const * const pCode1,
+ FormulaToken const * const * const pCode2 )
+{
+ return nPC >= 2 && pCode1 && pCode2 &&
+ (pCode2 > pCode1) && (pCode - pCode2 == 1) &&
+ (*pCode1 != nullptr) && (*pCode2 != nullptr);
+}
+
} // namespace
@@ -1684,7 +1694,7 @@ void FormulaCompiler::IntersectionLine()
// functions (potentially returning references, if not then a space
// or no space would be a syntax error anyway), not other operators
// or operands. Else discard.
- if (isAdjacentRpnEnd( pc, pCode, pCode1, pCode2) && isIntersectable( pCode1, pCode2))
+ if (isAdjacentOrGapRpnEnd( pc, pCode, pCode1, pCode2) && isIntersectable( pCode1, pCode2))
{
FormulaTokenRef pIntersect( new FormulaByteToken( ocIntersect));
// Replace ocSpaces with ocIntersect so that when switching