summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-05-27 23:19:36 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-05-31 17:52:13 +0000
commit37d985d098cc44798ccaeba78bf6795409a5b5c1 (patch)
treeacbe883c5b6acee958a608d1cde23d1bfb361a1d
parent282227a81df90dfe11f0b57a4d7558d7faa56836 (diff)
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@googlemail.com> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/source/core/tool/address.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 3ed6213b25bc..23bca3813423 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 )
{