[Libreoffice-commits] core.git: basic/source comphelper/source cui/source dbaccess/source emfio/source extensions/source framework/source lotuswordpro/source oox/source sc/source sdext/source sd/source sfx2/source slideshow/source starmath/source svtools/source svx/source sw/source UnoControls/source unoidl/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 26 17:03:11 UTC 2021


 UnoControls/source/base/multiplexer.cxx               |   43 ++--
 basic/source/uno/namecont.cxx                         |   31 +--
 comphelper/source/property/propertysethelper.cxx      |   17 -
 cui/source/options/treeopt.cxx                        |   28 +-
 cui/source/tabpages/tpbitmap.cxx                      |   24 +-
 dbaccess/source/ui/app/AppDetailPageHelper.cxx        |   20 +-
 emfio/source/reader/mtftools.cxx                      |  150 +++++++--------
 extensions/source/bibliography/general.cxx            |   30 +--
 framework/source/uielement/resourcemenucontroller.cxx |   61 +++---
 lotuswordpro/source/filter/lwpfribsection.cxx         |   22 +-
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx   |   18 -
 oox/source/export/chartexport.cxx                     |  176 +++++++++---------
 sc/source/filter/oox/autofilterbuffer.cxx             |   90 ++++-----
 sc/source/filter/oox/querytablebuffer.cxx             |    5 
 sc/source/ui/app/inputwin.cxx                         |   92 ++++-----
 sc/source/ui/cctrl/checklistmenu.cxx                  |   21 +-
 sc/source/ui/dbgui/tpsubt.cxx                         |   22 +-
 sc/source/ui/drawfunc/drawsh2.cxx                     |  124 ++++++------
 sc/source/ui/drawfunc/futext.cxx                      |   30 +--
 sd/source/ui/annotations/annotationtag.cxx            |   60 +++---
 sd/source/ui/app/scalectrl.cxx                        |   40 ++--
 sd/source/ui/app/sdpopup.cxx                          |   24 +-
 sdext/source/presenter/PresenterAccessibility.cxx     |   21 +-
 sfx2/source/control/recentdocsview.cxx                |   52 ++---
 sfx2/source/devtools/ObjectInspectorTreeHandler.cxx   |   64 +++---
 sfx2/source/doc/objserv.cxx                           |   28 +-
 sfx2/source/sidebar/DeckLayouter.cxx                  |   30 +--
 sfx2/source/sidebar/Sidebar.cxx                       |   31 +--
 slideshow/source/engine/animationfactory.cxx          |   56 ++---
 starmath/source/mathml/mathmlimport.cxx               |   32 +--
 svtools/source/misc/sampletext.cxx                    |   12 -
 svx/source/items/numfmtsh.cxx                         |   26 +-
 svx/source/svdraw/svdobj.cxx                          |   30 +--
 svx/source/svdraw/svdoole2.cxx                        |   40 ++--
 sw/source/core/access/AccessibilityCheck.cxx          |   29 +-
 sw/source/core/doc/textboxhelper.cxx                  |   22 +-
 sw/source/core/docnode/ndsect.cxx                     |   26 +-
 sw/source/core/edit/ednumber.cxx                      |   28 +-
 sw/source/core/layout/fly.cxx                         |   26 +-
 sw/source/core/layout/objectformattertxtfrm.cxx       |   22 +-
 sw/source/core/layout/pagechg.cxx                     |   26 +-
 sw/source/core/layout/sectfrm.cxx                     |   26 +-
 sw/source/core/layout/tabfrm.cxx                      |   26 +-
 sw/source/core/layout/wsfrm.cxx                       |   26 +-
 sw/source/core/text/porrst.cxx                        |   50 ++---
 sw/source/filter/ww8/docxattributeoutput.cxx          |   22 +-
 sw/source/ui/dbui/dbtablepreviewdialog.cxx            |   24 +-
 sw/source/ui/table/instable.cxx                       |   26 +-
 sw/source/uibase/app/appopt.cxx                       |   32 +--
 sw/source/uibase/docvw/SidebarTxtControl.cxx          |   28 +-
 sw/source/uibase/ribbar/workctrl.cxx                  |   28 +-
 sw/source/uibase/utlui/content.cxx                    |  106 +++++-----
 unoidl/source/legacyprovider.cxx                      |   25 +-
 unoidl/source/unoidl-write.cxx                        |   45 ++--
 54 files changed, 1098 insertions(+), 1095 deletions(-)

New commits:
commit b624b13b3d5a8e573c7de8158cadc66b1982d157
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Fri Mar 26 13:35:54 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Mar 26 18:02:19 2021 +0100

    loplugin:flatten
    
    Change-Id: Ib7a895fba66f8dc9b6501e61631c02694053b7fc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113157
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/UnoControls/source/base/multiplexer.cxx b/UnoControls/source/base/multiplexer.cxx
index 2e0f48dd75fb..a8322d845c43 100644
--- a/UnoControls/source/base/multiplexer.cxx
+++ b/UnoControls/source/base/multiplexer.cxx
@@ -40,29 +40,26 @@ namespace unocontrols {
     /* First get all interfaces from container with right type.*/                                                                   \
     OInterfaceContainerHelper* pContainer = m_aListenerHolder.getContainer( cppu::UnoType<INTERFACE>::get() );  \
     /* Do the follow only, if elements in container exist.*/                                                                        \
-    if( pContainer != nullptr )                                                                                                        \
-    {                                                                                                                               \
-        OInterfaceIteratorHelper aIterator( *pContainer );                                                                          \
-        EVENTTYP aLocalEvent = EVENT;                                                                                               \
-        /* Remark: The control is the event source not the peer.*/                                                                  \
-        /*         We must change the source of the event.      */                                                                  \
-        aLocalEvent.Source = m_xControl;                                                                                           \
-        /* Is the control not destroyed? */                                                                                         \
-        if( aLocalEvent.Source.is() )                                                                                               \
-        {                                                                                                                           \
-            if( aIterator.hasMoreElements() )                                                                                       \
-            {                                                                                                                       \
-                INTERFACE * pListener = static_cast<INTERFACE *>(aIterator.next());                                                 \
-                try                                                                                                                 \
-                {                                                                                                                   \
-                    pListener->METHOD( aLocalEvent );                                                                               \
-                }                                                                                                                   \
-                catch(const RuntimeException& )                                                                                     \
-                {                                                                                                                   \
-                    /* Ignore all system exceptions from the listener! */                                                           \
-                }                                                                                                                   \
-            }                                                                                                                       \
-        }                                                                                                                           \
+    if( !pContainer )                                                                                                        \
+        return;                                                                                                                               \
+    OInterfaceIteratorHelper aIterator( *pContainer );                                                                          \
+    EVENTTYP aLocalEvent = EVENT;                                                                                               \
+    /* Remark: The control is the event source not the peer.*/                                                                  \
+    /*         We must change the source of the event.      */                                                                  \
+    aLocalEvent.Source = m_xControl;                                                                                           \
+    /* Is the control not destroyed? */                                                                                         \
+    if( !aLocalEvent.Source )                                                                                               \
+        return;                                                                                                                           \
+    if( !aIterator.hasMoreElements() )                                                                                       \
+        return;                                                                                                             \
+    INTERFACE * pListener = static_cast<INTERFACE *>(aIterator.next());                                                 \
+    try                                                                                                                 \
+    {                                                                                                                   \
+        pListener->METHOD( aLocalEvent );                                                                               \
+    }                                                                                                                   \
+    catch(const RuntimeException& )                                                                                     \
+    {                                                                                                                   \
+        /* Ignore all system exceptions from the listener! */                                                           \
     }
 
 //  construct/destruct
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index d42b701a5405..25be6ca465af 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -2616,25 +2616,24 @@ void SAL_CALL SfxLibraryContainer::initialize( const Sequence< Any >& _rArgument
 {
     LibraryContainerMethodGuard aGuard( *this );
     sal_Int32 nArgCount = _rArguments.getLength();
-    if ( nArgCount == 1 )
+    if ( nArgCount != 1 )
+        throw IllegalArgumentException("too many args", static_cast<cppu::OWeakObject*>(this), -1);
+
+    OUString sInitialDocumentURL;
+    Reference< XStorageBasedDocument > xDocument;
+    if ( _rArguments[0] >>= sInitialDocumentURL )
     {
-        OUString sInitialDocumentURL;
-        Reference< XStorageBasedDocument > xDocument;
-        if ( _rArguments[0] >>= sInitialDocumentURL )
-        {
-            init( sInitialDocumentURL, nullptr );
-            return;
-        }
+        init( sInitialDocumentURL, nullptr );
+        return;
+    }
 
-        if ( _rArguments[0] >>= xDocument )
-        {
-            initializeFromDocument( xDocument );
-            return;
-        }
-        throw IllegalArgumentException("arg1 unknown type", static_cast<cppu::OWeakObject*>(this), 1);
+    if ( _rArguments[0] >>= xDocument )
+    {
+        initializeFromDocument( xDocument );
+        return;
     }
-    else
-        throw IllegalArgumentException("too many args", static_cast<cppu::OWeakObject*>(this), -1);
+    throw IllegalArgumentException("arg1 unknown type", static_cast<cppu::OWeakObject*>(this), 1);
+
 }
 
 void SfxLibraryContainer::initializeFromDocument( const Reference< XStorageBasedDocument >& _rxDocument )
diff --git a/comphelper/source/property/propertysethelper.cxx b/comphelper/source/property/propertysethelper.cxx
index 2c319cd042f2..a8a6e6a964d5 100644
--- a/comphelper/source/property/propertysethelper.cxx
+++ b/comphelper/source/property/propertysethelper.cxx
@@ -153,16 +153,15 @@ Sequence< Any > SAL_CALL PropertySetHelper::getPropertyValues(const Sequence< OU
         bUnknown = nullptr == pEntries[n];
     }
 
-    if( !bUnknown )
-    {
-        pEntries[nCount] = nullptr;
-        Sequence< Any > aValues(nCount);
-        aValues.realloc(nCount);
-        _getPropertyValues( pEntries.get(), aValues.getArray() );
-        return aValues;
-    }
-    else
+    if( bUnknown )
         throw RuntimeException( *pNames, static_cast< XPropertySet* >( this ) );
+
+    pEntries[nCount] = nullptr;
+    Sequence< Any > aValues(nCount);
+    aValues.realloc(nCount);
+    _getPropertyValues( pEntries.get(), aValues.getArray() );
+    return aValues;
+
 }
 
 void SAL_CALL PropertySetHelper::addPropertiesChangeListener( const Sequence< OUString >&, const Reference< XPropertiesChangeListener >& )
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index e254153ad4cc..e7bf078bcae4 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -746,22 +746,22 @@ IMPL_LINK(OfaTreeOptionsDialog, ApplyHdl_Impl, weld::Button&, rButton, void)
         SelectHdl_Impl();
     }
 
-    if (bNeedsRestart)
+    if (!bNeedsRestart)
+        return;
+
+    SolarMutexGuard aGuard;
+    weld::Window* pParent;
+    if (!bOkPressed)
+        pParent = m_xDialog.get();
+    else
     {
-        SolarMutexGuard aGuard;
-        weld::Window* pParent;
-        if (!bOkPressed)
-            pParent = m_xDialog.get();
-        else
-        {
-            m_xDialog->hide();
-            pParent = m_pParent;
-        }
-        bool bRestart = ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
-                                                        pParent, eRestartReason);
-        if (bRestart && !bOkPressed)
-            m_xDialog->response(RET_OK);
+        m_xDialog->hide();
+        pParent = m_pParent;
     }
+    bool bRestart = ::svtools::executeRestartDialog(comphelper::getProcessComponentContext(),
+                                                    pParent, eRestartReason);
+    if (bRestart && !bOkPressed)
+        m_xDialog->response(RET_OK);
 }
 
 void OfaTreeOptionsDialog::ApplyItemSets()
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 647bcaa105e3..f0a239775d13 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -563,21 +563,21 @@ IMPL_LINK_NOARG(SvxBitmapTabPage, ClickDeleteHdl, SvxPresetListBox*, void)
     std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/querydeletebitmapdialog.ui"));
     std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("AskDelBitmapDialog"));
 
