[Libreoffice-commits] core.git: 6 commits - comphelper/source compilerplugins/clang dbaccess/source filter/source icon-themes/tango package/source reportdesign/source sdext/source sd/source sfx2/source shell/source solenv/CompilerTest_compilerplugins_clang.mk starmath/source stoc/source svl/source svtools/source svx/source sw/uiconfig ucb/source vcl/inc vcl/source

Takeshi Abe tabe at fixedpoint.jp
Sat Sep 23 08:34:42 UTC 2017


 comphelper/source/property/propagg.cxx                 |  148 +--
 compilerplugins/clang/flatten.cxx                      |   15 
 compilerplugins/clang/test/unnecessarycatchthrow.cxx   |   35 
 compilerplugins/clang/unnecessarycatchthrow.cxx        |   79 ++
 dbaccess/source/core/api/tablecontainer.cxx            |   86 --
 dbaccess/source/ui/misc/linkeddocuments.cxx            |   20 
 filter/source/config/cache/filtercache.cxx             |   20 
 icon-themes/tango/cmd/lc_defaultcharstyle.png          |binary
 icon-themes/tango/cmd/lc_editstyle.png                 |binary
 icon-themes/tango/cmd/lc_editstyle.xcf.bz2             |binary
 icon-themes/tango/cmd/lc_emphasischarstyle.png         |binary
 icon-themes/tango/cmd/sc_romanliststyle.png            |binary
 icon-themes/tango/links.txt                            |    5 
 package/source/zippackage/ZipPackageFolder.cxx         |   16 
 reportdesign/source/core/api/ReportDefinition.cxx      |   62 -
 reportdesign/source/core/api/ReportEngineJFree.cxx     |  172 ++--
 sd/source/ui/presenter/PresenterTextView.cxx           |   15 
 sd/source/ui/slidesorter/shell/SlideSorterService.cxx  |   48 -
 sdext/source/presenter/PresenterPaneBase.cxx           |  144 +--
 sdext/source/presenter/PresenterProtocolHandler.cxx    |   54 -
 sfx2/source/control/thumbnailviewacc.cxx               |   21 
 sfx2/source/doc/Metadatable.cxx                        |    8 
 sfx2/source/doc/SfxDocumentMetaData.cxx                |   26 
 sfx2/source/doc/guisaveas.cxx                          |   16 
 sfx2/source/doc/objserv.cxx                            |   17 
 sfx2/source/doc/printhelper.cxx                        |   19 
 sfx2/source/doc/sfxbasemodel.cxx                       |  200 ++---
 sfx2/source/sidebar/UnoDecks.cxx                       |   12 
 sfx2/source/sidebar/UnoPanels.cxx                      |   12 
 shell/source/unix/sysshell/recently_used_file.cxx      |   52 -
 solenv/CompilerTest_compilerplugins_clang.mk           |    1 
 starmath/source/unomodel.cxx                           |  108 +-
 stoc/source/corereflection/crcomp.cxx                  |   14 
 stoc/source/corereflection/crefl.cxx                   |    8 
 stoc/source/corereflection/criface.cxx                 |    5 
 stoc/source/defaultregistry/defaultregistry.cxx        |   60 -
 stoc/source/inspect/introspection.cxx                  |    5 
 stoc/source/javaloader/javaloader.cxx                  |   10 
 stoc/source/security/access_controller.cxx             |   16 
 stoc/source/typeconv/convert.cxx                       |   31 
 svl/source/misc/lockfilecommon.cxx                     |    6 
 svl/source/numbers/numfmuno.cxx                        |  654 +++++++----------
 svtools/source/control/valueacc.cxx                    |   22 
 svtools/source/uno/unoevent.cxx                        |   50 -
 svx/source/accessibility/AccessibleTextHelper.cxx      |   23 
 svx/source/accessibility/GraphCtlAccessibleContext.cxx |   42 -
 svx/source/accessibility/charmapacc.cxx                |   12 
 svx/source/table/tabledesign.cxx                       |   10 
 svx/source/unodraw/UnoNameItemTable.cxx                |    6 
 svx/source/unodraw/unomtabl.cxx                        |    6 
 svx/source/unodraw/unoshap2.cxx                        |    7 
 svx/source/unogallery/unogalitem.cxx                   |   29 
 sw/uiconfig/swriter/toolbar/textstylebar.xml           |   15 
 ucb/source/cacher/cachedcontentresultset.cxx           |   13 
 vcl/inc/brdwin.hxx                                     |    2 
 vcl/source/window/brdwin.cxx                           |    5 
 vcl/source/window/splitwin.cxx                         |   12 
 57 files changed, 1166 insertions(+), 1308 deletions(-)

New commits:
commit e9825f51dc5228df78ed86ead7598b50598d9841
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Fri Sep 22 18:52:03 2017 +0900

    vcl: no need to have dispose() here
    
    Inlining it in dtor is enough.
    
    Change-Id: I20769f4b0af51103dd8fb2c5d24ee5e6ef2be1f8
    Reviewed-on: https://gerrit.libreoffice.org/42634
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 10854d9767bf..4d2a5e4142b6 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -52,7 +52,6 @@ class ImplSplitItem
 public:
     ImplSplitItem();
     ~ImplSplitItem();
-    void dispose();
 
     long                mnSize;
     long                mnPixSize;
@@ -85,7 +84,6 @@ class ImplSplitSet
 public:
     ImplSplitSet();
     ~ImplSplitSet();
-    void dispose();
 
     std::vector< ImplSplitItem* >      mpItems;
     Wallpaper*          mpWallpaper;
@@ -121,11 +119,6 @@ ImplSplitItem::ImplSplitItem()
 
 ImplSplitItem::~ImplSplitItem()
 {
-    dispose();
-}
-
-void ImplSplitItem::dispose()
-{
     if (mpSet) {
         delete mpSet ;
         mpSet = nullptr;
@@ -146,11 +139,6 @@ ImplSplitSet::ImplSplitSet() :
 
 ImplSplitSet::~ImplSplitSet()
 {
-    dispose();
-}
-
-void ImplSplitSet::dispose()
-{
     size_t nItems = mpItems.size();
 
     for ( size_t i = 0; i < nItems; i++ )
commit ab34e1a34bdb586e657025878a757516d0d143b7
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Sat Sep 23 08:36:14 2017 +0900

    vcl: Drop a couple of unused member variables
    
    Its usage was gone at df6ba2adbaeea9c5abe6e3ea0a583ec78ca9e7bd.
    
    Change-Id: Ia153cb8fb9247818684be09a81ac5eabdb1120e4
    Reviewed-on: https://gerrit.libreoffice.org/42682
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/inc/brdwin.hxx b/vcl/inc/brdwin.hxx
index 9c88da7d0631..36292b21e963 100644
--- a/vcl/inc/brdwin.hxx
+++ b/vcl/inc/brdwin.hxx
@@ -269,8 +269,6 @@ public:
 class ImplStdBorderWindowView : public ImplBorderWindowView
 {
     ImplBorderFrameData     maFrameData;
-    VclPtr<VirtualDevice>   mpATitleVirDev;
-    VclPtr<VirtualDevice>   mpDTitleVirDev;
 
 public:
                             ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow );
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index ef11bca638a1..c929d0be35f8 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -753,15 +753,10 @@ ImplStdBorderWindowView::ImplStdBorderWindowView( ImplBorderWindow* pBorderWindo
     maFrameData.mnHideState     = DrawButtonFlags::NONE;
     maFrameData.mnHelpState     = DrawButtonFlags::NONE;
     maFrameData.mbTitleClipped  = false;
-
-    mpATitleVirDev              = nullptr;
-    mpDTitleVirDev              = nullptr;
 }
 
 ImplStdBorderWindowView::~ImplStdBorderWindowView()
 {
-    mpATitleVirDev.disposeAndClear();
-    mpDTitleVirDev.disposeAndClear();
 }
 
 bool ImplStdBorderWindowView::MouseMove( const MouseEvent& rMEvt )
commit ee6bdeec8d618f039e72d496dff44beb5b99abb2
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Sep 22 15:32:24 2017 +0200

    loplugin:flatten in svl..svx
    
    and implement a check in the plugin to prevent us modifying the
    same patch of source code twice. This logic should probably be moved
    into plugin.cxx at some point.
    
    Change-Id: I7ebff6424cc8733bb2c8f7dba75eaaec68649290
    Reviewed-on: https://gerrit.libreoffice.org/42660
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/flatten.cxx b/compilerplugins/clang/flatten.cxx
index fd5094940c3c..4ca9d4fc4382 100644
--- a/compilerplugins/clang/flatten.cxx
+++ b/compilerplugins/clang/flatten.cxx
@@ -38,6 +38,7 @@ private:
     SourceRange extendOverComments(SourceRange range);
     std::string getSourceAsString(SourceRange range);
     std::string invertCondition(Expr const * condExpr, SourceRange conditionRange);
+    std::vector<std::pair<const char *, const char*>> mvModifiedRanges;
 };
 
 static const Stmt * containsSingleThrowExpr(const Stmt * stmt)
@@ -124,6 +125,20 @@ bool Flatten::rewrite(const IfStmt* ifStmt)
     }
     SourceRange elseKeywordRange = ifStmt->getElseLoc();
 
+    // If we overlap with a previous area we modified, we cannot perform this change
+    // without corrupting the source
+    SourceManager& SM = compiler.getSourceManager();
+    const char *p1 = SM.getCharacterData( ifStmt->getSourceRange().getBegin() );
+    const char *p2 = SM.getCharacterData( ifStmt->getSourceRange().getEnd() );
+    for (std::pair<const char*, const char *> const & rPair : mvModifiedRanges)
+    {
+        if (rPair.first <= p1 && p1 <= rPair.second)
+            return false;
+        if (p1 <= rPair.second && rPair.first <= p2)
+            return false;
+    }
+    mvModifiedRanges.emplace_back(p1, p2);
+
     thenRange = extendOverComments(thenRange);
     elseRange = extendOverComments(elseRange);
     elseKeywordRange = extendOverComments(elseKeywordRange);
diff --git a/svl/source/misc/lockfilecommon.cxx b/svl/source/misc/lockfilecommon.cxx
index adb9aa61a418..7949f7213cb0 100644
--- a/svl/source/misc/lockfilecommon.cxx
+++ b/svl/source/misc/lockfilecommon.cxx
@@ -137,11 +137,11 @@ OUString LockFileCommon::ParseName( const uno::Sequence< sal_Int8 >& aBuffer, sa
 
         if ( bEscape )
         {
-            if ( aBuffer[io_nCurPos] == ',' || aBuffer[io_nCurPos] == ';' || aBuffer[io_nCurPos] == '\\' )
-                aResult.append( (sal_Char)aBuffer[io_nCurPos] );
-            else
+            if ( aBuffer[io_nCurPos] != ',' && aBuffer[io_nCurPos] != ';' && aBuffer[io_nCurPos] != '\\' )
                 throw io::WrongFormatException();
 
+            aResult.append( (sal_Char)aBuffer[io_nCurPos] );
+
             bEscape = false;
             io_nCurPos++;
         }
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 0ed49e83eeac..bc0b44675cfc 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -145,42 +145,32 @@ sal_Int32 SAL_CALL SvNumberFormatterServiceObj::detectNumberFormat( sal_Int32 nK
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    sal_Int32 nRet = 0;
     SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : nullptr;
-    if (pFormatter)
-    {
-        sal_uInt32 nUKey = nKey;
-        double fValue = 0.0;
-        if ( pFormatter->IsNumberFormat(aString, nUKey, fValue) )
-            nRet = nUKey;
-        else
-            throw util::NotNumericException();
-    }
-    else
+    if (!pFormatter)
         throw uno::RuntimeException();
 
-    return nRet;
+    sal_uInt32 nUKey = nKey;
+    double fValue = 0.0;
+    if ( !pFormatter->IsNumberFormat(aString, nUKey, fValue) )
+        throw util::NotNumericException();;
+
+    return nUKey;
 }
 
 double SAL_CALL SvNumberFormatterServiceObj::convertStringToNumber( sal_Int32 nKey, const OUString& aString )
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    double fRet = 0.0;
     SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : nullptr;
-    if (pFormatter)
-    {
-        sal_uInt32 nUKey = nKey;
-        double fValue = 0.0;
-        if ( pFormatter->IsNumberFormat(aString, nUKey, fValue) )
-            fRet = fValue;
-        else
-            throw util::NotNumericException();
-    }
-    else
+    if (!pFormatter)
         throw uno::RuntimeException();
 
-    return fRet;
+    sal_uInt32 nUKey = nKey;
+    double fValue = 0.0;
+    if ( !pFormatter->IsNumberFormat(aString, nUKey, fValue) )
+        throw util::NotNumericException();;
+
+    return fValue;
 }
 
 OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToString( sal_Int32 nKey, double fValue )
@@ -189,14 +179,12 @@ OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToString( sal_Int32
 
     OUString aRet;
     SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : nullptr;
-    if (pFormatter)
-    {
-        Color* pColor = nullptr;
-        pFormatter->GetOutputString(fValue, nKey, aRet, &pColor);
-    }
-    else
+    if (!pFormatter)
         throw uno::RuntimeException();
 
+    Color* pColor = nullptr;
+    pFormatter->GetOutputString(fValue, nKey, aRet, &pColor);
+
     return aRet;
 }
 
@@ -208,18 +196,16 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForNumber( sal_Int32
 
     util::Color nRet = aDefaultColor; // color = sal_Int32
     SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : nullptr;
-    if (pFormatter)
-    {
-        OUString aStr;
-        Color* pColor = nullptr;
-        pFormatter->GetOutputString(fValue, nKey, aStr, &pColor);
-        if (pColor)
-            nRet = pColor->GetColor();
-        // Else keep Default
-    }
-    else
+    if (!pFormatter)
         throw uno::RuntimeException();
 
+    OUString aStr;
+    Color* pColor = nullptr;
+    pFormatter->GetOutputString(fValue, nKey, aStr, &pColor);
+    if (pColor)
+        nRet = pColor->GetColor();
+    // Else keep Default
+
     return nRet;
 }
 
@@ -230,15 +216,14 @@ OUString SAL_CALL SvNumberFormatterServiceObj::formatString( sal_Int32 nKey,
 
     OUString aRet;
     SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : nullptr;
-    if (pFormatter)
-    {
-        Color* pColor = nullptr;
-        pFormatter->GetOutputString(aString, nKey, aRet, &pColor);
-    }
-    else
+    if (!pFormatter)
     {
         throw uno::RuntimeException();
     }
+
+    Color* pColor = nullptr;
+    pFormatter->GetOutputString(aString, nKey, aRet, &pColor);
+
     return aRet;
 }
 
@@ -250,21 +235,19 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32
 
     util::Color nRet = aDefaultColor; // color = sal_Int32
     SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : nullptr;
-    if (pFormatter)
+    if (!pFormatter)
     {
-        OUString aStr;
-        Color* pColor = nullptr;
-        pFormatter->GetOutputString(aString, nKey, aStr, &pColor);
-        if (pColor)
-        {
-            nRet = pColor->GetColor();
-        }
-        // Else keep Default
+        throw uno::RuntimeException();
     }
-    else
+
+    OUString aStr;
+    Color* pColor = nullptr;
+    pFormatter->GetOutputString(aString, nKey, aStr, &pColor);
+    if (pColor)
     {
-        throw uno::RuntimeException();
+        nRet = pColor->GetColor();
     }
+    // Else keep Default
 
     return nRet;
 }
