From 95c10ff05c4036587302e03e903aa849cba828f3 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 2 May 2023 20:44:37 +0200 Subject: 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 Tested-by: Jenkins --- sc/source/ui/miscdlgs/anyrefdg.cxx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'sc') 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); } -- cgit