[Libreoffice-commits] core.git: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Nov 7 08:56:34 UTC 2018


 sw/source/core/doc/DocumentContentOperationsManager.cxx |    7 -
 sw/source/core/doc/docfly.cxx                           |    7 -
 sw/source/core/doc/notxtfrm.cxx                         |    9 --
 sw/source/core/docnode/ndtbl.cxx                        |   69 +++++-----------
 sw/source/core/layout/findfrm.cxx                       |    3 
 sw/source/core/layout/flylay.cxx                        |   11 --
 sw/source/core/layout/pagechg.cxx                       |   29 +++---
 sw/source/core/layout/sectfrm.cxx                       |   11 --
 sw/source/core/layout/tabfrm.cxx                        |    7 -
 sw/source/core/text/frmform.cxx                         |    7 -
 sw/source/core/text/itrcrsr.cxx                         |   11 --
 sw/source/core/text/pormulti.cxx                        |    9 --
 sw/source/core/text/txtfrm.cxx                          |   15 +--
 sw/source/core/txtnode/ndtxt.cxx                        |   19 +---
 sw/source/core/unocore/unoobj.cxx                       |    7 -
 sw/source/filter/basflt/shellio.cxx                     |   11 --
 sw/source/filter/ww8/wrtww8.cxx                         |    9 --
 sw/source/filter/ww8/ww8graf.cxx                        |   39 ++++-----
 sw/source/filter/ww8/ww8par3.cxx                        |   31 +++----
 sw/source/filter/ww8/ww8scan.cxx                        |   25 +----
 sw/source/filter/xml/xmlmeta.cxx                        |   10 --
 sw/source/ui/envelp/mailmrge.cxx                        |    6 -
 sw/source/ui/misc/outline.cxx                           |   29 +++---
 sw/source/uibase/dbui/dbmgr.cxx                         |   23 ++---
 sw/source/uibase/docvw/edtwin2.cxx                      |   11 --
 sw/source/uibase/ribbar/conarc.cxx                      |    7 -
 sw/source/uibase/ribbar/inputwin.cxx                    |   57 ++++++-------
 27 files changed, 186 insertions(+), 293 deletions(-)

New commits:
commit 977ccf4b0fffc178ad550bda47421db5bc4c82fd
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Nov 7 09:31:18 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Nov 7 09:55:05 2018 +0100

    loplugin:collapseif in sw
    
    Change-Id: I61e32f6ecaf72d51528af4b067d651a17691d4b1
    Reviewed-on: https://gerrit.libreoffice.org/62986
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 1b40c8605e49..37115a78c946 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2631,12 +2631,9 @@ void DocumentContentOperationsManager::TransliterateText(
     else if( pTNd && nSttCnt < nEndCnt )
         pTNd->TransliterateText( rTrans, nSttCnt, nEndCnt, pUndo.get() );
 
-    if( pUndo )
+    if( pUndo && pUndo->HasData() )
     {
-        if( pUndo->HasData() )
-        {
-            m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
-        }
+        m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
     }
     m_rDoc.getIDocumentState().SetModified();
 }
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index ad1f406933a9..452112cc7073 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -561,12 +561,9 @@ bool SwDoc::SetFlyFrameAttr( SwFrameFormat& rFlyFormat, SfxItemSet& rSet )
 
     bool const bRet = lcl_SetFlyFrameAttr(*this, &SwDoc::SetFlyFrameAnchor, rFlyFormat, rSet);
 
-    if (pSaveUndo)
+    if (pSaveUndo && pSaveUndo->GetUndo() )
     {
-        if ( pSaveUndo->GetUndo() )
-        {
-            GetIDocumentUndoRedo().AppendUndo( pSaveUndo->ReleaseUndo() );
-        }
+        GetIDocumentUndoRedo().AppendUndo( pSaveUndo->ReleaseUndo() );
     }
 
     getIDocumentState().SetModified();
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index cea0bdb9a591..4f5cc43636ad 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -690,13 +690,10 @@ bool SwNoTextFrame::GetCharRect( SwRect &rRect, const SwPosition& rPos,
     else
         rRect.Intersection_( aFrameRect );
 
-    if ( pCMS )
+    if ( pCMS && pCMS->m_bRealHeight )
     {
-        if ( pCMS->m_bRealHeight )
-        {
-            pCMS->m_aRealHeight.setY(rRect.Height());
-            pCMS->m_aRealHeight.setX(0);
-        }
+        pCMS->m_aRealHeight.setY(rRect.Height());
+        pCMS->m_aRealHeight.setX(0);
     }
 
     return true;
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index daba8542ef05..f206d2eb04a9 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1750,13 +1750,10 @@ bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind )
         }
     }
 
