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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 31 11:12:14 UTC 2020


 sw/source/core/view/viewsh.cxx          |  174 +++++++++---------
 sw/source/core/view/vprint.cxx          |   98 +++++-----
 sw/source/filter/ascii/parasc.cxx       |   26 +-
 sw/source/filter/html/css1atr.cxx       |  102 +++++-----
 sw/source/filter/html/htmlatr.cxx       |  224 +++++++++++------------
 sw/source/filter/html/htmlcss1.cxx      |  184 +++++++++----------
 sw/source/filter/html/htmlfld.cxx       |   22 +-
 sw/source/filter/html/htmlfly.cxx       |   36 +--
 sw/source/filter/html/htmlflywriter.cxx |   98 +++++-----
 sw/source/filter/html/htmlform.cxx      |   22 +-
 sw/source/filter/html/htmlforw.cxx      |   30 +--
 sw/source/filter/html/htmlplug.cxx      |   62 +++---
 sw/source/filter/html/htmltab.cxx       |   72 +++----
 sw/source/filter/html/parcss1.cxx       |   24 +-
 sw/source/filter/html/svxcss1.cxx       |  307 +++++++++++++++-----------------
 sw/source/filter/html/swhtml.cxx        |  100 +++++-----
 sw/source/filter/html/wrthtml.cxx       |   76 +++----
 17 files changed, 828 insertions(+), 829 deletions(-)

New commits:
commit 639206f38ef5be7687fe8172298e1374df5576eb
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 30 10:37:16 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 31 13:10:37 2020 +0200

    loplugin:flatten in sw/core/view..sw/core/html
    
    Change-Id: I793811af353fe61b12e5e89da2056fb58108e9dc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99852
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index cf366700d26b..cd171c79ba06 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -540,19 +540,19 @@ bool SwViewShell::AddPaintRect( const SwRect & rRect )
 
 void SwViewShell::InvalidateWindows( const SwRect &rRect )
 {
-    if ( !Imp()->IsCalcLayoutProgress() )
+    if ( Imp()->IsCalcLayoutProgress() )
+        return;
+
+    for(SwViewShell& rSh : GetRingContainer())
     {
-        for(SwViewShell& rSh : GetRingContainer())
+        if ( rSh.GetWin() )
         {
-            if ( rSh.GetWin() )
-            {
-                if ( rSh.IsPreview() )
-                    ::RepaintPagePreview( &rSh, rRect );
-                // In case of tiled rendering, invalidation is wanted even if
-                // the rectangle is outside the visual area.
-                else if ( rSh.VisArea().IsOver( rRect ) || comphelper::LibreOfficeKit::isActive() )
-                    rSh.GetWin()->Invalidate( rRect.SVRect() );
-            }
+            if ( rSh.IsPreview() )
+                ::RepaintPagePreview( &rSh, rRect );
+            // In case of tiled rendering, invalidation is wanted even if
+            // the rectangle is outside the visual area.
+            else if ( rSh.VisArea().IsOver( rRect ) || comphelper::LibreOfficeKit::isActive() )
+                rSh.GetWin()->Invalidate( rRect.SVRect() );
         }
     }
 }
@@ -566,32 +566,32 @@ const SwRect& SwViewShell::VisArea() const
 
 void SwViewShell::MakeVisible( const SwRect &rRect )
 {
-    if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareDialog(*this) )
+    if ( !(!VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareDialog(*this)) )
+        return;
+
+    if ( IsViewLocked() )
+        return;
+
+    if( mpWin )
     {
-        if ( !IsViewLocked() )
-        {
-            if( mpWin )
-            {
-                const SwFrame* pRoot = GetLayout();
-                int nLoopCnt = 3;
-                long nOldH;
-                do{
-                    nOldH = pRoot->getFrameArea().Height();
-                    StartAction();
-                    ScrollMDI( this, rRect, USHRT_MAX, USHRT_MAX );
-                    EndAction();
-                } while( nOldH != pRoot->getFrameArea().Height() && nLoopCnt-- );
-            }
+        const SwFrame* pRoot = GetLayout();
+        int nLoopCnt = 3;
+        long nOldH;
+        do{
+            nOldH = pRoot->getFrameArea().Height();
+            StartAction();
+            ScrollMDI( this, rRect, USHRT_MAX, USHRT_MAX );
+            EndAction();
+        } while( nOldH != pRoot->getFrameArea().Height() && nLoopCnt-- );
+    }
 #if OSL_DEBUG_LEVEL > 0
-            else
-            {
-                //MA: 04. Nov. 94, no one needs this, does one?
-                OSL_ENSURE( false, "Is MakeVisible still needed for printers?" );
-            }
+    else
+    {
+        //MA: 04. Nov. 94, no one needs this, does one?
+        OSL_ENSURE( false, "Is MakeVisible still needed for printers?" );
+    }
 
 #endif
-        }
-    }
 }
 
 weld::Window* SwViewShell::CareChildWin(SwViewShell const & rVSh)
@@ -928,21 +928,21 @@ void SwViewShell::SetSubtractFlysAnchoredAtFlys(bool bSubtractFlysAnchoredAtFlys
 void SwViewShell::SetEmptyDbFieldHidesPara(bool bEmptyDbFieldHidesPara)
 {
     IDocumentSettingAccess& rIDSA = getIDocumentSettingAccess();
-    if (rIDSA.get(DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA) != bEmptyDbFieldHidesPara)
+    if (rIDSA.get(DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA) == bEmptyDbFieldHidesPara)
+        return;
+
+    SwWait aWait(*GetDoc()->GetDocShell(), true);
+    rIDSA.set(DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA, bEmptyDbFieldHidesPara);
+    StartAction();
+    GetDoc()->getIDocumentState().SetModified();
+    for (auto const & pFieldType : *GetDoc()->getIDocumentFieldsAccess().GetFieldTypes())
     {
-        SwWait aWait(*GetDoc()->GetDocShell(), true);
-        rIDSA.set(DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA, bEmptyDbFieldHidesPara);
-        StartAction();
-        GetDoc()->getIDocumentState().SetModified();
-        for (auto const & pFieldType : *GetDoc()->getIDocumentFieldsAccess().GetFieldTypes())
+        if (pFieldType->Which() == SwFieldIds::Database)
         {
-            if (pFieldType->Which() == SwFieldIds::Database)
-            {
-                pFieldType->ModifyNotification(nullptr, nullptr);
-            }
+            pFieldType->ModifyNotification(nullptr, nullptr);
         }
-        EndAction();
     }
+    EndAction();
 }
 
 void SwViewShell::Reformat()
@@ -1723,24 +1723,24 @@ public:
     {
         pRef = pValue;
 
-        if (pValue != pShell->GetWin())
-        {
-            SdrView* pDrawView(pShell->Imp()->GetDrawView());
+        if (pValue == pShell->GetWin())
+            return;
 
-            if (nullptr != pDrawView)
-            {
-                SdrPageView* pSdrPageView(pDrawView->GetSdrPageView());
+        SdrView* pDrawView(pShell->Imp()->GetDrawView());
 
-                if (nullptr != pSdrPageView)
-                {
-                    m_pPatchedPageWindow = pSdrPageView->FindPageWindow(*pShell->GetWin());
+        if (nullptr == pDrawView)
+            return;
 
-                    if (nullptr != m_pPatchedPageWindow)
-                    {
-                        m_TemporaryPaintWindow.reset(new SdrPaintWindow(*pDrawView, *pValue));
-                        m_pPatchedPageWindow->patchPaintWindow(*m_TemporaryPaintWindow);
-                    }
-                }
+        SdrPageView* pSdrPageView(pDrawView->GetSdrPageView());
+
+        if (nullptr != pSdrPageView)
+        {
+            m_pPatchedPageWindow = pSdrPageView->FindPageWindow(*pShell->GetWin());
+
+            if (nullptr != m_pPatchedPageWindow)
+            {
+                m_TemporaryPaintWindow.reset(new SdrPaintWindow(*pDrawView, *pValue));
+                m_pPatchedPageWindow->patchPaintWindow(*m_TemporaryPaintWindow);
             }
         }
     }
@@ -2271,18 +2271,18 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
         EndAction();
     }
 
-    if( bOnlineSpellChgd )
+    if( !bOnlineSpellChgd )
+        return;
+
+    bool bOnlineSpl = rOpt.IsOnlineSpell();
+    for(SwViewShell& rSh : GetRingContainer())
     {
-        bool bOnlineSpl = rOpt.IsOnlineSpell();
-        for(SwViewShell& rSh : GetRingContainer())
-        {
-            if(&rSh == this)
-                continue;
-            rSh.mpOpt->SetOnlineSpell( bOnlineSpl );
-            vcl::Window *pTmpWin = rSh.GetWin();
-            if( pTmpWin )
-                pTmpWin->Invalidate();
-        }
+        if(&rSh == this)
+            continue;
+        rSh.mpOpt->SetOnlineSpell( bOnlineSpl );
+        vcl::Window *pTmpWin = rSh.GetWin();
+        if( pTmpWin )
+            pTmpWin->Invalidate();
     }
 
 }
@@ -2304,28 +2304,28 @@ void SwViewShell::SetReadonlyOption(bool bSet)
     //              and if need be format; Bug 61335
 
     // Are we switching from readonly to edit?
-    if( bSet != mpOpt->IsReadonly() )
-    {
-        // so that the flags can be queried properly.
-        mpOpt->SetReadonly( false );
+    if( bSet == mpOpt->IsReadonly() )
+        return;
 
-        bool bReformat = mpOpt->IsFieldName();
+    // so that the flags can be queried properly.
+    mpOpt->SetReadonly( false );
 
-        mpOpt->SetReadonly( bSet );
+    bool bReformat = mpOpt->IsFieldName();
 
-        if( bReformat )
-        {
-            StartAction();
-            Reformat();
-            if ( GetWin() )
-                GetWin()->Invalidate();
-            EndAction();
-        }
-        else if ( GetWin() )
+    mpOpt->SetReadonly( bSet );
+
+    if( bReformat )
+    {
+        StartAction();
+        Reformat();
+        if ( GetWin() )
             GetWin()->Invalidate();
-        if( Imp()->IsAccessible() )
-            Imp()->InvalidateAccessibleEditableState( false );
+        EndAction();
     }
+    else if ( GetWin() )
+        GetWin()->Invalidate();
+    if( Imp()->IsAccessible() )
+        Imp()->InvalidateAccessibleEditableState( false );
 }
 
 void  SwViewShell::SetPDFExportOption(bool bSet)
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index d542f351ca92..1e80073ee479 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -102,53 +102,53 @@ void SwPaintQueue::Add( SwViewShell *pNew, const SwRect &rNew )
 
 void SwPaintQueue::Repaint()
 {
-    if (!SwRootFrame::IsInPaint() && s_pPaintQueue)
-    {
-        SwQueuedPaint *pPt = s_pPaintQueue;
-        do
-        {   SwViewShell *pSh = pPt->pSh;
-            CurrShell aCurr( pSh );
-            if ( pSh->IsPreview() )
+    if (!(!SwRootFrame::IsInPaint() && s_pPaintQueue))
+        return;
+
+    SwQueuedPaint *pPt = s_pPaintQueue;
+    do
+    {   SwViewShell *pSh = pPt->pSh;
+        CurrShell aCurr( pSh );
+        if ( pSh->IsPreview() )
+        {
+            if ( pSh->GetWin() )
             {
-                if ( pSh->GetWin() )
-                {
-                    // for previewing, since rows/columns are known in PaintHdl (UI)
-                    pSh->GetWin()->Invalidate();
-                }
+                // for previewing, since rows/columns are known in PaintHdl (UI)
+                pSh->GetWin()->Invalidate();
             }
-            else
-                pSh->Paint(*pSh->GetOut(), pPt->aRect.SVRect());
-            pPt = pPt->pNext;
-        } while ( pPt );
+        }
+        else
+            pSh->Paint(*pSh->GetOut(), pPt->aRect.SVRect());
+        pPt = pPt->pNext;
+    } while ( pPt );
 
-        do
-        {
-            pPt = s_pPaintQueue;
-            s_pPaintQueue = s_pPaintQueue->pNext;
-            delete pPt;
-        } while (s_pPaintQueue);
-    }
+    do
+    {
+        pPt = s_pPaintQueue;
+        s_pPaintQueue = s_pPaintQueue->pNext;
+        delete pPt;
+    } while (s_pPaintQueue);
 }
 
 void SwPaintQueue::Remove( SwViewShell const *pSh )
 {
     SwQueuedPaint *pPt = s_pPaintQueue;
-    if (nullptr != pPt)
+    if (nullptr == pPt)
+        return;
+
+    SwQueuedPaint *pPrev = nullptr;
+    while ( pPt && pPt->pSh != pSh )
     {
-        SwQueuedPaint *pPrev = nullptr;
-        while ( pPt && pPt->pSh != pSh )
-        {
-            pPrev = pPt;
-            pPt = pPt->pNext;
-        }
-        if ( pPt )
-        {
-            if ( pPrev )
-                pPrev->pNext = pPt->pNext;
-            else if (pPt == s_pPaintQueue)
-                s_pPaintQueue = nullptr;
-            delete pPt;
-        }
+        pPrev = pPt;
+        pPt = pPt->pNext;
+    }
+    if ( pPt )
+    {
+        if ( pPrev )
+            pPrev->pNext = pPt->pNext;
+        else if (pPt == s_pPaintQueue)
+            s_pPaintQueue = nullptr;
+        delete pPt;
     }
 }
 
@@ -670,18 +670,18 @@ void SwViewShell::PrepareForPrint( const SwPrintData &rOptions, bool bIsPDFExpor
     // Font should not be black if it's a PDF Export
     mpOpt->SetBlackFont( rOptions.m_bPrintBlackFont && !bIsPDFExport );
 
-    if ( HasDrawView() )
+    if ( !HasDrawView() )
+        return;
+
+    SdrView *pDrawView = GetDrawView();
+    // OD 09.01.2003 #i6467# - consider, if view shell belongs to page preview
+    if ( !IsPreview() )
     {
-        SdrView *pDrawView = GetDrawView();
-        // OD 09.01.2003 #i6467# - consider, if view shell belongs to page preview
-        if ( !IsPreview() )
-        {
-            pDrawView->SetLayerPrintable( "Controls", rOptions.m_bPrintControl );
-        }
-        else
-        {
-            pDrawView->SetLayerVisible( "Controls", rOptions.m_bPrintControl );
-        }
+        pDrawView->SetLayerPrintable( "Controls", rOptions.m_bPrintControl );
+    }
+    else
+    {
+        pDrawView->SetLayerVisible( "Controls", rOptions.m_bPrintControl );
     }
 }
 
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index b3726c49dbf0..a2d7bbe30508 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -115,19 +115,19 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCursor, SvStream& rIn,
         aLang.SetWhich(RES_CHRATR_CTL_LANGUAGE);
         pItemSet->Put( aLang );
     }