@@ -275,11 +258,11 @@ OUString SAL_CALL SvNumberFormatterServiceObj::getInputString( sal_Int32 nKey, d
 
     OUString aRet;
     SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : nullptr;
-    if (pFormatter)
-        pFormatter->GetInputLineString(fValue, nKey, aRet);
-    else
+    if (!pFormatter)
         throw uno::RuntimeException();
 
+    pFormatter->GetInputLineString(fValue, nKey, aRet);
+
     return aRet;
 }
 
@@ -294,22 +277,20 @@ OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToPreviewString( con
 
     OUString aRet;
     SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : nullptr;
-    if (pFormatter)
-    {
-        LanguageType eLang = lcl_GetLanguage( nLocale );
-        Color* pColor = nullptr;
+    if (!pFormatter)
+        throw uno::RuntimeException();
 
-        bool bOk;
-        if ( bAllowEnglish )
-            bOk = pFormatter->GetPreviewStringGuess( aFormat, fValue, aRet, &pColor, eLang );
-        else
-            bOk = pFormatter->GetPreviewString( aFormat, fValue, aRet, &pColor, eLang );
+    LanguageType eLang = lcl_GetLanguage( nLocale );
+    Color* pColor = nullptr;
 
-        if (!bOk)
-            throw util::MalformedNumberFormatException();
-    }
+    bool bOk;
+    if ( bAllowEnglish )
+        bOk = pFormatter->GetPreviewStringGuess( aFormat, fValue, aRet, &pColor, eLang );
     else
-        throw uno::RuntimeException();
+        bOk = pFormatter->GetPreviewString( aFormat, fValue, aRet, &pColor, eLang );
+
+    if (!bOk)
+        throw util::MalformedNumberFormatException();
 
     return aRet;
 }
@@ -324,29 +305,25 @@ util::Color SAL_CALL SvNumberFormatterServiceObj::queryPreviewColorForNumber( co
 
     util::Color nRet = aDefaultColor; // color = sal_Int32
     SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : nullptr;
-    if (pFormatter)
-    {
-        OUString aOutString;
-        LanguageType eLang = lcl_GetLanguage( nLocale );
-        Color* pColor = nullptr;
+    if (!pFormatter)
+        throw uno::RuntimeException();
 
-        bool bOk;
-        if ( bAllowEnglish )
-            bOk = pFormatter->GetPreviewStringGuess( aFormat, fValue, aOutString, &pColor, eLang );
-        else
-            bOk = pFormatter->GetPreviewString( aFormat, fValue, aOutString, &pColor, eLang );
-
-        if (bOk)
-        {
-            if (pColor)
-                nRet = pColor->GetColor();
-            // Else keep Default
-        }
-        else
-            throw util::MalformedNumberFormatException();
-    }
+    OUString aOutString;
+    LanguageType eLang = lcl_GetLanguage( nLocale );
+    Color* pColor = nullptr;
+
+    bool bOk;
+    if ( bAllowEnglish )
+        bOk = pFormatter->GetPreviewStringGuess( aFormat, fValue, aOutString, &pColor, eLang );
     else
-        throw uno::RuntimeException();
+        bOk = pFormatter->GetPreviewString( aFormat, fValue, aOutString, &pColor, eLang );
+
+    if (!bOk)
+        throw util::MalformedNumberFormatException();
+
+    if (pColor)
+        nRet = pColor->GetColor();
+    // Else keep Default
 
     return nRet;
 }
@@ -388,10 +365,10 @@ uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsObj::getByKey( sal_I
 
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
     const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : nullptr;
-    if (pFormat)
-        return new SvNumberFormatObj( rSupplier, nKey, m_aMutex );
-    else
+    if (!pFormat)
         throw uno::RuntimeException();
+
+    return new SvNumberFormatObj( rSupplier, nKey, m_aMutex );
 }
 
 uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType,
@@ -401,24 +378,22 @@ uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType
     ::osl::MutexGuard aGuard( m_aMutex );
 
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if ( pFormatter )
-    {
-        sal_uInt32 nIndex = 0;
-        LanguageType eLang = lcl_GetLanguage( nLocale );
-        SvNumberFormatTable& rTable = bCreate ?
-                                        pFormatter->ChangeCL( nType, nIndex, eLang ) :
-                                        pFormatter->GetEntryTable( nType, nIndex, eLang );
-        sal_uInt32 nCount = rTable.size();
-        uno::Sequence<sal_Int32> aSeq(nCount);
-        sal_Int32* pAry = aSeq.getArray();
-        sal_uInt32 i=0;
-        for (SvNumberFormatTable::const_iterator it = rTable.begin(); it != rTable.end(); ++it, ++i)
-            pAry[i] = it->first;
-
-        return aSeq;
-    }
-    else
+    if ( !pFormatter )
         throw uno::RuntimeException();
+
+    sal_uInt32 nIndex = 0;
+    LanguageType eLang = lcl_GetLanguage( nLocale );
+    SvNumberFormatTable& rTable = bCreate ?
+                                    pFormatter->ChangeCL( nType, nIndex, eLang ) :
+                                    pFormatter->GetEntryTable( nType, nIndex, eLang );
+    sal_uInt32 nCount = rTable.size();
+    uno::Sequence<sal_Int32> aSeq(nCount);
+    sal_Int32* pAry = aSeq.getArray();
+    sal_uInt32 i=0;
+    for (SvNumberFormatTable::const_iterator it = rTable.begin(); it != rTable.end(); ++it, ++i)
+        pAry[i] = it->first;
+
+    return aSeq;
 }
 
 sal_Int32 SAL_CALL SvNumberFormatsObj::queryKey( const OUString& aFormat,
@@ -427,20 +402,16 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::queryKey( const OUString& aFormat,
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    sal_Int32 nRet = 0;
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if (pFormatter)
-    {
-        LanguageType eLang = lcl_GetLanguage( nLocale );
-        if (bScan)
-        {
-            //! FIXME: Something still needs to happen here ...
-        }
-        nRet = pFormatter->GetEntryKey( aFormat, eLang );
-    }
-    else
+    if (!pFormatter)
         throw uno::RuntimeException();
 
+    LanguageType eLang = lcl_GetLanguage( nLocale );
+    if (bScan)
+    {
+        //! FIXME: Something still needs to happen here ...
+    }
+    sal_Int32 nRet = pFormatter->GetEntryKey( aFormat, eLang );
     return nRet;
 }
 
@@ -451,25 +422,23 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const OUString& aFormat,
 
     sal_Int32 nRet = 0;
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if (pFormatter)
+    if (!pFormatter)
+        throw uno::RuntimeException();
+
+    OUString aFormStr = aFormat;
+    LanguageType eLang = lcl_GetLanguage( nLocale );
+    sal_uInt32 nKey = 0;
+    sal_Int32 nCheckPos = 0;
+    short nType = 0;
+    bool bOk = pFormatter->PutEntry( aFormStr, nCheckPos, nType, nKey, eLang );
+    if (bOk)
+        nRet = nKey;
+    else if (nCheckPos)
     {
-        OUString aFormStr = aFormat;
-        LanguageType eLang = lcl_GetLanguage( nLocale );
-        sal_uInt32 nKey = 0;
-        sal_Int32 nCheckPos = 0;
-        short nType = 0;
-        bool bOk = pFormatter->PutEntry( aFormStr, nCheckPos, nType, nKey, eLang );
-        if (bOk)
-            nRet = nKey;
-        else if (nCheckPos)
-        {
-            throw util::MalformedNumberFormatException(); // Invalid Format
-        }
-        else
-            throw uno::RuntimeException(); // Other error (e.g. already added)
+        throw util::MalformedNumberFormatException(); // Invalid Format
     }
     else
-        throw uno::RuntimeException();
+        throw uno::RuntimeException(); // Other error (e.g. already added)
 
     return nRet;
 }
@@ -482,26 +451,24 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const OUString& aFormat,
 
     sal_Int32 nRet = 0;
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if (pFormatter)
+    if (!pFormatter)
+        throw uno::RuntimeException();
+
+    OUString aFormStr = aFormat;
+    LanguageType eLang = lcl_GetLanguage( nLocale );
+    LanguageType eNewLang = lcl_GetLanguage( nNewLocale );
+    sal_uInt32 nKey = 0;
+    sal_Int32 nCheckPos = 0;
+    short nType = 0;
+    bool bOk = pFormatter->PutandConvertEntry( aFormStr, nCheckPos, nType, nKey, eLang, eNewLang );
+    if (bOk || nKey > 0)
+        nRet = nKey;
+    else if (nCheckPos)
     {
-        OUString aFormStr = aFormat;
-        LanguageType eLang = lcl_GetLanguage( nLocale );
-        LanguageType eNewLang = lcl_GetLanguage( nNewLocale );
-        sal_uInt32 nKey = 0;
-        sal_Int32 nCheckPos = 0;
-        short nType = 0;
-        bool bOk = pFormatter->PutandConvertEntry( aFormStr, nCheckPos, nType, nKey, eLang, eNewLang );
-        if (bOk || nKey > 0)
-            nRet = nKey;
-        else if (nCheckPos)
-        {
-            throw util::MalformedNumberFormatException();       // Invalid format
-        }
-        else
-            throw uno::RuntimeException(); // Other error (e.g. already added)
+        throw util::MalformedNumberFormatException();       // Invalid format
     }
     else
-        throw uno::RuntimeException();
+        throw uno::RuntimeException(); // Other error (e.g. already added)
 
     return nRet;
 }
@@ -525,16 +492,12 @@ OUString SAL_CALL SvNumberFormatsObj::generateFormat( sal_Int32 nBaseKey,
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    OUString aRet;
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if (pFormatter)
-    {
-        LanguageType eLang = lcl_GetLanguage( nLocale );
-        aRet = pFormatter->GenerateFormat(nBaseKey, eLang, bThousands, bRed, nDecimals, nLeading);
-    }
-    else
+    if (!pFormatter)
         throw uno::RuntimeException();
 
+    LanguageType eLang = lcl_GetLanguage( nLocale );
+    OUString aRet = pFormatter->GenerateFormat(nBaseKey, eLang, bThousands, bRed, nDecimals, nLeading);
     return aRet;
 }
 
