summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2023-05-02 20:44:37 +0200
committerEike Rathke <erack@redhat.com>2023-05-03 00:55:25 +0200
commit95c10ff05c4036587302e03e903aa849cba828f3 (patch)
treeee680d299fcc58e20096e8b53b86ecf6825bb242 /sc
parent581764d7781477deada108c7fa108c684983fbc8 (diff)
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 <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx16
1 files changed, 6 insertions, 10 deletions
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);
}