-    if( !rOpt.GetFontName().isEmpty() )
-    {
-        vcl::Font aTextFont( rOpt.GetFontName(), Size( 0, 10 ) );
-        if( pDoc->getIDocumentDeviceAccess().getPrinter( false ) )
-            aTextFont = pDoc->getIDocumentDeviceAccess().getPrinter( false )->GetFontMetric( aTextFont );
-        SvxFontItem aFont( aTextFont.GetFamilyType(), aTextFont.GetFamilyName(),
-                           OUString(), aTextFont.GetPitch(), aTextFont.GetCharSet(), RES_CHRATR_FONT );
-        pItemSet->Put( aFont );
-        aFont.SetWhich(RES_CHRATR_CJK_FONT);
-        pItemSet->Put( aFont );
-        aFont.SetWhich(RES_CHRATR_CTL_FONT);
-        pItemSet->Put( aFont );
-    }
+    if( rOpt.GetFontName().isEmpty() )
+        return;
+
+    vcl::Font aTextFont( rOpt.GetFontName(), Size( 0, 10 ) );
+    if( pDoc->getIDocumentDeviceAccess().getPrinter( false ) )
+        aTextFont = pDoc->getIDocumentDeviceAccess().getPrinter( false )->GetFontMetric( aTextFont );
+    SvxFontItem aFont( aTextFont.GetFamilyType(), aTextFont.GetFamilyName(),
+                       OUString(), aTextFont.GetPitch(), aTextFont.GetCharSet(), RES_CHRATR_FONT );
+    pItemSet->Put( aFont );
+    aFont.SetWhich(RES_CHRATR_CJK_FONT);
+    pItemSet->Put( aFont );
+    aFont.SetWhich(RES_CHRATR_CTL_FONT);
+    pItemSet->Put( aFont );
 }
 
 // Calling the parser
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 3bf645b5ddcf..b6a9062d33c9 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -1152,26 +1152,26 @@ void SwHTMLWriter::PrepareFontList( const SvxFontItem& rFontItem,
         }
     }
 
-    if( !bContainsKeyword && bGeneric )
+    if( !(!bContainsKeyword && bGeneric) )
+        return;
+
+    const char *pStr = nullptr;
+    switch( rFontItem.GetFamily() )
     {
-        const char *pStr = nullptr;
-        switch( rFontItem.GetFamily() )
-        {
-        case FAMILY_ROMAN:      pStr = sCSS1_PV_serif;      break;
-        case FAMILY_SWISS:      pStr = sCSS1_PV_sans_serif; break;
-        case FAMILY_SCRIPT:     pStr = sCSS1_PV_cursive;    break;
-        case FAMILY_DECORATIVE: pStr = sCSS1_PV_fantasy;    break;
-        case FAMILY_MODERN:     pStr = sCSS1_PV_monospace;  break;
-        default:
-            ;
-        }
+    case FAMILY_ROMAN:      pStr = sCSS1_PV_serif;      break;
+    case FAMILY_SWISS:      pStr = sCSS1_PV_sans_serif; break;
+    case FAMILY_SCRIPT:     pStr = sCSS1_PV_cursive;    break;
+    case FAMILY_DECORATIVE: pStr = sCSS1_PV_fantasy;    break;
+    case FAMILY_MODERN:     pStr = sCSS1_PV_monospace;  break;
+    default:
+        ;
+    }
 
-        if( pStr )
-        {
-            if( !rNames.isEmpty() )
-                rNames += ", ";
-            rNames += OStringToOUString( pStr, RTL_TEXTENCODING_ASCII_US );
-        }
+    if( pStr )
+    {
+        if( !rNames.isEmpty() )
+            rNames += ", ";
+        rNames += OStringToOUString( pStr, RTL_TEXTENCODING_ASCII_US );
     }
 }
 
@@ -2221,25 +2221,25 @@ void SwHTMLWriter::OutCSS1_FrameFormatBackground( const SwFrameFormat& rFrameFor
     // At last there is the background of the page, and as the final rescue
     // the value of the Config.
     OSL_ENSURE( m_pCurrPageDesc, "no page template found" );
-    if( !OutCSS1_FrameFormatBrush( *this,
+    if( OutCSS1_FrameFormatBrush( *this,
                               *m_pCurrPageDesc->GetMaster().makeBackgroundBrushItem() ) )
-    {
-        Color aColor( COL_WHITE );
+        return;
 
-        // The background color is normally only used in Browse-Mode.
-        // We always use it for a HTML document, but for a text document
-        // only if viewed in Browse-Mode.
-        if( m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) ||
-            m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE))
-        {
-            SwViewShell *pVSh = m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
-            if ( pVSh &&
-                 COL_TRANSPARENT != pVSh->GetViewOptions()->GetRetoucheColor())
-                aColor = pVSh->GetViewOptions()->GetRetoucheColor();
-        }
+    Color aColor( COL_WHITE );
 
-        OutCSS1_PropertyAscii(sCSS1_P_background, GetCSS1_Color(aColor));
+    // The background color is normally only used in Browse-Mode.
+    // We always use it for a HTML document, but for a text document
+    // only if viewed in Browse-Mode.
+    if( m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) ||
+        m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE))
+    {
+        SwViewShell *pVSh = m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
+        if ( pVSh &&
+             COL_TRANSPARENT != pVSh->GetViewOptions()->GetRetoucheColor())
+            aColor = pVSh->GetViewOptions()->GetRetoucheColor();
     }
