sc/source/core/data/conditio.cxx |   15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

New commits:
commit cf805848ed5be4ba46eef9a8d3999d9b06848c60
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Wed Sep 28 10:39:20 2022 -0400
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Sat Oct 1 18:05:22 2022 +0200

    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 <jl...@mail.com>
    Reviewed-by: Eike Rathke <er...@redhat.com>

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;

Reply via email to