chart2/source/view/axes/VCartesianGrid.cxx                 |   18 ---
 chart2/source/view/inc/PlottingPositionHelper.hxx          |    6 -
 chart2/source/view/main/PlottingPositionHelper.cxx         |    6 -
 dbaccess/source/ui/querydesign/querydlg.cxx                |   10 --
 dbaccess/source/ui/relationdesign/RTableConnectionData.cxx |    4 
 extensions/test/ole/cpnt/cpnt.cxx                          |   60 +++----------
 filter/source/msfilter/msdffimp.cxx                        |    4 
 hwpfilter/source/hwpreader.cxx                             |    7 -
 sc/source/core/data/conditio.cxx                           |    4 
 sc/source/core/data/table6.cxx                             |    6 -
 sc/source/core/tool/interpr2.cxx                           |    6 -
 sc/source/core/tool/interpr3.cxx                           |    6 -
 sc/source/ui/view/cellsh2.cxx                              |    8 -
 sc/source/ui/view/gridmerg.cxx                             |    4 
 sc/source/ui/view/output.cxx                               |   18 ---
 sc/source/ui/view/output2.cxx                              |    6 -
 scaddins/source/analysis/analysishelper.cxx                |   12 --
 svx/source/dialog/rubydialog.cxx                           |    6 -
 svx/source/xoutdev/_xpoly.cxx                              |    6 -
 sw/source/core/access/accpara.cxx                          |    6 -
 sw/source/core/access/accpara.hxx                          |    4 
 sw/source/core/crsr/crsrsh.cxx                             |    6 -
 sw/source/core/crsr/pam.cxx                                |    8 -
 sw/source/core/crsr/swcrsr.cxx                             |   14 ---
 sw/source/core/doc/DocumentRedlineManager.cxx              |    6 -
 sw/source/core/docnode/ndtbl1.cxx                          |   12 --
 sw/source/core/frmedt/tblsel.cxx                           |   16 ---
 sw/source/filter/html/htmlsect.cxx                         |    6 -
 vcl/source/gdi/gradient.cxx                                |   12 --
 vcl/source/outdev/gradient.cxx                             |   12 --
 vcl/source/text/ImplLayoutRuns.cxx                         |   12 --
 vcl/source/window/decoview.cxx                             |    6 -
 vcl/source/window/splitwin.cxx                             |    4 
 33 files changed, 69 insertions(+), 252 deletions(-)