+
+    OutCSS1_PropertyAscii(sCSS1_P_background, GetCSS1_Color(aColor));
 }
 
 static Writer& OutCSS1_SvxTextLn_SvxCrOut_SvxBlink( Writer& rWrt,
@@ -3664,28 +3664,28 @@ void SwHTMLWriter::OutCSS1_SfxItemSet( const SfxItemSet& rItemSet,
         OutCSS1_SvxFormatBreak_SwFormatPDesc_SvxFormatKeep( *this, rItemSet, bDeep );
     }
 
-    if( !m_bFirstCSS1Property )
+    if( m_bFirstCSS1Property )
+        return;
+
+    // if a Property was exported as part of a Style-Option,
+    // the Option still needs to be finished
+    OStringBuffer sOut;
+    switch( m_nCSS1OutMode & CSS1_OUTMODE_ANY_OFF )
     {
-        // if a Property was exported as part of a Style-Option,
-        // the Option still needs to be finished
-        OStringBuffer sOut;
-        switch( m_nCSS1OutMode & CSS1_OUTMODE_ANY_OFF )
-        {
-        case CSS1_OUTMODE_SPAN_TAG_OFF:
-            sOut.append(sCSS1_span_tag_end);
-            break;
+    case CSS1_OUTMODE_SPAN_TAG_OFF:
+        sOut.append(sCSS1_span_tag_end);
+        break;
 
-        case CSS1_OUTMODE_STYLE_OPT_OFF:
-            sOut.append(cCSS1_style_opt_end);
-            break;
+    case CSS1_OUTMODE_STYLE_OPT_OFF:
+        sOut.append(cCSS1_style_opt_end);
+        break;
 
-        case CSS1_OUTMODE_RULE_OFF:
-            sOut.append(sCSS1_rule_end);
-            break;
-        }
-        if (!sOut.isEmpty())
-            Strm().WriteOString( sOut.makeStringAndClear() );
+    case CSS1_OUTMODE_RULE_OFF:
+        sOut.append(sCSS1_rule_end);
+        break;
     }
+    if (!sOut.isEmpty())
+        Strm().WriteOString( sOut.makeStringAndClear() );
 }
 
 Writer& OutCSS1_HintSpanTag( Writer& rWrt, const SfxPoolItem& rHt )
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index e7997b56f5e5..e543026e2a2d 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -1604,121 +1604,121 @@ void HTMLEndPosLst::InsertNoScript( const SfxPoolItem& rItem,
                             SwHTMLFormatInfos& rFormatInfos, bool bParaAttrs )
 {
     // no range ?? in that case, don't take it, it will never take effect !!
-    if( nStart != nEnd )
-    {
-        bool bSet = false, bSplit = false;
-        switch( GetHTMLItemState(rItem) )
-        {
-        case HTML_ON_VALUE:
-            // output the attribute, if it isn't 'on', already
-            if( !ExistsOnTagItem( rItem.Which(), nStart ) )
-                bSet = true;
-            break;
-
-        case HTML_OFF_VALUE:
-            // If the corresponding attribute is 'on', split it.
-            // Additionally, output it as Style, if it is not set for the
-            // whole paragraph, because in that case it was already output
-            // together with the paragraph tag.
-            if( ExistsOnTagItem( rItem.Which(), nStart ) )
-                bSplit = true;
-            bSet = bOutStyles && !bParaAttrs &&
-                   !ExistsOffTagItem( rItem.Which(), nStart, nEnd );
-            break;
+    if( nStart == nEnd )
+        return;
 
-        case HTML_REAL_VALUE:
-            // we can always output the attribute
+    bool bSet = false, bSplit = false;
+    switch( GetHTMLItemState(rItem) )
+    {
+    case HTML_ON_VALUE:
+        // output the attribute, if it isn't 'on', already
+        if( !ExistsOnTagItem( rItem.Which(), nStart ) )
             bSet = true;
-            break;
+        break;
 
-        case HTML_STYLE_VALUE:
-            // We can only output the attribute as CSS1. If it is set for
-            // the paragraph, it was already output with the paragraph tag.
-            // The only exception is the character-background attribute. This
-            // attribute must always be handled like a Hint.
-            bSet = bOutStyles &&
-                   (!bParaAttrs
-                  || rItem.Which()==RES_CHRATR_BACKGROUND
-                  || rItem.Which()==RES_CHRATR_BOX
-                  || rItem.Which()==RES_CHRATR_OVERLINE);
-            break;
+    case HTML_OFF_VALUE:
+        // If the corresponding attribute is 'on', split it.
+        // Additionally, output it as Style, if it is not set for the
+        // whole paragraph, because in that case it was already output
+        // together with the paragraph tag.
+        if( ExistsOnTagItem( rItem.Which(), nStart ) )
+            bSplit = true;
+        bSet = bOutStyles && !bParaAttrs &&
+               !ExistsOffTagItem( rItem.Which(), nStart, nEnd );
+        break;
 
-        case HTML_CHRFMT_VALUE:
-            {
-                OSL_ENSURE( RES_TXTATR_CHARFMT == rItem.Which(),
-                        "Not a character style after all" );
-                const SwFormatCharFormat& rChrFormat = static_cast<const SwFormatCharFormat&>(rItem);
-                const SwCharFormat* pFormat = rChrFormat.GetCharFormat();
+    case HTML_REAL_VALUE:
+        // we can always output the attribute
+        bSet = true;
+        break;
 
-                const SwHTMLFormatInfo *pFormatInfo = GetFormatInfo( *pFormat, rFormatInfos );
-                if( !pFormatInfo->aToken.isEmpty() )
-                {
-                    // output the character style tag before the hard
-                    // attributes
-                    InsertItem( rItem, nStart, nEnd );
-                }
-                if( pFormatInfo->pItemSet )
-                {
-                    Insert( *pFormatInfo->pItemSet, nStart, nEnd,
-                            rFormatInfos, true, bParaAttrs );
-                }
-            }
-            break;
+    case HTML_STYLE_VALUE:
+        // We can only output the attribute as CSS1. If it is set for
+        // the paragraph, it was already output with the paragraph tag.
+        // The only exception is the character-background attribute. This
+        // attribute must always be handled like a Hint.
+        bSet = bOutStyles &&
+               (!bParaAttrs
+              || rItem.Which()==RES_CHRATR_BACKGROUND
+              || rItem.Which()==RES_CHRATR_BOX
+              || rItem.Which()==RES_CHRATR_OVERLINE);
+        break;
+
+    case HTML_CHRFMT_VALUE:
+        {
+            OSL_ENSURE( RES_TXTATR_CHARFMT == rItem.Which(),
+                    "Not a character style after all" );
+            const SwFormatCharFormat& rChrFormat = static_cast<const SwFormatCharFormat&>(rItem);
+            const SwCharFormat* pFormat = rChrFormat.GetCharFormat();
 
-        case HTML_AUTOFMT_VALUE:
+            const SwHTMLFormatInfo *pFormatInfo = GetFormatInfo( *pFormat, rFormatInfos );
+            if( !pFormatInfo->aToken.isEmpty() )
             {
-                const SwFormatAutoFormat& rAutoFormat = static_cast<const SwFormatAutoFormat&>(rItem);
-                const std::shared_ptr<SfxItemSet>& pSet = rAutoFormat.GetStyleHandle();
-                if( pSet )
-                    Insert( *pSet, nStart, nEnd, rFormatInfos, true, bParaAttrs );
+                // output the character style tag before the hard
+                // attributes
+                InsertItem( rItem, nStart, nEnd );
             }
-            break;
-
-        case HTML_COLOR_VALUE:
-            // A foreground color as a paragraph attribute is only exported if
-            // it is not the same as the default color.
+            if( pFormatInfo->pItemSet )
             {
-                OSL_ENSURE( RES_CHRATR_COLOR == rItem.Which(),
-                        "Not a foreground color, after all" );
-                Color aColor( static_cast<const SvxColorItem&>(rItem).GetValue() );
-                if( COL_AUTO == aColor )
-                    aColor = COL_BLACK;
-                bSet = !bParaAttrs || !xDfltColor ||
-                       !xDfltColor->IsRGBEqual( aColor );
+                Insert( *pFormatInfo->pItemSet, nStart, nEnd,
+                        rFormatInfos, true, bParaAttrs );
             }
-            break;
+        }
+        break;
 
-        case HTML_DROPCAP_VALUE:
+    case HTML_AUTOFMT_VALUE:
+        {
+            const SwFormatAutoFormat& rAutoFormat = static_cast<const SwFormatAutoFormat&>(rItem);
+            const std::shared_ptr<SfxItemSet>& pSet = rAutoFormat.GetStyleHandle();
+            if( pSet )
+                Insert( *pSet, nStart, nEnd, rFormatInfos, true, bParaAttrs );
+        }
+        break;
+
+    case HTML_COLOR_VALUE:
+        // A foreground color as a paragraph attribute is only exported if
+        // it is not the same as the default color.
+        {
+            OSL_ENSURE( RES_CHRATR_COLOR == rItem.Which(),
+                    "Not a foreground color, after all" );
+            Color aColor( static_cast<const SvxColorItem&>(rItem).GetValue() );
+            if( COL_AUTO == aColor )
+                aColor = COL_BLACK;
+            bSet = !bParaAttrs || !xDfltColor ||
+                   !xDfltColor->IsRGBEqual( aColor );
+        }
+        break;
+
+    case HTML_DROPCAP_VALUE:
+        {
+            OSL_ENSURE( RES_PARATR_DROP == rItem.Which(),
+                    "Not a drop cap, after all" );
+            const SwFormatDrop& rDrop = static_cast<const SwFormatDrop&>(rItem);
+            nEnd = nStart + rDrop.GetChars();
+            if( !bOutStyles )
             {
-                OSL_ENSURE( RES_PARATR_DROP == rItem.Which(),
-                        "Not a drop cap, after all" );
-                const SwFormatDrop& rDrop = static_cast<const SwFormatDrop&>(rItem);
-                nEnd = nStart + rDrop.GetChars();
-                if( !bOutStyles )
-                {
-                    // At least use the attributes of the character style
-                    const SwCharFormat *pCharFormat = rDrop.GetCharFormat();
-                    if( pCharFormat )
-                    {
-                        Insert( pCharFormat->GetAttrSet(), nStart, nEnd,
-                                rFormatInfos, true, bParaAttrs );
-                    }
-                }
-                else
+                // At least use the attributes of the character style
+                const SwCharFormat *pCharFormat = rDrop.GetCharFormat();
+                if( pCharFormat )
                 {
-                    bSet = true;
+                    Insert( pCharFormat->GetAttrSet(), nStart, nEnd,
+                            rFormatInfos, true, bParaAttrs );
                 }
             }
-            break;
-        default:
-            ;
+            else
+            {
+                bSet = true;
+            }
         }
-
-        if( bSet )
-            InsertItem( rItem, nStart, nEnd );
-        if( bSplit )
-            SplitItem( rItem, nStart, nEnd );
+        break;
+    default:
+        ;
     }
+
+    if( bSet )
+        InsertItem( rItem, nStart, nEnd );
+    if( bSplit )
+        SplitItem( rItem, nStart, nEnd );
 }
 
 void HTMLEndPosLst::Insert( const SfxPoolItem& rItem,
@@ -1843,20 +1843,20 @@ void HTMLEndPosLst::Insert( const SwDrawFrameFormat& rFormat, sal_Int32 nPos,
 {
     const SdrObject* pTextObj = SwHTMLWriter::GetMarqueeTextObj( rFormat );
 
-    if( pTextObj )
-    {
-        // get the edit engine attributes of the object as SW attributes and
-        // insert them as hints. Because of the amount of Hints the styles
-        // are not considered!
-        const SfxItemSet& rFormatItemSet = rFormat.GetAttrSet();
-        SfxItemSet aItemSet( *rFormatItemSet.GetPool(), svl::Items<RES_CHRATR_BEGIN,
-                                                     RES_CHRATR_END>{} );
-        SwHTMLWriter::GetEEAttrsFromDrwObj( aItemSet, pTextObj );
-        bool bOutStylesOld = bOutStyles;
-        bOutStyles = false;
-        Insert( aItemSet, nPos, nPos+1, rFormatInfos, false );
-        bOutStyles = bOutStylesOld;
-    }
+    if( !pTextObj )
+        return;
+
+    // get the edit engine attributes of the object as SW attributes and
+    // insert them as hints. Because of the amount of Hints the styles
+    // are not considered!
+    const SfxItemSet& rFormatItemSet = rFormat.GetAttrSet();
+    SfxItemSet aItemSet( *rFormatItemSet.GetPool(), svl::Items<RES_CHRATR_BEGIN,
+                                                 RES_CHRATR_END>{} );
+    SwHTMLWriter::GetEEAttrsFromDrwObj( aItemSet, pTextObj );
+    bool bOutStylesOld = bOutStyles;
+    bOutStyles = false;
+    Insert( aItemSet, nPos, nPos+1, rFormatInfos, false );
+    bOutStyles = bOutStylesOld;
 }
 
 sal_uInt16 HTMLEndPosLst::GetScriptAtPos( sal_Int32 nPos, sal_uInt16 nWeak )
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index a709df33ec72..ca3ba0b1a87f 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -412,26 +412,26 @@ void SwCSS1Parser::SetPageDescAttrs( const SvxBrushItem *pBrush,
         }
     }
 
-    if( bSetBrush || bSetBox || bSetFrameDir )
+    if( !(bSetBrush || bSetBox || bSetFrameDir) )
+        return;
+
+    static sal_uInt16 aPoolIds[] = { RES_POOLPAGE_HTML, RES_POOLPAGE_FIRST,
+                                 RES_POOLPAGE_LEFT, RES_POOLPAGE_RIGHT };
+    for(sal_uInt16 i : aPoolIds)
     {
-        static sal_uInt16 aPoolIds[] = { RES_POOLPAGE_HTML, RES_POOLPAGE_FIRST,
-                                     RES_POOLPAGE_LEFT, RES_POOLPAGE_RIGHT };
-        for(sal_uInt16 i : aPoolIds)
+        const SwPageDesc *pPageDesc = GetPageDesc( i, false );
+        if( pPageDesc )
         {
-            const SwPageDesc *pPageDesc = GetPageDesc( i, false );
-            if( pPageDesc )
-            {
-                SwPageDesc aNewPageDesc( *pPageDesc );
-                SwFrameFormat &rMaster = aNewPageDesc.GetMaster();
-                if( bSetBrush )
-                    rMaster.SetFormatAttr( *aBrushItem );
-                if( bSetBox )
-                    rMaster.SetFormatAttr( *aBoxItem );
-                if( bSetFrameDir )
-                    rMaster.SetFormatAttr( *aFrameDirItem );
-
-                ChgPageDesc( pPageDesc, aNewPageDesc );
-            }
+            SwPageDesc aNewPageDesc( *pPageDesc );
+            SwFrameFormat &rMaster = aNewPageDesc.GetMaster();
+            if( bSetBrush )
+                rMaster.SetFormatAttr( *aBrushItem );
+            if( bSetBox )
+                rMaster.SetFormatAttr( *aBoxItem );
+            if( bSetFrameDir )
+                rMaster.SetFormatAttr( *aFrameDirItem );
+
+            ChgPageDesc( pPageDesc, aNewPageDesc );
         }
     }
 }
@@ -1072,35 +1072,35 @@ void SwCSS1Parser::StyleParsed( const CSS1Selector *pSelector,
         return;
 
     SwCharFormat* pCFormat = GetChrFormat(nToken2, OUString());
-    if( pCFormat )
-    {
-        SwCharFormat *pParentCFormat = nullptr;
-        if( !aClass.isEmpty() )
-        {
-            OUString aName( pCFormat->GetName() );
-            AddClassName( aName, aClass );
-            pParentCFormat = pCFormat;
+    if( !pCFormat )
+        return;
 
-            pCFormat = m_pDoc->FindCharFormatByName( aName );
-            if( !pCFormat )
-            {
-                pCFormat = m_pDoc->MakeCharFormat( aName, pParentCFormat );
-                pCFormat->SetAuto(false);
-            }
-        }
+    SwCharFormat *pParentCFormat = nullptr;
+    if( !aClass.isEmpty() )
+    {
+        OUString aName( pCFormat->GetName() );
+        AddClassName( aName, aClass );
+        pParentCFormat = pCFormat;
 
-        if( Css1ScriptFlags::AllMask == nScript && !pParentCFormat )
-        {
-            SetCharFormatAttrs( pCFormat, rItemSet );
-        }
-        else
+        pCFormat = m_pDoc->FindCharFormatByName( aName );
+        if( !pCFormat )
         {
-            SfxItemSet aScriptItemSet( rItemSet );
-            RemoveScriptItems( aScriptItemSet, nScript,
-                               pParentCFormat ? &pParentCFormat->GetAttrSet() : nullptr );
-            SetCharFormatAttrs( pCFormat, aScriptItemSet );
+            pCFormat = m_pDoc->MakeCharFormat( aName, pParentCFormat );
+            pCFormat->SetAuto(false);
         }
     }
+
+    if( Css1ScriptFlags::AllMask == nScript && !pParentCFormat )
+    {
+        SetCharFormatAttrs( pCFormat, rItemSet );
+    }
+    else
+    {
+        SfxItemSet aScriptItemSet( rItemSet );
+        RemoveScriptItems( aScriptItemSet, nScript,
+                           pParentCFormat ? &pParentCFormat->GetAttrSet() : nullptr );
+        SetCharFormatAttrs( pCFormat, aScriptItemSet );
+    }
 }
 
 sal_uInt32 SwCSS1Parser::GetFontHeight( sal_uInt16 nSize ) const
@@ -1504,36 +1504,36 @@ void SwCSS1Parser::FillDropCap( SwFormatDrop& rDrop,
     }
 
     // for every other attribute create a character style
-    if( rItemSet.Count() )
-    {
-        SwCharFormat *pCFormat = nullptr;
-        OUString aName;
-        if( pName )
-        {
-            aName = *pName + ".FL";   // first letter
-            pCFormat = m_pDoc->FindCharFormatByName( aName );
-        }
-        else
-        {
-            do
-            {
-                aName = "first-letter " + OUString::number( static_cast<sal_Int32>(++m_nDropCapCnt) );
-            }
-            while( m_pDoc->FindCharFormatByName(aName) );
-        }
+    if( !rItemSet.Count() )
+        return;
 
-        if( !pCFormat )
+    SwCharFormat *pCFormat = nullptr;
+    OUString aName;
+    if( pName )
+    {
+        aName = *pName + ".FL";   // first letter
+        pCFormat = m_pDoc->FindCharFormatByName( aName );
+    }
+    else
+    {
+        do
         {
-            pCFormat = m_pDoc->MakeCharFormat( aName, m_pDoc->GetDfltCharFormat() );
-            pCFormat->SetAuto(false);
+            aName = "first-letter " + OUString::number( static_cast<sal_Int32>(++m_nDropCapCnt) );
         }
-        SetCharFormatAttrs( pCFormat, rItemSet );
+        while( m_pDoc->FindCharFormatByName(aName) );
+    }
 
-        // The character style needs only be set in the attribute, when
-        // the attribute also is set.
-        if( nLines > 1 )
-            rDrop.SetCharFormat( pCFormat );
+    if( !pCFormat )
+    {
+        pCFormat = m_pDoc->MakeCharFormat( aName, m_pDoc->GetDfltCharFormat() );
+        pCFormat->SetAuto(false);
     }
+    SetCharFormatAttrs( pCFormat, rItemSet );
+
+    // The character style needs only be set in the attribute, when
+    // the attribute also is set.
+    if( nLines > 1 )
+        rDrop.SetCharFormat( pCFormat );
 }
 
 // specific CSS1 of SwHTMLParsers
@@ -2297,36 +2297,36 @@ static void lcl_swcss1_setEncoding( SwFormat& rFormat, rtl_TextEncoding eEnc )
 
 void SwCSS1Parser::SetDfltEncoding( rtl_TextEncoding eEnc )
 {
-    if( eEnc != GetDfltEncoding() )
+    if( eEnc == GetDfltEncoding() )
+        return;
+
+    if( m_bIsNewDoc )
     {
-        if( m_bIsNewDoc )
+        // Set new encoding as pool default
+        static const sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT,
+                                       RES_CHRATR_CTL_FONT };
+        for(sal_uInt16 i : aWhichIds)
         {
-            // Set new encoding as pool default
-            static const sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT,
-                                           RES_CHRATR_CTL_FONT };
-            for(sal_uInt16 i : aWhichIds)
-            {
-                const SvxFontItem& rDfltFont =
-                    static_cast<const SvxFontItem&>(m_pDoc->GetDefault( i));
-                SvxFontItem aFont( rDfltFont.GetFamily(),
-                                   rDfltFont.GetFamilyName(),
-                                   rDfltFont.GetStyleName(),
-                                   rDfltFont.GetPitch(),
-                                   eEnc, i );
-                m_pDoc->SetDefault( aFont );
-            }
-
-            // Change all paragraph styles that do specify a font.
-            for( auto pTextFormatColl : *m_pDoc->GetTextFormatColls() )
-                lcl_swcss1_setEncoding( *pTextFormatColl, eEnc );
-
-            // Change all character styles that do specify a font.
-            for( auto pCharFormat : *m_pDoc->GetCharFormats() )
-                lcl_swcss1_setEncoding( *pCharFormat, eEnc );
+            const SvxFontItem& rDfltFont =
+                static_cast<const SvxFontItem&>(m_pDoc->GetDefault( i));
+            SvxFontItem aFont( rDfltFont.GetFamily(),
+                               rDfltFont.GetFamilyName(),
+                               rDfltFont.GetStyleName(),
+                               rDfltFont.GetPitch(),
+                               eEnc, i );
+            m_pDoc->SetDefault( aFont );
         }
 
-        SvxCSS1Parser::SetDfltEncoding( eEnc );
+        // Change all paragraph styles that do specify a font.
+        for( auto pTextFormatColl : *m_pDoc->GetTextFormatColls() )
+            lcl_swcss1_setEncoding( *pTextFormatColl, eEnc );
+
+        // Change all character styles that do specify a font.
+        for( auto pCharFormat : *m_pDoc->GetCharFormats() )
+            lcl_swcss1_setEncoding( *pCharFormat, eEnc );
     }
+
+    SvxCSS1Parser::SetDfltEncoding( eEnc );
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx
index 4b0133b726ea..d21737b41ab3 100644
--- a/sw/source/filter/html/htmlfld.cxx
+++ b/sw/source/filter/html/htmlfld.cxx
@@ -519,19 +519,19 @@ void SwHTMLParser::NewField()
         ;
     }
 
-    if (xNewField)
+    if (!xNewField)
+        return;
+
+    if (bInsOnEndTag)
     {
-        if (bInsOnEndTag)
-        {
-            m_xField = std::move(xNewField);
-        }
-        else
-        {
-            m_xDoc->getIDocumentContentOperations().InsertPoolItem(*m_pPam, SwFormatField(*xNewField));
-            xNewField.reset();
-        }
-        m_bInField = true;
+        m_xField = std::move(xNewField);
+    }
+    else
+    {
+        m_xDoc->getIDocumentContentOperations().InsertPoolItem(*m_pPam, SwFormatField(*xNewField));
+        xNewField.reset();
     }
+    m_bInField = true;
 }
 
 void SwHTMLParser::EndField()