-    if (xQueryBox->run() == RET_YES)
-    {
-        sal_uInt16 nNextId = m_xBitmapLB->GetItemId(nPos + 1);
-        if (!nNextId)
-            nNextId = m_xBitmapLB->GetItemId(nPos - 1);
+    if (xQueryBox->run() != RET_YES)
+        return;
 
-        m_pBitmapList->Remove( static_cast<sal_uInt16>(nPos) );
-        m_xBitmapLB->RemoveItem( nId );
+    sal_uInt16 nNextId = m_xBitmapLB->GetItemId(nPos + 1);
+    if (!nNextId)
+        nNextId = m_xBitmapLB->GetItemId(nPos - 1);
 
-        m_xBitmapLB->SelectItem(nNextId);
+    m_pBitmapList->Remove( static_cast<sal_uInt16>(nPos) );
+    m_xBitmapLB->RemoveItem( nId );
 
-        m_aCtlBitmapPreview.Invalidate();
-        ModifyBitmapHdl(m_xBitmapLB.get());
-        *m_pnBitmapListState |= ChangeType::MODIFIED;
-    }
+    m_xBitmapLB->SelectItem(nNextId);
+
+    m_aCtlBitmapPreview.Invalidate();
+    ModifyBitmapHdl(m_xBitmapLB.get());
+    *m_pnBitmapListState |= ChangeType::MODIFIED;
 }
 
 IMPL_LINK_NOARG( SvxBitmapTabPage, ModifyBitmapSizeHdl, weld::MetricSpinButton&, void )
diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
index 4d6b88f79738..1ab3c0ad29bf 100644
--- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx
+++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx
@@ -580,19 +580,19 @@ void OAppDetailPageHelper::createPage(ElementType _eType,const Reference< XNameA
         m_aLists[_eType] = createSimpleTree(sHelpId, _eType);
     }
 
-    if ( m_aLists[_eType] )
+    if ( !m_aLists[_eType] )
+        return;
+
+    weld::TreeView& rTreeView = m_aLists[_eType]->GetWidget();
+    if (!rTreeView.n_children() && _xContainer.is())
     {
-        weld::TreeView& rTreeView = m_aLists[_eType]->GetWidget();
-        if (!rTreeView.n_children() && _xContainer.is())
-        {
-            rTreeView.make_unsorted();
-            fillNames( _xContainer, _eType, sImageId, nullptr );
-            rTreeView.make_sorted();
+        rTreeView.make_unsorted();
+        fillNames( _xContainer, _eType, sImageId, nullptr );
+        rTreeView.make_sorted();
 
-            rTreeView.unselect_all();
-        }
-        setDetailPage(*m_aLists[_eType]);
+        rTreeView.unselect_all();
     }
+    setDetailPage(*m_aLists[_eType]);
 }
 
 void OAppDetailPageHelper::setDetailPage(DBTreeViewBase& rTreeView)
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 5a2f5d1ca806..3edf76e74357 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -356,97 +356,97 @@ namespace emfio
         maCurrentMetaFontAction.clear();
         maAlternativeFontScales.clear();
 
-        if(rNewMetaFontAction.is())
+        if(!rNewMetaFontAction.is())
+            return;
+
+        // check 1st criteria for FontScale active. We usually write this,
+        // so this will already sort out most situations
+        const vcl::Font& rCandidate(rNewMetaFontAction->GetFont());
+
+        if(0 != rCandidate.GetAverageFontWidth())
         {
-            // check 1st criteria for FontScale active. We usually write this,
-            // so this will already sort out most situations
-            const vcl::Font& rCandidate(rNewMetaFontAction->GetFont());
+            const tools::Long nUnscaledAverageFontWidth(rCandidate.GetOrCalculateAverageFontWidth());
 
-            if(0 != rCandidate.GetAverageFontWidth())
+            // check 2nd (system-dependent) criteria for FontScale
+            if(nUnscaledAverageFontWidth != rCandidate.GetFontHeight())
             {
-                const tools::Long nUnscaledAverageFontWidth(rCandidate.GetOrCalculateAverageFontWidth());
-
-                // check 2nd (system-dependent) criteria for FontScale
-                if(nUnscaledAverageFontWidth != rCandidate.GetFontHeight())
-                {
-                    // FontScale is active, remember and use as current
-                    maCurrentMetaFontAction = rNewMetaFontAction;
-                }
+                // FontScale is active, remember and use as current
+                maCurrentMetaFontAction = rNewMetaFontAction;
             }
         }
     }
 
     void ScaledFontDetectCorrectHelper::evaluateAlternativeFontScale(OUString const & rText, tools::Long nImportedTextLength)
     {
-        if(maCurrentMetaFontAction.is())
-        {
-            SolarMutexGuard aGuard; // VirtualDevice is not thread-safe
-            ScopedVclPtrInstance< VirtualDevice > pTempVirtualDevice;
+        if(!maCurrentMetaFontAction.is())
+            return;
 
-            // calculate measured TextLength
-            const vcl::Font& rFontCandidate(maCurrentMetaFontAction->GetFont());
-            pTempVirtualDevice->SetFont(rFontCandidate);
-            tools::Long nMeasuredTextLength(pTempVirtualDevice->GetTextWidth(rText));
-            // on failure, use original length
-            if (!nMeasuredTextLength)
-                nMeasuredTextLength = nImportedTextLength;
+        SolarMutexGuard aGuard; // VirtualDevice is not thread-safe
+        ScopedVclPtrInstance< VirtualDevice > pTempVirtualDevice;
 
-            // compare expected and imported TextLengths
-            if (nImportedTextLength != nMeasuredTextLength)
-            {
-                const double fFactorText(static_cast<double>(nImportedTextLength) / static_cast<double>(nMeasuredTextLength));
-                const double fFactorTextPercent(fabs(1.0 - fFactorText) * 100.0);
+        // calculate measured TextLength
+        const vcl::Font& rFontCandidate(maCurrentMetaFontAction->GetFont());
+        pTempVirtualDevice->SetFont(rFontCandidate);
+        tools::Long nMeasuredTextLength(pTempVirtualDevice->GetTextWidth(rText));
+        // on failure, use original length
+        if (!nMeasuredTextLength)
+            nMeasuredTextLength = nImportedTextLength;
+
+        // compare expected and imported TextLengths
+        if (nImportedTextLength != nMeasuredTextLength)
+        {
+            const double fFactorText(static_cast<double>(nImportedTextLength) / static_cast<double>(nMeasuredTextLength));
+            const double fFactorTextPercent(fabs(1.0 - fFactorText) * 100.0);
 
-                // if we assume that loaded file was written on old linux, we have to
-                // back-convert the scale value depending on which system we run
+            // if we assume that loaded file was written on old linux, we have to
+            // back-convert the scale value depending on which system we run
 #ifdef _WIN32
-                // When running on Windows the value was not adapted at font import (see WinMtfFontStyle
-                // constructor), so it is still NormedFontScaling and we need to convert to Windows-style
-                // scaling
+            // When running on Windows the value was not adapted at font import (see WinMtfFontStyle
+            // constructor), so it is still NormedFontScaling and we need to convert to Windows-style
+            // scaling
 #else
-                // When running on unx (non-Windows) the value was already adapted at font import (see WinMtfFontStyle
-                // constructor). It was wrongly assumed to be Windows-style FontScaling, so we need to revert that
-                // to get back to the needed unx-style FontScale
+            // When running on unx (non-Windows) the value was already adapted at font import (see WinMtfFontStyle
+            // constructor). It was wrongly assumed to be Windows-style FontScaling, so we need to revert that
+            // to get back to the needed unx-style FontScale
 #endif
-                // Interestingly this leads to the *same* correction, so no need to make this
-                // system-dependent (!)
-                const tools::Long nUnscaledAverageFontWidth(rFontCandidate.GetOrCalculateAverageFontWidth());
-                const tools::Long nScaledAverageFontWidth(rFontCandidate.GetAverageFontWidth());
-                const double fScaleFactor(static_cast<double>(nUnscaledAverageFontWidth) / static_cast<double>(rFontCandidate.GetFontHeight()));
-                const double fCorrectedAverageFontWidth(static_cast<double>(nScaledAverageFontWidth) * fScaleFactor);
-                tools::Long nCorrectedTextLength(0);
-
-                { // do in own scope, only need nUnscaledAverageFontWidth
-                    vcl::Font rFontCandidate2(rFontCandidate);
-                    rFontCandidate2.SetAverageFontWidth(static_cast<tools::Long>(fCorrectedAverageFontWidth));
-                    pTempVirtualDevice->SetFont(rFontCandidate2);
-                    nCorrectedTextLength = pTempVirtualDevice->GetTextWidth(rText);
-                    // on failure, use original length
-                    if (!nCorrectedTextLength)
-                        nCorrectedTextLength = nImportedTextLength;
-                }
+            // Interestingly this leads to the *same* correction, so no need to make this
+            // system-dependent (!)
+            const tools::Long nUnscaledAverageFontWidth(rFontCandidate.GetOrCalculateAverageFontWidth());
+            const tools::Long nScaledAverageFontWidth(rFontCandidate.GetAverageFontWidth());
+            const double fScaleFactor(static_cast<double>(nUnscaledAverageFontWidth) / static_cast<double>(rFontCandidate.GetFontHeight()));
+            const double fCorrectedAverageFontWidth(static_cast<double>(nScaledAverageFontWidth) * fScaleFactor);
+            tools::Long nCorrectedTextLength(0);
+
+            { // do in own scope, only need nUnscaledAverageFontWidth
+                vcl::Font rFontCandidate2(rFontCandidate);
+                rFontCandidate2.SetAverageFontWidth(static_cast<tools::Long>(fCorrectedAverageFontWidth));
+                pTempVirtualDevice->SetFont(rFontCandidate2);
+                nCorrectedTextLength = pTempVirtualDevice->GetTextWidth(rText);
+                // on failure, use original length
+                if (!nCorrectedTextLength)
+                    nCorrectedTextLength = nImportedTextLength;
+            }
 
-                const double fFactorCorrectedText(static_cast<double>(nImportedTextLength) / static_cast<double>(nCorrectedTextLength));
-                const double fFactorCorrectedTextPercent(fabs(1.0 - fFactorCorrectedText) * 100.0);
-
-                // If FactorCorrectedText fits better than FactorText this is probably
-                // an import of an old EMF/WMF written by LibreOffice on a non-Windows (unx) system
-                // and should be corrected.
-                // Usually in tested cases this lies inside 5% of range, so detecting this just using
-                //  fFactorTextPercent inside 5% -> no old file
-                //  fFactorCorrectedTextPercent inside 5% -> is old file
-                // works not too bad, but there are some strange not so often used fonts where that
-                // values do deviate, so better just compare if old corrected would fit better than
-                // the uncorrected case, that is usually safe.
-                if(fFactorCorrectedTextPercent < fFactorTextPercent)
-                {
-                    maAlternativeFontScales.push_back(fCorrectedAverageFontWidth);
-                }
-                else
-                {
-                    // also push, but negative to remember non-fitting case
-                    maAlternativeFontScales.push_back(-fCorrectedAverageFontWidth);
-                }
+            const double fFactorCorrectedText(static_cast<double>(nImportedTextLength) / static_cast<double>(nCorrectedTextLength));
+            const double fFactorCorrectedTextPercent(fabs(1.0 - fFactorCorrectedText) * 100.0);
+
+            // If FactorCorrectedText fits better than FactorText this is probably
+            // an import of an old EMF/WMF written by LibreOffice on a non-Windows (unx) system
+            // and should be corrected.
+            // Usually in tested cases this lies inside 5% of range, so detecting this just using
+            //  fFactorTextPercent inside 5% -> no old file
+            //  fFactorCorrectedTextPercent inside 5% -> is old file
+            // works not too bad, but there are some strange not so often used fonts where that
+            // values do deviate, so better just compare if old corrected would fit better than
+            // the uncorrected case, that is usually safe.
+            if(fFactorCorrectedTextPercent < fFactorTextPercent)
+            {
+                maAlternativeFontScales.push_back(fCorrectedAverageFontWidth);
+            }
+            else
+            {
+                // also push, but negative to remember non-fitting case
+                maAlternativeFontScales.push_back(-fCorrectedAverageFontWidth);
             }
         }
     }
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 1b712259f80a..f2517ed95515 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -304,24 +304,24 @@ void BibGeneralPage::SaveChanges()
     Reference< XForm > xForm = pDatMan->getForm();
     Reference< beans::XPropertySet > xProps( xForm, UNO_QUERY );
     Reference< sdbc::XResultSetUpdate > xResUpd( xProps, UNO_QUERY );
-    if (xResUpd.is() )
+    if (!xResUpd.is() )
+        return;
+
+    Any aModified = xProps->getPropertyValue( "IsModified" );
+    bool bFlag = false;
+    if ( ( aModified >>= bFlag ) && bFlag )
     {
-        Any aModified = xProps->getPropertyValue( "IsModified" );
-        bool bFlag = false;
-        if ( ( aModified >>= bFlag ) && bFlag )
-        {
 
-            try
-            {
-                Any aNew = xProps->getPropertyValue( "IsNew" );
-                aNew >>= bFlag;
-                if ( bFlag )
-                    xResUpd->insertRow();
-                else
-                    xResUpd->updateRow();
-            }
-            catch( const uno::Exception&) {}
+        try
+        {
+            Any aNew = xProps->getPropertyValue( "IsNew" );
+            aNew >>= bFlag;
+            if ( bFlag )
+                xResUpd->insertRow();
+            else
+                xResUpd->updateRow();
         }
+        catch( const uno::Exception&) {}
     }
 }
 
diff --git a/framework/source/uielement/resourcemenucontroller.cxx b/framework/source/uielement/resourcemenucontroller.cxx
index c56c91dc35e1..26198c0cf5f6 100644
--- a/framework/source/uielement/resourcemenucontroller.cxx
+++ b/framework/source/uielement/resourcemenucontroller.cxx
@@ -228,18 +228,18 @@ void ResourceMenuController::updatePopupMenu()
     framework::MenuBarManager::FillMenu( m_nNewMenuId, comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu )->GetMenu(), m_aModuleName, m_xMenuContainer, m_xDispatchProvider );
 
     // For context menus, add object verbs.
-    if ( m_bContextMenu )
+    if ( !m_bContextMenu )
+        return;
+
+    css::util::URL aObjectMenuURL;
+    aObjectMenuURL.Complete = ".uno:ObjectMenue";
+    m_xURLTransformer->parseStrict( aObjectMenuURL );
+    css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY );
+    css::uno::Reference< css::frame::XDispatch > xDispatch( xDispatchProvider->queryDispatch( aObjectMenuURL, OUString(), 0 ) );
+    if ( xDispatch.is() )
     {
-        css::util::URL aObjectMenuURL;
-        aObjectMenuURL.Complete = ".uno:ObjectMenue";
-        m_xURLTransformer->parseStrict( aObjectMenuURL );
-        css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY );
-        css::uno::Reference< css::frame::XDispatch > xDispatch( xDispatchProvider->queryDispatch( aObjectMenuURL, OUString(), 0 ) );
-        if ( xDispatch.is() )
-        {
-            xDispatch->addStatusListener( this, aObjectMenuURL );
-            xDispatch->removeStatusListener( this, aObjectMenuURL );
-        }
+        xDispatch->addStatusListener( this, aObjectMenuURL );
+        xDispatch->removeStatusListener( this, aObjectMenuURL );
     }
 }
 
