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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 30 18:19:41 UTC 2020


 sw/source/ui/dialog/ascfldlg.cxx               |   50 ++--
 sw/source/ui/dialog/uiregionsw.cxx             |  260 ++++++++++++-------------
 sw/source/ui/envelp/envlop1.cxx                |   34 +--
 sw/source/ui/envelp/label1.cxx                 |   32 +--
 sw/source/ui/fldui/DateFormFieldDialog.cxx     |  140 ++++++-------
 sw/source/ui/fldui/DropDownFieldDialog.cxx     |   28 +-
 sw/source/ui/fldui/DropDownFormFieldDialog.cxx |   76 +++----
 sw/source/ui/fldui/flddb.cxx                   |   56 ++---
 sw/source/ui/fldui/flddok.cxx                  |   24 +-
 sw/source/ui/fldui/fldpage.cxx                 |   38 +--
 sw/source/ui/fldui/fldref.cxx                  |   42 ++--
 sw/source/ui/fldui/fldtdlg.cxx                 |   46 ++--
 sw/source/ui/frmdlg/column.cxx                 |   28 +-
 sw/source/ui/frmdlg/frmpage.cxx                |   83 +++----
 sw/source/ui/index/cnttab.cxx                  |  206 +++++++++----------
 sw/source/ui/index/swuiidxmrk.cxx              |   88 ++++----
 sw/source/ui/misc/glosbib.cxx                  |   36 +--
 sw/source/ui/misc/insfnote.cxx                 |   40 +--
 sw/source/ui/table/autoformatpreview.cxx       |   22 +-
 sw/source/ui/table/tabledlg.cxx                |   98 ++++-----
 20 files changed, 713 insertions(+), 714 deletions(-)

New commits:
commit 4209d94b46cdd96898c02344b11700369ae88784
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 30 10:39:15 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 30 20:18:57 2020 +0200

    loplugin:flatten in sw/ui/dialog..sw/ui/table
    
    Change-Id: I2350c1d3f5fab727b0d47b6f3684804b77e68122
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99805
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx
index 327c5573e67a..e05e881e45cb 100644
--- a/sw/source/ui/dialog/ascfldlg.cxx
+++ b/sw/source/ui/dialog/ascfldlg.cxx
@@ -276,22 +276,22 @@ void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions )
     // save the user settings
     OUString sData;
     rOptions.WriteUserData( sData );
-    if (!sData.isEmpty())
+    if (sData.isEmpty())
+        return;
+
+    const OUString sFindNm = OUString::createFromAscii(
+                                m_xFontLB->get_visible() ? sDialogImpExtraData
+                                          : sDialogExpExtraData);
+    sal_Int32 nEnd, nStt = m_sExtraData.indexOf( sFindNm );
+    if( -1 != nStt )
     {
-        const OUString sFindNm = OUString::createFromAscii(
-                                    m_xFontLB->get_visible() ? sDialogImpExtraData
-                                              : sDialogExpExtraData);
-        sal_Int32 nEnd, nStt = m_sExtraData.indexOf( sFindNm );
-        if( -1 != nStt )
-        {
-            // called twice, so remove "old" settings
-            nEnd = m_sExtraData.indexOf( cDialogExtraDataClose,
-                                            nStt + nDialogExtraDataLen );
-            if( -1 != nEnd )
-                m_sExtraData = m_sExtraData.replaceAt( nStt, nEnd - nStt + 1, "" );
-        }
-        m_sExtraData += sFindNm + sData + OUStringChar(cDialogExtraDataClose);
+        // called twice, so remove "old" settings
+        nEnd = m_sExtraData.indexOf( cDialogExtraDataClose,
+                                        nStt + nDialogExtraDataLen );
+        if( -1 != nEnd )
+            m_sExtraData = m_sExtraData.replaceAt( nStt, nEnd - nStt + 1, "" );
     }
+    m_sExtraData += sFindNm + sData + OUStringChar(cDialogExtraDataClose);
 }
 
 void SwAsciiFilterDlg::SetCRLF( LineEnd eEnd )
@@ -334,18 +334,18 @@ bool SwAsciiFilterDlg::GetIncludeBOM() const
 
 void SwAsciiFilterDlg::UpdateIncludeBOMSensitiveState()
 {
-    if (m_xIncludeBOM_CB->get_visible())
+    if (!m_xIncludeBOM_CB->get_visible())
+        return;
+
+    switch (m_xCharSetLB->GetSelectTextEncoding())
     {
-        switch (m_xCharSetLB->GetSelectTextEncoding())
-        {
-            case RTL_TEXTENCODING_UTF8:
-            case RTL_TEXTENCODING_UCS2:
-                m_xIncludeBOM_CB->set_sensitive(true);
-                break;
-            default:
-                m_xIncludeBOM_CB->set_sensitive(false);
-                break;
-        }
+        case RTL_TEXTENCODING_UTF8:
+        case RTL_TEXTENCODING_UCS2:
+            m_xIncludeBOM_CB->set_sensitive(true);
+            break;
+        default:
+            m_xIncludeBOM_CB->set_sensitive(false);
+            break;
     }
 }
 
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index c51e2a7fd927..790254fc9496 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -538,21 +538,21 @@ SwEditRegionDlg::~SwEditRegionDlg( )
 void SwEditRegionDlg::SelectSection(const OUString& rSectionName)
 {
     std::unique_ptr<weld::TreeIter> xIter(m_xTree->make_iterator());
-    if (m_xTree->get_iter_first(*xIter))
+    if (!m_xTree->get_iter_first(*xIter))
+        return;
+
+    do
     {
-        do
+        SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(*xIter).toInt64());
+        if (pRepr->GetSectionData().GetSectionName() == rSectionName)
         {
-            SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(*xIter).toInt64());
-            if (pRepr->GetSectionData().GetSectionName() == rSectionName)
-            {
-                m_xTree->unselect_all();
-                m_xTree->select(*xIter);
-                m_xTree->scroll_to_row(*xIter);
-                GetFirstEntryHdl(*m_xTree);
-                break;
-            }
-        } while (m_xTree->iter_next(*xIter));
-    }
+            m_xTree->unselect_all();
+            m_xTree->select(*xIter);
+            m_xTree->scroll_to_row(*xIter);
+            GetFirstEntryHdl(*m_xTree);
+            break;
+        }
+    } while (m_xTree->iter_next(*xIter));
 }
 
 // selected entry in TreeListBox is showed in Edit window in case of
@@ -1022,58 +1022,58 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, weld::Button&, void)
     aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
 
     SwSectionPropertyTabDialog aTabDlg(m_xDialog.get(), aSet, rSh);
-    if (RET_OK == aTabDlg.run())
-    {
-        const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
-        if( pOutSet && pOutSet->Count() )
-        {
-            const SfxPoolItem *pColItem, *pBrushItem,
-                              *pFootnoteItem, *pEndItem, *pBalanceItem,
-                              *pFrameDirItem, *pLRSpaceItem;
-            SfxItemState eColState = pOutSet->GetItemState(
-                                    RES_COL, false, &pColItem );
-            SfxItemState eBrushState = pOutSet->GetItemState(
-                                    RES_BACKGROUND, false, &pBrushItem );
-            SfxItemState eFootnoteState = pOutSet->GetItemState(
-                                    RES_FTN_AT_TXTEND, false, &pFootnoteItem );
-            SfxItemState eEndState = pOutSet->GetItemState(
-                                    RES_END_AT_TXTEND, false, &pEndItem );
-            SfxItemState eBalanceState = pOutSet->GetItemState(
-                                    RES_COLUMNBALANCE, false, &pBalanceItem );
-            SfxItemState eFrameDirState = pOutSet->GetItemState(
-                                    RES_FRAMEDIR, false, &pFrameDirItem );
-            SfxItemState eLRState = pOutSet->GetItemState(
-                                    RES_LR_SPACE, false, &pLRSpaceItem);
-
-            if( SfxItemState::SET == eColState ||
-                SfxItemState::SET == eBrushState ||
-                SfxItemState::SET == eFootnoteState ||
-                SfxItemState::SET == eEndState ||
-                SfxItemState::SET == eBalanceState||
-                SfxItemState::SET == eFrameDirState||
-                SfxItemState::SET == eLRState)
-            {
-                m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
-                    SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
-                    if( SfxItemState::SET == eColState )
-                        pRepr->GetCol() = *static_cast<const SwFormatCol*>(pColItem);
-                    if( SfxItemState::SET == eBrushState )
-                        pRepr->GetBackground().reset(static_cast<SvxBrushItem*>(pBrushItem->Clone()));
-                    if( SfxItemState::SET == eFootnoteState )
-                        pRepr->GetFootnoteNtAtEnd() = *static_cast<const SwFormatFootnoteAtTextEnd*>(pFootnoteItem);
-                    if( SfxItemState::SET == eEndState )
-                        pRepr->GetEndNtAtEnd() = *static_cast<const SwFormatEndAtTextEnd*>(pEndItem);
-                    if( SfxItemState::SET == eBalanceState )
-                        pRepr->GetBalance().SetValue(static_cast<const SwFormatNoBalancedColumns*>(pBalanceItem)->GetValue());
-                    if( SfxItemState::SET == eFrameDirState )
-                        pRepr->GetFrameDir()->SetValue(static_cast<const SvxFrameDirectionItem*>(pFrameDirItem)->GetValue());
-                    if( SfxItemState::SET == eLRState )
-                        pRepr->GetLRSpace().reset(static_cast<SvxLRSpaceItem*>(pLRSpaceItem->Clone()));
-                    return false;
-                });
-            }
-        }
-    }
+    if (RET_OK != aTabDlg.run())
+        return;
+
+    const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
+    if( !(pOutSet && pOutSet->Count()) )
+        return;
+
+    const SfxPoolItem *pColItem, *pBrushItem,
+                      *pFootnoteItem, *pEndItem, *pBalanceItem,
+                      *pFrameDirItem, *pLRSpaceItem;
+    SfxItemState eColState = pOutSet->GetItemState(
+                            RES_COL, false, &pColItem );
+    SfxItemState eBrushState = pOutSet->GetItemState(
+                            RES_BACKGROUND, false, &pBrushItem );
+    SfxItemState eFootnoteState = pOutSet->GetItemState(
+                            RES_FTN_AT_TXTEND, false, &pFootnoteItem );
+    SfxItemState eEndState = pOutSet->GetItemState(
+                            RES_END_AT_TXTEND, false, &pEndItem );
+    SfxItemState eBalanceState = pOutSet->GetItemState(
+                            RES_COLUMNBALANCE, false, &pBalanceItem );
+    SfxItemState eFrameDirState = pOutSet->GetItemState(
+                            RES_FRAMEDIR, false, &pFrameDirItem );
+    SfxItemState eLRState = pOutSet->GetItemState(
+                            RES_LR_SPACE, false, &pLRSpaceItem);
+
+    if( !(SfxItemState::SET == eColState ||
+        SfxItemState::SET == eBrushState ||
+        SfxItemState::SET == eFootnoteState ||
+        SfxItemState::SET == eEndState ||
+        SfxItemState::SET == eBalanceState||
+        SfxItemState::SET == eFrameDirState||
+        SfxItemState::SET == eLRState))
+        return;
+
+    m_xTree->selected_foreach([&](weld::TreeIter& rEntry){
+        SectRepr* pRepr = reinterpret_cast<SectRepr*>(m_xTree->get_id(rEntry).toInt64());
+        if( SfxItemState::SET == eColState )
+            pRepr->GetCol() = *static_cast<const SwFormatCol*>(pColItem);
+        if( SfxItemState::SET == eBrushState )
+            pRepr->GetBackground().reset(static_cast<SvxBrushItem*>(pBrushItem->Clone()));
+        if( SfxItemState::SET == eFootnoteState )
+            pRepr->GetFootnoteNtAtEnd() = *static_cast<const SwFormatFootnoteAtTextEnd*>(pFootnoteItem);
+        if( SfxItemState::SET == eEndState )
+            pRepr->GetEndNtAtEnd() = *static_cast<const SwFormatEndAtTextEnd*>(pEndItem);
+        if( SfxItemState::SET == eBalanceState )
+            pRepr->GetBalance().SetValue(static_cast<const SwFormatNoBalancedColumns*>(pBalanceItem)->GetValue());
+        if( SfxItemState::SET == eFrameDirState )
+            pRepr->GetFrameDir()->SetValue(static_cast<const SvxFrameDirectionItem*>(pFrameDirItem)->GetValue());
+        if( SfxItemState::SET == eLRState )
+            pRepr->GetLRSpace().reset(static_cast<SvxLRSpaceItem*>(pLRSpaceItem->Clone()));
+        return false;
+    });
 }
 
 IMPL_LINK(SwEditRegionDlg, FileNameComboBoxHdl, weld::ComboBox&, rEdit, void)