diff --git a/sw/source/filter/html/htmlfly.cxx b/sw/source/filter/html/htmlfly.cxx
index 4a333ed3d65f..771a449ec90a 100644
--- a/sw/source/filter/html/htmlfly.cxx
+++ b/sw/source/filter/html/htmlfly.cxx
@@ -41,25 +41,25 @@ SwHTMLPosFlyFrame::SwHTMLPosFlyFrame( const SwPosFlyFrame& rPosFly,
     nAllFlags( nFlags )
 {
     const SwFormatAnchor& rAnchor = rPosFly.GetFormat().GetAnchor();
-    if ((RndStdIds::FLY_AT_CHAR == rAnchor.GetAnchorId()) &&
-        HtmlPosition::Inside == GetOutPos() )
+    if ((RndStdIds::FLY_AT_CHAR != rAnchor.GetAnchorId()) ||
+        HtmlPosition::Inside != GetOutPos())
+        return;
+
+    // Output of auto-bound frames will be a character farther back,
+    // because then the position aligns with Netscape.
+    OSL_ENSURE( rAnchor.GetContentAnchor(), "No anchor position?" );
+    if( !rAnchor.GetContentAnchor() )
+        return;
+
+    nContentIdx = rAnchor.GetContentAnchor()->nContent.GetIndex();
+    sal_Int16 eHoriRel = rPosFly.GetFormat().GetHoriOrient().
+                                        GetRelationOrient();
+    if( text::RelOrientation::FRAME == eHoriRel || text::RelOrientation::PRINT_AREA == eHoriRel )
     {
-        // Output of auto-bound frames will be a character farther back,
-        // because then the position aligns with Netscape.
-        OSL_ENSURE( rAnchor.GetContentAnchor(), "No anchor position?" );
-        if( rAnchor.GetContentAnchor() )
-        {
-            nContentIdx = rAnchor.GetContentAnchor()->nContent.GetIndex();
-            sal_Int16 eHoriRel = rPosFly.GetFormat().GetHoriOrient().
-                                                GetRelationOrient();
-            if( text::RelOrientation::FRAME == eHoriRel || text::RelOrientation::PRINT_AREA == eHoriRel )
-            {
-                const SwContentNode *pCNd = pNdIdx->GetNode().GetContentNode();
-                OSL_ENSURE( pCNd, "No Content-Node at PaM position" );
-                if( pCNd && nContentIdx < pCNd->Len() )
-                    nContentIdx++;
-            }
-        }
+        const SwContentNode *pCNd = pNdIdx->GetNode().GetContentNode();
+        OSL_ENSURE( pCNd, "No Content-Node at PaM position" );
+        if( pCNd && nContentIdx < pCNd->Len() )
+            nContentIdx++;
     }
 }
 
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index 55163aba520d..c382e116d4d3 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -995,66 +995,66 @@ void SwHTMLWriter::writeFrameFormatOptions(HtmlWriter& aHtml, const SwFrameForma
     // Insert wrap for graphics that are anchored to a paragraph as
     // <BR CLEAR=...> in the string
 
-    if( (nFrameOptions & HtmlFrmOpts::BrClear) &&
+    if( !((nFrameOptions & HtmlFrmOpts::BrClear) &&
         ((RndStdIds::FLY_AT_PARA == rFrameFormat.GetAnchor().GetAnchorId()) ||
          (RndStdIds::FLY_AT_CHAR == rFrameFormat.GetAnchor().GetAnchorId())) &&
-        SfxItemState::SET == rItemSet.GetItemState( RES_SURROUND, true, &pItem ))
-    {
-        const char* pSurroundString = nullptr;
+        SfxItemState::SET == rItemSet.GetItemState( RES_SURROUND, true, &pItem )))
+        return;
 
-        const SwFormatSurround* pSurround = static_cast<const SwFormatSurround*>(pItem);
-        sal_Int16 eHoriOri = rFrameFormat.GetHoriOrient().GetHoriOrient();
-        css::text::WrapTextMode eSurround = pSurround->GetSurround();
-        bool bAnchorOnly = pSurround->IsAnchorOnly();
-        switch( eHoriOri )
+    const char* pSurroundString = nullptr;
+
+    const SwFormatSurround* pSurround = static_cast<const SwFormatSurround*>(pItem);
+    sal_Int16 eHoriOri = rFrameFormat.GetHoriOrient().GetHoriOrient();
+    css::text::WrapTextMode eSurround = pSurround->GetSurround();
+    bool bAnchorOnly = pSurround->IsAnchorOnly();
+    switch( eHoriOri )
+    {
+        case text::HoriOrientation::RIGHT:
         {
-            case text::HoriOrientation::RIGHT:
+            switch( eSurround )
             {
-                switch( eSurround )
-                {
-                case css::text::WrapTextMode_NONE:
-                case css::text::WrapTextMode_RIGHT:
-                    pSurroundString = OOO_STRING_SVTOOLS_HTML_AL_right;
-                    break;
-                case css::text::WrapTextMode_LEFT:
-                case css::text::WrapTextMode_PARALLEL:
-                    if( bAnchorOnly )
-                        m_bClearRight = true;
-                    break;
-                default:
-                    ;
-                }
-            }
-            break;
-
+            case css::text::WrapTextMode_NONE:
+            case css::text::WrapTextMode_RIGHT:
+                pSurroundString = OOO_STRING_SVTOOLS_HTML_AL_right;
+                break;
+            case css::text::WrapTextMode_LEFT:
+            case css::text::WrapTextMode_PARALLEL:
+                if( bAnchorOnly )
+                    m_bClearRight = true;
+                break;
             default:
-            // If a frame is centered, it gets left aligned. This
-            // should be taken into account here, too.
-            {
-                switch( eSurround )
-                {
-                case css::text::WrapTextMode_NONE:
-                case css::text::WrapTextMode_LEFT:
-                    pSurroundString = OOO_STRING_SVTOOLS_HTML_AL_left;
-                    break;
-                case css::text::WrapTextMode_RIGHT:
-                case css::text::WrapTextMode_PARALLEL:
-                    if( bAnchorOnly )
-                        m_bClearLeft = true;
-                    break;
-                default:
-                    break;
-                }
+                ;
             }
-            break;
         }
+        break;
 
-        if (pSurroundString)
+        default:
+        // If a frame is centered, it gets left aligned. This
+        // should be taken into account here, too.
         {
-            aHtml.start(OOO_STRING_SVTOOLS_HTML_linebreak);
-            aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_clear, pSurroundString);
-            aHtml.end();
+            switch( eSurround )
+            {
+            case css::text::WrapTextMode_NONE:
+            case css::text::WrapTextMode_LEFT:
+                pSurroundString = OOO_STRING_SVTOOLS_HTML_AL_left;
+                break;
+            case css::text::WrapTextMode_RIGHT:
+            case css::text::WrapTextMode_PARALLEL:
+                if( bAnchorOnly )
+                    m_bClearLeft = true;
+                break;
+            default:
+                break;
+            }
         }
+        break;
+    }
+
+    if (pSurroundString)
+    {
+        aHtml.start(OOO_STRING_SVTOOLS_HTML_linebreak);
+        aHtml.attribute(OOO_STRING_SVTOOLS_HTML_O_clear, pSurroundString);
+        aHtml.end();
     }
 }
 
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index ee1b8f90881d..c15123a31717 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -2465,19 +2465,19 @@ void SwHTMLParser::InsertSelectText()
     OSL_ENSURE( m_pFormImpl && m_pFormImpl->GetFCompPropSet().is(),
             "no select control" );
 
-    if(!m_pFormImpl->GetStringList().empty())
-    {
-        OUString& rText = m_pFormImpl->GetStringList().back();
+    if(m_pFormImpl->GetStringList().empty())
+        return;
 
-        if( !aToken.isEmpty() && ' '==aToken[ 0 ] )
-        {
-            sal_Int32 nLen = rText.getLength();
-            if( !nLen || ' '==rText[nLen-1])
-                aToken = aToken.replaceAt( 0, 1, "" );
-        }
-        if( !aToken.isEmpty() )
-            rText += aToken;
+    OUString& rText = m_pFormImpl->GetStringList().back();
+
+    if( !aToken.isEmpty() && ' '==aToken[ 0 ] )
+    {
+        sal_Int32 nLen = rText.getLength();
+        if( !nLen || ' '==rText[nLen-1])
+            aToken = aToken.replaceAt( 0, 1, "" );
     }
+    if( !aToken.isEmpty() )
+        rText += aToken;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index ab41378d11b5..1072edeceab4 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -316,25 +316,25 @@ void SwHTMLWriter::OutForm( bool bTag_On, const SwStartNode *pStartNd )
         }
     }
 