@@ -503,29 +503,28 @@ void WindowListMenuController::itemActivated( const css::awt::MenuEvent& rEvent
 
 void WindowListMenuController::itemSelected( const css::awt::MenuEvent& rEvent )
 {
-    if ( rEvent.MenuId >= START_ITEMID_WINDOWLIST &&
-         rEvent.MenuId <= END_ITEMID_WINDOWLIST )
-    {
-        // window list menu item selected
-        css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext );
+    if ( rEvent.MenuId < START_ITEMID_WINDOWLIST || rEvent.MenuId > END_ITEMID_WINDOWLIST )
+        return;
 
-        sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST;
-        css::uno::Reference< css::container::XIndexAccess > xList = xDesktop->getFrames();
-        sal_Int32 nCount = xList->getCount();
-        for ( sal_Int32 i=0; i<nCount; ++i )
-        {
-            css::uno::Reference< css::frame::XFrame > xFrame;
-            xList->getByIndex(i) >>= xFrame;
-            if ( xFrame.is() && nTaskId == rEvent.MenuId )
-            {
-                VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
-                pWin->GrabFocus();
-                pWin->ToTop( ToTopFlags::RestoreWhenMin );
-                break;
-            }
+    // window list menu item selected
+    css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext );
 
-            nTaskId++;
+    sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST;
+    css::uno::Reference< css::container::XIndexAccess > xList = xDesktop->getFrames();
+    sal_Int32 nCount = xList->getCount();
+    for ( sal_Int32 i=0; i<nCount; ++i )
+    {
+        css::uno::Reference< css::frame::XFrame > xFrame;
+        xList->getByIndex(i) >>= xFrame;
+        if ( xFrame.is() && nTaskId == rEvent.MenuId )
+        {
+            VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
+            pWin->GrabFocus();
+            pWin->ToTop( ToTopFlags::RestoreWhenMin );
+            break;
         }
+
+        nTaskId++;
     }
 }
 
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index f411a8bbb957..a65763f38bd0 100644
--- a/lotuswordpro/source/filter/lwpfribsection.cxx
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -423,18 +423,18 @@ void LwpMasterPage::ParseSection(LwpFrib* pFrib)
 void LwpMasterPage::RegisterFillerPageStyle()
 {
     LwpLayout::UseWhenType eUserType = m_pLayout->GetUseWhenType();
-    if (eUserType == LwpLayout::StartOnOddPage || eUserType == LwpLayout::StartOnEvenPage)
+    if (eUserType != LwpLayout::StartOnOddPage && eUserType != LwpLayout::StartOnEvenPage)
+        return;
+
+    if (m_pLayout->HasFillerPageText(m_pPara->GetFoundry()))
     {
-        if (m_pLayout->HasFillerPageText(m_pPara->GetFoundry()))
-        {
-            std::unique_ptr<XFParaStyle> pPagebreakStyle(new XFParaStyle);
-            *pPagebreakStyle = *(m_pPara->GetXFParaStyle());
-            pPagebreakStyle->SetStyleName("");
-            pPagebreakStyle->SetBreaks(enumXFBreakAftPage);
-            XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
-            m_FillerPageStyleName
-                = pXFStyleManager->AddStyle(std::move(pPagebreakStyle)).m_pStyle->GetStyleName();
-        }
+        std::unique_ptr<XFParaStyle> pPagebreakStyle(new XFParaStyle);
+        *pPagebreakStyle = *(m_pPara->GetXFParaStyle());
+        pPagebreakStyle->SetStyleName("");
+        pPagebreakStyle->SetBreaks(enumXFBreakAftPage);
+        XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
+        m_FillerPageStyleName
+            = pXFStyleManager->AddStyle(std::move(pPagebreakStyle)).m_pStyle->GetStyleName();
     }
 }
 
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index bc24b0322059..f5191b54408a 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -712,17 +712,17 @@ void CompositeAlg::layoutShapeChildren(AlgAtom& rAlg, const ShapePtr& rShape,
     }
 
     // See if all vertical space is used or we have to center the content.
-    if (nVertMin >= 0 && nVertMin <= nVertMax && nVertMax <= rParent[XML_h])
+    if (!(nVertMin >= 0 && nVertMin <= nVertMax && nVertMax <= rParent[XML_h]))
+        return;
+
+    sal_Int32 nDiff = rParent[XML_h] - (nVertMax - nVertMin);
+    if (nDiff > 0)
     {
-        sal_Int32 nDiff = rParent[XML_h] - (nVertMax - nVertMin);
-        if (nDiff > 0)
+        for (auto& aCurrShape : rShape->getChildren())
         {
-            for (auto& aCurrShape : rShape->getChildren())
-            {
-                awt::Point aPosition = aCurrShape->getPosition();
-                aPosition.Y += nDiff / 2;
-                aCurrShape->setPosition(aPosition);
-            }
+            awt::Point aPosition = aCurrShape->getPosition();
+            aPosition.Y += nDiff / 2;
+            aCurrShape->setPosition(aPosition);
         }
     }
 }
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index e15e58a4f3ff..2b412d43430a 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -984,104 +984,104 @@ void ChartExport::exportExternalData( const Reference< css::chart::XChartDocumen
 void ChartExport::exportAdditionalShapes( const Reference< css::chart::XChartDocument >& xChartDoc )
 {
     Reference< beans::XPropertySet > xDocPropSet(xChartDoc, uno::UNO_QUERY);
-    if (xDocPropSet.is())
+    if (!xDocPropSet.is())
+        return;
+
+    css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes;
+    // get a sequence of non-chart shapes
+    try
     {
-        css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes;
-        // get a sequence of non-chart shapes
-        try
+        Any aShapesAny = xDocPropSet->getPropertyValue("AdditionalShapes");
+        if( (aShapesAny >>= mxAdditionalShapes) && mxAdditionalShapes.is() )
         {
-            Any aShapesAny = xDocPropSet->getPropertyValue("AdditionalShapes");
-            if( (aShapesAny >>= mxAdditionalShapes) && mxAdditionalShapes.is() )
-            {
-                OUString sId;
-                const char* sFullPath = nullptr;
-                const char* sRelativePath = nullptr;
-                sal_Int32 nDrawing = getNewDrawingUniqueId();
+            OUString sId;
+            const char* sFullPath = nullptr;
+            const char* sRelativePath = nullptr;
+            sal_Int32 nDrawing = getNewDrawingUniqueId();
 
-                switch (GetDocumentType())
+            switch (GetDocumentType())
+            {
+                case DOCUMENT_DOCX:
                 {
-                    case DOCUMENT_DOCX:
-                    {
-                        sFullPath = "word/drawings/drawing";
-                        sRelativePath = "../drawings/drawing";
-                        break;
-                    }
-                    case DOCUMENT_PPTX:
-                    {
-                        sFullPath = "ppt/drawings/drawing";
-                        sRelativePath = "../drawings/drawing";
-                        break;
-                    }
-                    case DOCUMENT_XLSX:
-                    {
-                        sFullPath = "xl/drawings/drawing";
-                        sRelativePath = "../drawings/drawing";
-                        break;
-                    }
-                    default:
-                    {
-                        sFullPath = "drawings/drawing";
-                        sRelativePath = "drawings/drawing";
-                        break;
-                    }
+                    sFullPath = "word/drawings/drawing";
+                    sRelativePath = "../drawings/drawing";
+                    break;
                 }
-                OUString sFullStream = OUStringBuffer()
-                    .appendAscii(sFullPath)
-                    .append(nDrawing)
-                    .append(".xml")
-                    .makeStringAndClear();
-                OUString sRelativeStream = OUStringBuffer()
-                    .appendAscii(sRelativePath)
-                    .append(nDrawing)
-                    .append(".xml")
-                    .makeStringAndClear();
-
-                sax_fastparser::FSHelperPtr pDrawing = CreateOutputStream(
-                    sFullStream,
-                    sRelativeStream,
-                    GetFS()->getOutputStream(),
-                    "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml",
-                    OUStringToOString(oox::getRelationship(Relationship::CHARTUSERSHAPES), RTL_TEXTENCODING_UTF8).getStr(),
-                    &sId);
-
-                GetFS()->singleElementNS(XML_c, XML_userShapes, FSNS(XML_r, XML_id), sId);
-
-                XmlFilterBase* pFB = GetFB();
-                pDrawing->startElement(FSNS(XML_c, XML_userShapes),
-                    FSNS(XML_xmlns, XML_cdr), pFB->getNamespaceURL(OOX_NS(dmlChartDr)),
-                    FSNS(XML_xmlns, XML_a), pFB->getNamespaceURL(OOX_NS(dml)),
-                    FSNS(XML_xmlns, XML_c), pFB->getNamespaceURL(OOX_NS(dmlChart)));
-
-                const sal_Int32 nShapeCount(mxAdditionalShapes->getCount());
-                for (sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
+                case DOCUMENT_PPTX:
                 {
-                    Reference< drawing::XShape > xShape;
-                    mxAdditionalShapes->getByIndex(nShapeId) >>= xShape;
-                    SAL_WARN_IF(!xShape.is(), "xmloff.chart", "Shape without an XShape?");
-                    if (!xShape.is())
-                        continue;
-
-                    // TODO: absSizeAnchor: we import both (absSizeAnchor and relSizeAnchor), but there is no essential difference between them.
-                    pDrawing->startElement(FSNS(XML_cdr, XML_relSizeAnchor));
-                    uno::Reference< beans::XPropertySet > xShapeProperties(xShape, uno::UNO_QUERY);
-                    if( xShapeProperties.is() )
-                    {
-                        Reference<embed::XVisualObject> xVisObject(mxChartModel, uno::UNO_QUERY);
-                        awt::Size aPageSize = xVisObject->getVisualAreaSize(embed::Aspects::MSOLE_CONTENT);
-                        WriteFromTo( xShape, aPageSize, pDrawing );
+                    sFullPath = "ppt/drawings/drawing";
+                    sRelativePath = "../drawings/drawing";
+                    break;
+                }
+                case DOCUMENT_XLSX:
+                {
+                    sFullPath = "xl/drawings/drawing";
+                    sRelativePath = "../drawings/drawing";
+                    break;
+                }
+                default:
+                {
+                    sFullPath = "drawings/drawing";
+                    sRelativePath = "drawings/drawing";
+                    break;
+                }
+            }
+            OUString sFullStream = OUStringBuffer()
+                .appendAscii(sFullPath)
+                .append(nDrawing)
+                .append(".xml")
+                .makeStringAndClear();
+            OUString sRelativeStream = OUStringBuffer()
+                .appendAscii(sRelativePath)
+                .append(nDrawing)
+                .append(".xml")
+                .makeStringAndClear();
+
+            sax_fastparser::FSHelperPtr pDrawing = CreateOutputStream(
+                sFullStream,
+                sRelativeStream,
+                GetFS()->getOutputStream(),
+                "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml",
+                OUStringToOString(oox::getRelationship(Relationship::CHARTUSERSHAPES), RTL_TEXTENCODING_UTF8).getStr(),
+                &sId);
+
+            GetFS()->singleElementNS(XML_c, XML_userShapes, FSNS(XML_r, XML_id), sId);
+
+            XmlFilterBase* pFB = GetFB();
+            pDrawing->startElement(FSNS(XML_c, XML_userShapes),
+                FSNS(XML_xmlns, XML_cdr), pFB->getNamespaceURL(OOX_NS(dmlChartDr)),
+                FSNS(XML_xmlns, XML_a), pFB->getNamespaceURL(OOX_NS(dml)),
+                FSNS(XML_xmlns, XML_c), pFB->getNamespaceURL(OOX_NS(dmlChart)));
+
+            const sal_Int32 nShapeCount(mxAdditionalShapes->getCount());
+            for (sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
+            {
+                Reference< drawing::XShape > xShape;
+                mxAdditionalShapes->getByIndex(nShapeId) >>= xShape;
+                SAL_WARN_IF(!xShape.is(), "xmloff.chart", "Shape without an XShape?");
+                if (!xShape.is())
+                    continue;
 
-                        ShapeExport aExport(XML_cdr, pDrawing, nullptr, GetFB(), GetDocumentType());
-                        aExport.WriteShape(xShape);
-                    }
-                    pDrawing->endElement(FSNS(XML_cdr, XML_relSizeAnchor));
+                // TODO: absSizeAnchor: we import both (absSizeAnchor and relSizeAnchor), but there is no essential difference between them.
+                pDrawing->startElement(FSNS(XML_cdr, XML_relSizeAnchor));
+                uno::Reference< beans::XPropertySet > xShapeProperties(xShape, uno::UNO_QUERY);
+                if( xShapeProperties.is() )
+                {
+                    Reference<embed::XVisualObject> xVisObject(mxChartModel, uno::UNO_QUERY);
+                    awt::Size aPageSize = xVisObject->getVisualAreaSize(embed::Aspects::MSOLE_CONTENT);
+                    WriteFromTo( xShape, aPageSize, pDrawing );
+
+                    ShapeExport aExport(XML_cdr, pDrawing, nullptr, GetFB(), GetDocumentType());
+                    aExport.WriteShape(xShape);
                 }
-                pDrawing->endElement(FSNS(XML_c, XML_userShapes));
+                pDrawing->endElement(FSNS(XML_cdr, XML_relSizeAnchor));
             }
+            pDrawing->endElement(FSNS(XML_c, XML_userShapes));
         }
-        catch (const uno::Exception&)
-        {
-            TOOLS_INFO_EXCEPTION("xmloff.chart", "AdditionalShapes not found");
-        }
+    }
+    catch (const uno::Exception&)
+    {
+        TOOLS_INFO_EXCEPTION("xmloff.chart", "AdditionalShapes not found");
     }
 }
 
diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx
index e09bd084e7f3..464c7e4a51dd 100644
--- a/sc/source/filter/oox/autofilterbuffer.cxx
+++ b/sc/source/filter/oox/autofilterbuffer.cxx
@@ -725,63 +725,63 @@ void AutoFilter::finalizeImport( const Reference< XDatabaseRange >& rxDatabaseRa
     aDescProps.setProperty( PROP_UseRegularExpressions, bUseRegExp );
 
     // sort
-    if (!maSortConditions.empty())
-    {
-        const SortConditionVector::value_type& xSortConditionPointer = *maSortConditions.begin();
-        const SortCondition& rSorConditionLoaded = *xSortConditionPointer;
+    if (maSortConditions.empty())
+        return;
+
+    const SortConditionVector::value_type& xSortConditionPointer = *maSortConditions.begin();
+    const SortCondition& rSorConditionLoaded = *xSortConditionPointer;
 
-        ScSortParam aParam;
-        aParam.bUserDef = false;
-        aParam.nUserIndex = 0;
-        aParam.bByRow = false;
+    ScSortParam aParam;
+    aParam.bUserDef = false;
+    aParam.nUserIndex = 0;
+    aParam.bByRow = false;
 
-        ScUserList* pUserList = ScGlobal::GetUserList();
-        if (!rSorConditionLoaded.maSortCustomList.isEmpty())
+    ScUserList* pUserList = ScGlobal::GetUserList();
+    if (!rSorConditionLoaded.maSortCustomList.isEmpty())
+    {
+        for (size_t i=0; pUserList && i < pUserList->size(); i++)
         {
-            for (size_t i=0; pUserList && i < pUserList->size(); i++)
+            const OUString aEntry((*pUserList)[i].GetString());
+            if (aEntry.equalsIgnoreAsciiCase(rSorConditionLoaded.maSortCustomList))
             {
-                const OUString aEntry((*pUserList)[i].GetString());
-                if (aEntry.equalsIgnoreAsciiCase(rSorConditionLoaded.maSortCustomList))
-                {
-                    aParam.bUserDef = true;
-                    aParam.nUserIndex = i;
-                    break;
-                }
+                aParam.bUserDef = true;
+                aParam.nUserIndex = i;
+                break;
             }
         }
+    }
 
-        if (!aParam.bUserDef)
-        {
-            pUserList->push_back(new ScUserListData(rSorConditionLoaded.maSortCustomList));
-            aParam.bUserDef = true;
-            aParam.nUserIndex = pUserList->size()-1;
-        }
+    if (!aParam.bUserDef)
+    {
+        pUserList->push_back(new ScUserListData(rSorConditionLoaded.maSortCustomList));
+        aParam.bUserDef = true;
+        aParam.nUserIndex = pUserList->size()-1;
+    }
 
-        // set sort parameter if we have detected it
-        if (aParam.bUserDef)
+    // set sort parameter if we have detected it
+    if (aParam.bUserDef)
+    {
+        SCCOLROW nStartPos = aParam.bByRow ? maRange.aStart.Col() : maRange.aStart.Row();
+        if (rSorConditionLoaded.mbDescending)
         {
-            SCCOLROW nStartPos = aParam.bByRow ? maRange.aStart.Col() : maRange.aStart.Row();
-            if (rSorConditionLoaded.mbDescending)
-            {
-                // descending sort - need to enable 1st SortParam slot
-                assert(aParam.GetSortKeyCount() == DEFSORT);
+            // descending sort - need to enable 1st SortParam slot
+            assert(aParam.GetSortKeyCount() == DEFSORT);
 
-                aParam.maKeyState[0].bDoSort = true;
-                aParam.maKeyState[0].bAscending = false;
-                aParam.maKeyState[0].nField += nStartPos;
-            }
+            aParam.maKeyState[0].bDoSort = true;
+            aParam.maKeyState[0].bAscending = false;
+            aParam.maKeyState[0].nField += nStartPos;
+        }
 
-            ScDocument& rDoc = getScDocument();
-            ScDBData* pDBData = rDoc.GetDBAtArea(
-                nSheet,
-                maRange.aStart.Col(), maRange.aStart.Row(),
-                maRange.aEnd.Col(), maRange.aEnd.Row());
+        ScDocument& rDoc = getScDocument();
+        ScDBData* pDBData = rDoc.GetDBAtArea(
+            nSheet,
+            maRange.aStart.Col(), maRange.aStart.Row(),
+            maRange.aEnd.Col(), maRange.aEnd.Row());
 
-            if (pDBData)
-                pDBData->SetSortParam(aParam);
-            else
-                OSL_FAIL("AutoFilter::finalizeImport(): cannot find matching DBData");
-        }
+        if (pDBData)
+            pDBData->SetSortParam(aParam);
+        else
+            OSL_FAIL("AutoFilter::finalizeImport(): cannot find matching DBData");
     }
 }
 
diff --git a/sc/source/filter/oox/querytablebuffer.cxx b/sc/source/filter/oox/querytablebuffer.cxx
index b6614068c2ff..0f561c5ab629 100644
--- a/sc/source/filter/oox/querytablebuffer.cxx
+++ b/sc/source/filter/oox/querytablebuffer.cxx
@@ -241,7 +241,10 @@ void QueryTable::finalizeImport()
 
     // find tables mode: entire document, all tables, or specific tables
     OUString aTables = pWebPr->mbHtmlTables ? lclBuildWebQueryTables( pWebPr->maTables ) : "HTML_all";
-    if( !aTables.isEmpty() ) try
+    if( aTables.isEmpty() )
+        return;
+
+    try
     {
         PropertySet aDocProps( getDocument() );
         Reference< XAreaLinks > xAreaLinks( aDocProps.getAnyProperty( PROP_AreaLinks ), UNO_QUERY_THROW );
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 926157e71d83..c7beb52ed9e6 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -995,34 +995,34 @@ void ScInputBarGroup::DecrementVerticalSize()
 
 void ScInputWindow::MenuHdl(std::string_view command)
 {
-    if (!command.empty())
-    {
-        bool bSubTotal = false;
-        bool bRangeFinder = false;
-        OpCode eCode = ocSum;
-        if ( command ==  "sum" )
-        {
-            eCode = ocSum;
-        }
-        else if ( command == "average" )
-        {
-            eCode = ocAverage;
-        }
-        else if ( command == "max" )
-        {
-            eCode = ocMax;
-        }
-        else if ( command == "min" )
-        {
-            eCode = ocMin;
-        }
-        else if ( command == "count" )
-        {
-            eCode = ocCount;
-        }
+    if (command.empty())
+        return;
 
-        AutoSum( bRangeFinder, bSubTotal, eCode );
+    bool bSubTotal = false;
+    bool bRangeFinder = false;
+    OpCode eCode = ocSum;
+    if ( command ==  "sum" )
+    {
+        eCode = ocSum;
+    }
+    else if ( command == "average" )
+    {
+        eCode = ocAverage;
     }
+    else if ( command == "max" )
+    {
+        eCode = ocMax;
+    }
+    else if ( command == "min" )
+    {
+        eCode = ocMin;
+    }
+    else if ( command == "count" )
+    {
+        eCode = ocCount;
+    }
+
+    AutoSum( bRangeFinder, bSubTotal, eCode );
 }
 
 IMPL_LINK_NOARG(ScInputWindow, DropdownClickHdl, ToolBox *, void)
@@ -1340,31 +1340,31 @@ int ScTextWnd::GetEditEngTxtHeight() const
 
 void ScTextWnd::SetScrollBarRange()
 {
-    if (m_xEditView)
-    {
-        OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
-        Size aOutputSize = rDevice.GetOutputSize();
+    if (!m_xEditView)
+        return;
 
-        int nUpper = GetEditEngTxtHeight();
-        int nCurrentDocPos = m_xEditView->GetVisArea().Top();
-        int nStepIncrement = GetTextHeight();
-        int nPageIncrement = aOutputSize.Height();
-        int nPageSize = aOutputSize.Height();
+    OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
+    Size aOutputSize = rDevice.GetOutputSize();
 
-        /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
-           effectively...
+    int nUpper = GetEditEngTxtHeight();
+    int nCurrentDocPos = m_xEditView->GetVisArea().Top();
+    int nStepIncrement = GetTextHeight();
+    int nPageIncrement = aOutputSize.Height();
+    int nPageSize = aOutputSize.Height();
 
-           lower = gtk_adjustment_get_lower
-           upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size
+    /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
+       effectively...
 
-           and requires that upper > lower or the deceleration animation never ends
-        */
-        nPageSize = std::min(nPageSize, nUpper);
+       lower = gtk_adjustment_get_lower
+       upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size
 
-        weld::ScrolledWindow& rVBar = mrGroupBar.GetScrollWin();
-        rVBar.vadjustment_configure(nCurrentDocPos, 0, nUpper,
-                                    nStepIncrement, nPageIncrement, nPageSize);
-    }
+       and requires that upper > lower or the deceleration animation never ends
+    */
+    nPageSize = std::min(nPageSize, nUpper);
+
+    weld::ScrolledWindow& rVBar = mrGroupBar.GetScrollWin();
+    rVBar.vadjustment_configure(nCurrentDocPos, 0, nUpper,
+                                nStepIncrement, nPageIncrement, nPageSize);
 }
 
 void ScTextWnd::DoScroll()
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 44f64b8bc4a7..201313f0e41e 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1395,17 +1395,18 @@ void ScCheckListMenuControl::launch(const tools::Rectangle& rRect)
 void ScCheckListMenuControl::NotifyCloseLOK()
 {
     VclPtr<vcl::Window> aNotifierWindow = mxFrame->GetParentWithLOKNotifier();
-    if (aNotifierWindow) {
-        const vcl::ILibreOfficeKitNotifier* pNotifier = aNotifierWindow->GetLOKNotifier();
-        if (pNotifier)
-        {
-            tools::JsonWriter aJsonWriter;
-            aJsonWriter.put("jsontype", "autofilter");
-            aJsonWriter.put("action", "close");
+    if (!aNotifierWindow)
+        return;
 
-            const std::string message = aJsonWriter.extractAsStdString();
-            pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str());
-        }
+    const vcl::ILibreOfficeKitNotifier* pNotifier = aNotifierWindow->GetLOKNotifier();
+    if (pNotifier)
+    {
+        tools::JsonWriter aJsonWriter;
+        aJsonWriter.put("jsontype", "autofilter");
+        aJsonWriter.put("action", "close");
+
+        const std::string message = aJsonWriter.extractAsStdString();
+        pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str());
     }
 }
 
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index b5acbc6cdb60..4b8c2e1396be 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -590,19 +590,19 @@ IMPL_LINK(ScTpSubTotalOptions, CheckHdl, weld::Button&, rBox, void)
 
 IMPL_LINK(ScTpSubTotalGroup, CheckBoxHdl, weld::Button&, rBox, void)
 {
-    if (&rBox == mxLbSelectAllColumns.get())
-    {
-        bool bChecked = mxLbSelectAllColumns->get_active();
+    if (&rBox != mxLbSelectAllColumns.get())
+        return;
 
-        mxLbColumns->all_foreach([&](const weld::TreeIter& rEntry) {
-            if ( bChecked )
-                mxLbColumns->set_toggle(rEntry, TRISTATE_TRUE);
-            else
-                mxLbColumns->set_toggle(rEntry, TRISTATE_FALSE);
+    bool bChecked = mxLbSelectAllColumns->get_active();
 
-            return false;
-        });
-    }
+    mxLbColumns->all_foreach([&](const weld::TreeIter& rEntry) {
+        if ( bChecked )
+            mxLbColumns->set_toggle(rEntry, TRISTATE_TRUE);
+        else
+            mxLbColumns->set_toggle(rEntry, TRISTATE_FALSE);
+
+        return false;
+    });
 }
 
 ScTpSubTotalGroup1::~ScTpSubTotalGroup1()
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index 1b2ef3240c1e..22f28e52efe8 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -311,69 +311,69 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet )      // disable functions
 
 static void setupFillColorForChart(SfxViewShell* pShell, SfxItemSet& rSet)
 {
-    if (pShell)
+    if (!pShell)
+        return;
+
+    SfxInPlaceClient* pIPClient = pShell->GetIPClient();
+    if (!pIPClient)
+        return;
+
+    const css::uno::Reference<::css::embed::XEmbeddedObject>& xEmbObj = pIPClient->GetObject();
+    if( !xEmbObj.is() )
+        return;
+
+    ::css::uno::Reference<::css::chart2::XChartDocument> xChart( xEmbObj->getComponent(), uno::UNO_QUERY );
+    if( !xChart.is() )
+        return;
+
+    css::uno::Reference<css::beans::XPropertySet> xPropSet = xChart->getPageBackground();
+    if (!xPropSet.is())
+        return;
+
+    css::uno::Reference<css::beans::XPropertySetInfo> xInfo(xPropSet->getPropertySetInfo());
+    if (!xInfo.is())
+        return;
+
+    if (xInfo->hasPropertyByName("FillColor"))
     {
-        SfxInPlaceClient* pIPClient = pShell->GetIPClient();
-        if (pIPClient)
-        {
-            const css::uno::Reference<::css::embed::XEmbeddedObject>& xEmbObj = pIPClient->GetObject();
-            if( xEmbObj.is() )
-            {
-                ::css::uno::Reference<::css::chart2::XChartDocument> xChart( xEmbObj->getComponent(), uno::UNO_QUERY );
-                if( xChart.is() )
-                {
-                    css::uno::Reference<css::beans::XPropertySet> xPropSet = xChart->getPageBackground();
-                    if (xPropSet.is())
-                    {
-                        css::uno::Reference<css::beans::XPropertySetInfo> xInfo(xPropSet->getPropertySetInfo());
-                        if (xInfo.is())
-                        {
-                            if (xInfo->hasPropertyByName("FillColor"))
-                            {
-                                sal_uInt32 nFillColor = 0;
-                                xPropSet->getPropertyValue("FillColor") >>= nFillColor;
-
-                                XFillColorItem aFillColorItem("", Color(ColorTransparency, nFillColor));
-                                rSet.Put(aFillColorItem);
-
-                                if (comphelper::LibreOfficeKit::isActive())
-                                    pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
-                                            (".uno:FillColor=" + std::to_string(nFillColor)).c_str());
-                            }
-
-                            if (comphelper::LibreOfficeKit::isActive() && xInfo->hasPropertyByName("FillGradientName"))
-                            {
-                                OUString aGradientName;
-                                xPropSet->getPropertyValue("FillGradientName") >>= aGradientName;
-
-                                ::css::uno::Reference< ::css::frame::XController > xChartController = xChart->getCurrentController();
-                                if( xChartController.is() )
-                                {
-                                    css::uno::Reference<css::lang::XMultiServiceFactory> xFact(xChartController->getModel(), css::uno::UNO_QUERY);
-
-                                    if (xFact.is())
-                                    {
-                                        css::uno::Reference<css::container::XNameAccess> xNameAccess(
-                                            xFact->createInstance("com.sun.star.drawing.GradientTable"), css::uno::UNO_QUERY);
-
-                                        if (xNameAccess.is() && xNameAccess->hasByName(aGradientName))
-                                        {
-                                            css::uno::Any aAny = xNameAccess->getByName(aGradientName);
-
-                                            XFillGradientItem aItem;
-                                            aItem.SetName(aGradientName);
-                                            aItem.PutValue(aAny, MID_FILLGRADIENT);
-
-                                            rSet.Put(aItem);
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
+        sal_uInt32 nFillColor = 0;
+        xPropSet->getPropertyValue("FillColor") >>= nFillColor;
+
+        XFillColorItem aFillColorItem("", Color(ColorTransparency, nFillColor));
+        rSet.Put(aFillColorItem);
+
+        if (comphelper::LibreOfficeKit::isActive())
+            pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                    (".uno:FillColor=" + std::to_string(nFillColor)).c_str());
+    }
+
+    if (!(comphelper::LibreOfficeKit::isActive() && xInfo->hasPropertyByName("FillGradientName")))
+        return;
+
+    OUString aGradientName;
+    xPropSet->getPropertyValue("FillGradientName") >>= aGradientName;
+
+    ::css::uno::Reference< ::css::frame::XController > xChartController = xChart->getCurrentController();
+    if( !xChartController.is() )
+        return;
+
+    css::uno::Reference<css::lang::XMultiServiceFactory> xFact(xChartController->getModel(), css::uno::UNO_QUERY);
+
+    if (!xFact.is())
+        return;
+
+    css::uno::Reference<css::container::XNameAccess> xNameAccess(
+        xFact->createInstance("com.sun.star.drawing.GradientTable"), css::uno::UNO_QUERY);
+
+    if (xNameAccess.is() && xNameAccess->hasByName(aGradientName))
+    {
+        css::uno::Any aAny = xNameAccess->getByName(aGradientName);
+
+        XFillGradientItem aItem;
+        aItem.SetName(aGradientName);
+        aItem.PutValue(aAny, MID_FILLGRADIENT);
+
+        rSet.Put(aItem);
     }
 }
 
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index 9e412449917c..30ab23371d2f 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -600,23 +600,23 @@ void FuText::SetInEditMode(SdrObject* pObj, const Point* pMousePixel,
         return;
 
     OutlinerView* pOLV = pView->GetTextEditOutlinerView();
-    if (pOLV)
-    {
-        if ( pMousePixel )
-        {
-            MouseEvent aEditEvt( *pMousePixel, 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0 );
-            pOLV->MouseButtonDown(aEditEvt);
-            pOLV->MouseButtonUp(aEditEvt);
-        }
-        else if ( bCursorToEnd )
-        {
-            ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
-            pOLV->SetSelection(aNewSelection);
-        }
+    if (!pOLV)
+        return;
 
-        if ( pInitialKey )
-            pOLV->PostKeyEvent( *pInitialKey );
+    if ( pMousePixel )
+    {
+        MouseEvent aEditEvt( *pMousePixel, 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0 );
+        pOLV->MouseButtonDown(aEditEvt);
+        pOLV->MouseButtonUp(aEditEvt);
     }
+    else if ( bCursorToEnd )
+    {
+        ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
+        pOLV->SetSelection(aNewSelection);
+    }
+
+    if ( pInitialKey )
+        pOLV->PostKeyEvent( *pInitialKey );
 }
 
 // Create default drawing objects via keyboard
diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx
index 4e79f8d337f9..052245ac15fd 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -616,43 +616,43 @@ IMPL_LINK(AnnotationTag, WindowEventHandler, VclWindowEvent&, rEvent, void)
         if( !pWindow )
             return;
 
-        if( pWindow == mpListenWindow )
+        if( pWindow != mpListenWindow )
+            return;
+
+        switch( rEvent.GetId() )
         {
-            switch( rEvent.GetId() )
+        case VclEventId::WindowMouseButtonUp:
             {
-            case VclEventId::WindowMouseButtonUp:
-                {
-                    // if we stop pressing the button without a mouse move we open the popup
-                    mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
-                    mpListenWindow = nullptr;
-                    if( !mpAnnotationWindow )
-                        OpenPopup(false);
-                }
-                break;
-            case VclEventId::WindowMouseMove:
-                {
-                    // if we move the mouse after a button down we want to start dragging
-                    mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
-                    mpListenWindow = nullptr;
+                // if we stop pressing the button without a mouse move we open the popup
+                mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+                mpListenWindow = nullptr;
+                if( !mpAnnotationWindow )
+                    OpenPopup(false);
+            }
+            break;
+        case VclEventId::WindowMouseMove:
+            {
+                // if we move the mouse after a button down we want to start dragging
+                mpListenWindow->RemoveEventListener( LINK(this, AnnotationTag, WindowEventHandler));
+                mpListenWindow = nullptr;
 
-                    SdrHdl* pHdl = mrView.PickHandle(maMouseDownPos);
-                    if( pHdl )
-                    {
-                        mrView.BrkAction();
-                        const sal_uInt16 nDrgLog = static_cast<sal_uInt16>(pWindow->PixelToLogic(Size(DRGPIX,0)).Width());
+                SdrHdl* pHdl = mrView.PickHandle(maMouseDownPos);
+                if( pHdl )
+                {
+                    mrView.BrkAction();
+                    const sal_uInt16 nDrgLog = static_cast<sal_uInt16>(pWindow->PixelToLogic(Size(DRGPIX,0)).Width());
 
-                        rtl::Reference< AnnotationTag > xTag( this );
+                    rtl::Reference< AnnotationTag > xTag( this );
 
-                        SdrDragMethod* pDragMethod = new AnnotationDragMove( mrView, xTag );
-                        mrView.BegDragObj(maMouseDownPos, nullptr, pHdl, nDrgLog, pDragMethod );
-                    }
+                    SdrDragMethod* pDragMethod = new AnnotationDragMove( mrView, xTag );
+                    mrView.BegDragObj(maMouseDownPos, nullptr, pHdl, nDrgLog, pDragMethod );
                 }
-                break;
-            case VclEventId::ObjectDying:
-                mpListenWindow = nullptr;
-                break;
-            default: break;
             }
+            break;
+        case VclEventId::ObjectDying:
+            mpListenWindow = nullptr;
+            break;
+        default: break;
         }
 }
 
diff --git a/sd/source/ui/app/scalectrl.cxx b/sd/source/ui/app/scalectrl.cxx
index 6ab069f8a1e4..d1b8dc277fce 100644
--- a/sd/source/ui/app/scalectrl.cxx
+++ b/sd/source/ui/app/scalectrl.cxx
@@ -83,26 +83,26 @@ void SdScaleControl::Command(const CommandEvent& rCEvt)
     ::tools::Rectangle aRect(rCEvt.GetMousePosPixel(), Size(1, 1));
     weld::Window* pParent = weld::GetPopupParent(GetStatusBar(), aRect);
     OString sResult = xPopup->popup_at_rect(pParent, aRect);
-    if (!sResult.isEmpty())
-    {
-        sal_Int32 i = sResult.toUInt32();
-        sal_Int32 nX;
-        sal_Int32 nY;
-        if (i > 11)
-            nX = 1;
-        else
-            nX = aTable[(12 - i) % 12];
-        if (i > 11)
-            nY = aTable[i % 12];
-        else
-            nY = 1;
-        pDoc->SetUIScale(Fraction(nX, nY));
-
-        SfxBindings& pBindings = pViewFrame->GetBindings();
-        pBindings.Invalidate(SID_SCALE); //update statusbar
-        pBindings.Invalidate(SID_ATTR_METRIC); //update sidebar
-        pViewShellBase->UpdateBorder(true); // update ruler
-    }
+    if (sResult.isEmpty())
+        return;
+
+    sal_Int32 i = sResult.toUInt32();
+    sal_Int32 nX;
+    sal_Int32 nY;
+    if (i > 11)
+        nX = 1;
+    else
+        nX = aTable[(12 - i) % 12];
+    if (i > 11)
+        nY = aTable[i % 12];
+    else
+        nY = 1;
+    pDoc->SetUIScale(Fraction(nX, nY));
+
+    SfxBindings& pBindings = pViewFrame->GetBindings();
+    pBindings.Invalidate(SID_SCALE); //update statusbar
+    pBindings.Invalidate(SID_ATTR_METRIC); //update sidebar
+    pViewShellBase->UpdateBorder(true); // update ruler
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sdpopup.cxx b/sd/source/ui/app/sdpopup.cxx
index ebccfe8cb4c9..52a0435351de 100644
--- a/sd/source/ui/app/sdpopup.cxx
+++ b/sd/source/ui/app/sdpopup.cxx
@@ -152,19 +152,19 @@ void SdFieldPopup::Fill( LanguageType eLanguage )
 void SdFieldPopup::Execute(weld::Window* pParent, const tools::Rectangle& rRect)
 {
     OString sIdent = m_xPopup->popup_at_rect(pParent, rRect);
-    if (!sIdent.isEmpty())
+    if (sIdent.isEmpty())
+        return;
+
+    if (sIdent == "1" || sIdent == "2")
     {
-        if (sIdent == "1" || sIdent == "2")
-        {
-            m_xPopup->set_active("1", sIdent == "1");
-            m_xPopup->set_active("2", sIdent == "2");
-        }
-        else
-        {
-            int nCount = m_xPopup->n_children();
-            for (int i = 3; i < nCount; i++)
-                m_xPopup->set_active(OString::number(i), sIdent == OString::number(i));
-        }
+        m_xPopup->set_active("1", sIdent == "1");
+        m_xPopup->set_active("2", sIdent == "2");
+    }
+    else
+    {
+        int nCount = m_xPopup->n_children();
+        for (int i = 3; i < nCount; i++)
+            m_xPopup->set_active(OString::number(i), sIdent == OString::number(i));
     }
 }
 
diff --git a/sdext/source/presenter/PresenterAccessibility.cxx b/sdext/source/presenter/PresenterAccessibility.cxx
index 768f4717a48d..c57cf61c946c 100644
--- a/sdext/source/presenter/PresenterAccessibility.cxx
+++ b/sdext/source/presenter/PresenterAccessibility.cxx
@@ -1105,18 +1105,17 @@ void PresenterAccessible::AccessibleObject::UpdateState(
     const bool bValue)
 {
     const sal_uInt32 nStateMask (AccessibleStateSet::GetStateMask(nState));
-    if (((mnStateSet & nStateMask)!=0) != bValue)
+    if (((mnStateSet & nStateMask) != 0) == bValue)
+        return;
+    if (bValue)
     {
-        if (bValue)
-        {
-            mnStateSet |= nStateMask;
-            FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(), Any(nState));
-        }
-        else
-        {
-            mnStateSet &= ~nStateMask;
-            FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(nState), Any());
-        }
+        mnStateSet |= nStateMask;
+        FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(), Any(nState));
+    }
+    else
+    {
+        mnStateSet &= ~nStateMask;
+        FireAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(nState), Any());
     }
 }
 
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index ca822d0c3487..137591a43991 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -356,39 +356,39 @@ void RecentDocsView::Paint(vcl::RenderContext& rRenderContext, const tools::Rect
 {
     ThumbnailView::Paint(rRenderContext, aRect);
 
-    if (mItemList.empty())
+    if (!mItemList.empty())
+        return;
+
+    if (maWelcomeImage.IsEmpty())
     {
-        if (maWelcomeImage.IsEmpty())
-        {
-            const tools::Long aWidth(aRect.GetWidth() > aRect.getHeight() ? aRect.GetHeight()/2 : aRect.GetWidth()/2);
-            maWelcomeImage = SfxApplication::GetApplicationLogo(aWidth);
-        }
+        const tools::Long aWidth(aRect.GetWidth() > aRect.getHeight() ? aRect.GetHeight()/2 : aRect.GetWidth()/2);
+        maWelcomeImage = SfxApplication::GetApplicationLogo(aWidth);
+    }
 
-        // No recent files to be shown yet. Show a welcome screen.
-        rRenderContext.Push(PushFlags::FONT | PushFlags::TEXTCOLOR);
-        SetMessageFont(rRenderContext);
-        rRenderContext.SetTextColor(maTextColor);
+    // No recent files to be shown yet. Show a welcome screen.
+    rRenderContext.Push(PushFlags::FONT | PushFlags::TEXTCOLOR);
+    SetMessageFont(rRenderContext);
+    rRenderContext.SetTextColor(maTextColor);
 
-        tools::Long nTextHeight = rRenderContext.GetTextHeight();
+    tools::Long nTextHeight = rRenderContext.GetTextHeight();
 
-        const Size& rImgSize = maWelcomeImage.GetSizePixel();
-        const Size& rSize = GetOutputSizePixel();
+    const Size& rImgSize = maWelcomeImage.GetSizePixel();
+    const Size& rSize = GetOutputSizePixel();
 
-        const int nX = (rSize.Width() - rImgSize.Width())/2;
-        int nY = (rSize.Height() - 3 * nTextHeight - rImgSize.Height())/2;
-        Point aImgPoint(nX, nY);
-        rRenderContext.DrawBitmapEx(aImgPoint, rImgSize, maWelcomeImage);
+    const int nX = (rSize.Width() - rImgSize.Width())/2;
+    int nY = (rSize.Height() - 3 * nTextHeight - rImgSize.Height())/2;
+    Point aImgPoint(nX, nY);
+    rRenderContext.DrawBitmapEx(aImgPoint, rImgSize, maWelcomeImage);
 
-        nY = nY + rImgSize.Height();
-        rRenderContext.DrawText(tools::Rectangle(0, nY + 1 * nTextHeight, rSize.Width(), nY + nTextHeight),
-                                maWelcomeLine1,
-                                DrawTextFlags::Center);
-        rRenderContext.DrawText(tools::Rectangle(0, nY + 2 * nTextHeight, rSize.Width(), rSize.Height()),
-                                maWelcomeLine2,
-                                DrawTextFlags::MultiLine | DrawTextFlags::WordBreak | DrawTextFlags::Center);
+    nY = nY + rImgSize.Height();
+    rRenderContext.DrawText(tools::Rectangle(0, nY + 1 * nTextHeight, rSize.Width(), nY + nTextHeight),
+                            maWelcomeLine1,
+                            DrawTextFlags::Center);
+    rRenderContext.DrawText(tools::Rectangle(0, nY + 2 * nTextHeight, rSize.Width(), rSize.Height()),
+                            maWelcomeLine2,
+                            DrawTextFlags::MultiLine | DrawTextFlags::WordBreak | DrawTextFlags::Center);
 
-        rRenderContext.Pop();
-    }
+    rRenderContext.Pop();
 }
 
 void RecentDocsView::LoseFocus()
diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
index b56cb02cdb30..a57021b37a19 100644
--- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
+++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
@@ -1087,39 +1087,39 @@ IMPL_LINK(ObjectInspectorTreeHandler, NotebookEnterPage, const OString&, rPageId
     mpObjectInspectorWidgets->mpTextView->hide();
 
     uno::Any aAny = maInspectionStack.back();
-    if (aAny.hasValue())
+    if (!aAny.hasValue())
+        return;
+
+    uno::Reference<uno::XInterface> xInterface(aAny, uno::UNO_QUERY);
+    if (rPageId == "object_inspector_interfaces_tab")
     {
-        uno::Reference<uno::XInterface> xInterface(aAny, uno::UNO_QUERY);
-        if (rPageId == "object_inspector_interfaces_tab")
-        {
-            mpObjectInspectorWidgets->mpInterfacesTreeView->freeze();
-            clearAll(mpObjectInspectorWidgets->mpInterfacesTreeView);
-            appendInterfaces(xInterface);
-            mpObjectInspectorWidgets->mpInterfacesTreeView->thaw();
-        }
-        else if (rPageId == "object_inspector_services_tab")
-        {
-            mpObjectInspectorWidgets->mpServicesTreeView->freeze();
-            clearAll(mpObjectInspectorWidgets->mpServicesTreeView);
-            appendServices(xInterface);
-            mpObjectInspectorWidgets->mpServicesTreeView->thaw();
-        }
-        else if (rPageId == "object_inspector_properties_tab")
-        {
-            mbPanedResetSize = true;
-            mpObjectInspectorWidgets->mpPropertiesTreeView->freeze();
-            clearAll(mpObjectInspectorWidgets->mpPropertiesTreeView);
-            appendProperties(xInterface);
-            mpObjectInspectorWidgets->mpPropertiesTreeView->thaw();
-            mpObjectInspectorWidgets->mpTextView->show();
-        }
-        else if (rPageId == "object_inspector_methods_tab")
-        {
-            mpObjectInspectorWidgets->mpMethodsTreeView->freeze();
-            clearAll(mpObjectInspectorWidgets->mpMethodsTreeView);
-            appendMethods(xInterface);
-            mpObjectInspectorWidgets->mpMethodsTreeView->thaw();
-        }
+        mpObjectInspectorWidgets->mpInterfacesTreeView->freeze();
+        clearAll(mpObjectInspectorWidgets->mpInterfacesTreeView);
+        appendInterfaces(xInterface);
+        mpObjectInspectorWidgets->mpInterfacesTreeView->thaw();
+    }
+    else if (rPageId == "object_inspector_services_tab")
+    {
+        mpObjectInspectorWidgets->mpServicesTreeView->freeze();
+        clearAll(mpObjectInspectorWidgets->mpServicesTreeView);
+        appendServices(xInterface);
+        mpObjectInspectorWidgets->mpServicesTreeView->thaw();
+    }
+    else if (rPageId == "object_inspector_properties_tab")
+    {
+        mbPanedResetSize = true;
+        mpObjectInspectorWidgets->mpPropertiesTreeView->freeze();
+        clearAll(mpObjectInspectorWidgets->mpPropertiesTreeView);
+        appendProperties(xInterface);
+        mpObjectInspectorWidgets->mpPropertiesTreeView->thaw();
+        mpObjectInspectorWidgets->mpTextView->show();
+    }
+    else if (rPageId == "object_inspector_methods_tab")
+    {
+        mpObjectInspectorWidgets->mpMethodsTreeView->freeze();
+        clearAll(mpObjectInspectorWidgets->mpMethodsTreeView);
+        appendMethods(xInterface);
+        mpObjectInspectorWidgets->mpMethodsTreeView->thaw();
     }
 }
 
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index f5d5cd441831..8eaca3d639f2 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -448,23 +448,23 @@ uno::Reference<security::XCertificate> SfxObjectShell::GetSignPDFCertificate() c
 
 static void sendErrorToLOK(ErrCode error)
 {
-    if (error.GetClass() != ErrCodeClass::NONE)
-    {
-        boost::property_tree::ptree aTree;
-        aTree.put("code", error);
-        aTree.put("kind", "");
-        aTree.put("cmd", "");
+    if (error.GetClass() == ErrCodeClass::NONE)
+        return;
 
-        std::unique_ptr<ErrorInfo> pInfo = ErrorInfo::GetErrorInfo(error);
-        OUString aErr;
-        if (ErrorStringFactory::CreateString(pInfo.get(), aErr))
-            aTree.put("message", aErr.toUtf8());
+    boost::property_tree::ptree aTree;
+    aTree.put("code", error);
+    aTree.put("kind", "");
+    aTree.put("cmd", "");
 
-        std::stringstream aStream;
-        boost::property_tree::write_json(aStream, aTree);
+    std::unique_ptr<ErrorInfo> pInfo = ErrorInfo::GetErrorInfo(error);
+    OUString aErr;
+    if (ErrorStringFactory::CreateString(pInfo.get(), aErr))
+        aTree.put("message", aErr.toUtf8());
 
-        SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, aStream.str().c_str());
-    }
+    std::stringstream aStream;
+    boost::property_tree::write_json(aStream, aTree);
+
+    SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_ERROR, aStream.str().c_str());
 }
 
 void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index 3752e7df8fe4..aea8b9b651ee 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -116,22 +116,22 @@ void DeckLayouter::LayoutDeck (
         return;
     tools::Rectangle aBox(PlaceDeckTitle(pDockingWindow, rDeckTitleBar, rContentArea));
 
-    if ( ! rPanels.empty())
-    {
-        // Prepare the layout item container.
-        ::std::vector<LayoutItem> aLayoutItems;
-        aLayoutItems.reserve(rPanels.size());
-        for (auto& rPanel : rPanels)
-            aLayoutItems.emplace_back(rPanel);
+    if (  rPanels.empty())
+        return;
 
-        LayoutPanels(
-            aBox,
-            rMinimalWidth,
-            rMinimalHeight,
-            aLayoutItems,
-            rVerticalScrollBar,
-            false);
-    }
+    // Prepare the layout item container.
+    ::std::vector<LayoutItem> aLayoutItems;
+    aLayoutItems.reserve(rPanels.size());
+    for (auto& rPanel : rPanels)
+        aLayoutItems.emplace_back(rPanel);
+
+    LayoutPanels(
+        aBox,
+        rMinimalWidth,
+        rMinimalHeight,
+        aLayoutItems,
+        rVerticalScrollBar,
+        false);
 }
 
 namespace {
diff --git a/sfx2/source/sidebar/Sidebar.cxx b/sfx2/source/sidebar/Sidebar.cxx
index 2a59ad7ef163..ca48542d5403 100644
--- a/sfx2/source/sidebar/Sidebar.cxx
+++ b/sfx2/source/sidebar/Sidebar.cxx
@@ -41,22 +41,23 @@ void Sidebar::ToggleDeck(std::u16string_view rsDeckId, SfxViewFrame* pViewFrame)
     if (!bInitiallyVisible)
         pViewFrame->ShowChildWindow(SID_SIDEBAR);
 
-    if (SidebarController* pController =
-            SidebarController::GetSidebarControllerForFrame(pViewFrame->GetFrame().GetFrameInterface()))
+    SidebarController* pController =
+            SidebarController::GetSidebarControllerForFrame(pViewFrame->GetFrame().GetFrameInterface());
+    if (!pController)
+        return;
+
+    if (bInitiallyVisible && pController->IsDeckVisible(rsDeckId))
     {
-        if (bInitiallyVisible && pController->IsDeckVisible(rsDeckId))
-        {
-            // close the sidebar if it was already visible and showing this sidebar deck
-            const util::URL aURL(Tools::GetURL(".uno:Sidebar"));
-            css::uno::Reference<frame::XDispatch> xDispatch(Tools::GetDispatch(pViewFrame->GetFrame().GetFrameInterface(), aURL));
-            if (xDispatch.is())
-                xDispatch->dispatch(aURL, css::uno::Sequence<beans::PropertyValue>());
-        }
-        else
-        {
-            pController->OpenThenSwitchToDeck(rsDeckId);
-            pController->GetFocusManager().GrabFocusPanel();
-        }
+        // close the sidebar if it was already visible and showing this sidebar deck
+        const util::URL aURL(Tools::GetURL(".uno:Sidebar"));
+        css::uno::Reference<frame::XDispatch> xDispatch(Tools::GetDispatch(pViewFrame->GetFrame().GetFrameInterface(), aURL));
+        if (xDispatch.is())
+            xDispatch->dispatch(aURL, css::uno::Sequence<beans::PropertyValue>());
+    }
+    else
+    {
+        pController->OpenThenSwitchToDeck(rsDeckId);
+        pController->GetFocusManager().GrabFocusPanel();
     }
 }
 
diff --git a/slideshow/source/engine/animationfactory.cxx b/slideshow/source/engine/animationfactory.cxx
index e874b0924cd8..e5a7d3b9e74c 100644
--- a/slideshow/source/engine/animationfactory.cxx
+++ b/slideshow/source/engine/animationfactory.cxx
@@ -278,21 +278,21 @@ namespace slideshow::internal
                 virtual void end() override { end_(); }
                 void end_()
                 {
-                    if( mbAnimationStarted )
-                    {
-                        mbAnimationStarted = false;
+                    if( !mbAnimationStarted )
+                        return;
 
-                        if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) )
-                            mpShapeManager->leaveAnimationMode( mpShape );
+                    mbAnimationStarted = false;
 
-                        if( mpShape->isContentChanged() )
-                            mpShapeManager->notifyShapeUpdate( mpShape );
+                    if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) )
+                        mpShapeManager->leaveAnimationMode( mpShape );
 
-                        // if there is a physics animation going on report the animation ending
-                        // and zero out the velocity of the shape
-                        if( mpBox2DWorld->isInitialized() )
-                            mpBox2DWorld->queueLinearVelocityUpdate( mpShape->getXShape(), {0,0});
-                    }
+                    if( mpShape->isContentChanged() )
+                        mpShapeManager->notifyShapeUpdate( mpShape );
+
+                    // if there is a physics animation going on report the animation ending
+                    // and zero out the velocity of the shape
+                    if( mpBox2DWorld->isInitialized() )
+                        mpBox2DWorld->queueLinearVelocityUpdate( mpShape->getXShape(), {0,0});
                 }
 
                 // NumberAnimation interface
@@ -441,25 +441,25 @@ namespace slideshow::internal
                         mpBox2DWorld->setHasWorldStepper(false);
                     }
 
-                    if( mbAnimationStarted )
-                    {
-                        mbAnimationStarted = false;
+                    if( !mbAnimationStarted )
+                        return;
 
-                        if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) )
-                            mpShapeManager->leaveAnimationMode( mpShape );
+                    mbAnimationStarted = false;
 