-    if( pUndo )
+    if( pUndo && bRet )
     {
-        if( bRet )
-        {
-            pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
-            GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
-        }
+        pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
+        GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
     }
     return bRet;
 }
@@ -1808,13 +1805,10 @@ bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind )
         }
     }
 
-    if( pUndo )
+    if( pUndo && bRet )
     {
-        if( bRet )
-        {
-            pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
-            GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
-        }
+        pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
+        GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
     }
     return bRet;
 
@@ -2142,12 +2136,9 @@ bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
         }
     }
 
-    if( pUndo )
+    if( pUndo && bRet )
     {
-        if( bRet )
-        {
-            GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
-        }
+        GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
     }
 
     return bRet;
@@ -2210,16 +2201,13 @@ bool SwDoc::SplitTable( const SwSelBoxes& rBoxes, bool bVert, sal_uInt16 nCnt,
         }
     }
 
-    if( pUndo )
+    if( pUndo && bRet )
     {
-        if( bRet )
-        {
-            if( bVert )
-                pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
-            else
-                pUndo->SaveNewBoxes( *pTableNd, aTmpLst, rBoxes, aNdsCnts );
-            GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
-        }
+        if( bVert )
+            pUndo->SaveNewBoxes( *pTableNd, aTmpLst );
+        else
+            pUndo->SaveNewBoxes( *pTableNd, aTmpLst, rBoxes, aNdsCnts );
+        GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
     }
 
     return bRet;
@@ -4297,15 +4285,12 @@ bool SwDoc::InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
                                                 bCpyName );
         }
 
-        if( pUndo )
+        if( pUndo && bRet )
         {
-            if( bRet )
-            {
-                pInsTableNd = GetNodes()[ rInsPos.nNode.GetIndex() - 1 ]->FindTableNode();
+            pInsTableNd = GetNodes()[ rInsPos.nNode.GetIndex() - 1 ]->FindTableNode();
 
-                pUndo->SetTableSttIdx( pInsTableNd->GetIndex() );
-                GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
-            }
+            pUndo->SetTableSttIdx( pInsTableNd->GetIndex() );
+            GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
         }
     }
     else
@@ -4427,13 +4412,8 @@ bool SwDoc::UnProtectTableCells( SwTable& rTable )
         }
     }
 
-    if( pUndo )
-    {
-        if( bChgd )
-        {
-            GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
-        }
-    }
+    if( pUndo && bChgd )
+        GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
     return bChgd;
 }
 
@@ -4480,13 +4460,8 @@ bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes )
             }
         }
 
-        if( pUndo )
-        {
-            if( bChgd )
-            {
-                GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
-            }
-        }
+        if( pUndo && bChgd )
+            GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
     }
     return bChgd;
 }
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index e4d94e45b1b6..90d5fedfac70 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -382,9 +382,8 @@ const SwContentFrame* SwContentFrame::ImplGetNextContentFrame( bool bFwd ) const
 
         bGoingUp = !(bGoingFwdOrBwd || bGoingDown);
 
-        if ( !bFwd )
+        if ( !bFwd && bGoingDown && p )
         {
-            if( bGoingDown && p )
                 while ( p->GetNext() )
                     p = p->GetNext();
         }
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index d9d2120bfdda..6dde1f694242 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -1295,14 +1295,11 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove )
                     if ( !pCell && pUp->IsCellFrame() )
                         pCell = pUp;
                 }