@@ -1134,46 +1134,46 @@ IMPL_LINK(SwEditRegionDlg, DDEHdl, weld::ToggleButton&, rButton, void)
     if (!CheckPasswd(&rButton))
         return;
     SectRepr* pSectRepr = reinterpret_cast<SectRepr*>(m_xTree->get_selected_id().toInt64());
-    if (pSectRepr)
+    if (!pSectRepr)
+        return;
+
+    bool bFile = m_xFileCB->get_active();
+    SwSectionData & rData( pSectRepr->GetSectionData() );
+    bool bDDE = rButton.get_active();
+    if(bDDE)
     {
-        bool bFile = m_xFileCB->get_active();
-        SwSectionData & rData( pSectRepr->GetSectionData() );
-        bool bDDE = rButton.get_active();
-        if(bDDE)
+        m_xFileNameFT->hide();
+        m_xDDECommandFT->set_sensitive(true);
+        m_xDDECommandFT->show();
+        m_xSubRegionFT->hide();
+        m_xSubRegionED->hide();
+        if (SectionType::FileLink == rData.GetType())
         {
-            m_xFileNameFT->hide();
-            m_xDDECommandFT->set_sensitive(true);
-            m_xDDECommandFT->show();
-            m_xSubRegionFT->hide();
-            m_xSubRegionED->hide();
-            if (SectionType::FileLink == rData.GetType())
-            {
-                pSectRepr->SetFile(OUString());
-                m_xFileNameED->set_text(OUString());
-                rData.SetLinkFilePassword(OUString());
-            }
-            rData.SetType(SectionType::DdeLink);
+            pSectRepr->SetFile(OUString());
+            m_xFileNameED->set_text(OUString());
+            rData.SetLinkFilePassword(OUString());
         }
-        else
+        rData.SetType(SectionType::DdeLink);
+    }
+    else
+    {
+        m_xDDECommandFT->hide();
+        m_xFileNameFT->set_sensitive(bFile);
+        m_xFileNameFT->show();
+        m_xSubRegionED->show();
+        m_xSubRegionFT->show();
+        m_xSubRegionED->set_sensitive(bFile);
+        m_xSubRegionFT->set_sensitive(bFile);
+        m_xSubRegionED->set_sensitive(bFile);
+        if (SectionType::DdeLink == rData.GetType())
         {
-            m_xDDECommandFT->hide();
-            m_xFileNameFT->set_sensitive(bFile);
-            m_xFileNameFT->show();
-            m_xSubRegionED->show();
-            m_xSubRegionFT->show();
-            m_xSubRegionED->set_sensitive(bFile);
-            m_xSubRegionFT->set_sensitive(bFile);
-            m_xSubRegionED->set_sensitive(bFile);
-            if (SectionType::DdeLink == rData.GetType())
-            {
-                rData.SetType(SectionType::FileLink);
-                pSectRepr->SetFile(OUString());
-                rData.SetLinkFilePassword(OUString());
-                m_xFileNameED->set_text(OUString());
-            }
+            rData.SetType(SectionType::FileLink);
+            pSectRepr->SetFile(OUString());
+            rData.SetLinkFilePassword(OUString());
+            m_xFileNameED->set_text(OUString());
         }
-        m_xFilePB->set_sensitive(bFile && !bDDE);
     }
+    m_xFilePB->set_sensitive(bFile && !bDDE);
 }
 
 void SwEditRegionDlg::ChangePasswd(bool bChange)
