[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sc/source

Eike Rathke erack at redhat.com
Sat May 31 10:52:39 PDT 2014


 sc/source/core/tool/address.cxx |   21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 37d985d098cc44798ccaeba78bf6795409a5b5c1
Author: Eike Rathke <erack at redhat.com>
Date:   Tue May 27 23:19:36 2014 +0200

    resolved fdo#70455 B1:SOMENAME is not a valid singleton reference
    
    (cherry picked from commit ac8532ce26e79453b3a969b956ebb7823c455131)
    
    Conflicts:
    	sc/source/core/tool/address.cxx
    
    Change-Id: Iac80d74a9ec6382a232fdc2f4b798e57dc643ad3
    Reviewed-on: https://gerrit.libreoffice.org/9515
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 3ed6213..23bca38 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -876,6 +876,14 @@ lcl_a1_get_row( const sal_Unicode* p, ScAddress* pAddr, sal_uInt16* nFlags )
     return pEnd;
 }
 
+/// B:B or 2:2, but not B:2 or 2:B or B2:B or B:B2 or ...
+static bool isValidSingleton( sal_uInt16 nFlags, sal_uInt16 nFlags2 )
+{
+    bool bCols = (nFlags & SCA_VALID_COL) && ((nFlags & SCA_VALID_COL2) || (nFlags2 & SCA_VALID_COL));
+    bool bRows = (nFlags & SCA_VALID_ROW) && ((nFlags & SCA_VALID_ROW2) || (nFlags2 & SCA_VALID_ROW));
+    return (bCols && !bRows) || (!bCols && bRows);
+}
+
 static sal_uInt16
 lcl_ScRange_Parse_XL_A1( ScRange& r,
                          const sal_Unicode* p,
@@ -982,7 +990,7 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
     }
 
     p = tmp2;
-    p = lcl_eatWhiteSpace( p+1 );
+    p = lcl_eatWhiteSpace( p+1 );   // after ':'
     tmp1 = lcl_a1_get_col( p, &r.aEnd, &nFlags2 );
     if( !tmp1 && aEndTabName.isEmpty() )     // Probably the aEndTabName was specified after the first range
     {
@@ -995,16 +1003,17 @@ lcl_ScRange_Parse_XL_A1( ScRange& r,
                 r.aEnd.SetTab( nTab );
                 nFlags |= SCA_VALID_TAB2 | SCA_TAB2_3D | SCA_TAB2_ABSOLUTE;
             }
-            p = lcl_eatWhiteSpace( p+1 );
+            if (*p == '!' || *p == ':')
+                p = lcl_eatWhiteSpace( p+1 );
             tmp1 = lcl_a1_get_col( p, &r.aEnd, &nFlags2 );
         }
     }
-    if( !tmp1 ) // strange, but valid singleton
-        return nFlags;
+    if( !tmp1 ) // strange, but maybe valid singleton
+        return isValidSingleton( nFlags, nFlags2) ? nFlags : (nFlags & ~SCA_VALID);
 
     tmp2 = lcl_a1_get_row( tmp1, &r.aEnd, &nFlags2 );
-    if( !tmp2 ) // strange, but valid singleton
-        return nFlags;
+    if( !tmp2 ) // strange, but maybe valid singleton
+        return isValidSingleton( nFlags, nFlags2) ? nFlags : (nFlags & ~SCA_VALID);
 
     if ( *tmp2 != 0 )
     {


More information about the Libreoffice-commits mailing list