diff options
author | Justin Luth <justin.luth@collabora.com> | 2022-09-28 10:39:20 -0400 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2022-10-01 18:05:22 +0200 |
commit | cf805848ed5be4ba46eef9a8d3999d9b06848c60 (patch) | |
tree | a21f61786d99b9111e5b5ddac1f7a6aacf34b641 | |
parent | 3b6e9582ce43242a2304047561116bb26808408b (diff) |
related tdf#123990 sc condition: cleanup ScConditionMode::Between
Change-Id: I6bec0af1c7fe109b81b5392c06f795eed03df061
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140716
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | sc/source/core/data/conditio.cxx | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 461a606e3ae2..8da18a4a0471 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1149,13 +1149,6 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) OUString aUpVal1( aStrVal1 ); //TODO: As a member? (Also set in Interpret) OUString aUpVal2( aStrVal2 ); - if ( eOp == ScConditionMode::Between || eOp == ScConditionMode::NotBetween ) - if (ScGlobal::GetCollator().compareString( aUpVal1, aUpVal2 ) > 0) - { - // Right order for value range - OUString aTemp( aUpVal1 ); aUpVal1 = aUpVal2; aUpVal2 = aTemp; - } - switch ( eOp ) { case ScConditionMode::Equal: @@ -1220,14 +1213,14 @@ bool ScConditionEntry::IsValidStr( const OUString& rArg, const ScAddress& rPos ) break; case ScConditionMode::Between: case ScConditionMode::NotBetween: + { + const sal_Int32 nCompare2 = ScGlobal::GetCollator().compareString(rArg, aUpVal2); // Test for NOTBETWEEN: - bValid = ( nCompare < 0 || - ScGlobal::GetCollator().compareString( rArg, - aUpVal2 ) > 0 ); + bValid = (nCompare > 0 && nCompare2 > 0) || (nCompare < 0 && nCompare2 < 0); if ( eOp == ScConditionMode::Between ) bValid = !bValid; break; - // ScConditionMode::Direct already handled above + } default: SAL_WARN("sc", "unknown operation in ScConditionEntry"); bValid = false; |