@@ -1301,29 +1301,29 @@ IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, v
 
 IMPL_LINK_NOARG(SwEditRegionDlg, SubRegionEventHdl, weld::ComboBox&, void)
 {
-    if (!m_bSubRegionsFilled)
-    {
-        //if necessary fill the names bookmarks/sections/tables now
+    if (m_bSubRegionsFilled)
+        return;
 
-        OUString sFileName = m_xFileNameED->get_text();
-        if(!sFileName.isEmpty())
-        {
-            SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
-            INetURLObject aAbs;
-            if( pMedium )
-                aAbs = pMedium->GetURLObject();
-            sFileName = URIHelper::SmartRel2Abs(
-                    aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
+    //if necessary fill the names bookmarks/sections/tables now
 
-            //load file and set the shell
-            SfxMedium aMedium( sFileName, StreamMode::STD_READ );
-            sFileName = aMedium.GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE );
-            ::lcl_ReadSections(aMedium, *m_xSubRegionED);
-        }
-        else
-            lcl_FillSubRegionList(rSh, *m_xSubRegionED, nullptr);
-        m_bSubRegionsFilled = true;
+    OUString sFileName = m_xFileNameED->get_text();
+    if(!sFileName.isEmpty())
+    {
+        SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
+        INetURLObject aAbs;
+        if( pMedium )
+            aAbs = pMedium->GetURLObject();
+        sFileName = URIHelper::SmartRel2Abs(
+                aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
+
+        //load file and set the shell
+        SfxMedium aMedium( sFileName, StreamMode::STD_READ );
+        sFileName = aMedium.GetURLObject().GetMainURL( INetURLObject::DecodeMechanism::NONE );
+        ::lcl_ReadSections(aMedium, *m_xSubRegionED);
     }
+    else
+        lcl_FillSubRegionList(rSh, *m_xSubRegionED, nullptr);
+    m_bSubRegionsFilled = true;
 }
 
 // helper function - read section names from medium
@@ -1331,18 +1331,18 @@ static void lcl_ReadSections( SfxMedium& rMedium, weld::ComboBox& rBox )
 {
     rBox.clear();
     uno::Reference < embed::XStorage > xStg;
-    if( rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is() )
-    {
-        std::vector<OUString> aArr;
-        SotClipboardFormatId nFormat = SotStorage::GetFormatID( xStg );
-        if ( nFormat == SotClipboardFormatId::STARWRITER_60 || nFormat == SotClipboardFormatId::STARWRITERGLOB_60 ||
-            nFormat == SotClipboardFormatId::STARWRITER_8 || nFormat == SotClipboardFormatId::STARWRITERGLOB_8)
-            SwGetReaderXML()->GetSectionList( rMedium, aArr );
+    if( !(rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is()) )
+        return;
 
-        for (auto const& it : aArr)
-        {
-            rBox.append_text(it);
-        }
+    std::vector<OUString> aArr;
+    SotClipboardFormatId nFormat = SotStorage::GetFormatID( xStg );
+    if ( nFormat == SotClipboardFormatId::STARWRITER_60 || nFormat == SotClipboardFormatId::STARWRITERGLOB_60 ||
+        nFormat == SotClipboardFormatId::STARWRITER_8 || nFormat == SotClipboardFormatId::STARWRITERGLOB_8)
+        SwGetReaderXML()->GetSectionList( rMedium, aArr );
+
+    for (auto const& it : aArr)
+    {
+        rBox.append_text(it);
     }
 }
 
diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx
index 928f675588a9..2cf92a3a51b3 100644
--- a/sw/source/ui/envelp/envlop1.cxx
+++ b/sw/source/ui/envelp/envlop1.cxx
@@ -272,26 +272,26 @@ IMPL_LINK_NOARG(SwEnvPage, SenderHdl, weld::Button&, void)
 
 void SwEnvPage::InitDatabaseBox()
 {
-    if (m_pSh->GetDBManager())
-    {
-        m_xDatabaseLB->clear();
-        const Sequence<OUString> aDataNames = SwDBManager::GetExistingDatabaseNames();
+    if (!m_pSh->GetDBManager())
+        return;
 
-        for (const OUString& rDataName : aDataNames)
-            m_xDatabaseLB->append_text(rDataName);
+    m_xDatabaseLB->clear();
+    const Sequence<OUString> aDataNames = SwDBManager::GetExistingDatabaseNames();
 
-        sal_Int32 nIdx{ 0 };
-        OUString sDBName = m_sActDBName.getToken( 0, DB_DELIM, nIdx );
-        OUString sTableName = m_sActDBName.getToken( 0, DB_DELIM, nIdx );
-        m_xDatabaseLB->set_active_text(sDBName);
-        if (m_pSh->GetDBManager()->GetTableNames(*m_xTableLB, sDBName))
-        {
-            m_xTableLB->append_text(sTableName);
-            m_pSh->GetDBManager()->GetColumnNames(*m_xDBFieldLB, sDBName, sTableName);
-        }
-        else
-            m_xDBFieldLB->clear();
+    for (const OUString& rDataName : aDataNames)
+        m_xDatabaseLB->append_text(rDataName);
+
+    sal_Int32 nIdx{ 0 };
+    OUString sDBName = m_sActDBName.getToken( 0, DB_DELIM, nIdx );
+    OUString sTableName = m_sActDBName.getToken( 0, DB_DELIM, nIdx );
+    m_xDatabaseLB->set_active_text(sDBName);
+    if (m_pSh->GetDBManager()->GetTableNames(*m_xTableLB, sDBName))
+    {
+        m_xTableLB->append_text(sTableName);
+        m_pSh->GetDBManager()->GetColumnNames(*m_xDBFieldLB, sDBName, sTableName);
     }
+    else
+        m_xDBFieldLB->clear();
 }
 
 std::unique_ptr<SfxTabPage> SwEnvPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
index 4ac097718c0e..afb54c7df414 100644
--- a/sw/source/ui/envelp/label1.cxx
+++ b/sw/source/ui/envelp/label1.cxx
@@ -420,24 +420,24 @@ SwLabRec* SwLabPage::GetSelectedEntryPos()
 
 void SwLabPage::InitDatabaseBox()
 {
-    if( GetDBManager() )
+    if( !GetDBManager() )
+        return;
+
+    m_xDatabaseLB->clear();
+    const css::uno::Sequence<OUString> aDataNames = SwDBManager::GetExistingDatabaseNames();
+    for (const OUString& rDataName : aDataNames)
+        m_xDatabaseLB->append_text(rDataName);
+    sal_Int32 nIdx{ 0 };
+    OUString sDBName = sActDBName.getToken( 0, DB_DELIM, nIdx );
+    OUString sTableName = sActDBName.getToken( 0, DB_DELIM, nIdx );
+    m_xDatabaseLB->set_active_text(sDBName);
+    if( !sDBName.isEmpty() && GetDBManager()->GetTableNames(*m_xTableLB, sDBName))
     {
-        m_xDatabaseLB->clear();
-        const css::uno::Sequence<OUString> aDataNames = SwDBManager::GetExistingDatabaseNames();
-        for (const OUString& rDataName : aDataNames)
-            m_xDatabaseLB->append_text(rDataName);
-        sal_Int32 nIdx{ 0 };
-        OUString sDBName = sActDBName.getToken( 0, DB_DELIM, nIdx );
-        OUString sTableName = sActDBName.getToken( 0, DB_DELIM, nIdx );
-        m_xDatabaseLB->set_active_text(sDBName);
-        if( !sDBName.isEmpty() && GetDBManager()->GetTableNames(*m_xTableLB, sDBName))
-        {
-            m_xTableLB->set_active_text(sTableName);
-            GetDBManager()->GetColumnNames(*m_xDBFieldLB, sActDBName, sTableName);
-        }
-        else
-            m_xDBFieldLB->clear();
+        m_xTableLB->set_active_text(sTableName);
+        GetDBManager()->GetColumnNames(*m_xDBFieldLB, sActDBName, sTableName);
     }
+    else
+        m_xDBFieldLB->clear();
 }
 
 std::unique_ptr<SfxTabPage> SwLabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet)
diff --git a/sw/source/ui/fldui/DateFormFieldDialog.cxx b/sw/source/ui/fldui/DateFormFieldDialog.cxx
index e038eaa34ea7..3739e17ef5b3 100644
--- a/sw/source/ui/fldui/DateFormFieldDialog.cxx
+++ b/sw/source/ui/fldui/DateFormFieldDialog.cxx
@@ -40,84 +40,84 @@ DateFormFieldDialog::~DateFormFieldDialog() {}
 
 void DateFormFieldDialog::Apply()
 {
-    if (m_pDateField != nullptr)
+    if (m_pDateField == nullptr)
+        return;
+
+    // Try to find out the current date value and replace the content
+    // with the right formatted date string
+    sw::mark::IFieldmark::parameter_map_t* pParameters = m_pDateField->GetParameters();
+    const SvNumberformat* pFormat = m_pNumberFormatter->GetEntry(m_xFormatLB->GetFormat());
+
+    // Get date value first
+    std::pair<bool, double> aResult = m_pDateField->GetCurrentDate();
+
+    // Then set the date format
+    (*pParameters)[ODF_FORMDATE_DATEFORMAT] <<= pFormat->GetFormatstring();
+    (*pParameters)[ODF_FORMDATE_DATEFORMAT_LANGUAGE]
+        <<= LanguageTag(pFormat->GetLanguage()).getBcp47();
+
+    // Update current date
+    if (aResult.first)
+    {
+        m_pDateField->SetCurrentDate(aResult.second);
+    }
+    else
     {
-        // Try to find out the current date value and replace the content
-        // with the right formatted date string
-        sw::mark::IFieldmark::parameter_map_t* pParameters = m_pDateField->GetParameters();
-        const SvNumberformat* pFormat = m_pNumberFormatter->GetEntry(m_xFormatLB->GetFormat());
-
-        // Get date value first
-        std::pair<bool, double> aResult = m_pDateField->GetCurrentDate();
-
-        // Then set the date format
-        (*pParameters)[ODF_FORMDATE_DATEFORMAT] <<= pFormat->GetFormatstring();
-        (*pParameters)[ODF_FORMDATE_DATEFORMAT_LANGUAGE]
-            <<= LanguageTag(pFormat->GetLanguage()).getBcp47();
-
-        // Update current date
-        if (aResult.first)
-        {
-            m_pDateField->SetCurrentDate(aResult.second);
-        }
-        else
-        {
-            (*pParameters)[ODF_FORMDATE_CURRENTDATE] <<= OUString();
-        }
+        (*pParameters)[ODF_FORMDATE_CURRENTDATE] <<= OUString();
     }
 }
 
 void DateFormFieldDialog::InitControls()
 {
-    if (m_pDateField != nullptr)
+    if (m_pDateField == nullptr)
+        return;
+
+    sw::mark::IFieldmark::parameter_map_t* pParameters = m_pDateField->GetParameters();
+
+    OUString sFormatString;
+    auto pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT);
+    if (pResult != pParameters->end())
+    {
+        pResult->second >>= sFormatString;
+    }
+
+    OUString sLang;
+    pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT_LANGUAGE);
+    if (pResult != pParameters->end())
     {
-        sw::mark::IFieldmark::parameter_map_t* pParameters = m_pDateField->GetParameters();
-
-        OUString sFormatString;
-        auto pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT);
-        if (pResult != pParameters->end())
-        {
-            pResult->second >>= sFormatString;
-        }
-
-        OUString sLang;
-        pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT_LANGUAGE);
-        if (pResult != pParameters->end())
-        {
-            pResult->second >>= sLang;
-        }
-
-        if (!sFormatString.isEmpty() && !sLang.isEmpty())
-        {
-            LanguageType aLangType = LanguageTag(sLang).getLanguageType();
-            sal_uInt32 nFormat = m_pNumberFormatter->GetEntryKey(sFormatString, aLangType);
-            if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
-            {
-                sal_Int32 nCheckPos = 0;
-                SvNumFormatType nType;
-                m_pNumberFormatter->PutEntry(sFormatString, nCheckPos, nType, nFormat,
-                                             LanguageTag(sLang).getLanguageType());
-            }
-
-            if (aLangType != LANGUAGE_DONTKNOW && nFormat != NUMBERFORMAT_ENTRY_NOT_FOUND)
-            {
-                if (m_xFormatLB->GetCurLanguage() == aLangType)
-                {
-                    m_xFormatLB->SetAutomaticLanguage(true);
-                }
-                else
-                {
-                    m_xFormatLB->SetAutomaticLanguage(false);
-                    m_xFormatLB->SetLanguage(aLangType);
-
-                    // Change format and change back for regenerating the list
-                    m_xFormatLB->SetFormatType(SvNumFormatType::ALL);
-                    m_xFormatLB->SetFormatType(SvNumFormatType::DATE);
-                }
-                m_xFormatLB->SetDefFormat(nFormat);
-            }
-        }
+        pResult->second >>= sLang;
+    }
+
+    if (sFormatString.isEmpty() || sLang.isEmpty())
+        return;
+
+    LanguageType aLangType = LanguageTag(sLang).getLanguageType();
+    sal_uInt32 nFormat = m_pNumberFormatter->GetEntryKey(sFormatString, aLangType);
+    if (nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
+    {
+        sal_Int32 nCheckPos = 0;
+        SvNumFormatType nType;
+        m_pNumberFormatter->PutEntry(sFormatString, nCheckPos, nType, nFormat,
+                                     LanguageTag(sLang).getLanguageType());
+    }
+
+    if (aLangType == LANGUAGE_DONTKNOW || nFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
+        return;
+
+    if (m_xFormatLB->GetCurLanguage() == aLangType)
+    {
+        m_xFormatLB->SetAutomaticLanguage(true);
+    }
+    else
+    {
+        m_xFormatLB->SetAutomaticLanguage(false);
+        m_xFormatLB->SetLanguage(aLangType);
+
+        // Change format and change back for regenerating the list
+        m_xFormatLB->SetFormatType(SvNumFormatType::ALL);
+        m_xFormatLB->SetFormatType(SvNumFormatType::DATE);
     }
+    m_xFormatLB->SetDefFormat(nFormat);
 }
 
 } // namespace sw
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx
index 08c866294b43..d85bc5365bee 100644
--- a/sw/source/ui/fldui/DropDownFieldDialog.cxx
+++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx
@@ -83,23 +83,23 @@ sw::DropDownFieldDialog::~DropDownFieldDialog()
 
 void sw::DropDownFieldDialog::Apply()
 {
-    if (m_pDropField)
-    {
-        OUString sSelect = m_xListItemsLB->get_selected_text();
-        if (m_pDropField->GetPar1() != sSelect)
-        {
-            m_rSh.StartAllAction();
+    if (!m_pDropField)
+        return;
 
-            std::unique_ptr<SwDropDownField> const pCopy(
-                static_cast<SwDropDownField*>(m_pDropField->CopyField().release()));
+    OUString sSelect = m_xListItemsLB->get_selected_text();
+    if (m_pDropField->GetPar1() == sSelect)
+        return;
 
-            pCopy->SetPar1(sSelect);
-            m_rSh.SwEditShell::UpdateOneField(*pCopy);
+    m_rSh.StartAllAction();
 
-            m_rSh.SetUndoNoResetModified();
-            m_rSh.EndAllAction();
-        }
-    }
+    std::unique_ptr<SwDropDownField> const pCopy(
+        static_cast<SwDropDownField*>(m_pDropField->CopyField().release()));
+
+    pCopy->SetPar1(sSelect);
+    m_rSh.SwEditShell::UpdateOneField(*pCopy);
+
+    m_rSh.SetUndoNoResetModified();
+    m_rSh.EndAllAction();
 }
 
 bool sw::DropDownFieldDialog::PrevButtonPressed() const