@@ -544,16 +507,12 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardIndex( const lang::Locale& nLo
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    sal_Int32 nRet = 0;
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if (pFormatter)
-    {
-        LanguageType eLang = lcl_GetLanguage( nLocale );
-        nRet = pFormatter->GetStandardIndex(eLang);
-    }
-    else
+    if (!pFormatter)
         throw uno::RuntimeException();
 
+    LanguageType eLang = lcl_GetLanguage( nLocale );
+    sal_Int32 nRet = pFormatter->GetStandardIndex(eLang);
     return nRet;
 }
 
@@ -561,19 +520,15 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    sal_Int32 nRet = 0;
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if (pFormatter)
-    {
-        LanguageType eLang = lcl_GetLanguage( nLocale );
-        // Mask out "defined" bit, so type from an existing number format
-        // can directly be used for getStandardFormat
-        nType &= ~css::util::NumberFormat::DEFINED;
-        nRet = pFormatter->GetStandardFormat(nType, eLang);
-    }
-    else
+    if (!pFormatter)
         throw uno::RuntimeException();
 
+    LanguageType eLang = lcl_GetLanguage( nLocale );
+    // Mask out "defined" bit, so type from an existing number format
+    // can directly be used for getStandardFormat
+    nType &= ~css::util::NumberFormat::DEFINED;
+    sal_Int32 nRet = pFormatter->GetStandardFormat(nType, eLang);
     return nRet;
 }
 
@@ -581,16 +536,12 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatIndex( sal_Int16 nIndex, const l
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    sal_Int32 nRet = 0;
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if (pFormatter)
-    {
-        LanguageType eLang = lcl_GetLanguage( nLocale );
-        nRet = pFormatter->GetFormatIndex( (NfIndexTableOffset)nIndex, eLang );
-    }
-    else
+    if (!pFormatter)
         throw uno::RuntimeException();
 
+    LanguageType eLang = lcl_GetLanguage( nLocale );
+    sal_Int32 nRet = pFormatter->GetFormatIndex( (NfIndexTableOffset)nIndex, eLang );
     return nRet;
 }
 
@@ -605,16 +556,12 @@ sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatForLocale( sal_Int32 nKey, const
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    sal_Int32 nRet = 0;
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if (pFormatter)
-    {
-        LanguageType eLang = lcl_GetLanguage( nLocale );
-        nRet = pFormatter->GetFormatForLanguageIfBuiltIn(nKey, eLang);
-    }
-    else
+    if (!pFormatter)
         throw uno::RuntimeException();
 
+    LanguageType eLang = lcl_GetLanguage( nLocale );
+    sal_Int32 nRet = pFormatter->GetFormatForLanguageIfBuiltIn(nKey, eLang);
     return nRet;
 }
 
@@ -671,86 +618,84 @@ uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const OUString& aProperty
     uno::Any aRet;
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
     const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : nullptr;
-    if (pFormat)
+    if (!pFormat)
+        throw uno::RuntimeException();
+
+    bool bThousand, bRed;
+    sal_uInt16 nDecimals, nLeading;
+
+    if (aPropertyName == PROPERTYNAME_FMTSTR)
+    {
+        aRet <<= pFormat->GetFormatstring();
+    }
+    else if (aPropertyName == PROPERTYNAME_LOCALE)
+    {
+        lang::Locale aLocale( LanguageTag::convertToLocale( pFormat->GetLanguage(), false));
+        aRet <<= aLocale;
+    }
+    else if (aPropertyName == PROPERTYNAME_TYPE)
+    {
+        aRet <<= (sal_Int16)( pFormat->GetType() );
+    }
+    else if (aPropertyName == PROPERTYNAME_COMMENT)
     {
-        bool bThousand, bRed;
-        sal_uInt16 nDecimals, nLeading;
-
-        if (aPropertyName == PROPERTYNAME_FMTSTR)
-        {
-            aRet <<= pFormat->GetFormatstring();
-        }
-        else if (aPropertyName == PROPERTYNAME_LOCALE)
-        {
-            lang::Locale aLocale( LanguageTag::convertToLocale( pFormat->GetLanguage(), false));
-            aRet <<= aLocale;
-        }
-        else if (aPropertyName == PROPERTYNAME_TYPE)
-        {
-            aRet <<= (sal_Int16)( pFormat->GetType() );
-        }
-        else if (aPropertyName == PROPERTYNAME_COMMENT)
-        {
-            aRet <<= pFormat->GetComment();
-        }
-        else if (aPropertyName == PROPERTYNAME_STDFORM)
-        {
-            //! Pass through SvNumberformat Member bStandard?
-            aRet <<= ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
-        }
-        else if (aPropertyName == PROPERTYNAME_USERDEF)
-        {
-            aRet <<= ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 );
-        }
-        else if (aPropertyName == PROPERTYNAME_DECIMALS)
-        {
-            pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
-            aRet <<= (sal_Int16) nDecimals;
-        }
-        else if (aPropertyName == PROPERTYNAME_LEADING)
-        {
-            pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
-            aRet <<= (sal_Int16) nLeading;
-        }
-        else if (aPropertyName == PROPERTYNAME_NEGRED)
-        {
-            pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
-            aRet <<= bRed;
-        }
-        else if (aPropertyName == PROPERTYNAME_THOUS)
-        {
-            pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
-            aRet <<= bThousand;
-        }
-        else if (aPropertyName == PROPERTYNAME_CURRSYM)
-        {
-            OUString aSymbol, aExt;
-            pFormat->GetNewCurrencySymbol( aSymbol, aExt );
-            aRet <<= aSymbol;
-        }
-        else if (aPropertyName == PROPERTYNAME_CURREXT)
-        {
-            OUString aSymbol, aExt;
-            pFormat->GetNewCurrencySymbol( aSymbol, aExt );
-            aRet <<= aExt;
-        }
-        else if (aPropertyName == PROPERTYNAME_CURRABB)
-        {
-            OUString aSymbol, aExt;
-            bool bBank = false;
-            pFormat->GetNewCurrencySymbol( aSymbol, aExt );
-            const NfCurrencyEntry* pCurr = SvNumberFormatter::GetCurrencyEntry( bBank,
-                aSymbol, aExt, pFormat->GetLanguage() );
-            if ( pCurr )
-                aRet <<= pCurr->GetBankSymbol();
-            else
-                aRet <<= OUString();
-        }
+        aRet <<= pFormat->GetComment();
+    }
+    else if (aPropertyName == PROPERTYNAME_STDFORM)
+    {
+        //! Pass through SvNumberformat Member bStandard?
+        aRet <<= ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
+    }
+    else if (aPropertyName == PROPERTYNAME_USERDEF)
+    {
+        aRet <<= ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 );
+    }
+    else if (aPropertyName == PROPERTYNAME_DECIMALS)
+    {
+        pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
+        aRet <<= (sal_Int16) nDecimals;
+    }
+    else if (aPropertyName == PROPERTYNAME_LEADING)
+    {
+        pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
+        aRet <<= (sal_Int16) nLeading;
+    }
+    else if (aPropertyName == PROPERTYNAME_NEGRED)
+    {
+        pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
+        aRet <<= bRed;
+    }
+    else if (aPropertyName == PROPERTYNAME_THOUS)
+    {
+        pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
+        aRet <<= bThousand;
+    }
+    else if (aPropertyName == PROPERTYNAME_CURRSYM)
+    {
+        OUString aSymbol, aExt;
+        pFormat->GetNewCurrencySymbol( aSymbol, aExt );
+        aRet <<= aSymbol;
+    }
+    else if (aPropertyName == PROPERTYNAME_CURREXT)
+    {
+        OUString aSymbol, aExt;
+        pFormat->GetNewCurrencySymbol( aSymbol, aExt );
+        aRet <<= aExt;
+    }
+    else if (aPropertyName == PROPERTYNAME_CURRABB)
+    {
+        OUString aSymbol, aExt;
+        bool bBank = false;
+        pFormat->GetNewCurrencySymbol( aSymbol, aExt );
+        const NfCurrencyEntry* pCurr = SvNumberFormatter::GetCurrencyEntry( bBank,
+            aSymbol, aExt, pFormat->GetLanguage() );
+        if ( pCurr )
+            aRet <<= pCurr->GetBankSymbol();
         else
-            throw beans::UnknownPropertyException();
+            aRet <<= OUString();
     }
     else
-        throw uno::RuntimeException();
+        throw beans::UnknownPropertyException();
 
     return aRet;
 }
@@ -787,47 +732,45 @@ uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValue
 
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
     const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : nullptr;
-    if (pFormat)
-    {
-        OUString aSymbol, aExt;
-        OUString aAbb;
-        bool bBank = false;
-        pFormat->GetNewCurrencySymbol( aSymbol, aExt );
-        const NfCurrencyEntry* pCurr = SvNumberFormatter::GetCurrencyEntry( bBank,
-            aSymbol, aExt, pFormat->GetLanguage() );
-        if ( pCurr )
-            aAbb = pCurr->GetBankSymbol();
-
-        OUString aFmtStr = pFormat->GetFormatstring();
-        OUString aComment = pFormat->GetComment();
-        bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
-        //! Pass through SvNumberformat Member bStandard?
-        bool bUserDef = ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 );
-        bool bThousand, bRed;
-        sal_uInt16 nDecimals, nLeading;
-        pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
-        lang::Locale aLocale( LanguageTag( pFormat->GetLanguage()).getLocale());
-
-        uno::Sequence<beans::PropertyValue> aSeq( comphelper::InitPropertySequence({
-                { PROPERTYNAME_FMTSTR, uno::Any(aFmtStr) },
-                { PROPERTYNAME_LOCALE, uno::Any(aLocale) },
-                { PROPERTYNAME_TYPE, uno::Any(sal_Int16( pFormat->GetType() )) },
-                { PROPERTYNAME_COMMENT, uno::Any(aComment) },
-                { PROPERTYNAME_STDFORM, uno::Any(bStandard) },
-                { PROPERTYNAME_USERDEF, uno::Any(bUserDef) },
-                { PROPERTYNAME_DECIMALS, uno::Any(sal_Int16( nDecimals )) },
-                { PROPERTYNAME_LEADING, uno::Any(sal_Int16( nLeading )) },
-                { PROPERTYNAME_NEGRED, uno::Any(bRed) },
-                { PROPERTYNAME_THOUS, uno::Any(bThousand) },
-                { PROPERTYNAME_CURRSYM, uno::Any(aSymbol) },
-                { PROPERTYNAME_CURREXT, uno::Any(aExt) },
-                { PROPERTYNAME_CURRABB, uno::Any(aAbb) }
-            }));
-
-        return aSeq;
-    }
-    else
+    if (!pFormat)
         throw uno::RuntimeException();
+
+    OUString aSymbol, aExt;
+    OUString aAbb;
+    bool bBank = false;
+    pFormat->GetNewCurrencySymbol( aSymbol, aExt );
+    const NfCurrencyEntry* pCurr = SvNumberFormatter::GetCurrencyEntry( bBank,
+        aSymbol, aExt, pFormat->GetLanguage() );
+    if ( pCurr )
+        aAbb = pCurr->GetBankSymbol();
+
+    OUString aFmtStr = pFormat->GetFormatstring();
+    OUString aComment = pFormat->GetComment();
+    bool bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
+    //! Pass through SvNumberformat Member bStandard?
+    bool bUserDef = ( ( pFormat->GetType() & css::util::NumberFormat::DEFINED ) != 0 );
+    bool bThousand, bRed;
+    sal_uInt16 nDecimals, nLeading;
+    pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
+    lang::Locale aLocale( LanguageTag( pFormat->GetLanguage()).getLocale());
+
+    uno::Sequence<beans::PropertyValue> aSeq( comphelper::InitPropertySequence({
+            { PROPERTYNAME_FMTSTR, uno::Any(aFmtStr) },
+            { PROPERTYNAME_LOCALE, uno::Any(aLocale) },
+            { PROPERTYNAME_TYPE, uno::Any(sal_Int16( pFormat->GetType() )) },
+            { PROPERTYNAME_COMMENT, uno::Any(aComment) },
+            { PROPERTYNAME_STDFORM, uno::Any(bStandard) },
+            { PROPERTYNAME_USERDEF, uno::Any(bUserDef) },
+            { PROPERTYNAME_DECIMALS, uno::Any(sal_Int16( nDecimals )) },
+            { PROPERTYNAME_LEADING, uno::Any(sal_Int16( nLeading )) },
+            { PROPERTYNAME_NEGRED, uno::Any(bRed) },
+            { PROPERTYNAME_THOUS, uno::Any(bThousand) },
+            { PROPERTYNAME_CURRSYM, uno::Any(aSymbol) },
+            { PROPERTYNAME_CURREXT, uno::Any(aExt) },
+            { PROPERTYNAME_CURRABB, uno::Any(aAbb) }
+        }));
+
+    return aSeq;
 }
 
 void SAL_CALL SvNumberFormatObj::setPropertyValues( const uno::Sequence<beans::PropertyValue>& )
