sc/source/core/tool/interpr4.cxx |    9 +++------
 sc/source/core/tool/interpr8.cxx |   18 ++++++------------
 2 files changed, 9 insertions(+), 18 deletions(-)

New commits:
commit 400568f51c63f5ec8de08a3255ce83cc1b0bdb66
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Sat Feb 19 13:21:19 2022 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Sat Feb 19 14:13:04 2022 +0100

    simplify code using PutInOrder()
    
    Change-Id: I71efd7ef83618d4f556dd6a0baa8ca6ffec17392
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130194
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 28ceba647ccf..27170ca94490 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -944,12 +944,9 @@ void ScInterpreter::DoubleRefToVars( const 
formula::FormulaToken* p,
     const ScComplexRefData& rCRef = *p->GetDoubleRef();
     SingleRefToVars( rCRef.Ref1, rCol1, rRow1, rTab1);
     SingleRefToVars( rCRef.Ref2, rCol2, rRow2, rTab2);
-    if (rCol2 < rCol1)
-        std::swap( rCol2, rCol1);
-    if (rRow2 < rRow1)
-        std::swap( rRow2, rRow1);
-    if (rTab2 < rTab1)
-        std::swap( rTab2, rTab1);
+    PutInOrder(rCol1, rCol2);
+    PutInOrder(rRow1, rRow2);
+    PutInOrder(rTab1, rTab2);
     if (!mrDoc.m_TableOpList.empty())
     {
         ScRange aRange( rCol1, rRow1, rTab1, rCol2, rRow2, rTab2 );
diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx
index 124205e46aaa..df75c92d41f1 100644
--- a/sc/source/core/tool/interpr8.cxx
+++ b/sc/source/core/tool/interpr8.cxx
@@ -1434,10 +1434,8 @@ void ScInterpreter::ScConcat_MS()
                     SetError( FormulaError::IllegalParameter);
                     break;
                 }
-                if ( nRow1 > nRow2 )
-                    std::swap( nRow1, nRow2 );
-                if ( nCol1 > nCol2 )
-                    std::swap( nCol1, nCol2 );
+                PutInOrder( nRow1, nRow2 );
+                PutInOrder( nCol1, nCol2 );
                 ScAddress aAdr;
                 aAdr.SetTab( nTab1 );
                 for ( SCROW nRow = nRow1; nRow <= nRow2; nRow++ )
@@ -1559,10 +1557,8 @@ void ScInterpreter::ScTextJoin_MS()
                 SetError( FormulaError::IllegalParameter);
                 break;
             }
-            if ( nRow1 > nRow2 )
-                std::swap( nRow1, nRow2 );
-            if ( nCol1 > nCol2 )
-                std::swap( nCol1, nCol2 );
+            PutInOrder( nRow1, nRow2 );
+            PutInOrder( nCol1, nCol2 );
             ScAddress aAdr;
             aAdr.SetTab( nTab1 );
             for ( SCROW nRow = nRow1; nRow <= nRow2; nRow++ )
@@ -1712,10 +1708,8 @@ void ScInterpreter::ScTextJoin_MS()
                     SetError( FormulaError::IllegalParameter);
                     break;
                 }
-                if ( nRow1 > nRow2 )
-                    std::swap( nRow1, nRow2 );
-                if ( nCol1 > nCol2 )
-                    std::swap( nCol1, nCol2 );
+                PutInOrder( nRow1, nRow2 );
+                PutInOrder( nCol1, nCol2 );
                 ScAddress aAdr;
                 aAdr.SetTab( nTab1 );
                 OUString aStr;

Reply via email to