[Libreoffice-commits] core.git: formula/source

Eike Rathke erack at redhat.com
Sat Apr 23 22:13:10 UTC 2016


 formula/source/core/api/FormulaCompiler.cxx |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 0c5663cfb13f4f55e246d42ac464d5e2c2f23099
Author: Eike Rathke <erack at redhat.com>
Date:   Sun Apr 24 00:07:24 2016 +0200

    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

diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 61c0f82..08300f5 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


More information about the Libreoffice-commits mailing list