-    if( xNewFormComps.is() &&
-        (!mxFormComps.is() || xNewFormComps != mxFormComps) )
+    if( !(xNewFormComps.is() &&
+        (!mxFormComps.is() || xNewFormComps != mxFormComps)) )
+        return;
+
+    // A form should be opened ...
+    if( mxFormComps.is() )
     {
-        // A form should be opened ...
-        if( mxFormComps.is() )
-        {
-            // ... but a form is still open: That is in every case an error,
-            // but we'll close the old form nevertheless.
-            OutForm( false, mxFormComps );
+        // ... but a form is still open: That is in every case an error,
+        // but we'll close the old form nevertheless.
+        OutForm( false, mxFormComps );
 
-            //!!!nWarn = 1; // Control will be assigned to wrong form
-        }
+        //!!!nWarn = 1; // Control will be assigned to wrong form
+    }
 
-        mxFormComps = xNewFormComps;
+    mxFormComps = xNewFormComps;
 
-        OutForm( true, mxFormComps );
-        uno::Reference< beans::XPropertySet >  xTmp;
-        OutHiddenControls( mxFormComps, xTmp );
-    }
+    OutForm( true, mxFormComps );
+    uno::Reference< beans::XPropertySet >  xTmp;
+    OutHiddenControls( mxFormComps, xTmp );
 }
 
 void SwHTMLWriter::OutHiddenForms()
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 525b3b0ea175..265deafe963f 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -311,22 +311,22 @@ void SwHTMLParser::SetSpace( const Size& rPixSpace,
         }
         rCSS1ItemSet.ClearItem( RES_UL_SPACE );
     }
-    if( nUpperSpace || nLowerSpace )
+    if( !(nUpperSpace || nLowerSpace) )
+        return;
+
+    SvxULSpaceItem aULItem( RES_UL_SPACE );
+    aULItem.SetUpper( nUpperSpace );
+    aULItem.SetLower( nLowerSpace );
+    rFlyItemSet.Put( aULItem );
+    if( nUpperSpace )
     {
-        SvxULSpaceItem aULItem( RES_UL_SPACE );
-        aULItem.SetUpper( nUpperSpace );
-        aULItem.SetLower( nLowerSpace );
-        rFlyItemSet.Put( aULItem );
-        if( nUpperSpace )
+        const SwFormatVertOrient& rVertOri =
+            rFlyItemSet.Get( RES_VERT_ORIENT );
+        if( text::VertOrientation::NONE == rVertOri.GetVertOrient() )
         {
-            const SwFormatVertOrient& rVertOri =
-                rFlyItemSet.Get( RES_VERT_ORIENT );
-            if( text::VertOrientation::NONE == rVertOri.GetVertOrient() )
-            {
-                SwFormatVertOrient aVertOri( rVertOri );
-                aVertOri.SetPos( aVertOri.GetPos() + nUpperSpace );
-                rFlyItemSet.Put( aVertOri );
-            }
+            SwFormatVertOrient aVertOri( rVertOri );
+            aVertOri.SetPos( aVertOri.GetPos() + nUpperSpace );
+            rFlyItemSet.Put( aVertOri );
         }
     }
 }
@@ -830,27 +830,27 @@ void SwHTMLParser::EndObject()
 #if HAVE_FEATURE_JAVA
     if( !m_pAppletImpl )
         return;