-                if ( bMove )
+                if ( bMove && pUp->IsRootFrame() )
                 {
-                    if ( pUp->IsRootFrame() )
-                    {
-                        rRect  = pUp->getFramePrintArea();
-                        rRect += pUp->getFrameArea().Pos();
-                        pUp = nullptr;
-                    }
+                    rRect  = pUp->getFramePrintArea();
+                    rRect += pUp->getFrameArea().Pos();
+                    pUp = nullptr;
                 }
                 if ( pUp )
                 {
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 94151fa3671f..6c8df71ff7ad 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -1967,27 +1967,24 @@ static void lcl_MoveAllLowerObjs( SwFrame* pFrame, const Point& rOffset )
             pFlyFrame->NotifyDrawObj();
             // --> let the active embedded object be moved
             SwFrame* pLower = pFlyFrame->Lower();
-            if ( pLower )
+            if ( pLower && pLower->IsNoTextFrame() )
             {
-                if ( pLower->IsNoTextFrame() )
+                SwRootFrame* pRoot = pLower->getRootFrame();
+                SwViewShell *pSh = pRoot ? pRoot->GetCurrShell() : nullptr;
+                if ( pSh )
                 {
-                    SwRootFrame* pRoot = pLower->getRootFrame();
-                    SwViewShell *pSh = pRoot ? pRoot->GetCurrShell() : nullptr;
-                    if ( pSh )
+                    SwNoTextFrame *const pContentFrame = static_cast<SwNoTextFrame*>(pLower);
+                    SwOLENode* pNode = pContentFrame->GetNode()->GetOLENode();
+                    if ( pNode )
                     {
-                        SwNoTextFrame *const pContentFrame = static_cast<SwNoTextFrame*>(pLower);
-                        SwOLENode* pNode = pContentFrame->GetNode()->GetOLENode();
-                        if ( pNode )
+                        svt::EmbeddedObjectRef& xObj = pNode->GetOLEObj().GetObject();
+                        if ( xObj.is() )
                         {
-                            svt::EmbeddedObjectRef& xObj = pNode->GetOLEObj().GetObject();
-                            if ( xObj.is() )
+                            for(SwViewShell& rSh : pSh->GetRingContainer())
                             {
-                                for(SwViewShell& rSh : pSh->GetRingContainer())
-                                {
-                                    SwFEShell* pFEShell = dynamic_cast< SwFEShell* >( &rSh );
-                                    if ( pFEShell )
-                                        pFEShell->MoveObjectIfActive( xObj, rOffset );
-                                }
+                                SwFEShell* pFEShell = dynamic_cast< SwFEShell* >( &rSh );
+                                if ( pFEShell )
+                                    pFEShell->MoveObjectIfActive( xObj, rOffset );
                             }
                         }
                     }
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 6853186ee2ca..500eaa6b15d1 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -423,14 +423,11 @@ void SwSectionFrame::Paste( SwFrame* pParent, SwFrame* pSibling )
     if( nFrameHeight )
         pParent->Grow( nFrameHeight );
 
-    if ( GetPrev() )
+    if ( GetPrev() && !IsFollow() )
     {
-        if ( !IsFollow() )
-        {
-            GetPrev()->InvalidateSize();
-            if ( GetPrev()->IsContentFrame() )
-                GetPrev()->InvalidatePage( pPage );
-        }
+        GetPrev()->InvalidateSize();
+        if ( GetPrev()->IsContentFrame() )
+            GetPrev()->InvalidatePage( pPage );
     }
 }
 
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 175e7d546f30..59bdea7c35d3 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2442,11 +2442,8 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
                     // #i29771# Two tries to split the table
                     // If an error occurred during splitting. We start a second
                     // try, this time without splitting of table rows.
-                    if ( bSplitError )
-                    {
-                        if ( HasFollowFlowLine() )
-                            RemoveFollowFlowLine();
-                    }
+                    if ( bSplitError && HasFollowFlowLine() )
+                        RemoveFollowFlowLine();
 
                     // If splitting the table was successful or not,
                     // we do not want to have 'empty' follow tables.
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 84d8785dc4d1..1712aa8475b7 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -322,11 +322,8 @@ bool SwTextFrame::CalcFollow(TextFrameIndex const nTextOfst)
             }
         }
 