diff --git a/sw/source/ui/fldui/DropDownFormFieldDialog.cxx b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx
index 4457b29f5eaf..a70488e46f19 100644
--- a/sw/source/ui/fldui/DropDownFormFieldDialog.cxx
+++ b/sw/source/ui/fldui/DropDownFormFieldDialog.cxx
@@ -129,30 +129,30 @@ void DropDownFormFieldDialog::InitControls()
 
 void DropDownFormFieldDialog::AppendItemToList()
 {
-    if (m_xListAddButton->get_sensitive())
+    if (!m_xListAddButton->get_sensitive())
+        return;
+
+    if (m_xListItemsTreeView->n_children() >= ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT)
     {
-        if (m_xListItemsTreeView->n_children() >= ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT)
-        {
-            std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(
-                m_xDialog.get(), VclMessageType::Info, VclButtonsType::Ok,
-                SwResId(STR_DROP_DOWN_FIELD_ITEM_LIMIT)));
-            xInfoBox->run();
-            return;
-        }
+        std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(
+            m_xDialog.get(), VclMessageType::Info, VclButtonsType::Ok,
+            SwResId(STR_DROP_DOWN_FIELD_ITEM_LIMIT)));
+        xInfoBox->run();
+        return;
+    }
 
-        const OUString sEntry(m_xListItemEntry->get_text());
-        if (!sEntry.isEmpty())
-        {
-            m_xListItemsTreeView->append_text(sEntry);
-            m_xListItemsTreeView->select_text(sEntry);
-            m_bListHasChanged = true;
+    const OUString sEntry(m_xListItemEntry->get_text());
+    if (!sEntry.isEmpty())
+    {
+        m_xListItemsTreeView->append_text(sEntry);
+        m_xListItemsTreeView->select_text(sEntry);
+        m_bListHasChanged = true;
 
-            // Clear entry
-            m_xListItemEntry->set_text(OUString());
-            m_xListItemEntry->grab_focus();
-        }
-        UpdateButtons();
+        // Clear entry
+        m_xListItemEntry->set_text(OUString());
+        m_xListItemEntry->grab_focus();
     }
+    UpdateButtons();
 }
 
 void DropDownFormFieldDialog::UpdateButtons()
@@ -170,28 +170,28 @@ void DropDownFormFieldDialog::UpdateButtons()
 
 void DropDownFormFieldDialog::Apply()
 {
-    if (m_pDropDownField != nullptr && m_bListHasChanged)
-    {
-        mark::IFieldmark::parameter_map_t* pParameters = m_pDropDownField->GetParameters();
+    if (!(m_pDropDownField != nullptr && m_bListHasChanged))
+        return;
 
-        css::uno::Sequence<OUString> vListEntries(m_xListItemsTreeView->n_children());
-        for (int nIndex = 0; nIndex < m_xListItemsTreeView->n_children(); ++nIndex)
-        {
-            vListEntries[nIndex] = m_xListItemsTreeView->get_text(nIndex);
-        }
+    mark::IFieldmark::parameter_map_t* pParameters = m_pDropDownField->GetParameters();
 
-        if (m_xListItemsTreeView->n_children() != 0)
-        {
-            (*pParameters)[ODF_FORMDROPDOWN_LISTENTRY] <<= vListEntries;
-        }
-        else
-        {
-            pParameters->erase(ODF_FORMDROPDOWN_LISTENTRY);
-        }
+    css::uno::Sequence<OUString> vListEntries(m_xListItemsTreeView->n_children());
+    for (int nIndex = 0; nIndex < m_xListItemsTreeView->n_children(); ++nIndex)
+    {
+        vListEntries[nIndex] = m_xListItemsTreeView->get_text(nIndex);
+    }
 
-        // After editing the drop down field's list we don't specify the selected item
-        pParameters->erase(ODF_FORMDROPDOWN_RESULT);
+    if (m_xListItemsTreeView->n_children() != 0)
+    {
+        (*pParameters)[ODF_FORMDROPDOWN_LISTENTRY] <<= vListEntries;
     }
+    else
+    {
+        pParameters->erase(ODF_FORMDROPDOWN_LISTENTRY);
+    }
+
+    // After editing the drop down field's list we don't specify the selected item
+    pParameters->erase(ODF_FORMDROPDOWN_RESULT);
 }
 
 } // namespace sw
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index 601dcadf69a6..99a7d5f05b3b 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -437,41 +437,41 @@ void SwFieldDBPage::CheckInsert()
 IMPL_LINK(SwFieldDBPage, TreeSelectHdl, weld::TreeView&, rBox, void)
 {
     std::unique_ptr<weld::TreeIter> xIter(rBox.make_iterator());
-    if (rBox.get_selected(xIter.get()))
-    {
-        const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
+    if (!rBox.get_selected(xIter.get()))
+        return;
 
-        bool bEntry = m_xDatabaseTLB->iter_parent(*xIter);
+    const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
 
-        if (nTypeId == SwFieldTypesEnum::Database && bEntry)
-            bEntry = m_xDatabaseTLB->iter_parent(*xIter);
+    bool bEntry = m_xDatabaseTLB->iter_parent(*xIter);
 
-        CheckInsert();
+    if (nTypeId == SwFieldTypesEnum::Database && bEntry)
+        bEntry = m_xDatabaseTLB->iter_parent(*xIter);
 
-        if (nTypeId == SwFieldTypesEnum::Database)
-        {
-            bool bNumFormat = false;
+    CheckInsert();
 
-            if (bEntry)
-            {
-                OUString sTableName;
-                OUString sColumnName;
-                sal_Bool bIsTable;
-                OUString sDBName = m_xDatabaseTLB->GetDBName(sTableName, sColumnName, &bIsTable);
-                bNumFormat = GetFieldMgr().IsDBNumeric(sDBName,
-                            sTableName,
-                            bIsTable,
-                            sColumnName);
-                if (!IsFieldEdit())
-                    m_xDBFormatRB->set_active(true);
-            }
+    if (nTypeId != SwFieldTypesEnum::Database)
+        return;
 
-            m_xDBFormatRB->set_sensitive(bNumFormat);
-            m_xNewFormatRB->set_sensitive(bNumFormat);
-            m_xNumFormatLB->set_sensitive(bNumFormat);
-            m_xFormat->set_sensitive(bNumFormat);
-        }
+    bool bNumFormat = false;
+
+    if (bEntry)
+    {
+        OUString sTableName;
+        OUString sColumnName;
+        sal_Bool bIsTable;
+        OUString sDBName = m_xDatabaseTLB->GetDBName(sTableName, sColumnName, &bIsTable);
+        bNumFormat = GetFieldMgr().IsDBNumeric(sDBName,
+                    sTableName,
+                    bIsTable,
+                    sColumnName);
+        if (!IsFieldEdit())
+            m_xDBFormatRB->set_active(true);
     }
+
+    m_xDBFormatRB->set_sensitive(bNumFormat);
+    m_xNewFormatRB->set_sensitive(bNumFormat);
+    m_xNumFormatLB->set_sensitive(bNumFormat);
+    m_xFormat->set_sensitive(bNumFormat);
 }
 
 IMPL_LINK_NOARG(SwFieldDBPage, AddDBHdl, weld::Button&, void)
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index 31bf38943ae5..d86416f68df3 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -497,20 +497,20 @@ IMPL_LINK_NOARG(SwFieldDokPage, FormatHdl, weld::TreeView&, void)
         nTypeId = static_cast<SwFieldTypesEnum>(m_xSelectionLB->get_id(nPos).toUInt32());
     }
 
-    if (nTypeId == SwFieldTypesEnum::NextPage || nTypeId == SwFieldTypesEnum::PreviousPage)
-    {
-        // Prev/Next - PageNumFields special treatment:
-        sal_uInt16 nTmp = m_xFormatLB->get_selected_id().toUInt32();
-        const OUString sOldText( m_xValueFT->get_label() );
-        const OUString sNewText( SwResId( SVX_NUM_CHAR_SPECIAL == nTmp  ? STR_VALUE
-                                                         : STR_OFFSET ));
+    if (nTypeId != SwFieldTypesEnum::NextPage && nTypeId != SwFieldTypesEnum::PreviousPage)
+        return;
 
-        if (sOldText != sNewText)
-            m_xValueFT->set_label(sNewText);
+    // Prev/Next - PageNumFields special treatment:
+    sal_uInt16 nTmp = m_xFormatLB->get_selected_id().toUInt32();
+    const OUString sOldText( m_xValueFT->get_label() );
+    const OUString sNewText( SwResId( SVX_NUM_CHAR_SPECIAL == nTmp  ? STR_VALUE
+                                                     : STR_OFFSET ));
 
-        if (sOldText != m_xValueFT->get_label())
-            m_xValueED->set_text(OUString());
-    }
+    if (sOldText != sNewText)
+        m_xValueFT->set_label(sNewText);
+
+    if (sOldText != m_xValueFT->get_label())
+        m_xValueED->set_text(OUString());
 }
 
 bool SwFieldDokPage::FillItemSet(SfxItemSet* )
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index 606f149ab331..b010a1afd767 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -71,26 +71,26 @@ void SwFieldPage::Init()
     // Dok-Switch (fldtdlg:ReInitTabPage)
     m_pCurField = m_aMgr.GetCurField();
 
