diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-02-19 13:21:19 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-02-19 14:13:04 +0100 |
commit | 400568f51c63f5ec8de08a3255ce83cc1b0bdb66 (patch) | |
tree | 94270202123307df9d92c1aa41e08e313f138d6f | |
parent | 94fc8eaba84a328ea064ee13efdd405e61209a50 (diff) |
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.lunak@collabora.com>
-rw-r--r-- | sc/source/core/tool/interpr4.cxx | 9 | ||||
-rw-r--r-- | sc/source/core/tool/interpr8.cxx | 18 |
2 files changed, 9 insertions, 18 deletions
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; |