-                        if( mpShape->isContentChanged() )
-                            mpShapeManager->notifyShapeUpdate( mpShape );
+                    if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) )
+                        mpShapeManager->leaveAnimationMode( mpShape );
 
-                        mpBox2DWorld->alertPhysicsAnimationEnd(mpShape);
-                        // if this was the only physics animation effect going on
-                        // all box2d bodies were destroyed on alertPhysicsAnimationEnd
-                        // except the one owned by the animation.
-                        // Try to destroy the remaining body - if it is unique
-                        // (it being unique means all physics animation effects have ended
-                        // since otherwise mpBox2DWorld would own a copy of the shared_ptr )
-                        mpBox2DBody.reset();
-                    }
+                    if( mpShape->isContentChanged() )
+                        mpShapeManager->notifyShapeUpdate( mpShape );
+
+                    mpBox2DWorld->alertPhysicsAnimationEnd(mpShape);
+                    // if this was the only physics animation effect going on
+                    // all box2d bodies were destroyed on alertPhysicsAnimationEnd
+                    // except the one owned by the animation.
+                    // Try to destroy the remaining body - if it is unique
+                    // (it being unique means all physics animation effects have ended
+                    // since otherwise mpBox2DWorld would own a copy of the shared_ptr )
+                    mpBox2DBody.reset();
 
                 }
 
diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx
index 57787dc5404a..33eb25b9b8d7 100644
--- a/starmath/source/mathml/mathmlimport.cxx
+++ b/starmath/source/mathml/mathmlimport.cxx
@@ -694,23 +694,23 @@ void SmXMLContext_Helper::ApplyAttrs()
         }
         // If not known, not implemented yet. Giving up.
     }
-    if (!sFontFamily.isEmpty())
-    {
-        if (sFontFamily.equalsIgnoreAsciiCase(GetXMLToken(XML_FIXED)))
-            aToken.eType = TFIXED;
-        else if (sFontFamily.equalsIgnoreAsciiCase("sans"))
-            aToken.eType = TSANS;
-        else if (sFontFamily.equalsIgnoreAsciiCase("serif"))
-            aToken.eType = TSERIF;
-        else //Just give up, we need to extend our font mechanism to be
-            //more general
-            return;
+    if (sFontFamily.isEmpty())
+        return;
 
-        aToken.aText = sFontFamily;
-        std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(aToken));
-        pFontNode->SetSubNodes(nullptr, popOrZero(rNodeStack));
-        rNodeStack.push_front(std::move(pFontNode));
-    }
+    if (sFontFamily.equalsIgnoreAsciiCase(GetXMLToken(XML_FIXED)))
+        aToken.eType = TFIXED;
+    else if (sFontFamily.equalsIgnoreAsciiCase("sans"))
+        aToken.eType = TSANS;
+    else if (sFontFamily.equalsIgnoreAsciiCase("serif"))
+        aToken.eType = TSERIF;
+    else //Just give up, we need to extend our font mechanism to be
+        //more general
+        return;
+
+    aToken.aText = sFontFamily;
+    std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(aToken));
+    pFontNode->SetSubNodes(nullptr, popOrZero(rNodeStack));
+    rNodeStack.push_front(std::move(pFontNode));
 }
 
 namespace