-    if( m_pAppletImpl->CreateApplet( m_sBaseURL ) )
-    {
-        m_pAppletImpl->FinishApplet();
+    if( !m_pAppletImpl->CreateApplet( m_sBaseURL ) )
+        return;
 
-        // and insert into the document
-        SwFrameFormat* pFlyFormat =
-            m_xDoc->getIDocumentContentOperations().InsertEmbObject(*m_pPam,
-                    ::svt::EmbeddedObjectRef( m_pAppletImpl->GetApplet(), embed::Aspects::MSOLE_CONTENT ),
-                    &m_pAppletImpl->GetItemSet() );
+    m_pAppletImpl->FinishApplet();
 
-        // set the alternative name
-        SwNoTextNode *pNoTextNd =
-            m_xDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx()
-                              ->GetIndex()+1 ]->GetNoTextNode();
-        pNoTextNd->SetTitle( m_pAppletImpl->GetAltText() );
+    // and insert into the document
+    SwFrameFormat* pFlyFormat =
+        m_xDoc->getIDocumentContentOperations().InsertEmbObject(*m_pPam,
+                ::svt::EmbeddedObjectRef( m_pAppletImpl->GetApplet(), embed::Aspects::MSOLE_CONTENT ),
+                &m_pAppletImpl->GetItemSet() );
 
-        // if applicable create frames and register auto-bound frames
-        RegisterFlyFrame( pFlyFormat );
+    // set the alternative name
+    SwNoTextNode *pNoTextNd =
+        m_xDoc->GetNodes()[ pFlyFormat->GetContent().GetContentIdx()
+                          ->GetIndex()+1 ]->GetNoTextNode();
+    pNoTextNd->SetTitle( m_pAppletImpl->GetAltText() );
 
-        m_pAppletImpl.reset();
-    }
+    // if applicable create frames and register auto-bound frames
+    RegisterFlyFrame( pFlyFormat );
+
+    m_pAppletImpl.reset();
 #else
     (void) this;                // Silence loplugin:staticmethods
 #endif
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 40c00df425da..20113a949d18 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -2450,26 +2450,26 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
 
     const_cast<SwTable *>(m_pSwTable)->SetHTMLTableLayout(m_xLayoutInfo);
 
-    if( m_pResizeDrawObjects )
+    if( !m_pResizeDrawObjects )
+        return;
+
+    sal_uInt16 nCount = m_pResizeDrawObjects->size();
+    for( sal_uInt16 i=0; i<nCount; i++ )
     {
-        sal_uInt16 nCount = m_pResizeDrawObjects->size();
-        for( sal_uInt16 i=0; i<nCount; i++ )
-        {
-            SdrObject *pObj = (*m_pResizeDrawObjects)[i];
-            sal_uInt16 nRow = (*m_pDrawObjectPercentWidths)[3*i];
-            sal_uInt16 nCol = (*m_pDrawObjectPercentWidths)[3*i+1];
-            sal_uInt8 nPercentWidth = static_cast<sal_uInt8>((*m_pDrawObjectPercentWidths)[3*i+2]);
+        SdrObject *pObj = (*m_pResizeDrawObjects)[i];
+        sal_uInt16 nRow = (*m_pDrawObjectPercentWidths)[3*i];
+        sal_uInt16 nCol = (*m_pDrawObjectPercentWidths)[3*i+1];
+        sal_uInt8 nPercentWidth = static_cast<sal_uInt8>((*m_pDrawObjectPercentWidths)[3*i+2]);
 
-            SwHTMLTableLayoutCell *pLayoutCell =
-                m_xLayoutInfo->GetCell( nRow, nCol );
-            sal_uInt16 nColSpan = pLayoutCell->GetColSpan();
+        SwHTMLTableLayoutCell *pLayoutCell =
+            m_xLayoutInfo->GetCell( nRow, nCol );
+        sal_uInt16 nColSpan = pLayoutCell->GetColSpan();
 
-            sal_uInt16 nWidth2, nDummy;
-            m_xLayoutInfo->GetAvail( nCol, nColSpan, nWidth2, nDummy );
-            nWidth2 = static_cast< sal_uInt16 >((static_cast<long>(m_nWidth) * nPercentWidth) / 100);
+        sal_uInt16 nWidth2, nDummy;
+        m_xLayoutInfo->GetAvail( nCol, nColSpan, nWidth2, nDummy );
+        nWidth2 = static_cast< sal_uInt16 >((static_cast<long>(m_nWidth) * nPercentWidth) / 100);
 
-            SwHTMLParser::ResizeDrawObject( pObj, nWidth2 );
-        }
+        SwHTMLParser::ResizeDrawObject( pObj, nWidth2 );
     }
 
 }
@@ -3108,33 +3108,33 @@ void CellSaveStruct::EndNoBreak( const SwPosition& rPos )
 
 void CellSaveStruct::CheckNoBreak( const SwPosition& rPos )
 {
-    if (m_xCnts && m_pCurrCnts == m_xCnts.get())
+    if (!(m_xCnts && m_pCurrCnts == m_xCnts.get()))
+        return;
+
+    if( m_bNoBreak )
+    {
+        // <NOBR> wasn't closed
+        m_xCnts->SetNoBreak();
+    }
+    else if( m_pNoBreakEndNodeIndex &&
+             m_pNoBreakEndNodeIndex->GetIndex() == rPos.nNode.GetIndex() )
     {
-        if( m_bNoBreak )
+        if( m_nNoBreakEndContentPos == rPos.nContent.GetIndex() )
         {
-            // <NOBR> wasn't closed
+            // <NOBR> was closed immediately before the cell end
             m_xCnts->SetNoBreak();
         }
-        else if( m_pNoBreakEndNodeIndex &&
-                 m_pNoBreakEndNodeIndex->GetIndex() == rPos.nNode.GetIndex() )
+        else if( m_nNoBreakEndContentPos + 1 == rPos.nContent.GetIndex() )
         {
-            if( m_nNoBreakEndContentPos == rPos.nContent.GetIndex() )
+            SwTextNode const*const pTextNd(rPos.nNode.GetNode().GetTextNode());
+            if( pTextNd )
             {
-                // <NOBR> was closed immediately before the cell end
-                m_xCnts->SetNoBreak();
-            }
-            else if( m_nNoBreakEndContentPos + 1 == rPos.nContent.GetIndex() )
-            {
-                SwTextNode const*const pTextNd(rPos.nNode.GetNode().GetTextNode());
-                if( pTextNd )
+                sal_Unicode const cLast =
+                        pTextNd->GetText()[m_nNoBreakEndContentPos];
+                if( ' '==cLast || '\x0a'==cLast )
                 {
-                    sal_Unicode const cLast =
-                            pTextNd->GetText()[m_nNoBreakEndContentPos];
-                    if( ' '==cLast || '\x0a'==cLast )
-                    {
-                        // There's just a blank or a newline between the <NOBR> and the cell end
-                        m_xCnts->SetNoBreak();
-                    }
+                    // There's just a blank or a newline between the <NOBR> and the cell end
+                    m_xCnts->SetNoBreak();
                 }
             }
         }
diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx
index 8527410527fc..39038ab8b91c 100644
--- a/sw/source/filter/html/parcss1.cxx
+++ b/sw/source/filter/html/parcss1.cxx
@@ -1218,20 +1218,20 @@ void CSS1Expression::GetURL( OUString& rURL  ) const
                 ')' == aValue[aValue.getLength()-1],
                 "no valid URL(...)" );
 
-    if( aValue.getLength() > 5 )
-    {
-        rURL = aValue.copy( 4, aValue.getLength() - 5 );
+    if( aValue.getLength() <= 5 )
+        return;
 
-        // tdf#94088 original stripped only spaces, but there may also be
-        // double quotes in CSS style URLs, so be prepared to spaces followed
-        // by a single quote followed by spaces
-        const sal_Unicode aSpace(' ');
-        const sal_Unicode aSingleQuote('\'');
+    rURL = aValue.copy( 4, aValue.getLength() - 5 );
 
-        rURL = comphelper::string::strip(rURL, aSpace);
-        rURL = comphelper::string::strip(rURL, aSingleQuote);
-        rURL = comphelper::string::strip(rURL, aSpace);
-    }
+    // tdf#94088 original stripped only spaces, but there may also be
+    // double quotes in CSS style URLs, so be prepared to spaces followed
+    // by a single quote followed by spaces
+    const sal_Unicode aSpace(' ');
+    const sal_Unicode aSingleQuote('\'');
+
+    rURL = comphelper::string::strip(rURL, aSpace);
+    rURL = comphelper::string::strip(rURL, aSingleQuote);
+    rURL = comphelper::string::strip(rURL, aSpace);
 }
 
 bool CSS1Expression::GetColor( Color &rColor ) const
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index c01a4e0b28ae..f47e3bd2f60c 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -1516,23 +1516,23 @@ static void ParseCSS1_background( const CSS1Expression *pExpr,
     if( GPOS_NONE == eRepeat )
         eRepeat = ePos;
 
-    if( bTransparent || bColor || !aURL.isEmpty() )
-    {
-        SvxBrushItem aBrushItem( aItemIds.nBrush );
+    if( !(bTransparent || bColor || !aURL.isEmpty()) )
+        return;
 
-        if( bTransparent )
-            aBrushItem.SetColor( COL_TRANSPARENT);
-        else if( bColor )
-            aBrushItem.SetColor( aColor );
+    SvxBrushItem aBrushItem( aItemIds.nBrush );
 
-        if( !aURL.isEmpty() )
-        {
-            aBrushItem.SetGraphicLink( URIHelper::SmartRel2Abs( INetURLObject( rParser.GetBaseURL()), aURL, Link<OUString *, bool>(), false ) );
-            aBrushItem.SetGraphicPos( eRepeat );
-        }
+    if( bTransparent )
+        aBrushItem.SetColor( COL_TRANSPARENT);
+    else if( bColor )
+        aBrushItem.SetColor( aColor );
 
-        rItemSet.Put( aBrushItem );
+    if( !aURL.isEmpty() )
+    {
+        aBrushItem.SetGraphicLink( URIHelper::SmartRel2Abs( INetURLObject( rParser.GetBaseURL()), aURL, Link<OUString *, bool>(), false ) );
+        aBrushItem.SetGraphicPos( eRepeat );
     }
+
+    rItemSet.Put( aBrushItem );
 }
 
 static void ParseCSS1_background_color( const CSS1Expression *pExpr,
@@ -1653,22 +1653,22 @@ static void ParseCSS1_list_style_type( const CSS1Expression *pExpr,
 {
     OSL_ENSURE( pExpr, "no expression" );
 
-    if( pExpr->GetType() == CSS1_IDENT )
-    {
-        const OUString& rValue = pExpr->GetString();
+    if( pExpr->GetType() != CSS1_IDENT )
+        return;
 
-        // values are context-dependent, so fill both
-        sal_uInt16 nEnum;
-        if( SvxCSS1Parser::GetEnum( aNumberStyleTable, rValue, nEnum ) )
-        {
-            rPropInfo.m_bNumbering = true;
-            rPropInfo.m_nNumberingType = static_cast<SvxNumType>(nEnum);
-        }
-        if( SvxCSS1Parser::GetEnum( aBulletStyleTable, rValue, nEnum ) )
-        {
-            rPropInfo.m_bBullet = true;
-            rPropInfo.m_cBulletChar = nEnum;
-        }
+    const OUString& rValue = pExpr->GetString();
+
+    // values are context-dependent, so fill both
+    sal_uInt16 nEnum;
+    if( SvxCSS1Parser::GetEnum( aNumberStyleTable, rValue, nEnum ) )
+    {
+        rPropInfo.m_bNumbering = true;
+        rPropInfo.m_nNumberingType = static_cast<SvxNumType>(nEnum);
+    }
+    if( SvxCSS1Parser::GetEnum( aBulletStyleTable, rValue, nEnum ) )
+    {
+        rPropInfo.m_bBullet = true;
+        rPropInfo.m_cBulletChar = nEnum;
     }
 }
 
@@ -1974,24 +1974,24 @@ static void ParseCSS1_text_indent( const CSS1Expression *pExpr,
         ;
     }
 
-    if( bSet )
+    if( !bSet )
+        return;
+
+    const SfxPoolItem* pItem;
+    if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nLRSpace, false,
+                                               &pItem ) )
     {
-        const SfxPoolItem* pItem;
-        if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nLRSpace, false,
-                                                   &pItem ) )
-        {
-            SvxLRSpaceItem aLRItem( *static_cast<const SvxLRSpaceItem*>(pItem) );
-            aLRItem.SetTextFirstLineOffset( nIndent );
-            rItemSet.Put( aLRItem );
-        }
-        else
-        {
-            SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
-            aLRItem.SetTextFirstLineOffset( nIndent );
-            rItemSet.Put( aLRItem );
-        }
-        rPropInfo.m_bTextIndent = true;
+        SvxLRSpaceItem aLRItem( *static_cast<const SvxLRSpaceItem*>(pItem) );
+        aLRItem.SetTextFirstLineOffset( nIndent );
+        rItemSet.Put( aLRItem );
     }