-    if( bNewMode != m_bFieldDlgHtmlMode )
-    {
-        m_bFieldDlgHtmlMode = bNewMode;
+    if( bNewMode == m_bFieldDlgHtmlMode )
+        return;
 
-        // initialise Rangelistbox
-        if( m_bFieldDlgHtmlMode && m_bFirstHTMLInit )
-        {
-            m_bFirstHTMLInit = false;
-            SwWrtShell *pSh = m_pWrtShell;
-            if(! pSh)
-                pSh = ::GetActiveWrtShell();
-            if(pSh)
-            {
-                SwDoc* pDoc = pSh->GetDoc();
-                pSh->InsertFieldType( SwSetExpFieldType( pDoc,
-                                    "HTML_ON", 1));
-                pSh->InsertFieldType( SwSetExpFieldType(pDoc,
-                                    "HTML_OFF", 1));
-            }
-        }
+    m_bFieldDlgHtmlMode = bNewMode;
+
+    // initialise Rangelistbox
+    if( !(m_bFieldDlgHtmlMode && m_bFirstHTMLInit) )
+        return;
+
+    m_bFirstHTMLInit = false;
+    SwWrtShell *pSh = m_pWrtShell;
+    if(! pSh)
+        pSh = ::GetActiveWrtShell();
+    if(pSh)
+    {
+        SwDoc* pDoc = pSh->GetDoc();
+        pSh->InsertFieldType( SwSetExpFieldType( pDoc,
+                            "HTML_ON", 1));
+        pSh->InsertFieldType( SwSetExpFieldType(pDoc,
+                            "HTML_OFF", 1));
     }
 }
 
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 9a94726ad74d..6c92d6f4d07a 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -119,29 +119,29 @@ void SwFieldRefPage::SaveSelectedTextNode()
 {
     mpSavedSelectedTextNode = nullptr;
     mnSavedSelectedPos = 0;
-    if ( m_xSelectionToolTipLB->get_visible() )
+    if ( !m_xSelectionToolTipLB->get_visible() )
+        return;
+
+    int nEntry = m_xSelectionToolTipLB->get_selected_index();
+    if (nEntry == -1)
+        return;
+
+    const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+
+    if ( nTypeId == REFFLDFLAG_HEADING )
     {
-        int nEntry = m_xSelectionToolTipLB->get_selected_index();
-        if (nEntry != -1)
+        mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
+        if ( mnSavedSelectedPos < maOutlineNodes.size() )
         {
-            const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
-
-            if ( nTypeId == REFFLDFLAG_HEADING )
-            {
-                mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
-                if ( mnSavedSelectedPos < maOutlineNodes.size() )
-                {
-                    mpSavedSelectedTextNode = maOutlineNodes[mnSavedSelectedPos];
-                }
-            }
-            else if ( nTypeId == REFFLDFLAG_NUMITEM )
-            {
-                mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
-                if ( mnSavedSelectedPos < maNumItems.size() )
-                {
-                    mpSavedSelectedTextNode = maNumItems[mnSavedSelectedPos]->GetTextNode();
-                }
-            }
+            mpSavedSelectedTextNode = maOutlineNodes[mnSavedSelectedPos];
+        }
+    }
+    else if ( nTypeId == REFFLDFLAG_NUMITEM )
+    {
+        mnSavedSelectedPos = m_xSelectionToolTipLB->get_id(nEntry).toUInt32();
+        if ( mnSavedSelectedPos < maNumItems.size() )
+        {
+            mpSavedSelectedTextNode = maNumItems[mnSavedSelectedPos]->GetTextNode();
         }
     }
 }
diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
index 4a12a7538586..fefd2eb8cd3a 100644
--- a/sw/source/ui/fldui/fldtdlg.cxx
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -205,20 +205,20 @@ void SwFieldDlg::ReInitTabPage(const OString& rPageId, bool bOnlyActivate)
 void SwFieldDlg::Activate()
 {
     SwView* pView = ::GetActiveView();
-    if( pView )
-    {
-        bool bHtmlMode = (::GetHtmlMode(static_cast<SwDocShell*>(SfxObjectShell::Current())) & HTMLMODE_ON) != 0;
-        const SwWrtShell& rSh = pView->GetWrtShell();
-        GetOKButton().set_sensitive(!rSh.IsReadOnlyAvailable() ||
-                                    !rSh.HasReadonlySel());
+    if( !pView )
+        return;
 
-        ReInitTabPage("variables", true);
+    bool bHtmlMode = (::GetHtmlMode(static_cast<SwDocShell*>(SfxObjectShell::Current())) & HTMLMODE_ON) != 0;
+    const SwWrtShell& rSh = pView->GetWrtShell();
+    GetOKButton().set_sensitive(!rSh.IsReadOnlyAvailable() ||
+                                !rSh.HasReadonlySel());
 
-        if( !bHtmlMode )
-        {
-            ReInitTabPage("ref", true);
-            ReInitTabPage("functions", true);
-        }
+    ReInitTabPage("variables", true);
+
+    if( !bHtmlMode )
+    {
+        ReInitTabPage("ref", true);
+        ReInitTabPage("functions", true);
     }
 }
 
@@ -268,20 +268,20 @@ void SwFieldDlg::ShowReferencePage()
 void SwFieldDlg::PageCreated(const OString& rId, SfxTabPage& rPage)
 {
 #if HAVE_FEATURE_DBCONNECTIVITY
-    if (rId == "database")
+    if (rId != "database")
+        return;
+
+    SfxDispatcher* pDispatch = m_pBindings->GetDispatcher();
+    SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : nullptr;
+    if(pViewFrame)
     {
-        SfxDispatcher* pDispatch = m_pBindings->GetDispatcher();
-        SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : nullptr;
-        if(pViewFrame)
+        SfxViewShell* pViewShell = SfxViewShell::GetFirst( true, checkSfxViewShell<SwView> );
+        while(pViewShell && pViewShell->GetViewFrame() != pViewFrame)
         {
-            SfxViewShell* pViewShell = SfxViewShell::GetFirst( true, checkSfxViewShell<SwView> );
-            while(pViewShell && pViewShell->GetViewFrame() != pViewFrame)
-            {
-                pViewShell = SfxViewShell::GetNext( *pViewShell, true, checkSfxViewShell<SwView> );
-            }
-            if(pViewShell)
-                static_cast<SwFieldDBPage&>(rPage).SetWrtShell(static_cast<SwView*>(pViewShell)->GetWrtShell());
+            pViewShell = SfxViewShell::GetNext( *pViewShell, true, checkSfxViewShell<SwView> );
         }
+        if(pViewShell)
+            static_cast<SwFieldDBPage&>(rPage).SetWrtShell(static_cast<SwView*>(pViewShell)->GetWrtShell());
     }
 #else
     (void) rId;
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
index 64b64dec25b8..3922ecffda8e 100644
--- a/sw/source/ui/frmdlg/column.cxx
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -916,20 +916,20 @@ void SwColumnPage::ColModify(const weld::SpinButton* pNF)
     // #i17816# changing the displayed types within the ValueSet
     //from two columns to two columns with different settings doesn't invalidate the
     // example windows in ::ColModify()
-    if (!pNF || m_xColMgr->GetCount() != m_nCols)
-    {
-        if (pNF)
-            m_aDefaultVS.SetNoSelection();
-        long nDist = static_cast< long >(m_xDistEd1->DenormalizePercent(m_xDistEd1->get_value(FieldUnit::TWIP)));
-        m_xColMgr->SetCount(m_nCols, static_cast<sal_uInt16>(nDist));
-        for(sal_uInt16 i = 0; i < m_nCols; i++)
-            m_nColDist[i] = nDist;
-        m_nFirstVis = 0;
-        SetLabels( m_nFirstVis );
-        UpdateCols();
-        ResetColWidth();
-        Update(nullptr);
-    }
+    if (pNF && m_xColMgr->GetCount() == m_nCols)
+        return;
+
+    if (pNF)
+        m_aDefaultVS.SetNoSelection();
+    long nDist = static_cast< long >(m_xDistEd1->DenormalizePercent(m_xDistEd1->get_value(FieldUnit::TWIP)));
+    m_xColMgr->SetCount(m_nCols, static_cast<sal_uInt16>(nDist));
+    for(sal_uInt16 i = 0; i < m_nCols; i++)
+        m_nColDist[i] = nDist;
+    m_nFirstVis = 0;
+    SetLabels( m_nFirstVis );
+    UpdateCols();
+    ResetColWidth();
+    Update(nullptr);
 }
 
 /*
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index f18d33fa8385..4ffdab33c776 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1940,59 +1940,58 @@ IMPL_LINK( SwFramePage, PosHdl, weld::ComboBox&, rLB, void )
         m_bAtVertPosModified = true;
 
     // special treatment for HTML-Mode with horizontal-vertical-dependencies
-    if(m_bHtmlMode && (RndStdIds::FLY_AT_CHAR == GetAnchor()))
+    if(!(m_bHtmlMode && (RndStdIds::FLY_AT_CHAR == GetAnchor())))
+        return;
+
+    bool bSet = false;
+    if(bHori)
     {
-        bool bSet = false;
-        if(bHori)
+        // right is allowed only above - from the left only above
+        // from the left at character -> below
+        if((text::HoriOrientation::LEFT == nAlign || text::HoriOrientation::RIGHT == nAlign) &&
+                0 == m_xVerticalDLB->get_active())
         {
-            // right is allowed only above - from the left only above
-            // from the left at character -> below
-            if((text::HoriOrientation::LEFT == nAlign || text::HoriOrientation::RIGHT == nAlign) &&
-                    0 == m_xVerticalDLB->get_active())
-            {
-                if(text::RelOrientation::FRAME == nRel)
-                    m_xVerticalDLB->set_active(1);
-                else
-                    m_xVerticalDLB->set_active(0);
-                bSet = true;
-            }
-            else if(text::HoriOrientation::LEFT == nAlign && 1 == m_xVerticalDLB->get_active())
-            {
+            if(text::RelOrientation::FRAME == nRel)
+                m_xVerticalDLB->set_active(1);
+            else
                 m_xVerticalDLB->set_active(0);
-                bSet = true;
-            }
-            else if(text::HoriOrientation::NONE == nAlign && 1 == m_xVerticalDLB->get_active())
+            bSet = true;
+        }
+        else if(text::HoriOrientation::LEFT == nAlign && 1 == m_xVerticalDLB->get_active())
+        {
+            m_xVerticalDLB->set_active(0);
+            bSet = true;
+        }
+        else if(text::HoriOrientation::NONE == nAlign && 1 == m_xVerticalDLB->get_active())
+        {
+            m_xVerticalDLB->set_active(0);
+            bSet = true;
+        }
+        if(bSet)
+            PosHdl(*m_xVerticalDLB);
+    }
+    else
+    {
+        if(text::VertOrientation::TOP == nAlign)
+        {
+            if (1 == m_xHorizontalDLB->get_active())
             {
-                m_xVerticalDLB->set_active(0);
+                m_xHorizontalDLB->set_active(0);
                 bSet = true;
             }
-            if(bSet)
-                PosHdl(*m_xVerticalDLB);
+            m_xHoriRelationLB->set_active(1);
         }
-        else
+        else if(text::VertOrientation::CHAR_BOTTOM == nAlign)
         {
-            if(text::VertOrientation::TOP == nAlign)
+            if (2 == m_xHorizontalDLB->get_active())
             {
-                if (1 == m_xHorizontalDLB->get_active())
-                {
-                    m_xHorizontalDLB->set_active(0);
-                    bSet = true;
-                }
-                m_xHoriRelationLB->set_active(1);
-            }
-            else if(text::VertOrientation::CHAR_BOTTOM == nAlign)
-            {
-                if (2 == m_xHorizontalDLB->get_active())
-                {
-                    m_xHorizontalDLB->set_active(0);
-                    bSet = true;
-                }
-                m_xHoriRelationLB->set_active(0) ;
+                m_xHorizontalDLB->set_active(0);
+                bSet = true;
             }
-            if(bSet)
-                PosHdl(*m_xHorizontalDLB);
+            m_xHoriRelationLB->set_active(0) ;
         }
-
+        if(bSet)
+            PosHdl(*m_xHorizontalDLB);
     }
 }
 
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index e7061b55719c..03fb621e0123 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -653,33 +653,33 @@ IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, weld::Button&, rBtn, void)
 {
     bool bLeft = &rBtn == m_xLeftPB.get();
     int nEntry = m_xHeaderTree->get_selected_index();
-    if (nEntry != -1)
+    if (nEntry == -1)
+        return;
+
+    int nToggleColumn = 0;
+    for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
     {
-        int nToggleColumn = 0;
-        for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
+        if (m_xHeaderTree->get_toggle(nEntry, j + 1) == TRISTATE_TRUE)
         {
-            if (m_xHeaderTree->get_toggle(nEntry, j + 1) == TRISTATE_TRUE)
-            {
-                nToggleColumn = j;
-                break;
-            }
+            nToggleColumn = j;
+            break;
         }
+    }
 
-        if (bLeft)
-        {
-            if (nToggleColumn)
-                --nToggleColumn;
-        }
-        else
-        {
-            if (nToggleColumn < MAXLEVEL)
-                ++nToggleColumn;
-        }
+    if (bLeft)
+    {
+        if (nToggleColumn)
+            --nToggleColumn;
+    }
+    else
+    {
+        if (nToggleColumn < MAXLEVEL)
+            ++nToggleColumn;
+    }
 
-        for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
-        {
-            m_xHeaderTree->set_toggle(nEntry, j == nToggleColumn ? TRISTATE_TRUE : TRISTATE_FALSE, j + 1);
-        }
+    for (sal_uInt16 j = 0; j <= MAXLEVEL; ++j)
+    {
+        m_xHeaderTree->set_toggle(nEntry, j == nToggleColumn ? TRISTATE_TRUE : TRISTATE_FALSE, j + 1);
     }
 }
 
@@ -800,18 +800,18 @@ SwTOXSelectTabPage::~SwTOXSelectTabPage()
 void SwTOXSelectTabPage::SetWrtShell(SwWrtShell const & rSh)
 {
     const sal_uInt16 nUserTypeCount = rSh.GetTOXTypeCount(TOX_USER);
-    if(nUserTypeCount > 1)
+    if(nUserTypeCount <= 1)
+        return;
+
+    //insert all new user indexes names after the standard user index
+    sal_Int32 nPos = m_xTypeLB->find_id(OUString::number(sal_uInt32(TO_USER))) + 1;
+    for (sal_uInt16 nUser = 1; nUser < nUserTypeCount; nUser++)
     {
-        //insert all new user indexes names after the standard user index
-        sal_Int32 nPos = m_xTypeLB->find_id(OUString::number(sal_uInt32(TO_USER))) + 1;
-        for (sal_uInt16 nUser = 1; nUser < nUserTypeCount; nUser++)
-        {
-            sal_uInt32 nEntryData = nUser << 8;
-            nEntryData |= TO_USER;
-            OUString sId(OUString::number(nEntryData));
-            m_xTypeLB->insert(nPos++, rSh.GetTOXType(TOX_USER, nUser)->GetTypeName(),
-                              &sId, nullptr, nullptr);
-        }
+        sal_uInt32 nEntryData = nUser << 8;
+        nEntryData |= TO_USER;
+        OUString sId(OUString::number(nEntryData));
+        m_xTypeLB->insert(nPos++, rSh.GetTOXType(TOX_USER, nUser)->GetTypeName(),
+                          &sId, nullptr, nullptr);
     }
 }
 
@@ -2662,23 +2662,23 @@ void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL)
 
 void SwTokenWindow::SetActiveControl(SwTOXWidget* pSet)
 {
-    if (pSet != m_pActiveCtrl)
-    {
-        m_pActiveCtrl = pSet;
-        if( m_pActiveCtrl )
-        {
-            m_pActiveCtrl->GrabFocus();
-            //it must be a SwTOXEdit
-            const SwFormToken* pFToken;
-            if( WindowType::EDIT == m_pActiveCtrl->GetType() )
-                pFToken = &static_cast<SwTOXEdit*>(m_pActiveCtrl)->GetFormToken();
-            else
-                pFToken = &static_cast<SwTOXButton*>(m_pActiveCtrl)->GetFormToken();
+    if (pSet == m_pActiveCtrl)
+        return;
 
-            SwFormToken aTemp( *pFToken );
-            m_aButtonSelectedHdl.Call( aTemp );
-        }
-    }
+    m_pActiveCtrl = pSet;
+    if( !m_pActiveCtrl )
+        return;
+
+    m_pActiveCtrl->GrabFocus();
+    //it must be a SwTOXEdit
+    const SwFormToken* pFToken;
+    if( WindowType::EDIT == m_pActiveCtrl->GetType() )
+        pFToken = &static_cast<SwTOXEdit*>(m_pActiveCtrl)->GetFormToken();
+    else
+        pFToken = &static_cast<SwTOXButton*>(m_pActiveCtrl)->GetFormToken();
+
+    SwFormToken aTemp( *pFToken );
+    m_aButtonSelectedHdl.Call( aTemp );
 }
 
 SwTOXWidget* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken& rToken)
@@ -3012,37 +3012,37 @@ IMPL_LINK_NOARG(SwTokenWindow, ScrollHdl, weld::ScrolledWindow&, void)
 
 void SwTokenWindow::AdjustScrolling()
 {
-    if (m_aControlList.size() > 1)
-    {
-        //validate scroll buttons
+    if (m_aControlList.size() <= 1)
+        return;
 
-        auto nLeft = m_xScrollWin->hadjustment_get_value();
-        auto nSpace = m_xScrollWin->hadjustment_get_page_size();
-        auto nWidth = m_xScrollWin->hadjustment_get_upper();
+    //validate scroll buttons
 
-        bool bEnable = nWidth > nSpace;
+    auto nLeft = m_xScrollWin->hadjustment_get_value();
+    auto nSpace = m_xScrollWin->hadjustment_get_page_size();
+    auto nWidth = m_xScrollWin->hadjustment_get_upper();
 
-        //the active control must be visible
-        if (bEnable && m_pActiveCtrl)
-        {
-            int x, y, width, height;
-            m_pActiveCtrl->get_extents_relative_to(*m_xCtrlParentWin, x, y, width, height);
+    bool bEnable = nWidth > nSpace;
 
-            if (x < nLeft || x + width > nLeft + nSpace)
-            {
-                MoveControls(x);
-                nLeft = x;
-            }
+    //the active control must be visible
+    if (bEnable && m_pActiveCtrl)
+    {
+        int x, y, width, height;
+        m_pActiveCtrl->get_extents_relative_to(*m_xCtrlParentWin, x, y, width, height);
 
-            m_xLeftScrollWin->set_sensitive(nLeft > 0);
-            m_xRightScrollWin->set_sensitive(nLeft + nSpace < nWidth);
-        }
-        else
+        if (x < nLeft || x + width > nLeft + nSpace)
         {
-            //if the control fits into the space then the first control must be at position 0
-            m_xRightScrollWin->set_sensitive(false);
-            m_xLeftScrollWin->set_sensitive(false);
+            MoveControls(x);
+            nLeft = x;
         }
+
+        m_xLeftScrollWin->set_sensitive(nLeft > 0);
+        m_xRightScrollWin->set_sensitive(nLeft + nSpace < nWidth);
+    }
+    else
+    {
+        //if the control fits into the space then the first control must be at position 0
+        m_xRightScrollWin->set_sensitive(false);
+        m_xLeftScrollWin->set_sensitive(false);
     }
 }
 
@@ -3254,31 +3254,31 @@ IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton&, rBtn, void )
     auto itTest = it;
     ++itTest;
 
-    if (!rBtn.IsNextControl() || (itTest != m_aControlList.end() && rBtn.IsNextControl()))
-    {
-        bool isNext = rBtn.IsNextControl();
+    if (!(!rBtn.IsNextControl() || (itTest != m_aControlList.end() && rBtn.IsNextControl())))
+        return;
 
-        auto iterFocus = it;
-        isNext ? ++iterFocus : --iterFocus;
+    bool isNext = rBtn.IsNextControl();
 
-        SwTOXWidget* pCtrlFocus = iterFocus->get();
-        pCtrlFocus->GrabFocus();
-        int nStartPos(0), nEndPos(0);
+    auto iterFocus = it;
+    isNext ? ++iterFocus : --iterFocus;
 
-        if (!isNext)
-        {
-            const sal_Int32 nLen = static_cast<SwTOXEdit*>(pCtrlFocus)->GetText().getLength();
+    SwTOXWidget* pCtrlFocus = iterFocus->get();
+    pCtrlFocus->GrabFocus();
+    int nStartPos(0), nEndPos(0);
 
-            nStartPos = nLen;
-            nEndPos = nLen;
-        }
+    if (!isNext)
+    {
+        const sal_Int32 nLen = static_cast<SwTOXEdit*>(pCtrlFocus)->GetText().getLength();
 
-        static_cast<SwTOXEdit*>(pCtrlFocus)->select_region(nStartPos, nEndPos);
+        nStartPos = nLen;
+        nEndPos = nLen;
+    }
 
-        rBtn.Check(false);
+    static_cast<SwTOXEdit*>(pCtrlFocus)->select_region(nStartPos, nEndPos);
 
-        AdjustScrolling();
-    }
+    rBtn.Check(false);
+
+    AdjustScrolling();
 }
 
 IMPL_LINK(SwTokenWindow, TbxFocusBtnHdl, SwTOXWidget&, rControl, void)
@@ -3465,20 +3465,20 @@ IMPL_LINK_NOARG(SwTOXStylesTabPage, AssignHdl, weld::Button&, void)
 {
     auto nLevPos = m_xLevelLB->get_selected_index();
     auto nTemplPos = m_xParaLayLB->get_selected_index();
-    if (nLevPos != -1 && nTemplPos != -1)
-    {
-        const OUString aStr(m_xLevelLB->get_text(nLevPos).getToken(0, aDeliStart)
-            + OUStringChar(aDeliStart)
-            + m_xParaLayLB->get_selected_text()
-            + OUStringChar(aDeliEnd));
+    if (nLevPos == -1 || nTemplPos == -1)
+        return;
 
-        m_pCurrentForm->SetTemplate(nLevPos, m_xParaLayLB->get_selected_text());
+    const OUString aStr(m_xLevelLB->get_text(nLevPos).getToken(0, aDeliStart)
+        + OUStringChar(aDeliStart)
+        + m_xParaLayLB->get_selected_text()
+        + OUStringChar(aDeliEnd));
 
-        m_xLevelLB->remove(nLevPos);
-        m_xLevelLB->insert_text(nLevPos, aStr);
-        m_xLevelLB->select_text(aStr);
-        Modify();
-    }
+    m_pCurrentForm->SetTemplate(nLevPos, m_xParaLayLB->get_selected_text());
+
+    m_xLevelLB->remove(nLevPos);
+    m_xLevelLB->insert_text(nLevPos, aStr);
+    m_xLevelLB->select_text(aStr);
+    Modify();
 }
 
 IMPL_LINK_NOARG(SwTOXStylesTabPage, StdHdl, weld::Button&, void)
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index d01c7a8a499c..1e9bf0d83cc4 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1267,34 +1267,34 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, weld::Button&, rButton, void)
     {
         aDlg.SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl));
     }
-    if(RET_OK == aDlg.run())
+    if(RET_OK != aDlg.run())
+        return;
+
+    if(bCreate && !sOldId.isEmpty())
     {
-        if(bCreate && !sOldId.isEmpty())
-        {
-            m_xEntryLB->remove_text(sOldId);
-        }
-        for(int i = 0; i < AUTH_FIELD_END; i++)
-        {
-            m_sFields[i] = aDlg.GetEntryText(static_cast<ToxAuthorityField>(i));
-            m_sCreatedEntry[i] = m_sFields[i];
-        }
-        if(bNewEntry && !m_xFromDocContentRB->get_active())
-        {
-            m_xFromDocContentRB->set_active(true);
-            ChangeSourceHdl(*m_xFromDocContentRB);
-        }
-        if(bCreate)
-        {
-            OSL_ENSURE(m_xEntryLB->find_text(m_sFields[AUTH_FIELD_IDENTIFIER]) == -1,
-                        "entry exists!");
-            m_xEntryLB->append_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
-            m_xEntryLB->set_active_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
-        }
-        m_xEntryED->set_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
-        m_xAuthorFI->set_label(m_sFields[AUTH_FIELD_AUTHOR]);
-        m_xTitleFI->set_label(m_sFields[AUTH_FIELD_TITLE]);
-        m_xActionBT->set_sensitive(true);
+        m_xEntryLB->remove_text(sOldId);
+    }
+    for(int i = 0; i < AUTH_FIELD_END; i++)
+    {
+        m_sFields[i] = aDlg.GetEntryText(static_cast<ToxAuthorityField>(i));
+        m_sCreatedEntry[i] = m_sFields[i];
+    }
+    if(bNewEntry && !m_xFromDocContentRB->get_active())
+    {
+        m_xFromDocContentRB->set_active(true);
+        ChangeSourceHdl(*m_xFromDocContentRB);
+    }
+    if(bCreate)
+    {
+        OSL_ENSURE(m_xEntryLB->find_text(m_sFields[AUTH_FIELD_IDENTIFIER]) == -1,
+                    "entry exists!");
+        m_xEntryLB->append_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
+        m_xEntryLB->set_active_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
     }
+    m_xEntryED->set_text(m_sFields[AUTH_FIELD_IDENTIFIER]);
+    m_xAuthorFI->set_label(m_sFields[AUTH_FIELD_AUTHOR]);
+    m_xTitleFI->set_label(m_sFields[AUTH_FIELD_TITLE]);
+    m_xActionBT->set_sensitive(true);
 }
 
 IMPL_LINK_NOARG(SwAuthorMarkPane, ChangeSourceHdl, weld::ToggleButton&, void)
@@ -1629,25 +1629,25 @@ IMPL_LINK(SwCreateAuthEntryDlg_Impl, IdentifierHdl, weld::ComboBox&, rBox, void)
 {
     const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>(
                                 rWrtSh.GetFieldType(SwFieldIds::TableOfAuthorities, OUString()));
-    if(pFType)
+    if(!pFType)
+        return;
+
+    const SwAuthEntry* pEntry = pFType->GetEntryByIdentifier(
+                                                    rBox.get_active_text());
+    if(!pEntry)
+        return;
+
+    for(int i = 0; i < AUTH_FIELD_END; i++)
     {
-        const SwAuthEntry* pEntry = pFType->GetEntryByIdentifier(
-                                                        rBox.get_active_text());
-        if(pEntry)
-        {
-            for(int i = 0; i < AUTH_FIELD_END; i++)
-            {
-                const TextInfo aCurInfo = aTextInfoArr[i];
-                if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
-                    continue;
-                if(AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField)
-                    m_xTypeListBox->set_active_text(
-                                pEntry->GetAuthorField(aCurInfo.nToxField));
-                else
-                    pEdits[i]->set_text(
-                                pEntry->GetAuthorField(aCurInfo.nToxField));
-            }
-        }
+        const TextInfo aCurInfo = aTextInfoArr[i];
+        if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
+            continue;
+        if(AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField)
+            m_xTypeListBox->set_active_text(
+                        pEntry->GetAuthorField(aCurInfo.nToxField));
+        else
+            pEdits[i]->set_text(
+                        pEntry->GetAuthorField(aCurInfo.nToxField));
     }
 }
 
diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
index 598fb05092da..f84bdf6f3954 100644
--- a/sw/source/ui/misc/glosbib.cxx
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -192,26 +192,26 @@ IMPL_LINK_NOARG( SwGlossaryGroupDlg, SelectHdl, weld::TreeView&, void )
 {
     m_xNewPB->set_sensitive(false);
     int nFirstEntry = m_xGroupTLB->get_selected_index();
-    if (nFirstEntry != -1)
-    {
-        GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nFirstEntry).toInt64());
-        const OUString sEntry(pUserData->sGroupName);
-        const OUString sName(m_xNameED->get_text());
-        bool bExists = false;
-        int nPos = m_xGroupTLB->find_text(sName);
-        if (nPos != -1)
-        {
-            GlosBibUserData* pFoundData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nPos).toInt64());
-            fprintf(stderr, "comparing %s and %s\n",
-                    OUStringToOString(pFoundData->sGroupName, RTL_TEXTENCODING_UTF8).getStr(),
-                    OUStringToOString(sEntry, RTL_TEXTENCODING_UTF8).getStr());
-            bExists = pFoundData->sGroupName == sEntry;
-        }
+    if (nFirstEntry == -1)
+        return;
 
-        m_xRenamePB->set_sensitive(!bExists && !sName.isEmpty());
-        fprintf(stderr, "one rename %d\n", !bExists && !sName.isEmpty());
-        m_xDelPB->set_sensitive(IsDeleteAllowed(sEntry));
+    GlosBibUserData* pUserData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nFirstEntry).toInt64());
+    const OUString sEntry(pUserData->sGroupName);
+    const OUString sName(m_xNameED->get_text());
+    bool bExists = false;
+    int nPos = m_xGroupTLB->find_text(sName);
+    if (nPos != -1)
+    {
+        GlosBibUserData* pFoundData = reinterpret_cast<GlosBibUserData*>(m_xGroupTLB->get_id(nPos).toInt64());
+        fprintf(stderr, "comparing %s and %s\n",
+                OUStringToOString(pFoundData->sGroupName, RTL_TEXTENCODING_UTF8).getStr(),
+                OUStringToOString(sEntry, RTL_TEXTENCODING_UTF8).getStr());
+        bExists = pFoundData->sGroupName == sEntry;
     }
+
+    m_xRenamePB->set_sensitive(!bExists && !sName.isEmpty());
+    fprintf(stderr, "one rename %d\n", !bExists && !sName.isEmpty());
+    m_xDelPB->set_sensitive(IsDeleteAllowed(sEntry));
 }
 
 IMPL_LINK_NOARG(SwGlossaryGroupDlg, NewHdl, weld::Button&, void)
diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx
index 23e5514a33d8..8b6abea48f8a 100644
--- a/sw/source/ui/misc/insfnote.cxx
+++ b/sw/source/ui/misc/insfnote.cxx
@@ -99,28 +99,28 @@ IMPL_LINK_NOARG(SwInsFootNoteDlg, NumberExtCharHdl, weld::Button&, void)
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateCharMapDialog(m_xDialog.get(), aAllSet, nullptr));
-    if (RET_OK == pDlg->Execute())
-    {
-        const SfxStringItem* pItem = SfxItemSet::GetItem<SfxStringItem>(pDlg->GetOutputItemSet(), SID_CHARMAP, false);
-        const SvxFontItem* pFontItem = SfxItemSet::GetItem<SvxFontItem>(pDlg->GetOutputItemSet(), SID_ATTR_CHAR_FONT, false);
-        if ( pItem )
-        {
-            m_xNumberCharEdit->set_text(pItem->GetValue());
-
-            if ( pFontItem )
-            {
-                m_aFontName = pFontItem->GetFamilyName();
-                m_eCharSet  = pFontItem->GetCharSet();
-                vcl::Font aFont(m_aFontName, pFontItem->GetStyleName(), m_xNumberCharEdit->get_font().GetFontSize());
-                aFont.SetCharSet( pFontItem->GetCharSet() );
-                aFont.SetPitch( pFontItem->GetPitch() );
-                m_xNumberCharEdit->set_font(aFont);
-            }
+    if (RET_OK != pDlg->Execute())
+        return;
 
-            m_bExtCharAvailable = true;
-            m_xOkBtn->set_sensitive(!m_xNumberCharEdit->get_text().isEmpty());
-        }
+    const SfxStringItem* pItem = SfxItemSet::GetItem<SfxStringItem>(pDlg->GetOutputItemSet(), SID_CHARMAP, false);
+    const SvxFontItem* pFontItem = SfxItemSet::GetItem<SvxFontItem>(pDlg->GetOutputItemSet(), SID_ATTR_CHAR_FONT, false);
+    if ( !pItem )
+        return;
+
+    m_xNumberCharEdit->set_text(pItem->GetValue());
+
+    if ( pFontItem )
+    {
+        m_aFontName = pFontItem->GetFamilyName();
+        m_eCharSet  = pFontItem->GetCharSet();
+        vcl::Font aFont(m_aFontName, pFontItem->GetStyleName(), m_xNumberCharEdit->get_font().GetFontSize());
+        aFont.SetCharSet( pFontItem->GetCharSet() );
+        aFont.SetPitch( pFontItem->GetPitch() );
+        m_xNumberCharEdit->set_font(aFont);
     }
+
+    m_bExtCharAvailable = true;
+    m_xOkBtn->set_sensitive(!m_xNumberCharEdit->get_text().isEmpty());
 }
 
 IMPL_LINK( SwInsFootNoteDlg, NextPrevHdl, weld::Button&, rBtn, void )
diff --git a/sw/source/ui/table/autoformatpreview.cxx b/sw/source/ui/table/autoformatpreview.cxx
index b524532d94f1..4ba0072172ab 100644
--- a/sw/source/ui/table/autoformatpreview.cxx
+++ b/sw/source/ui/table/autoformatpreview.cxx
@@ -345,18 +345,18 @@ void AutoFormatPreview::PaintCells(vcl::RenderContext& rRenderContext)
             DrawString(rRenderContext, nCol, nRow);
 
     // 3) border
-    if (maCurrentData.IsFrame())
-    {
-        const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
-        std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
-            drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(
-                rRenderContext, aNewViewInformation2D));
+    if (!maCurrentData.IsFrame())
+        return;
 
-        if (pProcessor2D)
-        {
-            pProcessor2D->process(maArray.CreateB2DPrimitiveArray());
-            pProcessor2D.reset();
-        }
+    const drawinglayer::geometry::ViewInformation2D aNewViewInformation2D;
+    std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
+        drawinglayer::processor2d::createPixelProcessor2DFromOutputDevice(rRenderContext,
+                                                                          aNewViewInformation2D));
+
+    if (pProcessor2D)
+    {
+        pProcessor2D->process(maArray.CreateB2DPrimitiveArray());
+        pProcessor2D.reset();
     }
 }
 
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 741dff825c85..a13e0b1c2be3 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -241,19 +241,19 @@ IMPL_LINK_NOARG(SwFormatTablePage, AutoClickHdl, weld::ToggleButton&, void)
 
 void SwFormatTablePage::RightModify()
 {
-    if (m_xFreeBtn->get_active())
+    if (!m_xFreeBtn->get_active())
+        return;
+
+    bool bEnable = m_xRightMF->get_value() == 0;
+    m_xRelWidthCB->set_sensitive(bEnable);
+    if ( !bEnable )
     {
-        bool bEnable = m_xRightMF->get_value() == 0;
-        m_xRelWidthCB->set_sensitive(bEnable);
-        if ( !bEnable )
-        {
-            m_xRelWidthCB->set_active(false);
-            RelWidthClickHdl(*m_xRelWidthCB);
-        }
-        bEnable = m_xRelWidthCB->get_active();
-        m_xRightMF->set_sensitive(!bEnable);
-        m_xRightFT->set_sensitive(!bEnable);
+        m_xRelWidthCB->set_active(false);
+        RelWidthClickHdl(*m_xRelWidthCB);
     }
+    bEnable = m_xRelWidthCB->get_active();
+    m_xRightMF->set_sensitive(!bEnable);
+    m_xRightFT->set_sensitive(!bEnable);
 }
 
 IMPL_LINK( SwFormatTablePage, ValueChangedHdl, weld::MetricSpinButton&, rEdit, void )
@@ -568,26 +568,26 @@ void  SwFormatTablePage::Reset( const SfxItemSet* )
 void    SwFormatTablePage::ActivatePage( const SfxItemSet& rSet )
 {
     OSL_ENSURE(pTableData, "table data not available?");
-    if(SfxItemState::SET == rSet.GetItemState( FN_TABLE_REP ))
-    {
-        SwTwips nCurWidth = text::HoriOrientation::FULL != pTableData->GetAlign() ?
-                                        pTableData->GetWidth() :
-                                            pTableData->GetSpace();
-        if(pTableData->GetWidthPercent() == 0 &&
-                nCurWidth != m_xWidthMF->DenormalizePercent(m_xWidthMF->get_value(FieldUnit::TWIP)))
-        {
-            m_xWidthMF->set_value(m_xWidthMF->NormalizePercent(
-                            nCurWidth), FieldUnit::TWIP);
-            m_xWidthMF->save_value();
-            nSaveWidth = nCurWidth;
-            m_xLeftMF->set_value(m_xLeftMF->NormalizePercent(
-                            pTableData->GetLeftSpace()), FieldUnit::TWIP);
-            m_xLeftMF->save_value();
-            m_xRightMF->set_value(m_xRightMF->NormalizePercent(
-                            pTableData->GetRightSpace()), FieldUnit::TWIP);
-            m_xRightMF->save_value();
-        }
-    }
+    if(SfxItemState::SET != rSet.GetItemState( FN_TABLE_REP ))
+        return;
+
+    SwTwips nCurWidth = text::HoriOrientation::FULL != pTableData->GetAlign() ?
+                                    pTableData->GetWidth() :
+                                        pTableData->GetSpace();
+    if(pTableData->GetWidthPercent() != 0 ||
+       nCurWidth == m_xWidthMF->DenormalizePercent(m_xWidthMF->get_value(FieldUnit::TWIP)))
+        return;
+
+    m_xWidthMF->set_value(m_xWidthMF->NormalizePercent(
+                    nCurWidth), FieldUnit::TWIP);
+    m_xWidthMF->save_value();
+    nSaveWidth = nCurWidth;
+    m_xLeftMF->set_value(m_xLeftMF->NormalizePercent(
+                    pTableData->GetLeftSpace()), FieldUnit::TWIP);
+    m_xLeftMF->save_value();
+    m_xRightMF->set_value(m_xRightMF->NormalizePercent(
+                    pTableData->GetRightSpace()), FieldUnit::TWIP);
+    m_xRightMF->save_value();
 }
 
 DeactivateRC SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet )
@@ -1676,30 +1676,30 @@ IMPL_LINK_NOARG(SwTextFlowPage, ApplyCollClickHdl_Impl, weld::ToggleButton&, voi
 
 IMPL_LINK_NOARG(SwTextFlowPage, PageBreakPosHdl_Impl, weld::ToggleButton&, void)
 {
-    if (m_xPgBrkCB->get_active())
+    if (!m_xPgBrkCB->get_active())
+        return;
+
+    if (m_xPgBrkBeforeRB->get_active() && m_xPgBrkRB->get_active())
     {
-        if (m_xPgBrkBeforeRB->get_active() && m_xPgBrkRB->get_active())
-        {
-            m_xPageCollCB->set_sensitive(true);
+        m_xPageCollCB->set_sensitive(true);
 
-            bool bEnable = m_xPageCollCB->get_active() && m_xPageCollLB->get_count();
+        bool bEnable = m_xPageCollCB->get_active() && m_xPageCollLB->get_count();
 
-            m_xPageCollLB->set_sensitive(bEnable);
-            if (!bHtmlMode)
-            {
-                m_xPageNoCB->set_sensitive(bEnable);
-                m_xPageNoNF->set_sensitive(bEnable && m_xPageNoCB->get_active());
-            }
-        }
-        else if (m_xPgBrkAfterRB->get_active())
+        m_xPageCollLB->set_sensitive(bEnable);
+        if (!bHtmlMode)
         {
-            m_xPageCollCB->set_active(false);
-            m_xPageCollCB->set_sensitive(false);
-            m_xPageCollLB->set_sensitive(false);
-            m_xPageNoCB->set_sensitive(false);
-            m_xPageNoNF->set_sensitive(false);
+            m_xPageNoCB->set_sensitive(bEnable);
+            m_xPageNoNF->set_sensitive(bEnable && m_xPageNoCB->get_active());
         }
     }
+    else if (m_xPgBrkAfterRB->get_active())
+    {
+        m_xPageCollCB->set_active(false);
+        m_xPageCollCB->set_sensitive(false);
+        m_xPageCollLB->set_sensitive(false);
+        m_xPageNoCB->set_sensitive(false);
+        m_xPageNoNF->set_sensitive(false);
+    }
 }
 
 IMPL_LINK_NOARG(SwTextFlowPage, PageBreakTypeHdl_Impl, weld::ToggleButton&, void)


More information about the Libreoffice-commits mailing list