@@ -880,37 +823,36 @@ void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const OUString& aProp
     ::osl::MutexGuard aGuard( m_aMutex );
 
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if (pFormatter)
+    if (!pFormatter)
+        throw uno::RuntimeException();
+
+    if (aPropertyName == PROPERTYNAME_NOZERO)
     {
-        if (aPropertyName == PROPERTYNAME_NOZERO)
-        {
-            //  operator >>= shouldn't be used for bool (?)
-            if ( auto b = o3tl::tryAccess<bool>(aValue) )
-                pFormatter->SetNoZero( *b );
-        }
-        else if (aPropertyName == PROPERTYNAME_NULLDATE)
-        {
-            util::Date aDate;
-            if ( aValue >>= aDate )
-                pFormatter->ChangeNullDate( aDate.Day, aDate.Month, aDate.Year );
-        }
-        else if (aPropertyName == PROPERTYNAME_STDDEC)
-        {
-            sal_Int16 nInt16 = sal_Int16();
-            if ( aValue >>= nInt16 )
-                pFormatter->ChangeStandardPrec( nInt16 );
-        }
-        else if (aPropertyName == PROPERTYNAME_TWODIGIT)
-        {
-            sal_Int16 nInt16 = sal_Int16();
-            if ( aValue >>= nInt16 )
-                pFormatter->SetYear2000( nInt16 );
-        }
-        else
-            throw beans::UnknownPropertyException();
+        //  operator >>= shouldn't be used for bool (?)
+        if ( auto b = o3tl::tryAccess<bool>(aValue) )
+            pFormatter->SetNoZero( *b );
+    }
+    else if (aPropertyName == PROPERTYNAME_NULLDATE)
+    {
+        util::Date aDate;
+        if ( aValue >>= aDate )
+            pFormatter->ChangeNullDate( aDate.Day, aDate.Month, aDate.Year );
+    }
+    else if (aPropertyName == PROPERTYNAME_STDDEC)
+    {
+        sal_Int16 nInt16 = sal_Int16();
+        if ( aValue >>= nInt16 )
+            pFormatter->ChangeStandardPrec( nInt16 );
+    }
+    else if (aPropertyName == PROPERTYNAME_TWODIGIT)
+    {
+        sal_Int16 nInt16 = sal_Int16();
+        if ( aValue >>= nInt16 )
+            pFormatter->SetYear2000( nInt16 );
     }
     else
-        throw uno::RuntimeException();
+        throw beans::UnknownPropertyException();
+
 }
 
 uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const OUString& aPropertyName )
@@ -919,26 +861,24 @@ uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const OUString& a
 
     uno::Any aRet;
     SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-    if (pFormatter)
+    if (!pFormatter)
+        throw uno::RuntimeException();
+
+    if (aPropertyName == PROPERTYNAME_NOZERO)
     {
-        if (aPropertyName == PROPERTYNAME_NOZERO)
-        {
-            aRet <<= pFormatter->GetNoZero();
-        }
-        else if (aPropertyName == PROPERTYNAME_NULLDATE)
-        {
-            const Date& rDate = pFormatter->GetNullDate();
-            aRet <<= rDate.GetUNODate();
-        }
-        else if (aPropertyName == PROPERTYNAME_STDDEC)
-            aRet <<= (sal_Int16)( pFormatter->GetStandardPrec() );
-        else if (aPropertyName == PROPERTYNAME_TWODIGIT)
-            aRet <<= (sal_Int16)( pFormatter->GetYear2000() );
-        else
-            throw beans::UnknownPropertyException();
+        aRet <<= pFormatter->GetNoZero();
     }
+    else if (aPropertyName == PROPERTYNAME_NULLDATE)
+    {
+        const Date& rDate = pFormatter->GetNullDate();
+        aRet <<= rDate.GetUNODate();
+    }
+    else if (aPropertyName == PROPERTYNAME_STDDEC)
+        aRet <<= (sal_Int16)( pFormatter->GetStandardPrec() );
+    else if (aPropertyName == PROPERTYNAME_TWODIGIT)
+        aRet <<= (sal_Int16)( pFormatter->GetYear2000() );
     else
-        throw uno::RuntimeException();
+        throw beans::UnknownPropertyException();
 
     return aRet;
 }
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 467e704a2586..f1e145cc8e7a 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -176,14 +176,12 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessible
 {
     ThrowIfDisposed();
     const SolarMutexGuard aSolarGuard;
-    uno::Reference< accessibility::XAccessible >    xRet;
     ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(i));
 
-    if( pItem )
-        xRet = pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ );
-    else
+    if( !pItem )
         throw lang::IndexOutOfBoundsException();
 
+    uno::Reference< accessibility::XAccessible >  xRet = pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ );
     return xRet;
 }
 
@@ -489,13 +487,11 @@ void SAL_CALL ValueSetAcc::selectAccessibleChild( sal_Int32 nChildIndex )
     const SolarMutexGuard aSolarGuard;
     ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
 
-    if(pItem != nullptr)
-    {
-        mpParent->SelectItem( pItem->mnId );
-        mpParent->Select ();
-    }
-    else
+    if(pItem == nullptr)
         throw lang::IndexOutOfBoundsException();
+
+    mpParent->SelectItem( pItem->mnId );
+    mpParent->Select ();
 }
 
 
@@ -504,13 +500,11 @@ sal_Bool SAL_CALL ValueSetAcc::isAccessibleChildSelected( sal_Int32 nChildIndex
     ThrowIfDisposed();
     const SolarMutexGuard aSolarGuard;
     ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
-    bool            bRet = false;
 
-    if (pItem != nullptr)
-        bRet = mpParent->IsItemSelected( pItem->mnId );
-    else
+    if (!(pItem != nullptr))
         throw lang::IndexOutOfBoundsException();
 
+    bool  bRet = mpParent->IsItemSelected( pItem->mnId );
     return bRet;
 }
 
diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx
index 351f6a76b999..7125562135b6 100644
--- a/svtools/source/uno/unoevent.cxx
+++ b/svtools/source/uno/unoevent.cxx
@@ -196,39 +196,37 @@ void getMacroFromAny(
         // else: unknown PropertyValue -> ignore
     }
 
-    if (bTypeOK)
+    if (!bTypeOK)
     {
-        if (bNone)
+        // no valid type: abort
+        throw IllegalArgumentException();
+    }
+
+    if (bNone)
+    {
+        // return empty macro
+        rMacro = SvxMacro( "", "" );
+    }
+    else
+    {
+        if (eType == STARBASIC)
         {
-            // return empty macro
-            rMacro = SvxMacro( "", "" );
+            // create macro and return
+            SvxMacro aMacro(sMacroVal, sLibVal, eType);
+            rMacro = aMacro;
+        }
+        else if (eType == EXTENDED_STYPE)
+        {
+            SvxMacro aMacro(sScriptVal, sScript);
+            rMacro = aMacro;
         }
         else
         {
-            if (eType == STARBASIC)
-            {
-                // create macro and return
-                SvxMacro aMacro(sMacroVal, sLibVal, eType);
-                rMacro = aMacro;
-            }
-            else if (eType == EXTENDED_STYPE)
-            {
-                SvxMacro aMacro(sScriptVal, sScript);
-                rMacro = aMacro;
-            }
-            else
-            {
-                // we can't process type: abort
-                // TODO: JavaScript macros
-                throw IllegalArgumentException();
-            }
+            // we can't process type: abort
+            // TODO: JavaScript macros
+            throw IllegalArgumentException();
         }
     }
-    else
-    {
-        // no valid type: abort
-        throw IllegalArgumentException();
-    }
 }
 
 }
diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx
index d38b26a68319..f14d5bbd4c01 100644
--- a/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -281,10 +281,10 @@ namespace accessibility
         if( !pTextForwarder )
             throw uno::RuntimeException("Unable to fetch text forwarder, model might be dead", mxFrontEnd);
 
-        if( pTextForwarder->IsValid() )
-            return *pTextForwarder;
-        else
+        if( !pTextForwarder->IsValid() )
             throw uno::RuntimeException("Text forwarder is invalid, model might be dead", mxFrontEnd);
+
+        return *pTextForwarder;
     }
 
     SvxViewForwarder& AccessibleTextHelper_Impl::GetViewForwarder() const
@@ -297,10 +297,10 @@ namespace accessibility
         if( !pViewForwarder )
             throw uno::RuntimeException("Unable to fetch view forwarder, model might be dead", mxFrontEnd);
 
-        if( pViewForwarder->IsValid() )
-            return *pViewForwarder;
-        else
+        if( !pViewForwarder->IsValid() )
             throw uno::RuntimeException("View forwarder is invalid, model might be dead", mxFrontEnd);
+
+        return *pViewForwarder;
     }
 
     SvxEditViewForwarder& AccessibleTextHelper_Impl::GetEditViewForwarder() const
@@ -315,20 +315,19 @@ namespace accessibility
             throw uno::RuntimeException("No edit view forwarder, object not in edit mode", mxFrontEnd);
         }
 
-        if( pViewForwarder->IsValid() )
-            return *pViewForwarder;
-        else
+        if( !pViewForwarder->IsValid() )
         {
             throw uno::RuntimeException("View forwarder is invalid, object not in edit mode", mxFrontEnd);
         }
+
+        return *pViewForwarder;
     }
 
     SvxEditSourceAdapter& AccessibleTextHelper_Impl::GetEditSource() const
     {
-        if( maEditSource.IsValid() )
-            return maEditSource;
-        else
+        if( !maEditSource.IsValid() )
             throw uno::RuntimeException("AccessibleTextHelper_Impl::GetEditSource: no edit source", mxFrontEnd );
+        return maEditSource;
     }
 
     // functor for sending child events (no stand-alone function, they are maybe not inlined)
diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
index 3020c2cbf4de..274caf4badf3 100644
--- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx
+++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx
@@ -175,26 +175,24 @@ Reference< XAccessible > SAL_CALL SvxGraphCtrlAccessibleContext::getAccessibleAt
 
     Reference< XAccessible > xAccessible;
 
-    if( mpControl )
+    if( !mpControl )
     {
-        Point aPnt( rPoint.X, rPoint.Y );
-        mpControl->PixelToLogic( aPnt );
+        throw DisposedException();
+    }
 
-        SdrObject* pObj = nullptr;
+    Point aPnt( rPoint.X, rPoint.Y );
+    mpControl->PixelToLogic( aPnt );
 
-        if(mpView && mpView->GetSdrPageView())
-        {
-            pObj = SdrObjListPrimitiveHit(*mpPage, aPnt, 1, *mpView->GetSdrPageView(), nullptr, false);
-        }
+    SdrObject* pObj = nullptr;
 
-        if( pObj )
-            xAccessible = getAccessible( pObj );
-    }
-    else
+    if(mpView && mpView->GetSdrPageView())
     {
-        throw DisposedException();
+        pObj = SdrObjListPrimitiveHit(*mpPage, aPnt, 1, *mpView->GetSdrPageView(), nullptr, false);
     }
 
+    if( pObj )
+        xAccessible = getAccessible( pObj );
+
     return xAccessible;
 }
 
@@ -684,18 +682,16 @@ tools::Rectangle SvxGraphCtrlAccessibleContext::GetBoundingBox()
     tools::Rectangle aBounds ( 0, 0, 0, 0 );
 
     vcl::Window* pWindow = mpControl;
-    if (pWindow != nullptr)
+    if (!(pWindow != nullptr))
+        throw DisposedException();
+
+    aBounds = pWindow->GetWindowExtentsRelative (nullptr);
+    vcl::Window* pParent = pWindow->GetAccessibleParentWindow();
+    if (pParent != nullptr)
     {
-        aBounds = pWindow->GetWindowExtentsRelative (nullptr);
-        vcl::Window* pParent = pWindow->GetAccessibleParentWindow();
-        if (pParent != nullptr)
-        {
-            tools::Rectangle aParentRect = pParent->GetWindowExtentsRelative (nullptr);
-            aBounds -= aParentRect.TopLeft();
-        }
+        tools::Rectangle aParentRect = pParent->GetWindowExtentsRelative (nullptr);
+        aBounds -= aParentRect.TopLeft();
     }
-    else
-        throw DisposedException();
 
     return aBounds;
 }
diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx
index 9e8c3ab5fa71..a0034b8beb40 100644
--- a/svx/source/accessibility/charmapacc.cxx
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -333,15 +333,13 @@ uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::ge
     uno::Reference< css::accessibility::XAccessible >    xRet;
     SvxShowCharSetItem* pItem = m_pParent->getCharSetControl()->ImplGetItem( static_cast< sal_uInt16 >( i ) );
 