New commits:
commit 3f284b6f12e3eb047398998b223663b38a9bfec8
Author:     Liu Hao <ianahao...@gmail.com>
AuthorDate: Mon Aug 15 00:11:55 2022 +0800
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Aug 23 10:45:41 2022 +0200

    tdf#148251 Use std::swap instead of using temporary values
    
    Change-Id: Ibbc46bfb17d4d27dc40e63c65190b3f3a5f2d9c4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138256
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/chart2/source/view/axes/VCartesianGrid.cxx 
b/chart2/source/view/axes/VCartesianGrid.cxx
index a5c44c22b042..07c51d4a23b9 100644
--- a/chart2/source/view/axes/VCartesianGrid.cxx
+++ b/chart2/source/view/axes/VCartesianGrid.cxx
@@ -74,23 +74,11 @@ GridLinePoints::GridLinePoints( const 
PlottingPositionHelper* pPosHelper, sal_In
     pPosHelper->doLogicScaling( &MaxX,&MaxY,&MaxZ );
 
     if(!pPosHelper->isMathematicalOrientationX())
-    {
-        double fHelp = MinX;
-        MinX = MaxX;
-        MaxX = fHelp;
-    }
+        std::swap( MinX, MaxX );
     if(!pPosHelper->isMathematicalOrientationY())
-    {
-        double fHelp = MinY;
-        MinY = MaxY;
-        MaxY = fHelp;
-    }
+        std::swap( MinY, MaxY );
     if(pPosHelper->isMathematicalOrientationZ())//z axis in draw is reverse to 
mathematical
-    {
-        double fHelp = MinZ;
-        MinZ = MaxZ;
-        MaxZ = fHelp;
-    }
+        std::swap( MinZ, MaxZ );
     bool bSwapXY = pPosHelper->isSwapXAndY();
 
     //P0: point on 'back' wall, not on 'left' wall
diff --git a/chart2/source/view/inc/PlottingPositionHelper.hxx 
b/chart2/source/view/inc/PlottingPositionHelper.hxx
index c0480a4e3b2c..916668dd6c14 100644
--- a/chart2/source/view/inc/PlottingPositionHelper.hxx
+++ b/chart2/source/view/inc/PlottingPositionHelper.hxx
@@ -400,11 +400,7 @@ inline bool PlottingPositionHelper::clipYRange( double& 
rMin, double& rMax ) con
 {
     //returns true if something remains
     if( rMin > rMax )
-    {
-        double fHelp = rMin;
-        rMin = rMax;
-        rMax = fHelp;
-    }
+        std::swap( rMin, rMax );
     if( rMin > getLogicMaxY() )
         return false;
     if( rMax < getLogicMinY() )
diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx 
b/chart2/source/view/main/PlottingPositionHelper.cxx
index eab2f69e7d9a..dfbf38bbd90e 100644
--- a/chart2/source/view/main/PlottingPositionHelper.cxx
+++ b/chart2/source/view/main/PlottingPositionHelper.cxx
@@ -418,11 +418,7 @@ double PolarPlottingPositionHelper::getWidthAngleDegree( 
double& fStartLogicValu
 {
     const ExplicitScaleData& rAngleScale = m_bSwapXAndY ? m_aScales[1] : 
m_aScales[0];
     if( rAngleScale.Orientation != AxisOrientation_MATHEMATICAL )
-    {
-        double fHelp = fEndLogicValueOnAngleAxis;
-        fEndLogicValueOnAngleAxis = fStartLogicValueOnAngleAxis;
-        fStartLogicValueOnAngleAxis = fHelp;
-    }
+        std::swap( fStartLogicValueOnAngleAxis, fEndLogicValueOnAngleAxis );
 
     double fStartAngleDegree = transformToAngleDegree( 
fStartLogicValueOnAngleAxis );
     double fEndAngleDegree   = transformToAngleDegree( 
fEndLogicValueOnAngleAxis );
diff --git a/dbaccess/source/ui/querydesign/querydlg.cxx 
b/dbaccess/source/ui/querydesign/querydlg.cxx
index 05c10de438e0..a54b78e24353 100644
--- a/dbaccess/source/ui/querydesign/querydlg.cxx
+++ b/dbaccess/source/ui/querydesign/querydlg.cxx
@@ -167,13 +167,9 @@ IMPL_LINK_NOARG( DlgQryJoin, LBChangeHdl, weld::ComboBox&, 
void )
             eJoinType = LEFT_JOIN;
             break;
         case ID_RIGHT_JOIN:
-            {
-                pResId = STR_QUERY_LEFTRIGHT_JOIN;
-                eJoinType = RIGHT_JOIN;
-                OUString sTemp = sFirstWinName;
-                sFirstWinName = sSecondWinName;
-                sSecondWinName = sTemp;
-            }
+            pResId = STR_QUERY_LEFTRIGHT_JOIN;
+            eJoinType = RIGHT_JOIN;
+            std::swap( sFirstWinName, sSecondWinName );
             break;
         case ID_FULL_JOIN:
             pResId = STR_QUERY_FULL_JOIN;
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx 
b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index 26b39b69c28d..2fb7c0b8213c 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -112,9 +112,7 @@ void ORelationTableConnectionData::ChangeOrientation()
     }
 
     // adapt member
-    TTableWindowData::value_type pTemp = m_pReferencingTable;
-    m_pReferencingTable = m_pReferencedTable;
-    m_pReferencedTable = pTemp;
+    std::swap( m_pReferencingTable, m_pReferencedTable );
 }
 
 void ORelationTableConnectionData::SetCardinality()
diff --git a/extensions/test/ole/cpnt/cpnt.cxx 
b/extensions/test/ole/cpnt/cpnt.cxx
index 0f37f04ecf59..41df66dba69f 100644
--- a/extensions/test/ole/cpnt/cpnt.cxx
+++ b/extensions/test/ole/cpnt/cpnt.cxx
@@ -1076,93 +1076,61 @@ void SAL_CALL OComponent::in_methodAll(
 // INOUT 
-----------------------------------------------------------------------------------
 void SAL_CALL OComponent::testinout_methodByte(sal_Int8& rOut) throw( 
RuntimeException )
 {
-    sal_Int8 tmp = rOut;
-    rOut = m_int8;
-    m_int8 = tmp;
+    std::swap( m_int8, rOut );
 }
 void SAL_CALL OComponent::testinout_methodFloat(float& rOut) throw( 
RuntimeException )
 {
-    float tmp = rOut;
-    rOut = m_float;
-    m_float = tmp;
+    std::swap( m_float, rOut );
 }
-
 void SAL_CALL OComponent::testinout_methodDouble(double& rOut) throw( 
RuntimeException )
 {
-    double tmp = rOut;
-    rOut = m_double;
-    m_double = tmp;
+    std::swap( m_double, rOut );
 }
 void SAL_CALL OComponent::testinout_methodBool(sal_Bool& rOut) throw( 
RuntimeException )
 {
-    sal_Bool tmp = rOut;
-    rOut = m_bool;
-    m_bool = tmp;
+    std::swap( m_bool, rOut );
 }
 void SAL_CALL OComponent::testinout_methodShort(sal_Int16& rOut) throw( 
RuntimeException )
 {
-    sal_Int16 tmp= rOut;
-    rOut = m_int16;
-    m_int16 = tmp;
+    std::swap( m_int16, rOut );
 }
 void SAL_CALL OComponent::testinout_methodUShort(sal_uInt16& rOut) throw( 
RuntimeException )
 {
-    sal_uInt16 tmp = rOut;
-    rOut = m_uint16;
-    m_uint16 = tmp;
+    std::swap( m_uint16, rOut );
 }
 void SAL_CALL OComponent::testinout_methodLong(sal_Int32& rOut) throw( 
RuntimeException )
 {
-    sal_Int32 tmp = rOut;
-    rOut = m_int32;
-    m_int32 = tmp;
+    std::swap( m_int32, rOut );
 }
 void SAL_CALL OComponent::testinout_methodULong(sal_uInt32& rOut) throw( 
RuntimeException )
 {
-    sal_uInt32 tmp = rOut;
-    rOut = m_uint32;
-    m_uint32 = tmp;
+    std::swap( m_uint32, rOut );
 }
 void SAL_CALL OComponent::testinout_methodHyper(sal_Int64& rOut) throw( 
RuntimeException )
 {
-    sal_Int64 tmp = rOut;
-    rOut = m_int64;
-    m_int64 = tmp;
+    std::swap( m_int64, rOut );
 }
-
 void SAL_CALL OComponent::testinout_methodUHyper(sal_uInt64& rOut) throw( 
RuntimeException )
 {
-    sal_uInt64 tmp = rOut;
-    rOut = m_uint64;
-    m_uint64 = tmp;
+    std::swap( m_uint64, rOut );
 }
-
 void SAL_CALL OComponent::testinout_methodString(OUString& rOut) throw( 
RuntimeException )
 {
-    OUString tmp = rOut;
-    rOut = m_string;
-    m_string = tmp;
+    std::swap( m_string, rOut );
 }
 void SAL_CALL OComponent::testinout_methodChar(sal_Unicode& rOut) throw( 
RuntimeException)
 {
-    sal_Unicode tmp = rOut;
-    rOut = m_char;
-    m_char = tmp;
+    std::swap( m_char, rOut );
 }
 void SAL_CALL OComponent::testinout_methodAny(Any& rOut) throw( 
RuntimeException)
 {
-    Any tmp = rOut;
-    rOut = m_any;
-    m_any = tmp;
+    std::swap( m_any, rOut );
 }
 void SAL_CALL OComponent::testinout_methodType(Type& rOut) throw( 
RuntimeException)
 {
-    Type tmp = rOut;
-    rOut = m_type;
-    m_type = tmp;
+    std::swap( m_type, rOut );
 }
 
-
 void SAL_CALL OComponent::testinout_methodSequence(Sequence< sal_Int32 >& 
rOut) throw( RuntimeException)
 {
 
diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index 087bbdcf0ddf..58032e65ee7b 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -2921,9 +2921,7 @@ void DffPropertyReader::ImportGradientColor( SfxItemSet& 
aSet, sal_uInt32 eMSO_F
         aCol1 = aCol2;
         aCol2 = aZwi;
         //Swap two colors' transparency
-        double dTemp = dTrans;
-        dTrans = dBackTrans;
-        dBackTrans = dTemp;
+        std::swap( dTrans, dBackTrans );
     }
 
     //Construct gradient item
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index 73642b5d63f0..d2690082ce3b 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -4152,11 +4152,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject 
*drawobj, const Picture* hbox)
                                 start_angle = atan2(pal.pt[0].y - 
pal.pt[1].y,pal.pt[1].x - pal.pt[0].x );
                                 end_angle = atan2(pal.pt[2].y - pal.pt[1].y, 
pal.pt[1].x - pal.pt[2].x);
 
-                                if( ( start_angle > end_angle ) && 
(start_angle - end_angle < M_PI )){
-                                    double tmp_angle = start_angle;
-                                    start_angle = end_angle;
-                                    end_angle = tmp_angle;
-                                }
+                                if( ( start_angle > end_angle ) && 
(start_angle - end_angle < M_PI ))
+                                    std::swap( start_angle, end_angle );
                                 mxList->addAttribute("draw:start-angle", 
sXML_CDATA, OUString::number(basegfx::rad2deg(start_angle)));
                                 mxList->addAttribute("draw:end-angle", 
sXML_CDATA, OUString::number(basegfx::rad2deg(end_angle)));
 
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 8022072ee630..7bf662bd5452 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -988,10 +988,8 @@ bool ScConditionEntry::IsValid( double nArg, const 
ScAddress& rPos ) const
 
     if ( eOp == ScConditionMode::Between || eOp == ScConditionMode::NotBetween 
)
         if ( nComp1 > nComp2 )
-        {
             // Right order for value range
-            double nTemp = nComp1; nComp1 = nComp2; nComp2 = nTemp;
-        }
+            std::swap( nComp1, nComp2 );
 
     // All corner cases need to be tested with ::rtl::math::approxEqual!
     bool bValid = false;
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 6d983811af9d..f7446ee73a32 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -756,11 +756,7 @@ bool ScTable::SearchAllStyle(
             if (bFound)
             {
                 if (nEndRow<nRow)
-                {
-                    SCROW nTemp = nRow;
-                    nRow = nEndRow;
-                    nEndRow = nTemp;
-                }
+                    std::swap( nRow, nEndRow );
                 rMatchedRanges.Join(ScRange(i, nRow, nTab, i, nEndRow, nTab));
                 nRow = nEndRow + 1;
                 bEverFound = true;
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 31b8812e8db7..26fd7c5d3063 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -535,11 +535,7 @@ void ScInterpreter::ScNetWorkdays( bool bOOXML_Version )
         size_t nRef = 0;
         bool bReverse = ( nDate1 > nDate2 );
         if ( bReverse )
-        {
-            sal_uInt32 nTemp = nDate1;
-            nDate1 = nDate2;
-            nDate2 = nTemp;
-        }
+            std::swap( nDate1, nDate2 );
         size_t nMax = nSortArray.size();
         while ( nDate1 <= nDate2 )
         {
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 73e576d011a2..4088a1b36c1a 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -4445,11 +4445,7 @@ void ScInterpreter::ScProbability()
     else
         fLo = fUp;
     if (fLo > fUp)
-    {
-        double fTemp = fLo;
-        fLo = fUp;
-        fUp = fTemp;
-    }
+        std::swap( fLo, fUp );
     ScMatrixRef pMatP = GetMatrix();
     ScMatrixRef pMatW = GetMatrix();
     if (!pMatP || !pMatW)
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 160cdcaa4a75..5b96bb65085b 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -943,15 +943,11 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                                     if (wraparound > 0) {
                                         if (eOper == ScConditionMode::Between) 
{
                                             eOper = 
ScConditionMode::NotBetween;
-                                            OUString tmp = aExpr1;
-                                            aExpr1 = aExpr2;
-                                            aExpr2 = tmp;
+                                            std::swap( aExpr1, aExpr2 );
                                         }
                                         else if (eOper == 
ScConditionMode::NotBetween) {
                                             eOper = ScConditionMode::Between;
-                                            OUString tmp = aExpr1;
-                                            aExpr1 = aExpr2;
-                                            aExpr2 = tmp;
+                                            std::swap( aExpr1, aExpr2 );
                                         }
                                     }
                                 }
diff --git a/sc/source/ui/view/gridmerg.cxx b/sc/source/ui/view/gridmerg.cxx
index a21be85fc970..117b3e1ad79a 100644
--- a/sc/source/ui/view/gridmerg.cxx
+++ b/sc/source/ui/view/gridmerg.cxx
@@ -200,9 +200,7 @@ void ScGridMerger::Flush()
                 //  (nVarStart / nVarDiff can be modified, aren't used after 
Flush)
 
                 nVarDiff = -nVarDiff;
-                tools::Long nTemp = nVarStart;
-                nVarStart = nVarEnd;
-                nVarEnd = nTemp;
+                std::swap( nVarStart, nVarEnd );
             }
             pDev->DrawGrid( tools::Rectangle( nVarStart, nFixStart, nVarEnd, 
nFixEnd ),
                             Size( nVarDiff, nFixEnd - nFixStart ),
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 24c94fd993f2..8e5020d0b3e6 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1935,11 +1935,7 @@ ReferenceMark ScOutputData::FillReferenceMark( SCCOL 
nRefStartX, SCROW nRefStart
         tools::Long nMaxX = nScrX + nScrW - 1;
         tools::Long nMaxY = nScrY + nScrH - 1;
         if ( bLayoutRTL )
-        {
-            tools::Long nTemp = nMinX;
-            nMinX = nMaxX;
-            nMaxX = nTemp;
-        }
+            std::swap( nMinX, nMaxX );
         tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
 
         bool bTop    = false;
@@ -2027,11 +2023,7 @@ void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW 
nRefStartY,
     tools::Long nMaxX = nScrX + nScrW - 1;
     tools::Long nMaxY = nScrY + nScrH - 1;
     if ( bLayoutRTL )
-    {
-        tools::Long nTemp = nMinX;
-        nMinX = nMaxX;
-        nMaxX = nTemp;
-    }
+        std::swap( nMinX, nMaxX );
     tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
 
     bool bTop    = false;
@@ -2154,11 +2146,7 @@ void ScOutputData::DrawOneChange( SCCOL nRefStartX, 
SCROW nRefStartY,
     tools::Long nMaxX = nScrX+nScrW-1;
     tools::Long nMaxY = nScrY+nScrH-1;
     if ( bLayoutRTL )
-    {
-        tools::Long nTemp = nMinX;
-        nMinX = nMaxX;
-        nMaxX = nTemp;
-    }
+        std::swap( nMinX, nMaxX );
     tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
 
     bool bTop    = false;
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index bd757cb7581f..bbcb812cdb57 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -2536,11 +2536,7 @@ void 
ScOutputData::DrawEditParam::getEngineSize(ScFieldEditEngine* pEngine, tool
     tools::Long nEngineHeight = pEngine->GetTextHeight();
 
     if (isVerticallyOriented())
-    {
-        tools::Long nTemp = nEngineWidth;
-        nEngineWidth = nEngineHeight;
-        nEngineHeight = nTemp;
-    }
+        std::swap( nEngineWidth, nEngineHeight );
 
     if (meOrient == SvxCellOrientation::Stacked)
         nEngineWidth = nEngineWidth * 11 / 10;
diff --git a/scaddins/source/analysis/analysishelper.cxx 
b/scaddins/source/analysis/analysishelper.cxx
index 405fdae9e5e6..58f5a4087543 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -345,11 +345,7 @@ sal_Int32 GetDiffDate( sal_Int32 nNullDate, sal_Int32 
nStartDate, sal_Int32 nEnd
     bool    bNeg = nStartDate > nEndDate;
 
     if( bNeg )
-    {
-        sal_Int32   n = nEndDate;
-        nEndDate = nStartDate;
-        nStartDate = n;
-    }
+        std::swap( nStartDate, nEndDate );
 
     sal_Int32       nRet;
 
@@ -456,11 +452,7 @@ double GetYearFrac( sal_Int32 nNullDate, sal_Int32 
nStartDate, sal_Int32 nEndDat
         return 0.0;     // nothing to do...
 
     if( nStartDate > nEndDate )
-    {
-        sal_Int32   n = nEndDate;
-        nEndDate = nStartDate;
-        nStartDate = n;
-    }
+        std::swap( nStartDate, nEndDate );
 
     sal_Int32 nDate1 = nStartDate + nNullDate;
     sal_Int32 nDate2 = nEndDate + nNullDate;
diff --git a/svx/source/dialog/rubydialog.cxx b/svx/source/dialog/rubydialog.cxx
index 135090c87211..3abd7e9b3517 100644
--- a/svx/source/dialog/rubydialog.cxx
+++ b/svx/source/dialog/rubydialog.cxx
@@ -741,11 +741,7 @@ void RubyPreview::Paint(vcl::RenderContext& 
rRenderContext, const tools::Rectang
 
     sal_Int16 nRubyPos = m_pParentDlg->m_xPositionLB->get_active();
     if (nRubyPos == 1) // BOTTOM
-    {
-        tools::Long nTmp = nYRuby;
-        nYRuby = nYBase;
-        nYBase = nTmp;
-    }
+        std::swap(nYRuby, nYBase);
     else if (nRubyPos == 2) // RIGHT ( vertically )
     {
         // Align the ruby text and base text to the vertical center.
diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx
index 4d556b1f9feb..e9f0f1ebad15 100644
--- a/svx/source/xoutdev/_xpoly.cxx
+++ b/svx/source/xoutdev/_xpoly.cxx
@@ -617,11 +617,7 @@ void XPolygon::CalcSmoothJoin(sal_uInt16 nCenter, 
sal_uInt16 nDrag, sal_uInt16 n
     // If nPoint is no control point, i.e. cannot be moved, then
     // move nDrag instead on the line between nCenter and nPnt
     if ( !IsControl(nPnt) )
-    {
-        sal_uInt16 nTmp = nDrag;
-        nDrag = nPnt;
-        nPnt = nTmp;
-    }
+        std::swap( nDrag, nPnt );
     Point*  pPoints = pImpXPolygon->pPointAry.get();
     Point   aDiff   = pPoints[nDrag] - pPoints[nCenter];
     double  fDiv    = CalcDistance(nCenter, nDrag);
diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index c51d77ae8ba1..0d7f7eaa5259 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -3471,11 +3471,7 @@ bool SwAccessibleParagraph::GetSelectionAtIndex(
     {
         sal_Int32 nCaretPos = GetCaretPos();
         if( nStart == nCaretPos )
-        {
-            sal_Int32 tmp = nStart;
-            nStart = nEnd;
-            nEnd = tmp;
-        }
+            std::swap( nStart, nEnd );
     }
     return bRet;
 }
diff --git a/sw/source/core/access/accpara.hxx 
b/sw/source/core/access/accpara.hxx
index 2e9692f9e7eb..59aac90ed3f0 100644
--- a/sw/source/core/access/accpara.hxx
+++ b/sw/source/core/access/accpara.hxx
@@ -133,9 +133,7 @@ class SwAccessibleParagraph :
     static void OrderRange(sal_Int32& nBegin, sal_Int32& nEnd)
     {
         if( nBegin > nEnd )
-        {
-            sal_Int32 nTmp = nBegin; nBegin = nEnd; nEnd = nTmp;
-        }
+            std::swap( nBegin, nEnd );
     }
 
     const SwRangeRedline* GetRedlineAtIndex();
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index c37595430761..2e34d4696be2 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3420,11 +3420,7 @@ bool SwCursorShell::IsSelFullPara() const
         sal_Int32 nStt = m_pCurrentCursor->GetPoint()->GetContentIndex();
         sal_Int32 nEnd = m_pCurrentCursor->GetMark()->GetContentIndex();
         if( nStt > nEnd )
-        {
-            sal_Int32 nTmp = nStt;
-            nStt = nEnd;
-            nEnd = nTmp;
-        }
+            std::swap( nStt, nEnd );
         const SwContentNode* pCNd = m_pCurrentCursor->GetPointContentNode();
         bRet = pCNd && !nStt && nEnd == pCNd->Len();
     }
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 0fd78618ef44..290379a22a64 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -801,12 +801,8 @@ bool SwPaM::HasReadonlySel(bool bFormView, bool const 
isReplace) const
         {
             SwNodeOffset nSttIdx = GetMark()->GetNodeIndex(),
                     nEndIdx = GetPoint()->GetNodeIndex();
-            if( nEndIdx <= nSttIdx )
-            {
-                SwNodeOffset nTmp = nSttIdx;
-                nSttIdx = nEndIdx;
-                nEndIdx = nTmp;
-            }
+            if( nEndIdx < nSttIdx )
+                std::swap( nSttIdx, nEndIdx );
 
             // If a protected section should be between nodes, then the
             // selection needs to contain already x nodes.
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index b888a062e516..b379fe689766 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -76,9 +76,7 @@ struct PercentHdl
     {
         bBack = (nStt > nEnd);
         if( bBack )
-        {
-            sal_uLong n = nStt; nStt = nEnd; nEnd = n;
-        }
+            std::swap( nStt, nEnd );
         ::StartProgress( STR_STATSTR_SEARCH, nStt, nEnd );
     }
 
@@ -101,9 +99,7 @@ struct PercentHdl
         nActPos = nStt;
         bBack = (nStt > nEnd );
         if( bBack )
-        {
-            sal_uLong n = nStt; nStt = nEnd; nEnd = n;
-        }
+            std::swap( nStt, nEnd );
         ::StartProgress( STR_STATSTR_SEARCH, nStt, nEnd, pDSh );
     }
 
@@ -304,11 +300,7 @@ bool SwCursor::IsSelOvr( SwCursorSelOverFlags eFlags )
             SwNodeOffset nSttIdx = GetMark()->GetNodeIndex(),
                 nEndIdx = GetPoint()->GetNodeIndex();
             if( nEndIdx <= nSttIdx )
-            {
-                SwNodeOffset nTmp = nSttIdx;
-                nSttIdx = nEndIdx;
-                nEndIdx = nTmp;
-            }
+                std::swap( nSttIdx, nEndIdx );
 
             const SwSectionFormats& rFormats = rDoc.GetSections();
             for( SwSectionFormats::size_type n = 0; n < rFormats.size(); ++n )
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 4bdde1ab0a0a..d39d698737e2 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -2714,7 +2714,8 @@ SwRedlineTable::size_type 
DocumentRedlineManager::GetRedlinePos( const SwNode& r
             const SwRangeRedline* pTmp = maRedlineTable[ n ];
             SwNodeOffset nPt = pTmp->GetPoint()->GetNodeIndex(),
                   nMk = pTmp->GetMark()->GetNodeIndex();
-            if( nPt < nMk ) { SwNodeOffset nTmp = nMk; nMk = nPt; nPt = nTmp; }
+            if( nPt < nMk )
+                std::swap( nMk, nPt );
 
             if( ( RedlineType::Any == nType || nType == pTmp->GetType()) &&
                 nMk <= nNdIdx && nNdIdx <= nPt )
@@ -2956,7 +2957,8 @@ void 
DocumentRedlineManager::AcceptRedlineParagraphFormatting( const SwPaM &rPam
         const SwRangeRedline* pTmp = maRedlineTable[ n ];
         SwNodeOffset nPt = pTmp->GetPoint()->GetNodeIndex(),
               nMk = pTmp->GetMark()->GetNodeIndex();
-        if( nPt < nMk ) { SwNodeOffset nTmp = nMk; nMk = nPt; nPt = nTmp; }
+        if( nPt < nMk )
+            std::swap( nMk, nPt );
 
         if( RedlineType::ParagraphFormat == pTmp->GetType() &&
             ( (nSttIdx <= nMk && nMk <= nEndIdx) || (nSttIdx <= nPt && nPt <= 
nEndIdx) ) )
diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index ad0ad63077fa..913f8ce71389 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -754,11 +754,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const 
SfxItemSet& rSet )
             }
 
             if ( bRTL )
-            {
-                bool bTmp = bRightOver;
-                bRightOver = bLeftOver;
-                bLeftOver = bTmp;
-            }
+                std::swap( bLeftOver, bRightOver );
 
             // Do not set anything by default in HeadlineRepeats
             if ( pTab->IsFollow() &&
@@ -1082,11 +1078,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, 
SfxItemSet& rSet )
             }
 
             if ( bRTL )
-            {
-                bool bTmp = bRightOver;
-                bRightOver = bLeftOver;
-                bLeftOver = bTmp;
-            }
+                std::swap( bLeftOver, bRightOver );
 
             const SwFrameFormat  *pFormat  = pCell->GetFormat();
             const SvxBoxItem  &rBox  = pFormat->GetBox();
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 4ce167928794..ccbb1219d6fe 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -203,9 +203,7 @@ void GetTableSel( const SwCursor& rCursor, SwSelBoxes& 
rBoxes,
         if ( nSttPos != USHRT_MAX && nEndPos != USHRT_MAX )
         {
             if( nEndPos < nSttPos )     // exchange
-            {
-                sal_uInt16 nTmp = nSttPos; nSttPos = nEndPos; nEndPos = nTmp;
-            }
+                std::swap( nSttPos, nEndPos );
 
             bool bChkProtected( SwTableSearchType::Protect & eSearchType );
             for( ; nSttPos <= nEndPos; ++nSttPos )
@@ -1857,17 +1855,9 @@ void MakeSelUnions( SwSelUnions& rUnions, const 
SwLayoutFrame *pStart,
             nEd2 = aRectFnSet.GetBottom(pTable->getFrameArea());
         Point aSt, aEd;
         if( nSt1 > nEd1 )
-        {
-            tools::Long nTmp = nSt1;
-            nSt1 = nEd1;
-            nEd1 = nTmp;
-        }
+            std::swap( nSt1, nEd1 );
         if( nSt2 > nEd2 )
-        {
-            tools::Long nTmp = nSt2;
-            nSt2 = nEd2;
-            nEd2 = nTmp;
-        }
+            std::swap( nSt2, nEd2 );
         if( aRectFnSet.IsVert() )
         {
             aSt = Point( nSt2, nSt1 );
diff --git a/sw/source/filter/html/htmlsect.cxx 
b/sw/source/filter/html/htmlsect.cxx
index ff694a7fffbe..ee1e6b55d39d 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -281,11 +281,7 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken )
             {
                 nPos2 = aHRef.lastIndexOf( cDelim, nPos );
                 if( nPos2 != -1 )
-                {
-                    sal_Int32 nTmp = nPos;
-                    nPos = nPos2;
-                    nPos2 = nTmp;
-                }
+                    std::swap( nPos, nPos2 );
             }
             OUString aURL;
             if( nPos == -1 )
diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx
index 67949fcec1fb..8e9e81f5a6b8 100644
--- a/vcl/source/gdi/gradient.cxx
+++ b/vcl/source/gdi/gradient.cxx
@@ -401,15 +401,9 @@ void 
Gradient::DrawLinearGradientToMetafile(tools::Rectangle const& rRect, GDIMe
     // gradient style axial has exchanged start and end colors
     if ( !bLinear)
     {
-        tools::Long nTempColor = nStartRed;
-        nStartRed = nEndRed;
-        nEndRed = nTempColor;
-        nTempColor = nStartGreen;
-        nStartGreen = nEndGreen;
-        nEndGreen = nTempColor;
-        nTempColor = nStartBlue;
-        nStartBlue = nEndBlue;
-        nEndBlue = nTempColor;
+        std::swap( nStartRed, nEndRed );
+        std::swap( nStartGreen, nEndGreen );
+        std::swap( nStartBlue, nEndBlue );
     }
 
     sal_uInt8   nRed;
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index fd8ee9e60a7d..47939934773d 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -269,15 +269,9 @@ void OutputDevice::DrawLinearGradient( const 
tools::Rectangle& rRect,
     // gradient style axial has exchanged start and end colors
     if ( !bLinear)
     {
-        tools::Long nTempColor = nStartRed;
-        nStartRed = nEndRed;
-        nEndRed = nTempColor;
-        nTempColor = nStartGreen;
-        nStartGreen = nEndGreen;
-        nEndGreen = nTempColor;
-        nTempColor = nStartBlue;
-        nStartBlue = nEndBlue;
-        nEndBlue = nTempColor;
+        std::swap( nStartRed, nEndRed );
+        std::swap( nStartGreen, nEndGreen );
+        std::swap( nStartBlue, nEndBlue );
     }
 
     sal_uInt8   nRed;
diff --git a/vcl/source/text/ImplLayoutRuns.cxx 
b/vcl/source/text/ImplLayoutRuns.cxx
index a560e17e1b8b..b0f7b5f30f60 100644
--- a/vcl/source/text/ImplLayoutRuns.cxx
+++ b/vcl/source/text/ImplLayoutRuns.cxx
@@ -52,11 +52,7 @@ void ImplLayoutRuns::AddRun( int nCharPos0, int nCharPos1, 
bool bRTL )
 
     // swap if needed
     if( bRTL == (nCharPos0 < nCharPos1) )
-    {
-        int nTemp = nCharPos0;
-        nCharPos0 = nCharPos1;
-        nCharPos1 = nTemp;
-    }
+        std::swap( nCharPos0, nCharPos1 );
 
     if (maRuns.size() >= 2 && nCharPos0 == maRuns[maRuns.size() - 2] && 
nCharPos1 == maRuns[maRuns.size() - 1])
     {
@@ -77,11 +73,7 @@ bool ImplLayoutRuns::PosIsInRun( int nCharPos ) const
     int nMinCharPos = maRuns[ mnRunIndex+0 ];
     int nEndCharPos = maRuns[ mnRunIndex+1 ];
     if( nMinCharPos > nEndCharPos ) // reversed in RTL case
-    {
-        int nTemp = nMinCharPos;
-        nMinCharPos = nEndCharPos;
-        nEndCharPos = nTemp;
-    }
+        std::swap( nMinCharPos, nEndCharPos );
 
     if( nCharPos < nMinCharPos )
         return false;
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 71481200d9f0..62c60f4e1336 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -853,11 +853,7 @@ void DecorationView::DrawHighlightFrame( const 
tools::Rectangle& rRect,
     }
 
     if ( nStyle == DrawHighlightFrameStyle::In )
-    {
-        Color aTempColor = aLightColor;
-        aLightColor = aShadowColor;
-        aShadowColor = aTempColor;
-    }
+        std::swap( aLightColor, aShadowColor );
 
     DrawFrame( rRect, aLightColor, aShadowColor );
 }
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 6257e43ca208..4bad98fa16a6 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -2335,9 +2335,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, tools::Long 
nNewSize,
     {
         nPos--;
         nDelta *= -1;
-        bool bTemp = bPropSmall;
-        bPropSmall = bPropGreat;
-        bPropGreat = bTemp;
+        std::swap( bPropSmall, bPropGreat );
     }
 
     sal_uInt16          n;

Reply via email to