diff --git a/svtools/source/misc/sampletext.cxx b/svtools/source/misc/sampletext.cxx
index 13809a57eb12..c59f5a7a43ec 100644
--- a/svtools/source/misc/sampletext.cxx
+++ b/svtools/source/misc/sampletext.cxx
@@ -932,8 +932,10 @@ namespace
             SAL_INFO("svtools", "RESERVED3");
         if (rIn[vcl::UnicodeCoverage::RESERVED4])
             SAL_INFO("svtools", "RESERVED4");
-        if (rIn[vcl::UnicodeCoverage::RESERVED5])
-            SAL_INFO("svtools", "RESERVED5");
+        if (!(rIn[vcl::UnicodeCoverage::RESERVED5]))
+            return;
+
+        SAL_INFO("svtools", "RESERVED5");
     }
 
     void lcl_dump_codepage_coverage(const std::optional<std::bitset<vcl::CodePageCoverage::MAX_CP_ENUM>> &roIn)
@@ -1009,8 +1011,10 @@ namespace
             SAL_INFO("svtools", "CP780");
         if (rIn[vcl::CodePageCoverage::CP850])
             SAL_INFO("svtools", "CP850");
-        if (rIn[vcl::CodePageCoverage::CP437])
-            SAL_INFO("svtools", "CP437");
+        if (!(rIn[vcl::CodePageCoverage::CP437]))
+            return;
+
+        SAL_INFO("svtools", "CP437");
     }
 #endif
 
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
index 87fe7fa79b39..b38317f5c579 100644
--- a/svx/source/items/numfmtsh.cxx
+++ b/svx/source/items/numfmtsh.cxx
@@ -192,21 +192,21 @@ void SvxNumberFormatShell::LanguageChanged(LanguageType eLangType, short& rFmtSe
 void SvxNumberFormatShell::FormatChanged(sal_uInt16 nFmtLbPos, OUString& rPreviewStr,
                                          const Color*& rpFontColor)
 {
-    if (static_cast<size_t>(nFmtLbPos) < aCurEntryList.size())
-    {
-        nCurFormatKey = aCurEntryList[nFmtLbPos];
+    if (static_cast<size_t>(nFmtLbPos) >= aCurEntryList.size())
+        return;
 
-        if (nCurFormatKey != NUMBERFORMAT_ENTRY_NOT_FOUND)
-        {
-            GetPreviewString_Impl(rPreviewStr, rpFontColor);
-        }
-        else if (nCurCategory == SvNumFormatType::CURRENCY)
+    nCurFormatKey = aCurEntryList[nFmtLbPos];
+
+    if (nCurFormatKey != NUMBERFORMAT_ENTRY_NOT_FOUND)
+    {
+        GetPreviewString_Impl(rPreviewStr, rpFontColor);
+    }
+    else if (nCurCategory == SvNumFormatType::CURRENCY)
+    {
+        if (static_cast<size_t>(nFmtLbPos) < aCurrencyFormatList.size())
         {
-            if (static_cast<size_t>(nFmtLbPos) < aCurrencyFormatList.size())
-            {
-                MakePrevStringFromVal(aCurrencyFormatList[nFmtLbPos], rPreviewStr, rpFontColor,
-                                      nValNum);
-            }
+            MakePrevStringFromVal(aCurrencyFormatList[nFmtLbPos], rPreviewStr, rpFontColor,
+                                  nValNum);
         }
     }
 }
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 71272cb85a20..8b4dccd1c2e0 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1788,25 +1788,25 @@ void SdrObject::SetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> pTextO
         SendUserCall(SdrUserCallType::Resize,aBoundRect0);
     }
 
-    if (getSdrModelFromSdrObject().IsUndoEnabled())
+    if (!getSdrModelFromSdrObject().IsUndoEnabled())
+        return;
+
+    // Don't do this during import.
+    SdrObject* pTopGroupObj = nullptr;
+    if (getParentSdrObjectFromSdrObject())
     {
-        // Don't do this during import.
-        SdrObject* pTopGroupObj = nullptr;
-        if (getParentSdrObjectFromSdrObject())
-        {
-            pTopGroupObj = getParentSdrObjectFromSdrObject();
-            while (pTopGroupObj->getParentSdrObjectFromSdrObject())
-            {
-                pTopGroupObj = pTopGroupObj->getParentSdrObjectFromSdrObject();
-            }
-        }
-        if (pTopGroupObj)
+        pTopGroupObj = getParentSdrObjectFromSdrObject();
+        while (pTopGroupObj->getParentSdrObjectFromSdrObject())
         {
-            // A shape was modified, which is in a group shape. Empty the group shape's grab-bag,
-            // which potentially contains the old text of the shapes in case of diagrams.
-            pTopGroupObj->SetGrabBagItem(uno::makeAny(uno::Sequence<beans::PropertyValue>()));
+            pTopGroupObj = pTopGroupObj->getParentSdrObjectFromSdrObject();
         }
     }
+    if (pTopGroupObj)
+    {
+        // A shape was modified, which is in a group shape. Empty the group shape's grab-bag,
+        // which potentially contains the old text of the shapes in case of diagrams.
+        pTopGroupObj->SetGrabBagItem(uno::makeAny(uno::Sequence<beans::PropertyValue>()));
+    }
 }
 
 void SdrObject::NbcSetOutlinerParaObject(std::unique_ptr<OutlinerParaObject> /*pTextObject*/)
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 3e11292b40f1..15f612c1f4e7 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -726,28 +726,28 @@ SdrOle2Obj::SdrOle2Obj(SdrModel& rSdrModel, SdrOle2Obj const & rSource)
         mpImpl->mxGraphic.reset(new Graphic(*rSource.mpImpl->mxGraphic));
     }
 