-    if( pItem )
-    {
-        pItem->m_pParent = this;
-        xRet = pItem->GetAccessible();
-        m_aChildren.push_back(xRet);
-    }
-    else
+    if( !pItem )
         throw lang::IndexOutOfBoundsException();
 
+    pItem->m_pParent = this;
+    xRet = pItem->GetAccessible();
+    m_aChildren.push_back(xRet);
+
     return xRet;
 }
 
diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx
index 321c40d58b4d..8796bb7e649e 100644
--- a/svx/source/table/tabledesign.cxx
+++ b/svx/source/table/tabledesign.cxx
@@ -699,15 +699,13 @@ void TableDesignFamily::setPropertyValue( const OUString& , const Any&  )
 
 Any TableDesignFamily::getPropertyValue( const OUString& PropertyName )
 {
-    if ( PropertyName == "DisplayName" )
-    {
-        OUString sDisplayName( SvxResId( RID_SVXSTR_STYLEFAMILY_TABLEDESIGN ) );
-        return Any( sDisplayName );
-    }
-    else
+    if ( PropertyName != "DisplayName" )
     {
         throw UnknownPropertyException( "unknown property: " + PropertyName, static_cast<OWeakObject *>(this) );
     }
+
+    OUString sDisplayName( SvxResId( RID_SVXSTR_STYLEFAMILY_TABLEDESIGN ) );
+    return Any( sDisplayName );
 }
 
 
diff --git a/svx/source/unodraw/UnoNameItemTable.cxx b/svx/source/unodraw/UnoNameItemTable.cxx
index 0a50dc3cfac2..33b72e5949f2 100644
--- a/svx/source/unodraw/UnoNameItemTable.cxx
+++ b/svx/source/unodraw/UnoNameItemTable.cxx
@@ -179,11 +179,11 @@ void SAL_CALL SvxUnoNameItemTable::replaceByName( const OUString& aApiName, cons
         }
     }
 
-    if( bFound )
-        ImplInsertByName( aName, aElement );
-    else
+    if( !bFound )
         throw container::NoSuchElementException();
 
+    ImplInsertByName( aName, aElement );
+
     if( !hasByName( aName ) )
         throw container::NoSuchElementException();
 }
diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx
index 1bb12319bdd3..f64aa6449b13 100644
--- a/svx/source/unodraw/unomtabl.cxx
+++ b/svx/source/unodraw/unomtabl.cxx
@@ -263,10 +263,10 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const
         }
     }
 
-    if( bFound )
-        ImplInsertByName( aName, aElement );
-    else
+    if( !bFound )
         throw container::NoSuchElementException();
+
+    ImplInsertByName( aName, aElement );
 }
 
 static bool getByNameFromPool( const OUString& rSearchName, SfxItemPool const * pPool, sal_uInt16 nWhich, uno::Any& rAny )
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 409265aad00c..5ed67a209371 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -308,13 +308,10 @@ sal_Int32 SAL_CALL SvxShapeGroup::getCount()
 {
     ::SolarMutexGuard aGuard;
 
-    sal_Int32 nRetval = 0;
-
-    if(mpObj.is() && mpObj->GetSubList())
-        nRetval = mpObj->GetSubList()->GetObjCount();
-    else
+    if(!mpObj.is() || !mpObj->GetSubList())
         throw uno::RuntimeException();
 
+    sal_Int32 nRetval = mpObj->GetSubList()->GetObjCount();
     return nRetval;
 }
 
diff --git a/svx/source/unogallery/unogalitem.cxx b/svx/source/unogallery/unogalitem.cxx
index 38d752220b87..ea8543a839a8 100644
--- a/svx/source/unogallery/unogalitem.cxx
+++ b/svx/source/unogallery/unogalitem.cxx
@@ -215,28 +215,27 @@ void GalleryItem::_setPropertyValues( const comphelper::PropertyMapEntry** ppEnt
         {
             OUString aNewTitle;
 
-            if( *pValues >>= aNewTitle )
+            if( !(*pValues >>= aNewTitle) )
             {
-                ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : nullptr );
+                throw lang::IllegalArgumentException();
+            }
 
-                if( pGalTheme )
-                {
-                    std::unique_ptr<SgaObject> pObj(pGalTheme->ImplReadSgaObject( const_cast< GalleryObject* >( implGetObject() ) ));
+            ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : nullptr );
 
-                    if( pObj )
+            if( pGalTheme )
+            {
+                std::unique_ptr<SgaObject> pObj(pGalTheme->ImplReadSgaObject( const_cast< GalleryObject* >( implGetObject() ) ));
+
+                if( pObj )
+                {
+                    if( pObj->GetTitle() != aNewTitle )
                     {
-                        if( pObj->GetTitle() != aNewTitle )
-                        {
-                            pObj->SetTitle( aNewTitle );
-                            pGalTheme->InsertObject( *pObj );
-                        }
+                        pObj->SetTitle( aNewTitle );
+                        pGalTheme->InsertObject( *pObj );
                     }
                 }
             }
-            else
-            {
-                throw lang::IllegalArgumentException();
-            }
+
         }
 
         ++ppEntries;
commit a8622c77d26ca7a635afc95bba9a5054dc31eb7c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Sep 22 12:53:28 2017 +0200

    loplugin:flatten in sdext..stoc
    
    Change-Id: I460e813e20a691c53738373376d3363f553bbab2
    Reviewed-on: https://gerrit.libreoffice.org/42636
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sdext/source/presenter/PresenterPaneBase.cxx b/sdext/source/presenter/PresenterPaneBase.cxx
index 7e034ee30551..c7bfa0b02fa0 100644
--- a/sdext/source/presenter/PresenterPaneBase.cxx
+++ b/sdext/source/presenter/PresenterPaneBase.cxx
@@ -143,86 +143,84 @@ void SAL_CALL PresenterPaneBase::initialize (const Sequence<Any>& rArguments)
             static_cast<XWeak*>(this));
     }
 
-    if (rArguments.getLength() == 5 || rArguments.getLength() == 6)
+    if (rArguments.getLength() != 5 && rArguments.getLength() != 6)
     {
-        try
+        throw RuntimeException(
+            "PresenterSpritePane: invalid number of arguments",
+                static_cast<XWeak*>(this));
+    }
+
+    try
+    {
+        // Get the resource id from the first argument.
+        if ( ! (rArguments[0] >>= mxPaneId))
         {
-            // Get the resource id from the first argument.
-            if ( ! (rArguments[0] >>= mxPaneId))
-            {
-                throw lang::IllegalArgumentException(
-                    "PresenterPane: invalid pane id",
-                    static_cast<XWeak*>(this),
-                    0);
-            }
-
-            if ( ! (rArguments[1] >>= mxParentWindow))
-            {
-                throw lang::IllegalArgumentException(
-                    "PresenterPane: invalid parent window",
-                    static_cast<XWeak*>(this),
-                    1);
-            }
-
-            Reference<rendering::XSpriteCanvas> xParentCanvas;
-            if ( ! (rArguments[2] >>= xParentCanvas))
-            {
-                throw lang::IllegalArgumentException(
-                    "PresenterPane: invalid parent canvas",
-                    static_cast<XWeak*>(this),
-                    2);
-            }
-
-            if ( ! (rArguments[3] >>= msTitle))
-            {
-                throw lang::IllegalArgumentException(
-                    "PresenterPane: invalid title",
-                    static_cast<XWeak*>(this),
-                    3);
-            }
-
-            if ( ! (rArguments[4] >>= mxBorderPainter))
-            {
-                throw lang::IllegalArgumentException(
-                    "PresenterPane: invalid border painter",
-                    static_cast<XWeak*>(this),
-                    4);
-            }
-
-            bool bIsWindowVisibleOnCreation (true);
-            if (rArguments.getLength()>5 && ! (rArguments[5] >>= bIsWindowVisibleOnCreation))
-            {
-                throw lang::IllegalArgumentException(
-                    "PresenterPane: invalid window visibility flag",
-                    static_cast<XWeak*>(this),
-                    5);
-            }
-
-            CreateWindows(mxParentWindow, bIsWindowVisibleOnCreation);
-
-            if (mxBorderWindow.is())
-            {
-                mxBorderWindow->addWindowListener(this);
-                mxBorderWindow->addPaintListener(this);
-            }
-
-            CreateCanvases(mxParentWindow, xParentCanvas);
-
-            // Raise new windows.
-            ToTop();
+            throw lang::IllegalArgumentException(
+                "PresenterPane: invalid pane id",
+                static_cast<XWeak*>(this),
+                0);
         }
-        catch (Exception&)
+
+        if ( ! (rArguments[1] >>= mxParentWindow))
         {
-            mxContentWindow = nullptr;
-            mxComponentContext = nullptr;
-            throw;
+            throw lang::IllegalArgumentException(
+                "PresenterPane: invalid parent window",
+                static_cast<XWeak*>(this),
+                1);
         }
+
+        Reference<rendering::XSpriteCanvas> xParentCanvas;
+        if ( ! (rArguments[2] >>= xParentCanvas))
+        {
+            throw lang::IllegalArgumentException(
+                "PresenterPane: invalid parent canvas",
+                static_cast<XWeak*>(this),
+                2);
+        }
+
+        if ( ! (rArguments[3] >>= msTitle))
+        {
+            throw lang::IllegalArgumentException(
+                "PresenterPane: invalid title",
+                static_cast<XWeak*>(this),
+                3);
+        }
+
+        if ( ! (rArguments[4] >>= mxBorderPainter))
+        {
+            throw lang::IllegalArgumentException(
+                "PresenterPane: invalid border painter",
+                static_cast<XWeak*>(this),
+                4);
+        }
+
+        bool bIsWindowVisibleOnCreation (true);
+        if (rArguments.getLength()>5 && ! (rArguments[5] >>= bIsWindowVisibleOnCreation))
+        {
+            throw lang::IllegalArgumentException(
+                "PresenterPane: invalid window visibility flag",
+                static_cast<XWeak*>(this),
+                5);
+        }
+
+        CreateWindows(mxParentWindow, bIsWindowVisibleOnCreation);
+
+        if (mxBorderWindow.is())
+        {
+            mxBorderWindow->addWindowListener(this);
+            mxBorderWindow->addPaintListener(this);
+        }
+
+        CreateCanvases(mxParentWindow, xParentCanvas);
+
+        // Raise new windows.
+        ToTop();
     }
-    else
+    catch (Exception&)
     {
-        throw RuntimeException(
-            "PresenterSpritePane: invalid number of arguments",
-                static_cast<XWeak*>(this));
+        mxContentWindow = nullptr;
+        mxComponentContext = nullptr;
+        throw;
     }
 }
 
diff --git a/sdext/source/presenter/PresenterProtocolHandler.cxx b/sdext/source/presenter/PresenterProtocolHandler.cxx
index f1aceb54f8d1..b7ca0c08a4b2 100644
--- a/sdext/source/presenter/PresenterProtocolHandler.cxx
+++ b/sdext/source/presenter/PresenterProtocolHandler.cxx
@@ -430,54 +430,48 @@ void SAL_CALL PresenterProtocolHandler::Dispatch::dispatch(
             static_cast<uno::XWeak*>(this));
     }
 
-    if (rURL.Protocol == "vnd.org.libreoffice.presenterscreen:"
-        && rURL.Path == msURLPath)
-    {
-        if (mpCommand.get() != nullptr)
-            mpCommand->Execute();
-    }
-    else
+    if (rURL.Protocol != "vnd.org.libreoffice.presenterscreen:"
+        || rURL.Path != msURLPath)
     {
         // We can not throw an IllegalArgumentException
         throw RuntimeException();
     }