-        if ( pPage )
-        {
-            if ( !bOldInvaContent )
-                pPage->ValidateContent();
-        }
+        if ( pPage  && !bOldInvaContent )
+            pPage->ValidateContent();
 
 #if OSL_DEBUG_LEVEL > 0
         OSL_ENSURE( pOldUp == GetUpper(), "SwTextFrame::CalcFollow: heavy follow" );
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 2d0273a43cca..eeca36566455 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1415,14 +1415,11 @@ TextFrameIndex SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoin
         pCMS->m_bPosCorr = true;
 
     // #i27615#
-    if (pCMS)
+    if (pCMS && pCMS->m_bInFrontOfLabel)
     {
-        if( pCMS->m_bInFrontOfLabel)
-        {
-            if (! (2 * nX < nWidth && pPor->InNumberGrp() &&
-                   !pPor->IsFootnoteNumPortion()))
-                pCMS->m_bInFrontOfLabel = false;
-        }
+        if (! (2 * nX < nWidth && pPor->InNumberGrp() &&
+               !pPor->IsFootnoteNumPortion()))
+            pCMS->m_bInFrontOfLabel = false;
     }
 
     // 7684: We are exactly ended up at their HyphPortion. It is our task to
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index ef87d58f168f..347d6f8f860f 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -2355,13 +2355,10 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
     SwFieldPortion *pField = nullptr;
     while( pPor )
     {
-        if( pPor->GetLen() )
+        if( pPor->GetLen() && !pHelpMulti )
         {
-            if( !pHelpMulti )
-            {
-                nMultiPos = nMultiPos + pPor->GetLen();
-                pTmpMulti = nullptr;
-            }
+            nMultiPos = nMultiPos + pPor->GetLen();
+            pTmpMulti = nullptr;
         }
         if( pPor->InFieldGrp() )
         {
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index e124fd73bc56..fc94e79a8648 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -267,18 +267,15 @@ namespace sw {
         else
         {
             SwpHints const*const pHints(m_pNode->GetpSwpHints());
-            if (pHints)
+            if (pHints && 0 < m_CurrentHint)
             {
-                if (0 < m_CurrentHint)
+                SwTextAttr const*const pHint(pHints->Get(m_CurrentHint - 1));
+                --m_CurrentHint;
+                if (ppNode)
                 {
-                    SwTextAttr const*const pHint(pHints->Get(m_CurrentHint - 1));
-                    --m_CurrentHint;
-                    if (ppNode)
-                    {
-                        *ppNode = m_pNode;
-                    }
-                    return pHint;
+                    *ppNode = m_pNode;
                 }
+                return pHint;
             }
             return nullptr;
         }
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index c9b419dd69ea..b47fcac792e6 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1202,20 +1202,17 @@ void SwTextNode::Update(
                 }
 
                 sal_Int32 * const pEnd = pHint->GetEnd();
-                if (pEnd)
+                if (pEnd && *pEnd > nChangePos )
                 {
-                    if ( *pEnd > nChangePos )
+                    if( *pEnd > nChangeEnd )
                     {
-                        if( *pEnd > nChangeEnd )
-                        {
-                            *pEnd = *pEnd - nChangeLen;
-                        }
-                        else
-                        {
-                            *pEnd = nChangePos;
-                        }
-                        bTextAttrChanged = !bStartOfTextAttrChanged;
+                        *pEnd = *pEnd - nChangeLen;
+                    }
+                    else
+                    {
+                        *pEnd = nChangePos;
                     }
+                    bTextAttrChanged = !bStartOfTextAttrChanged;
                 }
 
                 if ( bTextAttrChanged
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 4e2907dcafa2..67060efebabc 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -540,12 +540,9 @@ SwUnoCursorHelper::SetCursorPropertyValue(
             else if (FN_UNO_IS_NUMBER == rEntry.nWID)
             {
                 bool bIsNumber(false);
-                if (rValue >>= bIsNumber)
+                if ((rValue >>= bIsNumber) && !bIsNumber)
                 {
-                    if (!bIsNumber)
-                    {
-                        pTextNd->SetCountedInList( false );
-                    }
+                    pTextNd->SetCountedInList( false );
                 }
             }
             //PROPERTY_MAYBEVOID!
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 6ff946733cf8..cf8c34db8972 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -349,14 +349,11 @@ ErrCode SwReader::Read( const Reader& rOptions )
     mxDoc->GetCellStyles().clear();
 
     mxDoc->GetIDocumentUndoRedo().DoUndo(bDocUndo);
-    if (!bReadPageDescs)
+    if (!bReadPageDescs && bSaveUndo )
     {
-        if( bSaveUndo )
-        {
-            mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
-            mxDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::INSDOKUMENT, nullptr );
-            mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore );
-        }
+        mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );
+        mxDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::INSDOKUMENT, nullptr );
+        mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::Ignore );
     }
 
     // delete Pam if it was created only for reading
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 8cf84557772f..04a1ad1ff658 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1363,13 +1363,10 @@ WW8_WrPct::~WW8_WrPct()
 void WW8_WrPct::AppendPc(WW8_FC nStartFc)
 {
     WW8_CP nStartCp = nStartFc - nOldFc;    // subtract the beginning of the text
-    if ( !nStartCp )
+    if ( !nStartCp && !m_Pcts.empty())
     {
-        if (!m_Pcts.empty())
-        {
-            OSL_ENSURE(1 == m_Pcts.size(), "empty Piece!");
-            m_Pcts.pop_back();
-        }
+        OSL_ENSURE(1 == m_Pcts.size(), "empty Piece!");
+        m_Pcts.pop_back();
     }
 
     nOldFc = nStartFc;                      // remember StartFc as old
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 90cd932fa6d4..ec4425b1da8c 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1146,28 +1146,25 @@ void SwWW8ImplReader::InsertTxbxText(SdrTextObj* pTextObj,
 
             if( bDone )
             {
-                if( pFlyFormat )
+                if( pFlyFormat && pRecord )
                 {
-                    if( pRecord )
-                    {
-                        SfxItemSet aFlySet( m_rDoc.GetAttrPool(),
-                            svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END-1>{} );
-
-                        tools::Rectangle aInnerDist(   pRecord->nDxTextLeft,
-                                                pRecord->nDyTextTop,
-                                                pRecord->nDxTextRight,
-                                                pRecord->nDyTextBottom  );
-                        MatchSdrItemsIntoFlySet( pTextObj,
-                                                 aFlySet,
-                                                 pRecord->eLineStyle,
-                                                 pRecord->eLineDashing,
-                                                 pRecord->eShapeType,
-                                                 aInnerDist );
-
-                        pFlyFormat->SetFormatAttr( aFlySet );
-
-                        MapWrapIntoFlyFormat(pRecord, pFlyFormat);
-                    }
+                    SfxItemSet aFlySet( m_rDoc.GetAttrPool(),
+                        svl::Items<RES_FRMATR_BEGIN, RES_FRMATR_END-1>{} );
+
+                    tools::Rectangle aInnerDist(   pRecord->nDxTextLeft,
+                                             pRecord->nDyTextTop,
+                                             pRecord->nDxTextRight,
+                                             pRecord->nDyTextBottom  );
+                    MatchSdrItemsIntoFlySet( pTextObj,
+                                             aFlySet,
+                                             pRecord->eLineStyle,
+                                             pRecord->eLineDashing,
+                                             pRecord->eShapeType,
+                                             aInnerDist );
+
+                    pFlyFormat->SetFormatAttr( aFlySet );
+
+                    MapWrapIntoFlyFormat(pRecord, pFlyFormat);
                 }
                 aString.clear();
                 rbEraseTextObj = (nullptr != pFlyFormat);
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index f8ec183e94ef..34bca3e5ac85 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1603,25 +1603,22 @@ SwNumRule* WW8ListManager::GetNumRuleForActivation(sal_uInt16 nLFOPosition,
                 pRet = pParentListInfo->pNumRule;
 
                 //did it not affect start at value ?
-                if (bFirstUse)
+                if (bFirstUse && rOverride.bStartAt)
                 {
-                    if (rOverride.bStartAt)
+                    const SwNumFormat &rFormat =
+                        pParentListInfo->pNumRule->Get(nLevel);
+                    if (
+                         rFormat.GetStart() ==
+                         rLFOInfo.maOverrides[nLevel].nStartAt
+                       )
                     {
-                        const SwNumFormat &rFormat =
-                            pParentListInfo->pNumRule->Get(nLevel);
-                        if (
-                             rFormat.GetStart() ==
-                             rLFOInfo.maOverrides[nLevel].nStartAt
-                           )
-                        {
-                            bRestart = true;
-                        }
-                        else
-                        {
-                            bNewstart = true;
-                            nStart = writer_cast<sal_uInt16>
-                                (rLFOInfo.maOverrides[nLevel].nStartAt);
-                        }
+                        bRestart = true;
+                    }
+                    else
+                    {
+                        bNewstart = true;
+                        nStart = writer_cast<sal_uInt16>
+                            (rLFOInfo.maOverrides[nLevel].nStartAt);
                     }
                 }
 
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index ca4903521f03..5354cbbb1c56 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -3184,11 +3184,8 @@ bool WW8PLCFx_Fc_FKP::SeekPos(WW8_FC nFcPos)
 
 WW8_FC WW8PLCFx_Fc_FKP::Where()
 {
-    if( !pFkp )
-    {
-        if( !NewFkp() )
-            return WW8_FC_MAX;
-    }
+    if( !pFkp && !NewFkp() )
+        return WW8_FC_MAX;
     WW8_FC nP = pFkp ? pFkp->Where() : WW8_FC_MAX;
     if( nP != WW8_FC_MAX )
         return nP;
@@ -3216,11 +3213,8 @@ sal_uInt8* WW8PLCFx_Fc_FKP::GetSprmsAndPos(WW8_FC& rStart, WW8_FC& rEnd, sal_Int
 
 void WW8PLCFx_Fc_FKP::advance()
 {
-    if( !pFkp )
-    {
-        if( !NewFkp() )
-            return;
-    }
+    if( !pFkp && !NewFkp() )
+        return;
 
     if (!pFkp)
         return;
@@ -5107,14 +5101,11 @@ sal_uInt16 WW8PLCFMan::WhereIdx(bool *const pbStart, WW8_CP *const pPos) const
     for (sal_uInt16 i=m_nPLCF; i > 0; --i)
     {
         pD = &m_aD[i-1];
-        if (pD != m_pPcdA)
+        if (pD != m_pPcdA && pD->nStartPos < nNext )
         {
-            if( pD->nStartPos < nNext )
-            {
-                nNext = pD->nStartPos;
-                nNextIdx = i-1;
-                bStart = true;
-            }
+            nNext = pD->nStartPos;
+            nNextIdx = i-1;
+            bStart = true;
         }
     }
     if( pPos )
diff --git a/sw/source/filter/xml/xmlmeta.cxx b/sw/source/filter/xml/xmlmeta.cxx
index d984abb6017e..360f0c918c2c 100644
--- a/sw/source/filter/xml/xmlmeta.cxx
+++ b/sw/source/filter/xml/xmlmeta.cxx
@@ -163,14 +163,10 @@ void SwXMLExport::ExportMeta_()
 {
     SvXMLExport::ExportMeta_();
 
-    if( !m_bBlock )
+    if( !m_bBlock && IsShowProgress() )
     {
-
-        if( IsShowProgress() )
-        {
-            ProgressBarHelper *pProgress = GetProgressBarHelper();
-            pProgress->SetValue( pProgress->GetValue() + 2 );
-        }
+        ProgressBarHelper *pProgress = GetProgressBarHelper();
+        pProgress->SetValue( pProgress->GetValue() + 2 );
     }
 }
 
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
index f896e3b52f73..f9648fdd83fa 100644
--- a/sw/source/ui/envelp/mailmrge.cxx
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -413,10 +413,8 @@ void SwMailMergeDlg::Apply()
 
 IMPL_LINK( SwMailMergeDlg, ButtonHdl, Button *, pBtn, void )
 {
-    if (pBtn == m_pOkBTN) {
-        if( ExecQryShell() )
-            EndDialog(RET_OK);
-    }
+    if (pBtn == m_pOkBTN && ExecQryShell() )
+        EndDialog(RET_OK);
 }
 
 IMPL_LINK( SwMailMergeDlg, OutputTypeHdl, Button *, pBtn, void )
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index a5b6b4576bda..d0588a3d9a73 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -351,25 +351,22 @@ short SwOutlineTabDialog::Ok()
         ::SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i),
                                          sHeadline );
         SwTextFormatColl* pColl = rWrtSh.FindTextFormatCollByName( sHeadline );
-        if( !pColl )
+        if( !pColl && aCollNames[i] != sHeadline)
         {
-            if(aCollNames[i] != sHeadline)
-            {
-                SwTextFormatColl* pTextColl = rWrtSh.GetTextCollFromPool(
-                    static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i) );
-                pTextColl->DeleteAssignmentToListLevelOfOutlineStyle();
-                pTextColl->ResetFormatAttr(RES_PARATR_NUMRULE);
+            SwTextFormatColl* pTextColl = rWrtSh.GetTextCollFromPool(
+                static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i) );
+            pTextColl->DeleteAssignmentToListLevelOfOutlineStyle();
+            pTextColl->ResetFormatAttr(RES_PARATR_NUMRULE);
 
-                if( !aCollNames[i].isEmpty() )
+            if( !aCollNames[i].isEmpty() )
+            {
+                pTextColl = rWrtSh.GetParaStyle(
+                            aCollNames[i], SwWrtShell::GETSTYLE_CREATESOME);
+                if(pTextColl)
                 {
-                    pTextColl = rWrtSh.GetParaStyle(
-                                aCollNames[i], SwWrtShell::GETSTYLE_CREATESOME);
-                    if(pTextColl)
-                    {
-                        pTextColl->AssignToListLevelOfOutlineStyle(i);
-                        SwNumRuleItem aItem(pOutlineRule->GetName());
-                        pTextColl->SetFormatAttr(aItem);
-                    }
+                    pTextColl->AssignToListLevelOfOutlineStyle(i);
+                    SwNumRuleItem aItem(pOutlineRule->GetName());
+                    pTextColl->SetFormatAttr(aItem);
                 }
             }
         }
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 9af9d7933401..71ee070be572 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -2531,21 +2531,18 @@ SwDSParam* SwDBManager::FindDSData(const SwDBData& rData, bool bCreate)
                 break;
             }
     }
-    if(bCreate)
+    if(bCreate && !pFound)
     {
-        if(!pFound)
+        pFound = new SwDSParam(rData);
+        m_DataSourceParams.push_back(std::unique_ptr<SwDSParam>(pFound));
+        try
+        {
+            uno::Reference<lang::XComponent> xComponent(pFound->xConnection, uno::UNO_QUERY);
+            if(xComponent.is())
+                xComponent->addEventListener(pImpl->m_xDisposeListener.get());
+        }
+        catch(const uno::Exception&)
         {
-            pFound = new SwDSParam(rData);
-            m_DataSourceParams.push_back(std::unique_ptr<SwDSParam>(pFound));
-            try
-            {
-                uno::Reference<lang::XComponent> xComponent(pFound->xConnection, uno::UNO_QUERY);
-                if(xComponent.is())
-                    xComponent->addEventListener(pImpl->m_xDisposeListener.get());
-            }
-            catch(const uno::Exception&)
-            {
-            }
         }
     }
     return pFound;
diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx
index e2049a33be52..e4258ed60f50 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -119,14 +119,11 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
 
     SdrView *pSdrView = rSh.GetDrawView();
 
-    if( bQuickBalloon )
+    if( bQuickBalloon && pSdrView )
     {
-        if( pSdrView )
-        {
-            SdrPageView* pPV = pSdrView->GetSdrPageView();
-            SwDPage* pPage = pPV ? static_cast<SwDPage*>(pPV->GetPage()) : nullptr;
-            bContinue = pPage && pPage->RequestHelp(this, pSdrView, rEvt);
-        }
+        SdrPageView* pPV = pSdrView->GetSdrPageView();
+        SwDPage* pPage = pPV ? static_cast<SwDPage*>(pPV->GetPage()) : nullptr;
+        bContinue = pPage && pPage->RequestHelp(this, pSdrView, rEvt);
     }
 
     if( bContinue && bQuickBalloon)
diff --git a/sw/source/uibase/ribbar/conarc.cxx b/sw/source/uibase/ribbar/conarc.cxx
index 67ab49b8bc2f..e9c082806439 100644
--- a/sw/source/uibase/ribbar/conarc.cxx
+++ b/sw/source/uibase/ribbar/conarc.cxx
@@ -33,11 +33,8 @@ ConstArc::ConstArc(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView)
 bool ConstArc::MouseButtonDown( const MouseEvent& rMEvt )
 {
     bool bReturn = SwDrawBase::MouseButtonDown(rMEvt);
-    if (bReturn)
-    {
-        if (!m_nButtonUpCount)
-            m_aStartPoint = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
-    }
+    if (bReturn && !m_nButtonUpCount)
+        m_aStartPoint = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
     return bReturn;
 }
 
diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx
index b928fc570788..7e4c4f3a3439 100644
--- a/sw/source/uibase/ribbar/inputwin.cxx
+++ b/sw/source/uibase/ribbar/inputwin.cxx
@@ -223,42 +223,39 @@ void SwInputWindow::ShowWin()
         {
             sEdit += pMgr->GetCurFieldPar2();
         }
-        else if( bFirst )
+        else if( bFirst && bIsTable )
         {
-            if( bIsTable )
-            {
-                m_bResetUndo = true;
-                SAL_WARN_IF(
-                    officecfg::Office::Common::Undo::Steps::get() <= 0,
-                    "sw", "/org.openoffice.Office.Common/Undo/Steps <= 0");
+            m_bResetUndo = true;
+            SAL_WARN_IF(
+                officecfg::Office::Common::Undo::Steps::get() <= 0,
+                "sw", "/org.openoffice.Office.Common/Undo/Steps <= 0");
 
-                m_bDoesUndo = pWrtShell->DoesUndo();
-                if( !m_bDoesUndo )
-                {
-                    pWrtShell->DoUndo();
-                }
+            m_bDoesUndo = pWrtShell->DoesUndo();
+            if( !m_bDoesUndo )
+            {
+                pWrtShell->DoUndo();
+            }
 
-                if( !pWrtShell->SwCursorShell::HasSelection() )
-                {
-                    pWrtShell->MoveSection( GoCurrSection, fnSectionStart );
-                    pWrtShell->SetMark();
-                    pWrtShell->MoveSection( GoCurrSection, fnSectionEnd );
-                }
-                if( pWrtShell->SwCursorShell::HasSelection() )
+            if( !pWrtShell->SwCursorShell::HasSelection() )
+            {
+                pWrtShell->MoveSection( GoCurrSection, fnSectionStart );
+                pWrtShell->SetMark();
+                pWrtShell->MoveSection( GoCurrSection, fnSectionEnd );
+            }
+            if( pWrtShell->SwCursorShell::HasSelection() )
+            {
+                pWrtShell->StartUndo( SwUndoId::DELETE );
+                pWrtShell->Delete();
+                if( SwUndoId::EMPTY != pWrtShell->EndUndo( SwUndoId::DELETE ))
                 {
-                    pWrtShell->StartUndo( SwUndoId::DELETE );
-                    pWrtShell->Delete();
-                    if( SwUndoId::EMPTY != pWrtShell->EndUndo( SwUndoId::DELETE ))
-                    {
-                        m_bCallUndo = true;
-                    }
+                    m_bCallUndo = true;
                 }
-                pWrtShell->DoUndo(false);
-
-                SfxItemSet aSet( pWrtShell->GetAttrPool(), svl::Items<RES_BOXATR_FORMULA, RES_BOXATR_FORMULA>{} );
-                if( pWrtShell->GetTableBoxFormulaAttrs( aSet ))
-                    sEdit += aSet.Get( RES_BOXATR_FORMULA ).GetFormula();
             }
+            pWrtShell->DoUndo(false);
+
+            SfxItemSet aSet( pWrtShell->GetAttrPool(), svl::Items<RES_BOXATR_FORMULA, RES_BOXATR_FORMULA>{} );
+            if( pWrtShell->GetTableBoxFormulaAttrs( aSet ))
+                sEdit += aSet.Get( RES_BOXATR_FORMULA ).GetFormula();
         }
 
         if( bFirst )


More information about the Libreoffice-commits mailing list