-    if( !IsEmptyPresObj() )
-    {
-        ::comphelper::IEmbeddedHelper* pDestPers(getSdrModelFromSdrObject().GetPersist());
-        ::comphelper::IEmbeddedHelper* pSrcPers(rSource.getSdrModelFromSdrObject().GetPersist());
-        if( pDestPers && pSrcPers )
-        {
-            DBG_ASSERT( !mpImpl->mxObjRef.is(), "Object already existing!" );
-            comphelper::EmbeddedObjectContainer& rContainer = pSrcPers->getEmbeddedObjectContainer();
-            uno::Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( mpImpl->aPersistName );
-            if ( xObj.is() )
-            {
-                OUString aTmp;
-                mpImpl->mxObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject(
-                    rContainer, xObj, aTmp, pSrcPers->getDocumentBaseURL(), pDestPers->getDocumentBaseURL()), rSource.GetAspect());
-                mpImpl->mbTypeAsked = false;
-                mpImpl->aPersistName = aTmp;
-                CheckFileLink_Impl();
-            }
+    if( IsEmptyPresObj() )
+        return;
 
-            Connect();
-        }
+    ::comphelper::IEmbeddedHelper* pDestPers(getSdrModelFromSdrObject().GetPersist());
+    ::comphelper::IEmbeddedHelper* pSrcPers(rSource.getSdrModelFromSdrObject().GetPersist());
+    if( !(pDestPers && pSrcPers) )
+        return;
+
+    DBG_ASSERT( !mpImpl->mxObjRef.is(), "Object already existing!" );
+    comphelper::EmbeddedObjectContainer& rContainer = pSrcPers->getEmbeddedObjectContainer();
+    uno::Reference < embed::XEmbeddedObject > xObj = rContainer.GetEmbeddedObject( mpImpl->aPersistName );
+    if ( xObj.is() )
+    {
+        OUString aTmp;
+        mpImpl->mxObjRef.Assign( pDestPers->getEmbeddedObjectContainer().CopyAndGetEmbeddedObject(
+            rContainer, xObj, aTmp, pSrcPers->getDocumentBaseURL(), pDestPers->getDocumentBaseURL()), rSource.GetAspect());
+        mpImpl->mbTypeAsked = false;
+        mpImpl->aPersistName = aTmp;
+        CheckFileLink_Impl();
     }