+
+    if (mpCommand.get() != nullptr)
+        mpCommand->Execute();
 }
 
 void SAL_CALL PresenterProtocolHandler::Dispatch::addStatusListener(
     const css::uno::Reference<css::frame::XStatusListener>& rxListener,
     const css::util::URL& rURL)
 {
-    if (rURL.Path == msURLPath)
-    {
-        maStatusListenerContainer.push_back(rxListener);
-
-        frame::FeatureStateEvent aEvent;
-        aEvent.FeatureURL = rURL;
-        aEvent.IsEnabled = mpCommand->IsEnabled();
-        aEvent.Requery = false;
-        aEvent.State = mpCommand->GetState();
-        rxListener->statusChanged(aEvent);
-    }
-    else
+    if (rURL.Path != msURLPath)
         throw RuntimeException();
+
+    maStatusListenerContainer.push_back(rxListener);
+
+    frame::FeatureStateEvent aEvent;
+    aEvent.FeatureURL = rURL;
+    aEvent.IsEnabled = mpCommand->IsEnabled();
+    aEvent.Requery = false;
+    aEvent.State = mpCommand->GetState();
+    rxListener->statusChanged(aEvent);
 }
 
 void SAL_CALL PresenterProtocolHandler::Dispatch::removeStatusListener (
     const css::uno::Reference<css::frame::XStatusListener>& rxListener,
     const css::util::URL& rURL)
 {
-    if (rURL.Path == msURLPath)
-    {
-        StatusListenerContainer::iterator iListener (
-            ::std::find(
-                maStatusListenerContainer.begin(),
-                maStatusListenerContainer.end(),
-                rxListener));
-        if (iListener != maStatusListenerContainer.end())
-            maStatusListenerContainer.erase(iListener);
-    }
-    else
+    if (rURL.Path != msURLPath)
         throw RuntimeException();
+
+    StatusListenerContainer::iterator iListener (
+        ::std::find(
+            maStatusListenerContainer.begin(),
+            maStatusListenerContainer.end(),
+            rxListener));
+    if (iListener != maStatusListenerContainer.end())
+        maStatusListenerContainer.erase(iListener);
 }
 
 //----- document::XEventListener ----------------------------------------------
diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx
index cab703490918..d6f977f4bd74 100644
--- a/sfx2/source/control/thumbnailviewacc.cxx
+++ b/sfx2/source/control/thumbnailviewacc.cxx
@@ -138,14 +138,12 @@ uno::Reference< accessibility::XAccessible > SAL_CALL ThumbnailViewAcc::getAcces
 {
     ThrowIfDisposed();
     const SolarMutexGuard aSolarGuard;
-    uno::Reference< accessibility::XAccessible >    xRet;
     ThumbnailViewItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(i));
 
-    if( pItem )
-        xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
-    else
+    if( !pItem )
         throw lang::IndexOutOfBoundsException();
 
+    uno::Reference< accessibility::XAccessible >  xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
     return xRet;
 }
 
@@ -414,12 +412,10 @@ void SAL_CALL ThumbnailViewAcc::selectAccessibleChild( sal_Int32 nChildIndex )
     const SolarMutexGuard aSolarGuard;
     ThumbnailViewItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
 
-    if(pItem != nullptr)
-    {
-        mpParent->SelectItem( pItem->mnId );
-    }
-    else
+    if(pItem == nullptr)
         throw lang::IndexOutOfBoundsException();
+
+    mpParent->SelectItem( pItem->mnId );
 }
 
 sal_Bool SAL_CALL ThumbnailViewAcc::isAccessibleChildSelected( sal_Int32 nChildIndex )
@@ -427,14 +423,11 @@ sal_Bool SAL_CALL ThumbnailViewAcc::isAccessibleChildSelected( sal_Int32 nChildI
     ThrowIfDisposed();
     const SolarMutexGuard aSolarGuard;
     ThumbnailViewItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
-    bool            bRet = false;
 
-    if (pItem != nullptr)
-        bRet = mpParent->IsItemSelected( pItem->mnId );
-    else
+    if (pItem == nullptr)
         throw lang::IndexOutOfBoundsException();
 
-    return bRet;
+    return mpParent->IsItemSelected( pItem->mnId );
 }
 
 void SAL_CALL ThumbnailViewAcc::clearAccessibleSelection()
diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx
index b7913dc4e349..2879e12e1131 100644
--- a/sfx2/source/doc/Metadatable.cxx
+++ b/sfx2/source/doc/Metadatable.cxx
@@ -1281,15 +1281,13 @@ void Metadatable::SetMetadataReference( const css::beans::StringPair & i_rRefere
                             IsInContent() ? s_content : s_styles );
         }
         XmlIdRegistry & rReg( dynamic_cast<XmlIdRegistry&>( GetRegistry() ) );
-        if (rReg.TryRegisterMetadatable(*this, streamName, i_rReference.Second))
-        {
-            m_pReg = &rReg;
-        }
-        else
+        if (!rReg.TryRegisterMetadatable(*this, streamName, i_rReference.Second))
         {
             throw lang::IllegalArgumentException(
                 "Metadatable::SetMetadataReference: argument is invalid", /*this*/nullptr, 0);
         }
+
+        m_pReg = &rReg;
     }
 }
 
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index ecbdededf266..f3e6c5124024 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -1843,16 +1843,15 @@ SfxDocumentMetaData::storeToStorage(
     xExp->setSourceDocument(css::uno::Reference<css::lang::XComponent>(this));
     css::uno::Reference<css::document::XFilter> xFilter(xExp,
         css::uno::UNO_QUERY_THROW);
-    if (xFilter->filter(css::uno::Sequence< css::beans::PropertyValue >())) {
-        css::uno::Reference<css::embed::XTransactedObject> xTransaction(
-            xStorage, css::uno::UNO_QUERY);
-        if (xTransaction.is()) {
-            xTransaction->commit();
-        }
-    } else {
+    if (!xFilter->filter(css::uno::Sequence< css::beans::PropertyValue >())) {
         throw css::io::IOException(
                 "SfxDocumentMetaData::storeToStorage: cannot filter", *this);
     }
+    css::uno::Reference<css::embed::XTransactedObject> xTransaction(
+        xStorage, css::uno::UNO_QUERY);
+    if (xTransaction.is()) {
+        xTransaction->commit();
+    }
 }
 
 void SAL_CALL
@@ -1955,17 +1954,16 @@ void SAL_CALL SfxDocumentMetaData::initialize( const css::uno::Sequence< css::un
 
     for (sal_Int32 i = 0; i < aArguments.getLength(); ++i) {
         const css::uno::Any any = aArguments[i];
-        if (any >>= xDoc) {
-            if (!xDoc.is()) {
-                throw css::lang::IllegalArgumentException(
-                    "SfxDocumentMetaData::initialize: argument is null",
-                    *this, static_cast<sal_Int16>(i));
-            }
-        } else {
+        if (!(any >>= xDoc)) {
             throw css::lang::IllegalArgumentException(
                 "SfxDocumentMetaData::initialize: argument must be XDocument",
                 *this, static_cast<sal_Int16>(i));
         }
+        if (!xDoc.is()) {
+            throw css::lang::IllegalArgumentException(
+                "SfxDocumentMetaData::initialize: argument is null",
+                *this, static_cast<sal_Int16>(i));
+        }
     }
 
     if (!xDoc.is()) {
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 75a6c4f9353b..548ccd30d161 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -613,15 +613,7 @@ bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName )
                             GetMediaDescr() >> aPropsForDialog;
                             xFilterProperties->setPropertyValues( aPropsForDialog );
 
-                            if( xFilterDialog->execute() )
-                            {
-                                uno::Sequence< beans::PropertyValue > aPropsFromDialog =
-                                                                            xFilterProperties->getPropertyValues();
-                                const sal_Int32 nPropsLen {aPropsFromDialog.getLength()};
-                                for ( sal_Int32 nInd = 0; nInd < nPropsLen; ++nInd )
-                                    GetMediaDescr()[aPropsFromDialog[nInd].Name] = aPropsFromDialog[nInd].Value;
-                            }
-                            else
+                            if( !xFilterDialog->execute() )
                             {
                                 throw task::ErrorCodeIOException(
                                     ("ModelData_Impl::ExecuteFilterDialog_Impl:"
@@ -629,6 +621,12 @@ bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName )
                                     uno::Reference< uno::XInterface >(),
                                     sal_uInt32(ERRCODE_IO_ABORT));
                             }
+
+                            uno::Sequence< beans::PropertyValue > aPropsFromDialog =
+                                                                        xFilterProperties->getPropertyValues();
+                            const sal_Int32 nPropsLen {aPropsFromDialog.getLength()};
+                            for ( sal_Int32 nInd = 0; nInd < nPropsLen; ++nInd )
+                                GetMediaDescr()[aPropsFromDialog[nInd].Name] = aPropsFromDialog[nInd].Value;
                         }
                     }
 
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 0dfd5b80959f..6dc7fc317dc2 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -622,15 +622,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
 
                 SfxStoringHelper aHelper;
 
-                if ( QueryHiddenInformation( bIsPDFExport ? HiddenWarningFact::WhenCreatingPDF : HiddenWarningFact::WhenSaving, nullptr ) == RET_YES )
-                {
-                    aHelper.GUIStoreModel( GetModel(),
-                                                         OUString::createFromAscii( pSlot->GetUnoName() ),
-                                                         aDispatchArgs,
-                                                         bPreselectPassword,
-                                                         GetDocumentSignatureState() );
-                }
-                else
+                if ( QueryHiddenInformation( bIsPDFExport ? HiddenWarningFact::WhenCreatingPDF : HiddenWarningFact::WhenSaving, nullptr ) != RET_YES )
                 {
                     // the user has decided not to store the document
                     throw task::ErrorCodeIOException(
@@ -638,6 +630,13 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                         uno::Reference< uno::XInterface >(), sal_uInt32(ERRCODE_IO_ABORT));
                 }
 
+                aHelper.GUIStoreModel( GetModel(),
+                                       OUString::createFromAscii( pSlot->GetUnoName() ),
+                                       aDispatchArgs,
+                                       bPreselectPassword,
+                                       GetDocumentSignatureState() );
+
+
                 // merge aDispatchArgs to the request
                 SfxAllItemSet aResultParams( GetPool() );
                 TransformParameters( nId,
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index f4824a6b8fe8..3e02827bbe6e 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -698,7 +698,6 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
             sal_Int32 nCopies = 0;
             if ( !( rProp.Value >>= nCopies ) )
                 throw css::lang::IllegalArgumentException();
-
             aCheckedArgs[nProps].Name = rProp.Name;
             aCheckedArgs[nProps++].Value <<= nCopies;
         }
@@ -708,26 +707,20 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
         else if ( rProp.Name == "Collate" || rProp.Name == "Sort" )
         {
             bool bTemp;
-            if ( rProp.Value >>= bTemp )
-            {
-                aCheckedArgs[nProps].Name = "Collate";
-                aCheckedArgs[nProps++].Value <<= bTemp;
-            }
-            else
+            if ( !(rProp.Value >>= bTemp) )
                 throw css::lang::IllegalArgumentException();
+            aCheckedArgs[nProps].Name = "Collate";
+            aCheckedArgs[nProps++].Value <<= bTemp;
         }
 
         // Pages-Property
         else if ( rProp.Name == "Pages" )
         {
             OUString sTemp;
-            if( rProp.Value >>= sTemp )
-            {
-                aCheckedArgs[nProps].Name = rProp.Name;
-                aCheckedArgs[nProps++].Value <<= sTemp;
-            }
-            else
+            if( !(rProp.Value >>= sTemp) )
                 throw css::lang::IllegalArgumentException();
+            aCheckedArgs[nProps].Name = rProp.Name;
+            aCheckedArgs[nProps++].Value <<= sTemp;
         }
 
         // MonitorVisible
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index d3907953cbb0..ce5f43c9bf9d 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1878,95 +1878,87 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla
     {
         if ( aFlavor.MimeType == "application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"" )
         {
-            if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() )
-            {
-                TransferableObjectDescriptor aDesc;
+            if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() )
+                throw datatransfer::UnsupportedFlavorException();
 
-                aDesc.maClassName = m_pData->m_pObjectShell->GetClassName();
-                aDesc.maTypeName = aFlavor.HumanPresentableName;
+            TransferableObjectDescriptor aDesc;
 
-                // TODO/LATER: ViewAspect needs to be sal_Int64
-                aDesc.mnViewAspect = sal::static_int_cast< sal_uInt16 >( embed::Aspects::MSOLE_CONTENT );
+            aDesc.maClassName = m_pData->m_pObjectShell->GetClassName();
+            aDesc.maTypeName = aFlavor.HumanPresentableName;
 
-                Size aSize = m_pData->m_pObjectShell->GetVisArea().GetSize();
+            // TODO/LATER: ViewAspect needs to be sal_Int64
+            aDesc.mnViewAspect = sal::static_int_cast< sal_uInt16 >( embed::Aspects::MSOLE_CONTENT );
 
-                MapUnit aMapUnit = m_pData->m_pObjectShell->GetMapUnit();
-                aDesc.maSize = OutputDevice::LogicToLogic( aSize, aMapUnit, MapUnit::Map100thMM );
-                aDesc.maDragStartPos = Point();
-                aDesc.maDisplayName.clear();
+            Size aSize = m_pData->m_pObjectShell->GetVisArea().GetSize();
 
-                SvMemoryStream aMemStm( 1024, 1024 );
-                WriteTransferableObjectDescriptor( aMemStm, aDesc );
-                aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Tell() );
-            }
-            else
-                throw datatransfer::UnsupportedFlavorException();
+            MapUnit aMapUnit = m_pData->m_pObjectShell->GetMapUnit();
+            aDesc.maSize = OutputDevice::LogicToLogic( aSize, aMapUnit, MapUnit::Map100thMM );
+            aDesc.maDragStartPos = Point();
+            aDesc.maDisplayName.clear();
+
+            SvMemoryStream aMemStm( 1024, 1024 );
+            WriteTransferableObjectDescriptor( aMemStm, aDesc );
+            aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Tell() );
         }
         else if ( aFlavor.MimeType == "application/x-openoffice-embed-source;windows_formatname=\"Star EMBS\"" )
         {
-            if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() )
+            if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() )
+                throw datatransfer::UnsupportedFlavorException();
+
+            try
+            {
+                utl::TempFile aTmp;
+                aTmp.EnableKillingFile();
+                storeToURL( aTmp.GetURL(), Sequence < beans::PropertyValue >() );
+                SvStream* pStream = aTmp.GetStream( StreamMode::READ );
+                const sal_uInt32 nLen = pStream->Seek( STREAM_SEEK_TO_END );
+                Sequence< sal_Int8 > aSeq( nLen );
+                pStream->Seek( STREAM_SEEK_TO_BEGIN );
+                pStream->ReadBytes(aSeq.getArray(), nLen);
+                delete pStream;
+                if( aSeq.getLength() )
+                    aAny <<= aSeq;
+            }
+            catch ( Exception& )
             {
-                try
-                {
-                    utl::TempFile aTmp;
-                    aTmp.EnableKillingFile();
-                    storeToURL( aTmp.GetURL(), Sequence < beans::PropertyValue >() );
-                    SvStream* pStream = aTmp.GetStream( StreamMode::READ );
-                    const sal_uInt32 nLen = pStream->Seek( STREAM_SEEK_TO_END );
-                    Sequence< sal_Int8 > aSeq( nLen );
-                    pStream->Seek( STREAM_SEEK_TO_BEGIN );
-                    pStream->ReadBytes(aSeq.getArray(), nLen);
-                    delete pStream;
-                    if( aSeq.getLength() )
-                        aAny <<= aSeq;
-                }
-                catch ( Exception& )
-                {
-                }
             }