+    else
+    {
+        SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
+        aLRItem.SetTextFirstLineOffset( nIndent );
+        rItemSet.Put( aLRItem );
+    }
+    rPropInfo.m_bTextIndent = true;
 }
 
 static void ParseCSS1_margin_left( const CSS1Expression *pExpr,
@@ -2034,27 +2034,27 @@ static void ParseCSS1_margin_left( const CSS1Expression *pExpr,
         ;
     }
 
-    if( bSet )
+    if( !bSet )
+        return;
+
+    rPropInfo.m_nLeftMargin = nLeft;
+    if( nLeft < 0 )
+        nLeft = 0;
+    const SfxPoolItem* pItem;
+    if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nLRSpace, false,
+                                               &pItem ) )
     {
-        rPropInfo.m_nLeftMargin = nLeft;
-        if( nLeft < 0 )
-            nLeft = 0;
-        const SfxPoolItem* pItem;
-        if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nLRSpace, false,
-                                                   &pItem ) )
-        {
-            SvxLRSpaceItem aLRItem( *static_cast<const SvxLRSpaceItem*>(pItem) );
-            aLRItem.SetTextLeft( static_cast<sal_uInt16>(nLeft) );
-            rItemSet.Put( aLRItem );
-        }
-        else
-        {
-            SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
-            aLRItem.SetTextLeft( static_cast<sal_uInt16>(nLeft) );
-            rItemSet.Put( aLRItem );
-        }
-        rPropInfo.m_bLeftMargin = true;
+        SvxLRSpaceItem aLRItem( *static_cast<const SvxLRSpaceItem*>(pItem) );
+        aLRItem.SetTextLeft( static_cast<sal_uInt16>(nLeft) );
+        rItemSet.Put( aLRItem );
+    }
+    else
+    {
+        SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
+        aLRItem.SetTextLeft( static_cast<sal_uInt16>(nLeft) );
+        rItemSet.Put( aLRItem );
     }
+    rPropInfo.m_bLeftMargin = true;
 }
 
 static void ParseCSS1_margin_right( const CSS1Expression *pExpr,
@@ -2093,27 +2093,27 @@ static void ParseCSS1_margin_right( const CSS1Expression *pExpr,
         ;
     }
 
-    if( bSet )
+    if( !bSet )
+        return;
+
+    rPropInfo.m_nRightMargin = nRight;
+    if( nRight < 0 )
+        nRight = 0;
+    const SfxPoolItem* pItem;
+    if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nLRSpace, false,
+                                               &pItem ) )
     {
-        rPropInfo.m_nRightMargin = nRight;
-        if( nRight < 0 )
-            nRight = 0;
-        const SfxPoolItem* pItem;
-        if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nLRSpace, false,
-                                                   &pItem ) )
-        {
-            SvxLRSpaceItem aLRItem( *static_cast<const SvxLRSpaceItem*>(pItem) );
-            aLRItem.SetRight( static_cast<sal_uInt16>(nRight) );
-            rItemSet.Put( aLRItem );
-        }
-        else
-        {
-            SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
-            aLRItem.SetRight( static_cast<sal_uInt16>(nRight) );
-            rItemSet.Put( aLRItem );
-        }
-        rPropInfo.m_bRightMargin = true;
+        SvxLRSpaceItem aLRItem( *static_cast<const SvxLRSpaceItem*>(pItem) );
+        aLRItem.SetRight( static_cast<sal_uInt16>(nRight) );
+        rItemSet.Put( aLRItem );
+    }
+    else
+    {
+        SvxLRSpaceItem aLRItem( aItemIds.nLRSpace );
+        aLRItem.SetRight( static_cast<sal_uInt16>(nRight) );
+        rItemSet.Put( aLRItem );
     }
+    rPropInfo.m_bRightMargin = true;
 }
 
 static void ParseCSS1_margin_top( const CSS1Expression *pExpr,
@@ -2158,24 +2158,24 @@ static void ParseCSS1_margin_top( const CSS1Expression *pExpr,
         ;
     }
 
-    if( bSet )
+    if( !bSet )
+        return;
+
+    const SfxPoolItem* pItem;
+    if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nULSpace, false,
+                                               &pItem ) )
     {
-        const SfxPoolItem* pItem;
-        if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nULSpace, false,
-                                                   &pItem ) )
-        {
-            SvxULSpaceItem aULItem( *static_cast<const SvxULSpaceItem*>(pItem) );
-            aULItem.SetUpper( nUpper );
-            rItemSet.Put( aULItem );
-        }
-        else
-        {
-            SvxULSpaceItem aULItem( aItemIds.nULSpace );
-            aULItem.SetUpper( nUpper );
-            rItemSet.Put( aULItem );
-        }
-        rPropInfo.m_bTopMargin = true;
+        SvxULSpaceItem aULItem( *static_cast<const SvxULSpaceItem*>(pItem) );
+        aULItem.SetUpper( nUpper );
+        rItemSet.Put( aULItem );
     }
+    else
+    {
+        SvxULSpaceItem aULItem( aItemIds.nULSpace );
+        aULItem.SetUpper( nUpper );
+        rItemSet.Put( aULItem );
+    }
+    rPropInfo.m_bTopMargin = true;
 }
 
 static void ParseCSS1_margin_bottom( const CSS1Expression *pExpr,
@@ -2220,24 +2220,24 @@ static void ParseCSS1_margin_bottom( const CSS1Expression *pExpr,
         ;
     }
 
-    if( bSet )
+    if( !bSet )
+        return;
+
+    const SfxPoolItem* pItem;
+    if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nULSpace, false,
+                                               &pItem ) )
     {
-        const SfxPoolItem* pItem;
-        if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nULSpace, false,
-                                                   &pItem ) )
-        {
-            SvxULSpaceItem aULItem( *static_cast<const SvxULSpaceItem*>(pItem) );
-            aULItem.SetLower( nLower );
-            rItemSet.Put( aULItem );
-        }
-        else
-        {
-            SvxULSpaceItem aULItem( aItemIds.nULSpace );
-            aULItem.SetLower( nLower );
-            rItemSet.Put( aULItem );
-        }
-        rPropInfo.m_bBottomMargin = true;
+        SvxULSpaceItem aULItem( *static_cast<const SvxULSpaceItem*>(pItem) );
+        aULItem.SetLower( nLower );
+        rItemSet.Put( aULItem );
     }
+    else
+    {
+        SvxULSpaceItem aULItem( aItemIds.nULSpace );
+        aULItem.SetLower( nLower );
+        rItemSet.Put( aULItem );
+    }
+    rPropInfo.m_bBottomMargin = true;
 }
 
 static void ParseCSS1_margin( const CSS1Expression *pExpr,
@@ -2355,37 +2355,37 @@ static void ParseCSS1_margin( const CSS1Expression *pExpr,
         }
     }
 
-    if( bSetMargins[0] || bSetMargins[2] )
-    {
-        if( nMargins[0] < 0 )
-            nMargins[0] = 0;
-        if( nMargins[2] < 0 )
-            nMargins[2] = 0;
+    if( !(bSetMargins[0] || bSetMargins[2]) )
+        return;
 
-        const SfxPoolItem* pItem;
-        if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nULSpace, false,
-                                                   &pItem ) )
-        {
-            SvxULSpaceItem aULItem( *static_cast<const SvxULSpaceItem*>(pItem) );
-            if( bSetMargins[0] )
-                aULItem.SetUpper( static_cast<sal_uInt16>(nMargins[0]) );
-            if( bSetMargins[2] )
-                aULItem.SetLower( static_cast<sal_uInt16>(nMargins[2]) );
-            rItemSet.Put( aULItem );
-        }
-        else
-        {
-            SvxULSpaceItem aULItem( aItemIds.nULSpace );
-            if( bSetMargins[0] )
-                aULItem.SetUpper( static_cast<sal_uInt16>(nMargins[0]) );
-            if( bSetMargins[2] )
-                aULItem.SetLower( static_cast<sal_uInt16>(nMargins[2]) );
-            rItemSet.Put( aULItem );
-        }
+    if( nMargins[0] < 0 )
+        nMargins[0] = 0;
+    if( nMargins[2] < 0 )
+        nMargins[2] = 0;
 
-        rPropInfo.m_bTopMargin |= bSetMargins[0];
-        rPropInfo.m_bBottomMargin |= bSetMargins[2];
+    const SfxPoolItem* pItem;
+    if( SfxItemState::SET == rItemSet.GetItemState( aItemIds.nULSpace, false,
+                                               &pItem ) )
+    {
+        SvxULSpaceItem aULItem( *static_cast<const SvxULSpaceItem*>(pItem) );
+        if( bSetMargins[0] )
+            aULItem.SetUpper( static_cast<sal_uInt16>(nMargins[0]) );
+        if( bSetMargins[2] )
+            aULItem.SetLower( static_cast<sal_uInt16>(nMargins[2]) );
+        rItemSet.Put( aULItem );
+    }
+    else
+    {
+        SvxULSpaceItem aULItem( aItemIds.nULSpace );
+        if( bSetMargins[0] )
+            aULItem.SetUpper( static_cast<sal_uInt16>(nMargins[0]) );
+        if( bSetMargins[2] )
+            aULItem.SetLower( static_cast<sal_uInt16>(nMargins[2]) );
+        rItemSet.Put( aULItem );
     }