+
+    Connect();
 }
 
 SdrOle2Obj::SdrOle2Obj(
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index 82589ef9f715..071b2baf06c1 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -744,24 +744,23 @@ public:
 
         // If outline level stands for heading level...
         const int currentLevel = pTextNode->GetAttrOutlineLevel();
-        if (currentLevel)
+        if (!currentLevel)
+            return;
+
+        // ... and if is bigger than previous by more than 1, warn.
+        if (currentLevel - m_prevLevel > 1)
         {
-            // ... and if is bigger than previous by more than 1, warn.
-            if (currentLevel - m_prevLevel > 1)
-            {
-                // Preparing and posting a warning.
-                OUString resultString = SwResId(STR_HEADING_ORDER);
-                resultString
-                    = resultString.replaceAll("%LEVEL_CURRENT%", OUString::number(currentLevel));
-                resultString
-                    = resultString.replaceAll("%LEVEL_PREV%", OUString::number(m_prevLevel));
-
-                lclAddIssue(m_rIssueCollection, resultString);
-            }
+            // Preparing and posting a warning.
+            OUString resultString = SwResId(STR_HEADING_ORDER);
+            resultString
+                = resultString.replaceAll("%LEVEL_CURRENT%", OUString::number(currentLevel));
+            resultString = resultString.replaceAll("%LEVEL_PREV%", OUString::number(m_prevLevel));
 
-            // Updating previous level.
-            m_prevLevel = currentLevel;
+            lclAddIssue(m_rIssueCollection, resultString);
         }
+
+        // Updating previous level.
+        m_prevLevel = currentLevel;
     }
 
 private:
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index abe8f38d2124..9bcd522e4277 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -168,21 +168,21 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, bool bCopyText)
     // TODO: Text dialog attr setting to frame
 
     // Check if the shape had text before and move it to the new textframe
-    if (bCopyText && !sCopyableText.isEmpty())
+    if (!bCopyText || sCopyableText.isEmpty())
+        return;
+
+    auto pSdrShape = pShape->FindRealSdrObject();
+    if (pSdrShape)
     {
-        auto pSdrShape = pShape->FindRealSdrObject();
-        if (pSdrShape)
-        {
-            auto pSourceText = dynamic_cast<SdrTextObj*>(pSdrShape);
-            uno::Reference<text::XTextRange> xDestText(xRealTextFrame, uno::UNO_QUERY);
+        auto pSourceText = dynamic_cast<SdrTextObj*>(pSdrShape);
+        uno::Reference<text::XTextRange> xDestText(xRealTextFrame, uno::UNO_QUERY);
 
-            xDestText->setString(sCopyableText);
+        xDestText->setString(sCopyableText);
 
-            if (pSourceText)
-                pSourceText->SetText(OUString());
+        if (pSourceText)
+            pSourceText->SetText(OUString());
 
-            pShape->GetDoc()->getIDocumentState().SetModified();
-        }
+        pShape->GetDoc()->getIDocumentState().SetModified();
     }
 }
 
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index b13c8fe662ce..26647f2355cf 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1197,22 +1197,22 @@ void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/, bool const
     // If the Area is within a Fly or TableBox, we can only hide it if
     // there is more Content which has Frames.
     // Or else the Fly/TableBox Frame does not have a Lower!
-    if (!bForce)
+    if (bForce)
+        return;
+
+    SwNodeIndex aIdx( *this );
+    if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
+        !CheckNodesRange( *this, aIdx, true ) ||
+        // #i21457#
+        !lcl_IsInSameTableBox( rNds, *this, true ))
     {
-        SwNodeIndex aIdx( *this );
-        if( !SwNodes::GoPrevSection( &aIdx, true, false ) ||
-            !CheckNodesRange( *this, aIdx, true ) ||
+        aIdx = *EndOfSectionNode();
+        if( !rNds.GoNextSection( &aIdx, true, false ) ||
+            !CheckNodesRange( *EndOfSectionNode(), aIdx, true ) ||
             // #i21457#
-            !lcl_IsInSameTableBox( rNds, *this, true ))
+            !lcl_IsInSameTableBox( rNds, *EndOfSectionNode(), false ))
         {
-            aIdx = *EndOfSectionNode();
-            if( !rNds.GoNextSection( &aIdx, true, false ) ||
-                !CheckNodesRange( *EndOfSectionNode(), aIdx, true ) ||
-                // #i21457#
-                !lcl_IsInSameTableBox( rNds, *EndOfSectionNode(), false ))
-            {
-                m_pSection->m_Data.SetHiddenFlag(false);
-            }
+            m_pSection->m_Data.SetHiddenFlag(false);
         }
     }
 }
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 7d152920af9a..38582a4143e3 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -405,23 +405,23 @@ public:
     MakeAllOutlineContentTemporarilyVisibile(SwWrtShell* pShell)
         : pWrtShell(pShell)
     {
-        if (pWrtShell && pWrtShell->GetViewOptions() && pWrtShell->GetViewOptions()->IsShowOutlineContentVisibilityButton())
+        if (!(pWrtShell && pWrtShell->GetViewOptions() && pWrtShell->GetViewOptions()->IsShowOutlineContentVisibilityButton()))
+            return;
+
+        // make all outlines content visible and store outline nodes having
+        // content visible attribute value false
+        SwOutlineNodes rOutlineNds = pWrtShell->GetNodes().GetOutLineNds();
+        for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNds.size(); ++nPos)
         {
-            // make all outlines content visible and store outline nodes having
-            // content visible attribute value false
-            SwOutlineNodes rOutlineNds = pWrtShell->GetNodes().GetOutLineNds();
-            for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNds.size(); ++nPos)
+            SwNode* pNd = rOutlineNds[nPos];
+            if (pNd->IsTextNode()) // should always be true
             {
-                SwNode* pNd = rOutlineNds[nPos];
-                if (pNd->IsTextNode()) // should always be true
+                bool bOutlineContentVisibleAttr = true;
+                pNd->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr);
+                if (!bOutlineContentVisibleAttr)
                 {
-                    bool bOutlineContentVisibleAttr = true;
-                    pNd->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr);

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list