-            else
-                throw datatransfer::UnsupportedFlavorException();
         }
         else if ( aFlavor.MimeType == "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" )
         {
-            if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() )
-            {
+            if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() )
+                throw datatransfer::UnsupportedFlavorException();
 
-                std::shared_ptr<GDIMetaFile> xMetaFile =
-                    m_pData->m_pObjectShell->GetPreviewMetaFile( true );
 
-                if (xMetaFile)
-                {
-                    SvMemoryStream aMemStm( 65535, 65535 );
-                    aMemStm.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
+            std::shared_ptr<GDIMetaFile> xMetaFile =
+                m_pData->m_pObjectShell->GetPreviewMetaFile( true );
 
-                    xMetaFile->Write( aMemStm );
-                    aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ),
-                                                    aMemStm.Seek( STREAM_SEEK_TO_END ) );
-                }
+            if (xMetaFile)
+            {
+                SvMemoryStream aMemStm( 65535, 65535 );
+                aMemStm.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
+
+                xMetaFile->Write( aMemStm );
+                aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ),
+                                                aMemStm.Seek( STREAM_SEEK_TO_END ) );
             }
-            else
-                throw datatransfer::UnsupportedFlavorException();
         }
         else if ( aFlavor.MimeType == "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"" )
         {
-            if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() )
-            {
-                std::shared_ptr<GDIMetaFile> xMetaFile =
-                    m_pData->m_pObjectShell->CreatePreviewMetaFile_Impl( true );
+            if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() )
+                throw datatransfer::UnsupportedFlavorException();
 
-                if (xMetaFile)
-                {
-                    SvMemoryStream aMemStm( 65535, 65535 );
-                    aMemStm.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
+            std::shared_ptr<GDIMetaFile> xMetaFile =
+                m_pData->m_pObjectShell->CreatePreviewMetaFile_Impl( true );
 
-                    xMetaFile->Write( aMemStm );
-                    aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ),
-                                                    aMemStm.Seek( STREAM_SEEK_TO_END ) );
-                }
+            if (xMetaFile)
+            {
+                SvMemoryStream aMemStm( 65535, 65535 );
+                aMemStm.SetVersion( SOFFICE_FILEFORMAT_CURRENT );
+
+                xMetaFile->Write( aMemStm );
+                aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( aMemStm.GetData() ),
+                                                aMemStm.Seek( STREAM_SEEK_TO_END ) );
             }
-            else
-                throw datatransfer::UnsupportedFlavorException();
         }
         else if ( aFlavor.MimeType == "application/x-openoffice-emf;windows_formatname=\"Image EMF\"" )
         {
@@ -2045,51 +2037,47 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla
         }
         else if ( aFlavor.MimeType == "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"" )
         {
-            if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() )
+            if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() )
+                throw datatransfer::UnsupportedFlavorException();
+
+            std::shared_ptr<GDIMetaFile> xMetaFile =
+                m_pData->m_pObjectShell->GetPreviewMetaFile( true );
+
+            if (xMetaFile)
             {
-                std::shared_ptr<GDIMetaFile> xMetaFile =
-                    m_pData->m_pObjectShell->GetPreviewMetaFile( true );
+                std::shared_ptr<SvMemoryStream> xStream(
+                    GraphicHelper::getFormatStrFromGDI_Impl(
+                        xMetaFile.get(), ConvertDataFormat::BMP ) );
 
-                if (xMetaFile)
+                if (xStream)
                 {
-                    std::shared_ptr<SvMemoryStream> xStream(
-                        GraphicHelper::getFormatStrFromGDI_Impl(
-                            xMetaFile.get(), ConvertDataFormat::BMP ) );
-
-                    if (xStream)
-                    {
-                        xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT );
-                        aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ),
-                                                        xStream->Seek( STREAM_SEEK_TO_END ) );
-                    }
+                    xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT );
+                    aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ),
+                                                    xStream->Seek( STREAM_SEEK_TO_END ) );
                 }
             }
-            else
-                throw datatransfer::UnsupportedFlavorException();
         }
         else if ( aFlavor.MimeType == "image/png" )
         {
-            if ( aFlavor.DataType == cppu::UnoType<Sequence< sal_Int8 >>::get() )
+            if ( aFlavor.DataType != cppu::UnoType<Sequence< sal_Int8 >>::get() )
+                throw datatransfer::UnsupportedFlavorException();
+
+            std::shared_ptr<GDIMetaFile> xMetaFile =
+                m_pData->m_pObjectShell->GetPreviewMetaFile( true );
+
+            if (xMetaFile)
             {
-                std::shared_ptr<GDIMetaFile> xMetaFile =
-                    m_pData->m_pObjectShell->GetPreviewMetaFile( true );
+                std::shared_ptr<SvMemoryStream> xStream(
+                    GraphicHelper::getFormatStrFromGDI_Impl(
+                        xMetaFile.get(), ConvertDataFormat::PNG ) );
 
-                if (xMetaFile)
+                if (xStream)
                 {
-                    std::shared_ptr<SvMemoryStream> xStream(
-                        GraphicHelper::getFormatStrFromGDI_Impl(
-                            xMetaFile.get(), ConvertDataFormat::PNG ) );
-
-                    if (xStream)
-                    {
-                        xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT );
-                        aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ),
-                                                        xStream->Seek( STREAM_SEEK_TO_END ) );
-                    }
+                    xStream->SetVersion( SOFFICE_FILEFORMAT_CURRENT );
+                    aAny <<= Sequence< sal_Int8 >( static_cast< const sal_Int8* >( xStream->GetData() ),
+                                                    xStream->Seek( STREAM_SEEK_TO_END ) );
                 }
             }
-            else
-                throw datatransfer::UnsupportedFlavorException();
         }
         else
             throw datatransfer::UnsupportedFlavorException();
diff --git a/sfx2/source/sidebar/UnoDecks.cxx b/sfx2/source/sidebar/UnoDecks.cxx
index 66dcc0719092..9812bc5c6dfa 100644
--- a/sfx2/source/sidebar/UnoDecks.cxx
+++ b/sfx2/source/sidebar/UnoDecks.cxx
@@ -38,17 +38,11 @@ uno::Any SAL_CALL SfxUnoDecks::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
 
-    uno::Any aRet;
-
-    if (hasByName(aName))
-    {
-        uno::Reference<ui::XDeck> xDeck = new SfxUnoDeck(xFrame, aName);
-        aRet <<= xDeck;
-    }
-    else
+    if (!hasByName(aName))
         throw container::NoSuchElementException();
 
-    return aRet;
+    uno::Reference<ui::XDeck> xDeck = new SfxUnoDeck(xFrame, aName);
+    return uno::Any(xDeck);
 }
 
 
diff --git a/sfx2/source/sidebar/UnoPanels.cxx b/sfx2/source/sidebar/UnoPanels.cxx
index 257c75cea4bc..a74763572cdb 100644
--- a/sfx2/source/sidebar/UnoPanels.cxx
+++ b/sfx2/source/sidebar/UnoPanels.cxx
@@ -47,17 +47,11 @@ uno::Any SAL_CALL SfxUnoPanels::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
 
-    uno::Any aRet;
-
-    if (hasByName(aName))
-    {
-        uno::Reference<ui::XPanel> xPanel = new SfxUnoPanel(xFrame, aName, mDeckId);
-        aRet <<= xPanel;
-    }
-    else
+    if (!hasByName(aName))
         throw container::NoSuchElementException();
 
-    return aRet;
+    uno::Reference<ui::XPanel> xPanel = new SfxUnoPanel(xFrame, aName, mDeckId);
+    return uno::Any(xPanel);
 }
 
 
diff --git a/shell/source/unix/sysshell/recently_used_file.cxx b/shell/source/unix/sysshell/recently_used_file.cxx
index ee0e598fbd32..9068e96b0b55 100644
--- a/shell/source/unix/sysshell/recently_used_file.cxx
+++ b/shell/source/unix/sysshell/recently_used_file.cxx
@@ -50,37 +50,35 @@ recently_used_file::recently_used_file() :
     osl::Security sec;
     OUString homedir_url;
 
