sc/source/ui/miscdlgs/anyrefdg.cxx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
New commits: commit 95c10ff05c4036587302e03e903aa849cba828f3 Author: Eike Rathke <er...@redhat.com> AuthorDate: Tue May 2 20:44:37 2023 +0200 Commit: Eike Rathke <er...@redhat.com> CommitDate: Wed May 3 00:55:25 2023 +0200 More complete positive list for ScFormulaReferenceHelper::ShowReference() Various operators were omitted so for an expression using only such like '~' range "union"/concatenation the ranges weren't highlighted; also use indexOfAny() instead of repeated indexOf(). Change-Id: I288bb8e0a2bf738bbc3a56025474a18ea18a4d13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151297 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 0ffad93cfe25..579a61ee23a9 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -263,16 +263,12 @@ void ScFormulaReferenceHelper::ShowReference(const OUString& rStr) if( !m_bEnableColorRef ) return; - if( rStr.indexOf('(') != -1 || - rStr.indexOf('+') != -1 || - rStr.indexOf('*') != -1 || - rStr.indexOf('-') != -1 || - rStr.indexOf('/') != -1 || - rStr.indexOf('&') != -1 || - rStr.indexOf('<') != -1 || - rStr.indexOf('>') != -1 || - rStr.indexOf('=') != -1 || - rStr.indexOf('^') != -1 ) + // Exclude ';' semicolon as it is the separator for ParseWithNames() used + // in ShowSimpleReference(). Also sheet separator '.' dot is part of simple + // reference (could be array col/row separator as well but then in '{' '}' + // braces). Prefer '!' exclamation mark to be intersection operator rather + // than Excel sheet separator. + if (comphelper::string::indexOfAny( rStr, u"()+-*/^%&=<>~! #[]{},|\\@", 0) != -1) { ShowFormulaReference(rStr); }