+
+    rPropInfo.m_bTopMargin |= bSetMargins[0];
+    rPropInfo.m_bBottomMargin |= bSetMargins[2];
 }
 
 static bool ParseCSS1_padding_xxx( const CSS1Expression *pExpr,
@@ -3049,19 +3049,18 @@ static void ParseCSS1_so_language( const CSS1Expression *pExpr,
                                SvxCSS1PropertyInfo& /*rPropInfo*/,
                                const SvxCSS1Parser& /*rParser*/ )
 {
-    if( CSS1_IDENT == pExpr->GetType() ||
-        CSS1_STRING == pExpr->GetType() )
+    if( CSS1_IDENT != pExpr->GetType() && CSS1_STRING != pExpr->GetType() )
+        return;
+
+    LanguageType eLang = LanguageTag::convertToLanguageTypeWithFallback( pExpr->GetString() );
+    if( LANGUAGE_DONTKNOW != eLang )
     {
-        LanguageType eLang = LanguageTag::convertToLanguageTypeWithFallback( pExpr->GetString() );
-        if( LANGUAGE_DONTKNOW != eLang )
-        {
-            SvxLanguageItem aLang( eLang, aItemIds.nLanguage );
-            rItemSet.Put( aLang );
-            aLang.SetWhich( aItemIds.nLanguageCJK );
-            rItemSet.Put( aLang );
-            aLang.SetWhich( aItemIds.nLanguageCTL );
-            rItemSet.Put( aLang );
-        }
+        SvxLanguageItem aLang( eLang, aItemIds.nLanguage );
+        rItemSet.Put( aLang );
+        aLang.SetWhich( aItemIds.nLanguageCJK );
+        rItemSet.Put( aLang );
+        aLang.SetWhich( aItemIds.nLanguageCTL );
+        rItemSet.Put( aLang );
     }
 }
 
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index f8b13ae78b96..7050efc0a320 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2471,65 +2471,65 @@ void SwHTMLParser::AddParSpace()
 
     SvxULSpaceItem rULSpace =
         static_cast<const SvxULSpaceItem&>(pTextNode->SwContentNode::GetAttr( RES_UL_SPACE ));
-    if( !rULSpace.GetLower() )
+    if( rULSpace.GetLower() )
+        return;
+
+    const SvxULSpaceItem& rCollULSpace =
+        pTextNode->GetAnyFormatColl().GetULSpace();
+    if( rCollULSpace.GetLower() &&
+        rCollULSpace.GetUpper() == rULSpace.GetUpper() )
     {
-        const SvxULSpaceItem& rCollULSpace =
-            pTextNode->GetAnyFormatColl().GetULSpace();
-        if( rCollULSpace.GetLower() &&
-            rCollULSpace.GetUpper() == rULSpace.GetUpper() )
-        {
-            pTextNode->ResetAttr( RES_UL_SPACE );
-        }
-        else
-        {
-            //What I do here, is that I examine the attributes, and if
-            //I find out, that it's CJK/CTL, then I set the paragraph space
-            //to the value set in HTML_CJK_PARSPACE/HTML_CTL_PARSPACE.
+        pTextNode->ResetAttr( RES_UL_SPACE );
+    }
+    else
+    {
+        //What I do here, is that I examine the attributes, and if
+        //I find out, that it's CJK/CTL, then I set the paragraph space
+        //to the value set in HTML_CJK_PARSPACE/HTML_CTL_PARSPACE.
 
-            bool bIsCJK = false;
-            bool bIsCTL = false;
+        bool bIsCJK = false;
+        bool bIsCTL = false;
 
-            const size_t nCntAttr = pTextNode->GetpSwpHints()
-                            ? pTextNode->GetSwpHints().Count() : 0;
+        const size_t nCntAttr = pTextNode->GetpSwpHints()
+                        ? pTextNode->GetSwpHints().Count() : 0;
 
-            for(size_t i = 0; i < nCntAttr; ++i)
-            {
-                SwTextAttr *const pHt = pTextNode->GetSwpHints().Get(i);
-                sal_uInt16 const nWhich = pHt->Which();
-                if (RES_CHRATR_CJK_FONT == nWhich ||
-                    RES_CHRATR_CJK_FONTSIZE == nWhich ||
-                    RES_CHRATR_CJK_LANGUAGE == nWhich ||
-                    RES_CHRATR_CJK_POSTURE == nWhich ||
-                    RES_CHRATR_CJK_WEIGHT == nWhich)
-                {
-                    bIsCJK = true;
-                    break;
-                }
-                if (RES_CHRATR_CTL_FONT == nWhich ||
-                    RES_CHRATR_CTL_FONTSIZE == nWhich ||
-                    RES_CHRATR_CTL_LANGUAGE == nWhich ||
-                    RES_CHRATR_CTL_POSTURE == nWhich ||
-                    RES_CHRATR_CTL_WEIGHT == nWhich)
-                {
-                    bIsCTL = true;
-                    break;
-                }
-            }
-
-            if( bIsCTL )
+        for(size_t i = 0; i < nCntAttr; ++i)
+        {
+            SwTextAttr *const pHt = pTextNode->GetSwpHints().Get(i);
+            sal_uInt16 const nWhich = pHt->Which();
+            if (RES_CHRATR_CJK_FONT == nWhich ||
+                RES_CHRATR_CJK_FONTSIZE == nWhich ||
+                RES_CHRATR_CJK_LANGUAGE == nWhich ||
+                RES_CHRATR_CJK_POSTURE == nWhich ||
+                RES_CHRATR_CJK_WEIGHT == nWhich)
             {
-                pTextNode->SetAttr(
-                    SvxULSpaceItem( rULSpace.GetUpper(), HTML_CTL_PARSPACE, RES_UL_SPACE )  );
+                bIsCJK = true;
+                break;
             }
-            else if( bIsCJK )
+            if (RES_CHRATR_CTL_FONT == nWhich ||
+                RES_CHRATR_CTL_FONTSIZE == nWhich ||
+                RES_CHRATR_CTL_LANGUAGE == nWhich ||
+                RES_CHRATR_CTL_POSTURE == nWhich ||
+                RES_CHRATR_CTL_WEIGHT == nWhich)
             {
-                pTextNode->SetAttr(
-                    SvxULSpaceItem( rULSpace.GetUpper(), HTML_CJK_PARSPACE, RES_UL_SPACE )  );
-            } else {
-                pTextNode->SetAttr(
-                    SvxULSpaceItem( rULSpace.GetUpper(), HTML_PARSPACE, RES_UL_SPACE )  );
+                bIsCTL = true;
+                break;
             }
         }
+
+        if( bIsCTL )
+        {
+            pTextNode->SetAttr(
+                SvxULSpaceItem( rULSpace.GetUpper(), HTML_CTL_PARSPACE, RES_UL_SPACE )  );
+        }
+        else if( bIsCJK )
+        {
+            pTextNode->SetAttr(
+                SvxULSpaceItem( rULSpace.GetUpper(), HTML_CJK_PARSPACE, RES_UL_SPACE )  );
+        } else {
+            pTextNode->SetAttr(
+                SvxULSpaceItem( rULSpace.GetUpper(), HTML_PARSPACE, RES_UL_SPACE )  );
+        }
     }
 }
 
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 2f83734aee37..877d1a1c63cb 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -1187,35 +1187,35 @@ void SwHTMLWriter::OutPointFieldmarks( const SwPosition& rPos )
     if (!pMark)
         return;
 
-    if (pMark->GetFieldname() == ODF_FORMCHECKBOX)
-    {
-        const sw::mark::ICheckboxFieldmark* pCheckBox =
-            dynamic_cast<const sw::mark::ICheckboxFieldmark*>(pMark);
+    if (pMark->GetFieldname() != ODF_FORMCHECKBOX)
+        return;
 
-        if (pCheckBox)
-        {
-            OString aOut("<"
-                OOO_STRING_SVTOOLS_HTML_input
-                " "
-                OOO_STRING_SVTOOLS_HTML_O_type
-                "=\""
-                OOO_STRING_SVTOOLS_HTML_IT_checkbox
-                "\"");
-
-            if (pCheckBox->IsChecked())
-            {
-                aOut += " "
-                    OOO_STRING_SVTOOLS_HTML_O_checked
-                    "=\""
-                    OOO_STRING_SVTOOLS_HTML_O_checked
-                    "\"";
-            }
+    const sw::mark::ICheckboxFieldmark* pCheckBox =
+        dynamic_cast<const sw::mark::ICheckboxFieldmark*>(pMark);
 
-            aOut += "/>";
-            Strm().WriteOString(aOut);
-        }
+    if (!pCheckBox)
+        return;
+
+    OString aOut("<"
+        OOO_STRING_SVTOOLS_HTML_input
+        " "
+        OOO_STRING_SVTOOLS_HTML_O_type
+        "=\""
+        OOO_STRING_SVTOOLS_HTML_IT_checkbox
+        "\"");
+
+    if (pCheckBox->IsChecked())
+    {
+        aOut += " "
+            OOO_STRING_SVTOOLS_HTML_O_checked
+            "=\""
+            OOO_STRING_SVTOOLS_HTML_O_checked
+            "\"";
     }
 
+    aOut += "/>";
+    Strm().WriteOString(aOut);
+
     // TODO : Handle other single-point fieldmark types here (if any).
 }
 
@@ -1343,19 +1343,19 @@ sal_uInt16 SwHTMLWriter::GetLangWhichIdFromScript( sal_uInt16 nScript )
 void SwHTMLWriter::OutLanguage( LanguageType nLang )
 {
     // ReqIF mode: consumers would ignore language anyway.
-    if (LANGUAGE_DONTKNOW != nLang && !mbReqIF)
-    {
-        OStringBuffer sOut;
-        sOut.append(' ');
-        if (mbXHTML)
-            sOut.append(OOO_STRING_SVTOOLS_XHTML_O_lang);
-        else
-            sOut.append(OOO_STRING_SVTOOLS_HTML_O_lang);
-        sOut.append("=\"");
-        Strm().WriteOString( sOut.makeStringAndClear() );
-        HTMLOutFuncs::Out_String( Strm(), LanguageTag::convertToBcp47(nLang),
-                                  m_eDestEnc, &m_aNonConvertableCharacters ).WriteChar( '"' );
-    }
+    if (!(LANGUAGE_DONTKNOW != nLang && !mbReqIF))
+        return;
+
+    OStringBuffer sOut;
+    sOut.append(' ');
+    if (mbXHTML)
+        sOut.append(OOO_STRING_SVTOOLS_XHTML_O_lang);
+    else
+        sOut.append(OOO_STRING_SVTOOLS_HTML_O_lang);
+    sOut.append("=\"");
+    Strm().WriteOString( sOut.makeStringAndClear() );
+    HTMLOutFuncs::Out_String( Strm(), LanguageTag::convertToBcp47(nLang),
+                              m_eDestEnc, &m_aNonConvertableCharacters ).WriteChar( '"' );
 }
 
 SvxFrameDirection SwHTMLWriter::GetHTMLDirection( const SfxItemSet& rItemSet ) const


More information about the Libreoffice-commits mailing list