-    if (sec.getHomeDir(homedir_url))
-    {
-        OUString homedir;
-        osl::FileBase::getSystemPathFromFileURL(homedir_url, homedir);
-
-        OUString rufn = homedir;
-        ensure_final_slash(rufn);
-        rufn += ".recently-used";
-
-        OString tmp =
-            OUStringToOString(rufn, osl_getThreadTextEncoding());
-
-        int fd = open(tmp.getStr(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
-        if (fd != -1) {
-            file_ = fdopen(fd, "w+");
-            if (file_ == nullptr) {
-                close(fd);
-            }
-        }
+    if (!sec.getHomeDir(homedir_url))
+        throw "Cannot determine user home directory";
+
+    OUString homedir;
+    osl::FileBase::getSystemPathFromFileURL(homedir_url, homedir);
+
+    OUString rufn = homedir;
+    ensure_final_slash(rufn);
+    rufn += ".recently-used";
 
-        if (nullptr == file_)
-            throw "I/O error opening ~/.recently-used";
+    OString tmp =
+        OUStringToOString(rufn, osl_getThreadTextEncoding());
 
-        if (lockf(fileno(file_), F_LOCK, 0) != 0)
-        {
-            fclose(file_);
-            throw "Cannot lock ~/.recently-used";
+    int fd = open(tmp.getStr(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+    if (fd != -1) {
+        file_ = fdopen(fd, "w+");
+        if (file_ == nullptr) {
+            close(fd);
         }
     }
-    else
-        throw "Cannot determine user home directory";
+
+    if (nullptr == file_)
+        throw "I/O error opening ~/.recently-used";
+
+    if (lockf(fileno(file_), F_LOCK, 0) != 0)
+    {
+        fclose(file_);
+        throw "Cannot lock ~/.recently-used";
+    }
 }
 
 
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index ef5276b6512d..114662deaf15 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -584,19 +584,17 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
                     if (pPrinter)
                     {
                         OUString sPrinterName;
-                        if (*pValues >>= sPrinterName )
+                        if ( !(*pValues >>= sPrinterName) )
+                            throw IllegalArgumentException();
+
+                        if ( !sPrinterName.isEmpty() )
                         {
-                            if ( !sPrinterName.isEmpty() )
-                            {
-                                VclPtrInstance<SfxPrinter> pNewPrinter( std::unique_ptr<SfxItemSet>(pPrinter->GetOptions().Clone()), sPrinterName );
-                                if (pNewPrinter->IsKnown())
-                                    pDocSh->SetPrinter ( pNewPrinter );
-                                else
-                                    pNewPrinter.disposeAndClear();
-                            }
+                            VclPtrInstance<SfxPrinter> pNewPrinter( std::unique_ptr<SfxItemSet>(pPrinter->GetOptions().Clone()), sPrinterName );
+                            if (pNewPrinter->IsKnown())
+                                pDocSh->SetPrinter ( pNewPrinter );
+                            else
+                                pNewPrinter.disposeAndClear();
                         }
-                        else
-                            throw IllegalArgumentException();
                     }
                 }
             }
@@ -604,61 +602,57 @@ void SmModel::_setPropertyValues(const PropertyMapEntry** ppEntries, const Any*
             case HANDLE_PRINTER_SETUP:
             {
                 Sequence < sal_Int8 > aSequence;
-                if ( *pValues >>= aSequence )
-                {
-                    sal_uInt32 nSize = aSequence.getLength();
-                    SvMemoryStream aStream ( aSequence.getArray(), nSize, StreamMode::READ );
-                    aStream.Seek ( STREAM_SEEK_TO_BEGIN );
-                    static sal_uInt16 const nRange[] =
-                    {
-                        SID_PRINTSIZE,       SID_PRINTSIZE,
-                        SID_PRINTZOOM,       SID_PRINTZOOM,
-                        SID_PRINTTITLE,      SID_PRINTTITLE,
-                        SID_PRINTTEXT,       SID_PRINTTEXT,
-                        SID_PRINTFRAME,      SID_PRINTFRAME,
-                        SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES,
-                        SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS,
-                        SID_AUTO_CLOSE_BRACKETS,    SID_AUTO_CLOSE_BRACKETS,
-                        0
-                    };
-                    auto pItemSet = o3tl::make_unique<SfxItemSet>( SmDocShell::GetPool(), nRange );
-                    SmModule *pp = SM_MOD();
-                    pp->GetConfig()->ConfigToItemSet(*pItemSet);
-                    VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
-
-                    pDocSh->SetPrinter( pPrinter );
-                }
-                else
+                if ( !(*pValues >>= aSequence) )
                     throw IllegalArgumentException();
+
+                sal_uInt32 nSize = aSequence.getLength();
+                SvMemoryStream aStream ( aSequence.getArray(), nSize, StreamMode::READ );
+                aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+                static sal_uInt16 const nRange[] =
+                {
+                    SID_PRINTSIZE,       SID_PRINTSIZE,
+                    SID_PRINTZOOM,       SID_PRINTZOOM,
+                    SID_PRINTTITLE,      SID_PRINTTITLE,
+                    SID_PRINTTEXT,       SID_PRINTTEXT,
+                    SID_PRINTFRAME,      SID_PRINTFRAME,
+                    SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES,
+                    SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS,
+                    SID_AUTO_CLOSE_BRACKETS,    SID_AUTO_CLOSE_BRACKETS,
+                    0
+                };
+                auto pItemSet = o3tl::make_unique<SfxItemSet>( SmDocShell::GetPool(), nRange );
+                SmModule *pp = SM_MOD();
+                pp->GetConfig()->ConfigToItemSet(*pItemSet);
+                VclPtr<SfxPrinter> pPrinter = SfxPrinter::Create ( aStream, std::move(pItemSet) );
+
+                pDocSh->SetPrinter( pPrinter );
             }
             break;
             case HANDLE_SYMBOLS:
             {
                 // this is set
                 Sequence < SymbolDescriptor > aSequence;
-                if ( *pValues >>= aSequence )
+                if ( !(*pValues >>= aSequence) )
+                    throw IllegalArgumentException();
+
+                sal_uInt32 nSize = aSequence.getLength();
+                SmModule *pp = SM_MOD();
+                SmSymbolManager &rManager = pp->GetSymbolManager();
+                SymbolDescriptor *pDescriptor = aSequence.getArray();
+                for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++)
                 {
-                    sal_uInt32 nSize = aSequence.getLength();
-                    SmModule *pp = SM_MOD();
-                    SmSymbolManager &rManager = pp->GetSymbolManager();
-                    SymbolDescriptor *pDescriptor = aSequence.getArray();
-                    for (sal_uInt32 i = 0; i < nSize ; i++, pDescriptor++)
-                    {
-                        vcl::Font aFont;
-                        aFont.SetFamilyName ( pDescriptor->sFontName );
-                        aFont.SetCharSet ( static_cast < rtl_TextEncoding > (pDescriptor->nCharSet) );
-                        aFont.SetFamily ( static_cast < FontFamily > (pDescriptor->nFamily ) );
-                        aFont.SetPitch  ( static_cast < FontPitch >  (pDescriptor->nPitch ) );
-                        aFont.SetWeight ( static_cast < FontWeight > (pDescriptor->nWeight ) );
-                        aFont.SetItalic ( static_cast < FontItalic > (pDescriptor->nItalic ) );
-                        SmSym aSymbol ( pDescriptor->sName, aFont, static_cast < sal_Unicode > (pDescriptor->nCharacter),
-                                        pDescriptor->sSymbolSet );
-                        aSymbol.SetExportName ( pDescriptor->sExportName );
-                        rManager.AddOrReplaceSymbol ( aSymbol );
-                    }
+                    vcl::Font aFont;
+                    aFont.SetFamilyName ( pDescriptor->sFontName );
+                    aFont.SetCharSet ( static_cast < rtl_TextEncoding > (pDescriptor->nCharSet) );
+                    aFont.SetFamily ( static_cast < FontFamily > (pDescriptor->nFamily ) );
+                    aFont.SetPitch  ( static_cast < FontPitch >  (pDescriptor->nPitch ) );
+                    aFont.SetWeight ( static_cast < FontWeight > (pDescriptor->nWeight ) );
+                    aFont.SetItalic ( static_cast < FontItalic > (pDescriptor->nItalic ) );
+                    SmSym aSymbol ( pDescriptor->sName, aFont, static_cast < sal_Unicode > (pDescriptor->nCharacter),
+                                    pDescriptor->sSymbolSet );
+                    aSymbol.SetExportName ( pDescriptor->sExportName );
+                    rManager.AddOrReplaceSymbol ( aSymbol );
                 }
-                else
-                    throw IllegalArgumentException();
             }
             break;
             // #i33095# Security Options
diff --git a/stoc/source/corereflection/crcomp.cxx b/stoc/source/corereflection/crcomp.cxx
index 0a0572676a73..01e043144075 100644
--- a/stoc/source/corereflection/crcomp.cxx
+++ b/stoc/source/corereflection/crcomp.cxx
@@ -210,16 +210,13 @@ void IdlCompFieldImpl::set( const Any & rObj, const Any & rValue )
         if (pTD)
         {
             TYPELIB_DANGER_RELEASE( pObjTD );
-            if (coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() ))
-            {
-                return;
-            }
-            else
+            if (!coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() ))
             {
                 throw IllegalArgumentException(
                     "cannot assign value to destination",
                     static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 1 );
             }
+            return;
         }
         TYPELIB_DANGER_RELEASE( pObjTD );
     }
@@ -246,16 +243,13 @@ void IdlCompFieldImpl::set( Any & rObj, const Any & rValue )
         if (pTD)
         {
             TYPELIB_DANGER_RELEASE( pObjTD );
-            if (coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() ))
-            {
-                return;
-            }
-            else
+            if (!coerce_assign( const_cast<char *>(static_cast<char const *>(rObj.getValue()) + _nOffset), getTypeDescr(), rValue, getReflection() ))
             {
                 throw IllegalArgumentException(
                     "cannot assign to destination",
                     static_cast<XWeak *>(static_cast<OWeakObject *>(this)), 1 );
             }
+            return;
         }
         TYPELIB_DANGER_RELEASE( pObjTD );
     }
diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx
index 00c9429b3586..8982b768a684 100644
--- a/stoc/source/corereflection/crefl.cxx
+++ b/stoc/source/corereflection/crefl.cxx
@@ -264,12 +264,10 @@ Any IdlReflectionServiceImpl::getByHierarchicalName( const OUString & rName )
         // else is enum member(?)
 
         // update
-        if (aRet.hasValue())
-            _aElements.setValue( rName, aRet );
-        else
-        {
+        if (!aRet.hasValue())
             throw container::NoSuchElementException( rName );
-        }
+
+        _aElements.setValue( rName, aRet );
     }
     return aRet;
 }
diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx
index 680e55083dd4..841cb235eb90 100644
--- a/stoc/source/corereflection/criface.cxx
+++ b/stoc/source/corereflection/criface.cxx
@@ -296,16 +296,15 @@ void IdlAttributeFieldImpl::checkException(
             &e, exception->pData, exception->pType,
             getReflection()->getUno2Cpp().get());
         uno_any_destruct(exception, nullptr);
-        if (e.isExtractableTo(
+        if (!e.isExtractableTo(
                 cppu::UnoType<RuntimeException>::get()))
         {
-            cppu::throwException(e);
-        } else {
             throw WrappedTargetRuntimeException(
                 "non-RuntimeException occurred when accessing an"
                 " interface type attribute",
                 context, e);
         }
+        cppu::throwException(e);
     }
 }
 
diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx
index fb54149dc27d..5f24b18e34f6 100644
--- a/stoc/source/defaultregistry/defaultregistry.cxx
+++ b/stoc/source/defaultregistry/defaultregistry.cxx
@@ -263,10 +263,10 @@ sal_Bool SAL_CALL NestedKeyImpl::isReadOnly(  )
     Guard< Mutex > aGuard( m_xRegistry->m_mutex );
     computeChanges();
 
-    if ( m_localKey.is() && m_localKey->isValid() )
-           return m_localKey->isReadOnly();
-    else
+    if ( !m_localKey.is() || !m_localKey->isValid() )
         throw InvalidRegistryException();
+
+   return m_localKey->isReadOnly();
 }
 
 
@@ -724,22 +724,20 @@ void SAL_CALL NestedKeyImpl::closeKey(  )
 void SAL_CALL NestedKeyImpl::deleteKey( const OUString& rKeyName )
 {
     Guard< Mutex > aGuard( m_xRegistry->m_mutex );
-    if ( m_localKey.is() && m_localKey->isValid() &&
-         !m_localKey->isReadOnly() )
+    if ( !m_localKey.is() || !m_localKey->isValid() ||
+         m_localKey->isReadOnly() )
     {
-        OUString resolvedName = computeName(rKeyName);
+        throw InvalidRegistryException();
+    }
 
-        if ( resolvedName.isEmpty() )
-        {
-            throw InvalidRegistryException();
-        }
+    OUString resolvedName = computeName(rKeyName);
 
-        m_xRegistry->m_localReg->getRootKey()->deleteKey(resolvedName);
-    }
-    else
+    if ( resolvedName.isEmpty() )
     {
         throw InvalidRegistryException();
     }
+
+    m_xRegistry->m_localReg->getRootKey()->deleteKey(resolvedName);
 }
 
 
@@ -976,15 +974,13 @@ void SAL_CALL NestedKeyImpl::deleteLink( const OUString& rLinkName )
             resolvedName = m_name + "/" + rLinkName;
     }
 
-    if ( m_localKey.is() && m_localKey->isValid() &&
-         !m_localKey->isReadOnly() )
-    {
-        m_xRegistry->m_localReg->getRootKey()->deleteLink(resolvedName);
-    }
-    else
+    if ( !m_localKey.is() || !m_localKey->isValid() ||
+         m_localKey->isReadOnly() )
     {
         throw InvalidRegistryException();
     }
+
+    m_xRegistry->m_localReg->getRootKey()->deleteLink(resolvedName);
 }
 
 
@@ -1224,25 +1220,23 @@ void SAL_CALL NestedRegistryImpl::destroy(  )
 Reference< XRegistryKey > SAL_CALL NestedRegistryImpl::getRootKey(  )
 {
     Guard< Mutex > aGuard( m_mutex );
-    if ( m_localReg.is() && m_localReg->isValid() )
+    if ( !m_localReg.is() || !m_localReg->isValid() )
     {
-        Reference<XRegistryKey> localKey, defaultKey;
+        throw InvalidRegistryException();
+    }
 
-        localKey = m_localReg->getRootKey();
+    Reference<XRegistryKey> localKey, defaultKey;
 
-        if ( localKey.is() )
-        {
-            if ( m_defaultReg.is() && m_defaultReg->isValid() )
-            {
-                defaultKey = m_defaultReg->getRootKey();
-            }
+    localKey = m_localReg->getRootKey();
 
-            return static_cast<XRegistryKey*>(new NestedKeyImpl(this, localKey, defaultKey));
-        }
-    }
-    else
+    if ( localKey.is() )
     {
-        throw InvalidRegistryException();
+        if ( m_defaultReg.is() && m_defaultReg->isValid() )
+        {
+            defaultKey = m_defaultReg->getRootKey();
+        }
+
+        return static_cast<XRegistryKey*>(new NestedKeyImpl(this, localKey, defaultKey));
     }
 
     return Reference<XRegistryKey>();

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list