[Libreoffice-commits] core.git: canvas/source chart2/source compilerplugins/clang cpputools/source desktop/source embeddedobj/source forms/source framework/source io/source linguistic/source package/source sc/source sdext/source sd/source sfx2/source starmath/source svx/source sw/source ucb/source unodevtools/source vbahelper/source xmlhelp/source xmlsecurity/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Sep 29 06:52:11 UTC 2017


 canvas/source/tools/verifyinput.cxx                               |   37 -
 chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx |    3 
 chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx       |    3 
 compilerplugins/clang/flatten.cxx                                 |  198 ++++++-
 compilerplugins/clang/test/flatten.cxx                            |   40 +
 cpputools/source/unoexe/unoexe.cxx                                |    9 
 desktop/source/app/officeipcthread.cxx                            |    3 
 embeddedobj/source/commonembedding/persistence.cxx                |    7 
 forms/source/xforms/NameContainer.hxx                             |    3 
 framework/source/fwe/xml/xmlnamespaces.cxx                        |   24 
 framework/source/services/substitutepathvars.cxx                  |    6 
 framework/source/tabwin/tabwindow.cxx                             |   92 +--
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |   88 +--
 framework/source/uiconfiguration/uiconfigurationmanager.cxx       |   35 -
 framework/source/uiconfiguration/windowstateconfiguration.cxx     |   76 +-
 framework/source/uifactory/uielementfactorymanager.cxx            |    6 
 io/source/stm/omark.cxx                                           |   21 
 linguistic/source/convdiclist.cxx                                 |    8 
 package/source/zipapi/ZipFile.cxx                                 |   12 
 package/source/zippackage/ZipPackageFolder.cxx                    |   47 -
 sc/source/core/opencl/op_logical.cxx                              |   77 +-
 sc/source/ui/unoobj/docuno.cxx                                    |   15 
 sd/source/core/stlfamily.cxx                                      |    5 
 sd/source/core/stlsheet.cxx                                       |  260 ++++------
 sd/source/ui/unoidl/unopback.cxx                                  |  114 ++--
 sdext/source/presenter/PresenterPaneFactory.cxx                   |    9 
 sdext/source/presenter/PresenterViewFactory.cxx                   |   15 
 sfx2/source/doc/printhelper.cxx                                   |    5 
 sfx2/source/sidebar/TabBar.cxx                                    |   31 -
 starmath/source/accessibility.cxx                                 |  131 ++---
 svx/source/unodraw/unoshap3.cxx                                   |   38 -
 svx/source/unogallery/unogaltheme.cxx                             |   12 
 svx/source/unogallery/unogalthemeprovider.cxx                     |   12 
 sw/source/core/access/accpara.cxx                                 |    4 
 sw/source/core/unocore/unochart.cxx                               |   13 
 sw/source/core/unocore/unodraw.cxx                                |   87 +--
 sw/source/core/unocore/unosett.cxx                                |    3 
 sw/source/core/unocore/unotext.cxx                                |   24 
 sw/source/uibase/uno/unomailmerge.cxx                             |   72 +-
 sw/source/uibase/uno/unotxvw.cxx                                  |   60 +-
 ucb/source/ucp/file/filglob.cxx                                   |    8 
 ucb/source/ucp/file/filinpstr.cxx                                 |    3 
 ucb/source/ucp/file/filstr.cxx                                    |    9 
 unodevtools/source/skeletonmaker/skeletoncommon.cxx               |    3 
 unodevtools/source/unodevtools/options.cxx                        |    7 
 vbahelper/source/vbahelper/vbadocumentbase.cxx                    |    9 
 vbahelper/source/vbahelper/vbahelper.cxx                          |    5 
 xmlhelp/source/cxxhelp/provider/inputstream.cxx                   |    4 
 xmlhelp/source/cxxhelp/provider/urlparameter.cxx                  |    4 
 xmlsecurity/source/xmlsec/saxhelper.cxx                           |   36 -
 50 files changed, 909 insertions(+), 884 deletions(-)

New commits:
commit 1ffba0e356608fb6dbf568248e2a953b4d7fb5d6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Sep 28 10:33:09 2017 +0200

    loplugin:flatten check for throw in then clause
    
    also make the plugin ignore the case where we have var decl's in the
    clause we want to flatten, which could lead to problematic extension of
    variable lifetime
    
    Change-Id: I3061f7104e8c6a460bf74f5eac325a516ec50c59
    Reviewed-on: https://gerrit.libreoffice.org/42889
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/canvas/source/tools/verifyinput.cxx b/canvas/source/tools/verifyinput.cxx
index c5764b38f7aa..9e15738302b4 100644
--- a/canvas/source/tools/verifyinput.cxx
+++ b/canvas/source/tools/verifyinput.cxx
@@ -550,34 +550,31 @@ namespace canvas
                 throw lang::IllegalArgumentException();
 #endif
             }
-            else
+            if( bitmapLayout.ColorSpace->getBitsPerPixel() < 0 )
             {
-                if( bitmapLayout.ColorSpace->getBitsPerPixel() < 0 )
-                {
 #if OSL_DEBUG_LEVEL > 0
-                    throw lang::IllegalArgumentException(
-                        OUString::createFromAscii(pStr) +
-                        ": verifyInput(): bitmap layout's ColorSpace getBitsPerPixel() is negative",
-                        xIf, nArgPos );
+                throw lang::IllegalArgumentException(
+                    OUString::createFromAscii(pStr) +
+                    ": verifyInput(): bitmap layout's ColorSpace getBitsPerPixel() is negative",
+                    xIf, nArgPos );
 #else
-                    throw lang::IllegalArgumentException();
+                throw lang::IllegalArgumentException();
 #endif
-                }
+            }
 
-                if( bitmapLayout.ColorSpace->getEndianness() < util::Endianness::LITTLE ||
-                    bitmapLayout.ColorSpace->getEndianness() > util::Endianness::BIG )
-                {
+            if( bitmapLayout.ColorSpace->getEndianness() < util::Endianness::LITTLE ||
+                bitmapLayout.ColorSpace->getEndianness() > util::Endianness::BIG )
+            {
 #if OSL_DEBUG_LEVEL > 0
-                    throw lang::IllegalArgumentException(
-                        OUString::createFromAscii(pStr) +
-                        ": verifyInput(): bitmap layout's ColorSpace getEndianness() value is out of range (" +
-                        OUString::number(sal::static_int_cast<sal_Int32>(bitmapLayout.ColorSpace->getEndianness())) +
-                        " not known)",
-                        xIf, nArgPos );
+                throw lang::IllegalArgumentException(
+                    OUString::createFromAscii(pStr) +
+                    ": verifyInput(): bitmap layout's ColorSpace getEndianness() value is out of range (" +
+                    OUString::number(sal::static_int_cast<sal_Int32>(bitmapLayout.ColorSpace->getEndianness())) +
+                    " not known)",
+                    xIf, nArgPos );
 #else
-                    throw lang::IllegalArgumentException();
+                throw lang::IllegalArgumentException();
 #endif
-                }
             }
         }
 
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 589e8ad45a48..3bf65b1f71db 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -1357,8 +1357,7 @@ void SAL_CALL ChartDocumentWrapper::setDelegator(
         if( rDelegator.is() )
             throw lang::DisposedException("ChartDocumentWrapper is disposed",
                 static_cast< ::cppu::OWeakObject* >( this ));
-        else
-            return;
+        return;
     }
 
     if( rDelegator.is())
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 95d20ccf654d..f40ac477e780 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -1137,8 +1137,7 @@ void WrappedDataRowSourceProperty::setPropertyValue( const Any& rOuterValue, con
         sal_Int32 nNew = (sal_Int32)css::chart::ChartDataRowSource_ROWS;
         if( !(rOuterValue >>= nNew) )
             throw lang::IllegalArgumentException( "Property DataRowSource requires css::chart::ChartDataRowSource value", nullptr, 0 );
-        else
-            eChartDataRowSource = css::chart::ChartDataRowSource(nNew);
+        eChartDataRowSource = css::chart::ChartDataRowSource(nNew);
     }
 
     m_aOuterValue = rOuterValue;
diff --git a/compilerplugins/clang/flatten.cxx b/compilerplugins/clang/flatten.cxx
index 4ca9d4fc4382..dd7afa44d068 100644
--- a/compilerplugins/clang/flatten.cxx
+++ b/compilerplugins/clang/flatten.cxx
@@ -31,17 +31,21 @@ public:
     }
 
     bool TraverseCXXCatchStmt(CXXCatchStmt * );
-    bool VisitIfStmt(const IfStmt * );
+    bool VisitIfStmt(IfStmt const * );
 private:
-    bool rewrite(const IfStmt * );
+    bool rewrite1(IfStmt const * );
+    bool rewrite2(IfStmt const * );
     SourceRange ignoreMacroExpansions(SourceRange range);
     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;
+    bool checkOverlap(SourceRange);
+    bool lastStmtInParent(Stmt const * stmt);
+
+    std::vector<std::pair<char const *, char const *>> mvModifiedRanges;
 };
 
-static const Stmt * containsSingleThrowExpr(const Stmt * stmt)
+static Stmt const * containsSingleThrowExpr(Stmt const * stmt)
 {
     if (auto compoundStmt = dyn_cast<CompoundStmt>(stmt)) {
         if (compoundStmt->size() != 1)
@@ -54,13 +58,40 @@ static const Stmt * containsSingleThrowExpr(const Stmt * stmt)
     return dyn_cast<CXXThrowExpr>(stmt);
 }
 
+static bool containsVarDecl(Stmt const * stmt)
+{
+    if (auto compoundStmt = dyn_cast<CompoundStmt>(stmt)) {
+        for (auto i = compoundStmt->body_begin(); i != compoundStmt->body_end(); ++i) {
+            auto declStmt = dyn_cast<DeclStmt>(*i);
+            if (declStmt && isa<VarDecl>(*declStmt->decl_begin()))
+                return true;
+        }
+        return false;
+    }
+    auto declStmt = dyn_cast<DeclStmt>(stmt);
+    return declStmt && isa<VarDecl>(*declStmt->decl_begin());
+}
+
+bool Flatten::lastStmtInParent(Stmt const * stmt)
+{
+    auto parent = parentStmt(stmt);
+    if (!parent) {
+        return true;
+    }
+    auto parentCompound = dyn_cast<CompoundStmt>(parent);
+    if (!parentCompound) {
+        return true;
+    }
+    return parentCompound->body_back() == stmt;
+}
+
 bool Flatten::TraverseCXXCatchStmt(CXXCatchStmt* )
 {
     // ignore stuff inside catch statements, where doing a "if...else..throw" is more natural
     return true;
 }
 
-bool Flatten::VisitIfStmt(const IfStmt* ifStmt)
+bool Flatten::VisitIfStmt(IfStmt const * ifStmt)
 {
     if (ignoreLocation(ifStmt))
         return true;
@@ -78,25 +109,51 @@ bool Flatten::VisitIfStmt(const IfStmt* ifStmt)
         return true;
 
     auto throwExpr = containsSingleThrowExpr(ifStmt->getElse());
-    if (!throwExpr)
-        return true;
-
-    // if both the "if" and the "else" contain throws, no improvement
-    if (containsSingleThrowExpr(ifStmt->getThen()))
-        return true;
-
-    if (!rewrite(ifStmt))
+    if (throwExpr)
+    {
+        // if both the "if" and the "else" contain throws, no improvement
+        if (containsSingleThrowExpr(ifStmt->getThen()))
+            return true;
+        // if the "if" statement is not the last statement in it's block, and it contains
+        // var decls in it's then block, we cannot de-indent the then block without
+        // extending the lifetime of some variables, which may be problematic
+        if (!lastStmtInParent(ifStmt) && containsVarDecl(ifStmt->getThen()))
+            return true;
+
+        if (!rewrite1(ifStmt))
+        {
+            report(
+                DiagnosticsEngine::Warning,
+                "unconditional throw in else branch, rather invert the condition, throw early, and flatten the normal case",
+                throwExpr->getLocStart())
+                << throwExpr->getSourceRange();
+            report(
+                DiagnosticsEngine::Note,
+                "if condition here",
+                ifStmt->getLocStart())
+                << ifStmt->getSourceRange();
+        }
+    }
+    throwExpr = containsSingleThrowExpr(ifStmt->getThen());
+    if (throwExpr)
     {
-        report(
-            DiagnosticsEngine::Warning,
-            "unconditional throw in else branch, rather invert the condition, throw early, and flatten the normal case",
-            throwExpr->getLocStart())
-            << throwExpr->getSourceRange();
-        report(
-            DiagnosticsEngine::Note,
-            "if condition here",
-            ifStmt->getLocStart())
-            << ifStmt->getSourceRange();
+        // if both the "if" and the "else" contain throws, no improvement
+        if (containsSingleThrowExpr(ifStmt->getElse()))
+            return true;
+        // if the "if" statement is not the last statement in it's block, and it contains
+        // var decls in it's else block, we cannot de-indent the else block without
+        // extending the lifetime of some variables, which may be problematic
+        if (!lastStmtInParent(ifStmt) && containsVarDecl(ifStmt->getElse()))
+            return true;
+
+        if (!rewrite2(ifStmt))
+        {
+            report(
+                DiagnosticsEngine::Warning,
+                "unconditional throw in then branch, just flatten the else",
+                throwExpr->getLocStart())
+                << throwExpr->getSourceRange();
+        }
     }
     return true;
 }
@@ -104,9 +161,9 @@ bool Flatten::VisitIfStmt(const IfStmt* ifStmt)
 static std::string stripOpenAndCloseBrace(std::string s);
 static std::string deindent(std::string const & s);
 static std::vector<std::string> split(std::string s);
-static bool startswith(const std::string& rStr, const char* pSubStr);
+static bool startswith(std::string const & rStr, char const * pSubStr);
 
-bool Flatten::rewrite(const IfStmt* ifStmt)
+bool Flatten::rewrite1(IfStmt const * ifStmt)
 {
     if (!rewriter)
         return false;
@@ -127,17 +184,8 @@ bool Flatten::rewrite(const IfStmt* ifStmt)
 
     // 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);
+    if (!checkOverlap(ifStmt->getSourceRange()))
+        return false;
 
     thenRange = extendOverComments(thenRange);
     elseRange = extendOverComments(elseRange);
@@ -160,6 +208,7 @@ bool Flatten::rewrite(const IfStmt* ifStmt)
     if (!replaceText(elseRange, thenString)) {
         return false;
     }
+    std::cout << "rewrite 3" << std::endl;
     if (!removeText(elseKeywordRange)) {
         return false;
     }
@@ -173,6 +222,71 @@ bool Flatten::rewrite(const IfStmt* ifStmt)
     return true;
 }
 
+bool Flatten::rewrite2(IfStmt const * ifStmt)
+{
+    if (!rewriter)
+        return false;
+
+    auto conditionRange = ignoreMacroExpansions(ifStmt->getCond()->getSourceRange());
+    if (!conditionRange.isValid()) {
+        return false;
+    }
+    auto thenRange = ignoreMacroExpansions(ifStmt->getThen()->getSourceRange());
+    if (!thenRange.isValid()) {
+        return false;
+    }
+    auto elseRange = ignoreMacroExpansions(ifStmt->getElse()->getSourceRange());
+    if (!elseRange.isValid()) {
+        return false;
+    }
+    SourceRange elseKeywordRange = ifStmt->getElseLoc();
+
+    // If we overlap with a previous area we modified, we cannot perform this change
+    // without corrupting the source
+    if (!checkOverlap(ifStmt->getSourceRange()))
+        return false;
+
+    elseRange = extendOverComments(elseRange);
+    elseKeywordRange = extendOverComments(elseKeywordRange);
+
+    // in adjusting the formatting I assume that "{" starts on a new line
+
+    std::string elseString = getSourceAsString(elseRange);
+    if (auto compoundStmt = dyn_cast<CompoundStmt>(ifStmt->getElse())) {
+        if (compoundStmt->getLBracLoc().isValid()) {
+            elseString = stripOpenAndCloseBrace(elseString);
+        }
+    }
+    elseString = deindent(elseString);
+
+    if (!replaceText(elseRange, elseString)) {
+        return false;
+    }
+    if (!removeText(elseKeywordRange)) {
+        return false;
+    }
+
+    return true;
+}
+
+// If we overlap with a previous area we modified, we cannot perform this change
+// without corrupting the source
+bool Flatten::checkOverlap(SourceRange range)
+{
+    SourceManager& SM = compiler.getSourceManager();
+    char const  *p1 = SM.getCharacterData( range.getBegin() );
+    char const *p2 = SM.getCharacterData( range.getEnd() );
+    for (std::pair<char const *, char const *> 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);
+    return true;
+}
+
 std::string Flatten::invertCondition(Expr const * condExpr, SourceRange conditionRange)
 {
     std::string s = getSourceAsString(conditionRange);
@@ -253,7 +367,7 @@ std::vector<std::string> split(std::string s)
     return rv;
 }
 
-static bool startswith(const std::string& rStr, const char* pSubStr)
+static bool startswith(std::string const & rStr, char const * pSubStr)
 {
     return rStr.compare(0, strlen(pSubStr), pSubStr) == 0;
 }
@@ -299,8 +413,8 @@ SourceRange Flatten::extendOverComments(SourceRange range)
     SourceManager& SM = compiler.getSourceManager();
     SourceLocation startLoc = range.getBegin();
     SourceLocation endLoc = range.getEnd();
-    const char *p1 = SM.getCharacterData( startLoc );
-    const char *p2 = SM.getCharacterData( endLoc );
+    char const *p1 = SM.getCharacterData( startLoc );
+    char const *p2 = SM.getCharacterData( endLoc );
 
     // scan backwards from the beginning to include any spaces on that line
     while (*(p1-1) == ' ')
@@ -338,13 +452,13 @@ std::string Flatten::getSourceAsString(SourceRange range)
     SourceManager& SM = compiler.getSourceManager();
     SourceLocation startLoc = range.getBegin();
     SourceLocation endLoc = range.getEnd();
-    const char *p1 = SM.getCharacterData( startLoc );
-    const char *p2 = SM.getCharacterData( endLoc );
+    char const *p1 = SM.getCharacterData( startLoc );
+    char const *p2 = SM.getCharacterData( endLoc );
     p2 += Lexer::MeasureTokenLength( endLoc, SM, compiler.getLangOpts());
     return std::string( p1, p2 - p1);
 }
 
-loplugin::Plugin::Registration< Flatten > X("flatten", false);
+loplugin::Plugin::Registration< Flatten > X("flatten", true);
 
 }
 
diff --git a/compilerplugins/clang/test/flatten.cxx b/compilerplugins/clang/test/flatten.cxx
index d6d55d6a1771..8d745b16ad45 100644
--- a/compilerplugins/clang/test/flatten.cxx
+++ b/compilerplugins/clang/test/flatten.cxx
@@ -11,13 +11,51 @@
 
 extern int foo();
 extern int bar();
+class Class {};
 
-int main() {
+void top1() {
     if (foo() == 1) { // expected-note {{if condition here [loplugin:flatten]}}
+        Class aClass;
+        (void)aClass;
     } else {
         throw std::exception(); // expected-error {{unconditional throw in else branch, rather invert the condition, throw early, and flatten the normal case [loplugin:flatten]}}
     }
+}
+
+void top2() {
+    if (foo() == 2) {
+        throw std::exception(); // expected-error {{unconditional throw in then branch, just flatten the else [loplugin:flatten]}}
+    } else {
+        Class aClass;
+        (void)aClass;
+    }
+}
 
+void top3() {
+    // no warning expected
+    if (foo() == 2) {
+        throw std::exception();
+    } else {
+        Class aClass;
+        (void)aClass;
+    }
+    int x = 1;
+    (void)x;
+}
+
+void top4() {
+    // no warning expected
+    if (foo() == 2) {
+        Class aClass;
+        (void)aClass;
+    } else {
+        throw std::exception();
+    }
+    int x = 1;
+    (void)x;
+}
+
+int main() {
     // no warning expected
     if (bar() == 3) {
         throw std::exception();
diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx
index bc35b6ef9d0f..05d37ba528aa 100644
--- a/cpputools/source/unoexe/unoexe.cxx
+++ b/cpputools/source/unoexe/unoexe.cxx
@@ -107,12 +107,9 @@ static bool readOption( OUString * pValue, const sal_Char * pOpt,
         {
             throw RuntimeException( "incomplete option \"-" + aOpt + "\" given!" );
         }
-        else
-        {
-            SAL_INFO("cpputools.unoexe", "> identified option -" << pOpt << " = " << aArg);
-            ++(*pnIndex);
-            return true;
-        }
+        SAL_INFO("cpputools.unoexe", "> identified option -" << pOpt << " = " << aArg);
+        ++(*pnIndex);
+        return true;
     }
       else if (aArg.indexOf(aOpt) == 1)
     {
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx
index 303def43540f..b0af939cffe1 100644
--- a/desktop/source/app/officeipcthread.cxx
+++ b/desktop/source/app/officeipcthread.cxx
@@ -346,8 +346,7 @@ void SAL_CALL RequestHandlerController::queryTermination( const EventObject& )
 
     if ( RequestHandler::AreRequestsPending() )
         throw TerminationVetoException();
-    else
-        RequestHandler::SetDowning();
+    RequestHandler::SetDowning();
 }
 
 void SAL_CALL RequestHandlerController::notifyTermination( const EventObject& )
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index 2a5d09bfeb94..07bc635a44a4 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -1770,11 +1770,8 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt
                     "The object is not a valid linked object!",
                     static_cast< ::cppu::OWeakObject* >(this) );
     }
-    else
-    {
-        // the current implementation of OOo links does not implement this method since it does not implement
-        // all the set of interfaces required for OOo embedded object ( XEmbedPersist is not supported ).
-    }
+    // the current implementation of OOo links does not implement this method since it does not implement
+    // all the set of interfaces required for OOo embedded object ( XEmbedPersist is not supported ).
 
     if ( !xStorage.is() )
         throw lang::IllegalArgumentException( "No parent storage is provided!",
diff --git a/forms/source/xforms/NameContainer.hxx b/forms/source/xforms/NameContainer.hxx
index 99a667a1baca..07656745f006 100644
--- a/forms/source/xforms/NameContainer.hxx
+++ b/forms/source/xforms/NameContainer.hxx
@@ -103,8 +103,7 @@ public:
         typename map_t::const_iterator aIter = findItem( rName );
         if( aIter == maItems.end() )
             throw css::container::NoSuchElementException();
-        else
-            return css::uno::makeAny( aIter->second );
+        return css::uno::makeAny( aIter->second );
     }
 
     virtual css::uno::Sequence<OUString> SAL_CALL getElementNames() override
diff --git a/framework/source/fwe/xml/xmlnamespaces.cxx b/framework/source/fwe/xml/xmlnamespaces.cxx
index a505a2101094..9b57861589c2 100644
--- a/framework/source/fwe/xml/xmlnamespaces.cxx
+++ b/framework/source/fwe/xml/xmlnamespaces.cxx
@@ -70,23 +70,21 @@ void XMLNamespaces::addNamespace( const OUString& aName, const OUString& aValue
         // for the default namespace - check and throw exception if check fails
         throw SAXException( "Clearing xml namespace only allowed for default namespace!", Reference< XInterface >(), Any() );
     }
+
+    if ( aNamespaceName.isEmpty() )
+        m_aDefaultNamespace = aValue;
     else
     {
-        if ( aNamespaceName.isEmpty() )
-            m_aDefaultNamespace = aValue;
+        p = m_aNamespaceMap.find( aNamespaceName );
+        if ( p != m_aNamespaceMap.end() )
+        {
+            // replace current namespace definition
+            m_aNamespaceMap.erase( p );
+            m_aNamespaceMap.emplace( aNamespaceName, aValue );
+        }
         else
         {
-            p = m_aNamespaceMap.find( aNamespaceName );
-            if ( p != m_aNamespaceMap.end() )
-            {
-                // replace current namespace definition
-                m_aNamespaceMap.erase( p );
-                m_aNamespaceMap.emplace( aNamespaceName, aValue );
-            }
-            else
-            {
-                m_aNamespaceMap.emplace( aNamespaceName, aValue );
-            }
+            m_aNamespaceMap.emplace( aNamespaceName, aValue );
         }
     }
 }
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index 7aea555232a6..4d87d98c3e89 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -478,8 +478,7 @@ OUString SubstitutePathVariables::impl_substituteVariable( const OUString& rText
             {
                 throw NoSuchElementException( "Endless recursion detected. Cannot substitute variables!", static_cast<cppu::OWeakObject *>(this) );
             }
-            else
-                aResult = rText;
+            aResult = rText;
         }
         else
         {
@@ -488,8 +487,7 @@ OUString SubstitutePathVariables::impl_substituteVariable( const OUString& rText
             {
                 throw NoSuchElementException( "Unknown variable found!", static_cast<cppu::OWeakObject *>(this) );
             }
-            else
-                aResult = aWorkText;
+            aResult = aWorkText;
         }
     }
 
diff --git a/framework/source/tabwin/tabwindow.cxx b/framework/source/tabwin/tabwindow.cxx
index 9070ce850ca8..606f13748517 100644
--- a/framework/source/tabwin/tabwindow.cxx
+++ b/framework/source/tabwin/tabwindow.cxx
@@ -619,34 +619,32 @@ void SAL_CALL TabWindow::setTabProps( ::sal_Int32 ID, const css::uno::Sequence<
         sal_uInt16 nPos = pTabControl->GetPagePos( sal_uInt16( ID ));
         if ( nPos == TAB_PAGE_NOTFOUND )
             throw css::lang::IndexOutOfBoundsException();
-        else
-        {
-            comphelper::SequenceAsHashMap aSeqHashMap( Properties );
-
-            OUString aTitle  = pTabControl->GetPageText( sal_uInt16( ID ));
-            sal_Int32       nNewPos = nPos;
 
-            aTitle = aSeqHashMap.getUnpackedValueOrDefault< OUString >(
-                                    m_aTitlePropName, aTitle );
-            pTabControl->SetPageText( sal_uInt16( ID ), aTitle );
-            nNewPos = aSeqHashMap.getUnpackedValueOrDefault< sal_Int32 >(
-                                    m_aPosPropName, nNewPos );
-            if ( nNewPos != sal_Int32( nPos ))
-            {
-                nPos = sal_uInt16( nNewPos );
-                if ( nPos >= pTabControl->GetPageCount() )
-                    nPos = TAB_APPEND;
+        comphelper::SequenceAsHashMap aSeqHashMap( Properties );
 
-                pTabControl->RemovePage( sal_uInt16( ID ));
-                pTabControl->InsertPage( sal_uInt16( ID ), aTitle, nPos );
-            }
+        OUString aTitle  = pTabControl->GetPageText( sal_uInt16( ID ));
+        sal_Int32       nNewPos = nPos;
 
-            /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-            aLock.clear();
+        aTitle = aSeqHashMap.getUnpackedValueOrDefault< OUString >(
+                                m_aTitlePropName, aTitle );
+        pTabControl->SetPageText( sal_uInt16( ID ), aTitle );
+        nNewPos = aSeqHashMap.getUnpackedValueOrDefault< sal_Int32 >(
+                                m_aPosPropName, nNewPos );
+        if ( nNewPos != sal_Int32( nPos ))
+        {
+            nPos = sal_uInt16( nNewPos );
+            if ( nPos >= pTabControl->GetPageCount() )
+                nPos = TAB_APPEND;
 
-            css::uno::Sequence< css::beans::NamedValue > aNamedValueSeq = getTabProps( ID );
-            implts_SendNotification( NOTIFY_CHANGED, ID, aNamedValueSeq );
+            pTabControl->RemovePage( sal_uInt16( ID ));
+            pTabControl->InsertPage( sal_uInt16( ID ), aTitle, nPos );
         }
+
+        /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+        aLock.clear();
+
+        css::uno::Sequence< css::beans::NamedValue > aNamedValueSeq = getTabProps( ID );
+        implts_SendNotification( NOTIFY_CHANGED, ID, aNamedValueSeq );
     }
 }
 
@@ -665,18 +663,16 @@ css::uno::Sequence< css::beans::NamedValue > SAL_CALL TabWindow::getTabProps( ::
         sal_uInt16 nPos = pTabControl->GetPagePos( sal_uInt16( ID ));
         if ( nPos == TAB_PAGE_NOTFOUND )
             throw css::lang::IndexOutOfBoundsException();
-        else
-        {
-            OUString aTitle = pTabControl->GetPageText( sal_uInt16( ID ));
-                          nPos   = pTabControl->GetPagePos( sal_uInt16( ID ));
 
-            css::uno::Sequence< css::beans::NamedValue > aSeq
-            {
-                { m_aTitlePropName, css::uno::makeAny( aTitle ) },
-                { m_aPosPropName,   css::uno::makeAny( sal_Int32( nPos )) }
-            };
-            return aSeq;
-        }
+        OUString aTitle = pTabControl->GetPageText( sal_uInt16( ID ));
+                  nPos   = pTabControl->GetPagePos( sal_uInt16( ID ));
+
+        css::uno::Sequence< css::beans::NamedValue > aSeq
+        {
+            { m_aTitlePropName, css::uno::makeAny( aTitle ) },
+            { m_aPosPropName,   css::uno::makeAny( sal_Int32( nPos )) }
+        };
+        return aSeq;
     }
 
     return aNamedValueSeq;
@@ -696,21 +692,19 @@ void SAL_CALL TabWindow::activateTab( ::sal_Int32 ID )
         sal_uInt16 nPos = pTabControl->GetPagePos( sal_uInt16( ID ));
         if ( nPos == TAB_PAGE_NOTFOUND )
             throw css::lang::IndexOutOfBoundsException();
-        else
-        {
-            sal_Int32 nOldID     = pTabControl->GetCurPageId();
-            OUString aTitle = pTabControl->GetPageText( sal_uInt16( ID ));
-            pTabControl->SetCurPageId( sal_uInt16( ID ));
-            pTabControl->SelectTabPage( sal_uInt16( ID ));
-            impl_SetTitle( aTitle );
-
-            aLock.clear();
-            /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-
-            if ( nOldID != TAB_PAGE_NOTFOUND )
-                implts_SendNotification( NOTIFY_DEACTIVATED, nOldID );
-            implts_SendNotification( NOTIFY_ACTIVATED, ID );
-        }
+
+        sal_Int32 nOldID     = pTabControl->GetCurPageId();
+        OUString aTitle = pTabControl->GetPageText( sal_uInt16( ID ));
+        pTabControl->SetCurPageId( sal_uInt16( ID ));
+        pTabControl->SelectTabPage( sal_uInt16( ID ));
+        impl_SetTitle( aTitle );
+
+        aLock.clear();
+        /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+
+        if ( nOldID != TAB_PAGE_NOTFOUND )
+            implts_SendNotification( NOTIFY_DEACTIVATED, nOldID );
+        implts_SendNotification( NOTIFY_ACTIVATED, ID );
     }
 }
 
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 403e045c99f8..fcde32765a42 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -1128,17 +1128,15 @@ sal_Bool SAL_CALL ModuleUIConfigurationManager::hasSettings( const OUString& Res
     if (( nElementType == css::ui::UIElementType::UNKNOWN ) ||
         ( nElementType >= css::ui::UIElementType::COUNT   ))
         throw IllegalArgumentException();
-    else
-    {
-        SolarMutexGuard g;
 
-        if ( m_bDisposed )
-            throw DisposedException();
+    SolarMutexGuard g;
 
-        UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
-        if ( pDataSettings )
-            return true;
-    }
+    if ( m_bDisposed )
+        throw DisposedException();
+
+    UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
+    if ( pDataSettings )
+        return true;
 
     return false;
 }
@@ -1150,22 +1148,20 @@ Reference< XIndexAccess > SAL_CALL ModuleUIConfigurationManager::getSettings( co
     if (( nElementType == css::ui::UIElementType::UNKNOWN ) ||
         ( nElementType >= css::ui::UIElementType::COUNT   ))
         throw IllegalArgumentException();
-    else
-    {
-        SolarMutexGuard g;
 
-        if ( m_bDisposed )
-            throw DisposedException();
+    SolarMutexGuard g;
 
-        UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
-        if ( pDataSettings )
-        {
-            // Create a copy of our data if someone wants to change the data.
-            if ( bWriteable )
-                return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY );
-            else
-                return pDataSettings->xSettings;
-        }
+    if ( m_bDisposed )
+        throw DisposedException();
+
+    UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+    if ( pDataSettings )
+    {
+        // Create a copy of our data if someone wants to change the data.
+        if ( bWriteable )
+            return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY );
+        else
+            return pDataSettings->xSettings;
     }
 
     throw NoSuchElementException();
@@ -1474,17 +1470,15 @@ sal_Bool SAL_CALL ModuleUIConfigurationManager::isDefaultSettings( const OUStrin
     if (( nElementType == css::ui::UIElementType::UNKNOWN ) ||
         ( nElementType >= css::ui::UIElementType::COUNT   ))
         throw IllegalArgumentException();
-    else
-    {
-        SolarMutexGuard g;
 
-        if ( m_bDisposed )
-            throw DisposedException();
+    SolarMutexGuard g;
 
-        UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
-        if ( pDataSettings && pDataSettings->bDefaultNode )
-            return true;
-    }
+    if ( m_bDisposed )
+        throw DisposedException();
+
+    UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
+    if ( pDataSettings && pDataSettings->bDefaultNode )
+        return true;
 
     return false;
 }
@@ -1496,25 +1490,23 @@ Reference< XIndexAccess > SAL_CALL ModuleUIConfigurationManager::getDefaultSetti
     if (( nElementType == css::ui::UIElementType::UNKNOWN ) ||
         ( nElementType >= css::ui::UIElementType::COUNT   ))
         throw IllegalArgumentException();
-    else
-    {
-        SolarMutexGuard g;
 
-        if ( m_bDisposed )
-            throw DisposedException();
+    SolarMutexGuard g;
 
-        // preload list of element types on demand
-        impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
+    if ( m_bDisposed )
+        throw DisposedException();
 
-        // Look into our default vector/unordered_map combination
-        UIElementDataHashMap& rDefaultHashMap = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
-        UIElementDataHashMap::iterator pIter = rDefaultHashMap.find( ResourceURL );
-        if ( pIter != rDefaultHashMap.end() )
-        {
-            if ( !pIter->second.xSettings.is() )
-                impl_requestUIElementData( nElementType, LAYER_DEFAULT, pIter->second );
-            return pIter->second.xSettings;
-        }
+    // preload list of element types on demand
+    impl_preloadUIElementTypeList( LAYER_DEFAULT, nElementType );
+
+    // Look into our default vector/unordered_map combination
+    UIElementDataHashMap& rDefaultHashMap = m_aUIElements[LAYER_DEFAULT][nElementType].aElementsHashMap;
+    UIElementDataHashMap::iterator pIter = rDefaultHashMap.find( ResourceURL );
+    if ( pIter != rDefaultHashMap.end() )
+    {
+        if ( !pIter->second.xSettings.is() )
+            impl_requestUIElementData( nElementType, LAYER_DEFAULT, pIter->second );
+        return pIter->second.xSettings;
     }
 
     // Nothing has been found!
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index 06b267a48700..16a3ca5310cf 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -902,12 +902,9 @@ sal_Bool SAL_CALL UIConfigurationManager::hasSettings( const OUString& ResourceU
     if (( nElementType == css::ui::UIElementType::UNKNOWN ) ||
         ( nElementType >= css::ui::UIElementType::COUNT   ))
         throw IllegalArgumentException();
-    else
-    {
-        UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
-        if ( pDataSettings && !pDataSettings->bDefault )
-            return true;
-    }
+    UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType, false );
+    if ( pDataSettings && !pDataSettings->bDefault )
+        return true;
 
     return false;
 }
@@ -919,22 +916,20 @@ Reference< XIndexAccess > SAL_CALL UIConfigurationManager::getSettings( const OU
     if (( nElementType == css::ui::UIElementType::UNKNOWN ) ||
         ( nElementType >= css::ui::UIElementType::COUNT   ))
         throw IllegalArgumentException();
-    else
-    {
-        SolarMutexGuard g;
 
-        if ( m_bDisposed )
-            throw DisposedException();
+    SolarMutexGuard g;
 
-        UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
-        if ( pDataSettings && !pDataSettings->bDefault )
-        {
-            // Create a copy of our data if someone wants to change the data.
-            if ( bWriteable )
-                return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY );
-            else
-                return pDataSettings->xSettings;
-        }
+    if ( m_bDisposed )
+        throw DisposedException();
+
+    UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
+    if ( pDataSettings && !pDataSettings->bDefault )
+    {
+        // Create a copy of our data if someone wants to change the data.
+        if ( bWriteable )
+            return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY );
+        else
+            return pDataSettings->xSettings;
     }
 
     throw NoSuchElementException();
diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index 97c71e7a39b4..99a6464c50e0 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -255,8 +255,7 @@ Any SAL_CALL ConfigurationAccess_WindowState::getByName( const OUString& rResour
         Any a( impl_getWindowStateFromResourceURL( rResourceURL ) );
         if ( a == Any() )
             throw NoSuchElementException();
-        else
-            return a;
+        return a;
     }
 }
 
@@ -365,54 +364,49 @@ void SAL_CALL ConfigurationAccess_WindowState::insertByName( const OUString& rRe
     ResourceURLToInfoCache::const_iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
     if ( pIter != m_aResourceURLToInfoCache.end() )
         throw ElementExistException();
-    else
+
+    if ( !m_bConfigAccessInitialized )
     {
-        if ( !m_bConfigAccessInitialized )
-        {
-            impl_initializeConfigAccess();
-            m_bConfigAccessInitialized = true;
-        }
+        impl_initializeConfigAccess();
+        m_bConfigAccessInitialized = true;
+    }
 
-        // Try to ask our configuration access
-        if ( m_xConfigAccess.is() )
+    // Try to ask our configuration access
+    if ( m_xConfigAccess.is() )
+    {
+        if ( m_xConfigAccess->hasByName( rResourceURL ) )
+            throw ElementExistException();
+
+        WindowStateInfo aWinStateInfo;
+        impl_fillStructFromSequence( aWinStateInfo, aPropSet );
+        m_aResourceURLToInfoCache.emplace( rResourceURL, aWinStateInfo );
+
+        // insert must be write-through => insert element into configuration
+        Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
+        if ( xNameContainer.is() )
         {
-            if ( m_xConfigAccess->hasByName( rResourceURL ) )
-                throw ElementExistException();
-            else
-            {
-                WindowStateInfo aWinStateInfo;
-                impl_fillStructFromSequence( aWinStateInfo, aPropSet );
-                m_aResourceURLToInfoCache.emplace( rResourceURL, aWinStateInfo );
+            Reference< XSingleServiceFactory > xFactory( m_xConfigAccess, UNO_QUERY );
+            g.clear();
 
-                // insert must be write-through => insert element into configuration
-                Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
-                if ( xNameContainer.is() )
+            try
+            {
+                Reference< XPropertySet > xPropSet( xFactory->createInstance(), UNO_QUERY );
+                if ( xPropSet.is() )
                 {
-                    Reference< XSingleServiceFactory > xFactory( m_xConfigAccess, UNO_QUERY );
-                    g.clear();
-
-                    try
-                    {
-                        Reference< XPropertySet > xPropSet( xFactory->createInstance(), UNO_QUERY );
-                        if ( xPropSet.is() )
-                        {
-                            Any a;
-                            impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
-                            a <<= xPropSet;
-                            xNameContainer->insertByName( rResourceURL, a );
-                            Reference< XChangesBatch > xFlush( xFactory, UNO_QUERY );
-                            if ( xFlush.is() )
-                                xFlush->commitChanges();
-                        }
-                    }
-                    catch ( const Exception& )
-                    {
-                    }
+                    Any a;
+                    impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
+                    a <<= xPropSet;
+                    xNameContainer->insertByName( rResourceURL, a );
+                    Reference< XChangesBatch > xFlush( xFactory, UNO_QUERY );
+                    if ( xFlush.is() )
+                        xFlush->commitChanges();
                 }
             }
+            catch ( const Exception& )
+            {
+            }
         }
     }
-
 }
 
 // XNameReplace
diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx
index 557a38c7d665..a3b33637ca8a 100644
--- a/framework/source/uifactory/uielementfactorymanager.cxx
+++ b/framework/source/uifactory/uielementfactorymanager.cxx
@@ -128,8 +128,7 @@ void ConfigurationAccess_FactoryManager::addFactorySpecifierToTypeNameModule( co
 
     if ( pIter != m_aFactoryManagerMap.end() )
         throw ElementExistException();
-    else
-        m_aFactoryManagerMap.emplace( aHashKey, rServiceSpecifier );
+    m_aFactoryManagerMap.emplace( aHashKey, rServiceSpecifier );
 }
 
 void ConfigurationAccess_FactoryManager::removeFactorySpecifierFromTypeNameModule( const OUString& rType, const OUString& rName, const OUString& rModule )
@@ -143,8 +142,7 @@ void ConfigurationAccess_FactoryManager::removeFactorySpecifierFromTypeNameModul
 
     if ( pIter == m_aFactoryManagerMap.end() )
         throw NoSuchElementException();
-    else
-        m_aFactoryManagerMap.erase( aHashKey );
+    m_aFactoryManagerMap.erase( aHashKey );
 }
 
 Sequence< Sequence< PropertyValue > > ConfigurationAccess_FactoryManager::getFactoriesDescription() const
diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx
index 33cc84bfdf8d..4066a8a5e3c3 100644
--- a/io/source/stm/omark.cxx
+++ b/io/source/stm/omark.cxx
@@ -216,10 +216,8 @@ void OMarkableOutputStream::deleteMark(sal_Int32 Mark)
             "MarkableOutputStream::deleteMark unknown mark (" + OUString::number(Mark) + ")",
             *this, 0);
     }
-    else {
-        m_mapMarks.erase( ii );
-        checkMarksAndFlush();
-    }
+    m_mapMarks.erase( ii );
+    checkMarksAndFlush();
 }
 
 void OMarkableOutputStream::jumpToMark(sal_Int32 nMark)
@@ -232,9 +230,7 @@ void OMarkableOutputStream::jumpToMark(sal_Int32 nMark)
             "MarkableOutputStream::jumpToMark unknown mark (" + OUString::number(nMark) + ")",
             *this, 0);
     }
-    else {
-        m_nCurrentPos = (*ii).second;
-    }
+    m_nCurrentPos = (*ii).second;
 }
 
 void OMarkableOutputStream::jumpToFurthest()
@@ -631,10 +627,8 @@ void OMarkableInputStream::deleteMark(sal_Int32 Mark)
             "MarkableInputStream::deleteMark unknown mark (" + OUString::number(Mark) + ")",
             *this , 0 );
     }
-    else {
-        m_mapMarks.erase( ii );
-        checkMarksAndFlush();
-    }
+    m_mapMarks.erase( ii );
+    checkMarksAndFlush();
 }
 
 void OMarkableInputStream::jumpToMark(sal_Int32 nMark)
@@ -648,10 +642,7 @@ void OMarkableInputStream::jumpToMark(sal_Int32 nMark)
             "MarkableInputStream::jumpToMark unknown mark (" + OUString::number(nMark) + ")",
             *this , 0 );
     }
-    else
-    {
-        m_nCurrentPos = (*ii).second;
-    }
+    m_nCurrentPos = (*ii).second;
 }
 
 void OMarkableInputStream::jumpToFurthest()
diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx
index 0951d6796ed8..edb5eef7df30 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -433,11 +433,9 @@ uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary(
 
     if (!xRes.is())
         throw NoSupportException();
-    else
-    {
-        xRes->setActive( true );
-        GetNameContainer().insertByName( rName, Any(xRes) );
-    }
+
+    xRes->setActive( true );
+    GetNameContainer().insertByName( rName, Any(xRes) );
     return xRes;
 }
 
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 11bc362c6a48..bc978e9dcad1 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -917,11 +917,10 @@ sal_Int32 ZipFile::readCEN()
                  nOffset == 0xffffffff ||
                  nCompressedSize == 0xffffffff ) {
                 throw ZipException("PK64 zip file entry" );
-            } else {
-                aEntry.nCompressedSize = nCompressedSize;
-                aEntry.nSize = nSize;
-                aEntry.nOffset = nOffset;
             }
+            aEntry.nCompressedSize = nCompressedSize;
+            aEntry.nSize = nSize;
+            aEntry.nOffset = nOffset;
 
             aEntry.nOffset += nLocPos;
             aEntry.nOffset *= -1;
@@ -1010,10 +1009,9 @@ void ZipFile::recover()
                             if ( nSize == 0xffffffff ||
                                  nCompressedSize == 0xffffffff ) {
                                 throw ZipException("PK64 zip file entry" );
-                            } else {
-                                aEntry.nCompressedSize = nCompressedSize;
-                                aEntry.nSize = nSize;
                             }
+                            aEntry.nCompressedSize = nCompressedSize;
+                            aEntry.nSize = nSize;
 
                             sal_Int32 nDescrLength =
                                 ( aEntry.nMethod == DEFLATED && ( aEntry.nFlag & 8 ) ) ? 16 : 0;
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index ed5e6d0d29ed..abee6bbdc562 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -169,33 +169,32 @@ void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const uno::
 {
     if (hasByName(aName))
         throw ElementExistException(THROW_WHERE );
-    else
-    {
-        uno::Reference < XUnoTunnel > xRef;
-        aElement >>= xRef;
-        if ( !(aElement >>= xRef) )
-            throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
-
-        sal_Int64 nTest;
-        ZipPackageEntry *pEntry;
-        if ( ( nTest = xRef->getSomething ( ZipPackageFolder::static_getImplementationId() ) ) != 0 )
-        {
-            ZipPackageFolder *pFolder = reinterpret_cast < ZipPackageFolder * > ( nTest );
-            pEntry = static_cast < ZipPackageEntry * > ( pFolder );
-        }
-        else if ( ( nTest = xRef->getSomething ( ZipPackageStream::static_getImplementationId() ) ) != 0 )
-        {
-            ZipPackageStream *pStream = reinterpret_cast < ZipPackageStream * > ( nTest );
-            pEntry = static_cast < ZipPackageEntry * > ( pStream );
-        }
-        else
-            throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
 
-        if (pEntry->getName() != aName )
-            pEntry->setName (aName);
-        doInsertByName ( pEntry, true );
+    uno::Reference < XUnoTunnel > xRef;
+    aElement >>= xRef;
+    if ( !(aElement >>= xRef) )
+        throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
+
+    sal_Int64 nTest;
+    ZipPackageEntry *pEntry;
+    if ( ( nTest = xRef->getSomething ( ZipPackageFolder::static_getImplementationId() ) ) != 0 )
+    {
+        ZipPackageFolder *pFolder = reinterpret_cast < ZipPackageFolder * > ( nTest );
+        pEntry = static_cast < ZipPackageEntry * > ( pFolder );
+    }
+    else if ( ( nTest = xRef->getSomething ( ZipPackageStream::static_getImplementationId() ) ) != 0 )
+    {
+        ZipPackageStream *pStream = reinterpret_cast < ZipPackageStream * > ( nTest );
+        pEntry = static_cast < ZipPackageEntry * > ( pStream );
     }
+    else
+       throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
+
+    if (pEntry->getName() != aName )
+        pEntry->setName (aName);
+    doInsertByName ( pEntry, true );
 }
+
 void SAL_CALL ZipPackageFolder::removeByName( const OUString& Name )
 {
     ContentHash::iterator aIter = maContents.find ( Name );
diff --git a/sc/source/core/opencl/op_logical.cxx b/sc/source/core/opencl/op_logical.cxx
index 7f63af628cab..acb836a02c20 100644
--- a/sc/source/core/opencl/op_logical.cxx
+++ b/sc/source/core/opencl/op_logical.cxx
@@ -320,47 +320,44 @@ void OpIf::GenSlidingWindowFunction(std::stringstream &ss,
     {
         throw UnhandledToken("unknown operand for ocPush", __FILE__, __LINE__);
     }
-    else
+    if(vSubArguments.size()==3)
     {
-        if(vSubArguments.size()==3)
-        {
-            ss << "    if(isnan(";
-            ss << vSubArguments[0]->GenSlidingWindowDeclRef();
-            ss << ")||  ";
-            ss << vSubArguments[0]->GenSlidingWindowDeclRef();
-            ss << " == 0)\n";
-            ss << "         return ";
-            ss << vSubArguments[2]->GenSlidingWindowDeclRef();
-            ss << ";\n";
-            ss << "     else";
-            ss <<"          return ";
-            ss << vSubArguments[1]->GenSlidingWindowDeclRef();
-            ss <<";\n";
-        }
-        if(vSubArguments.size()==2)
-        {
-            ss << "    if(isnan(";
-            ss << vSubArguments[0]->GenSlidingWindowDeclRef();
-            ss << ")||  ";
-            ss << vSubArguments[0]->GenSlidingWindowDeclRef();
-            ss << " == 0)\n";
-            ss << "         return 0;\n";
-            ss << "     else";
-            ss <<"          return ";
-            ss << vSubArguments[1]->GenSlidingWindowDeclRef();
-            ss <<";\n";
-        }
-        if(vSubArguments.size()==1)
-        {
-            ss << "    if(isnan(";
-            ss << vSubArguments[0]->GenSlidingWindowDeclRef();
-            ss << ")||  ";
-            ss << vSubArguments[0]->GenSlidingWindowDeclRef();
-            ss << " == 0)\n";
-            ss << "         return 0;\n";
-            ss << "     else";
-            ss <<"          return 1;\n";
-        }
+        ss << "    if(isnan(";
+        ss << vSubArguments[0]->GenSlidingWindowDeclRef();
+        ss << ")||  ";
+        ss << vSubArguments[0]->GenSlidingWindowDeclRef();
+        ss << " == 0)\n";
+        ss << "         return ";
+        ss << vSubArguments[2]->GenSlidingWindowDeclRef();
+        ss << ";\n";
+        ss << "     else";
+        ss <<"          return ";
+        ss << vSubArguments[1]->GenSlidingWindowDeclRef();
+        ss <<";\n";
+    }
+    if(vSubArguments.size()==2)
+    {
+        ss << "    if(isnan(";
+        ss << vSubArguments[0]->GenSlidingWindowDeclRef();
+        ss << ")||  ";
+        ss << vSubArguments[0]->GenSlidingWindowDeclRef();
+        ss << " == 0)\n";
+        ss << "         return 0;\n";
+        ss << "     else";
+        ss <<"          return ";
+        ss << vSubArguments[1]->GenSlidingWindowDeclRef();
+        ss <<";\n";
+    }
+    if(vSubArguments.size()==1)
+    {
+        ss << "    if(isnan(";
+        ss << vSubArguments[0]->GenSlidingWindowDeclRef();
+        ss << ")||  ";
+        ss << vSubArguments[0]->GenSlidingWindowDeclRef();
+        ss << " == 0)\n";
+        ss << "         return 0;\n";
+        ss << "     else";
+        ss <<"          return 1;\n";
     }
     ss << "}\n";
 }
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 629b2c6816e3..265334a5eef8 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -3418,15 +3418,12 @@ void SAL_CALL ScTableSheetsObj::insertByName( const OUString& aName, const uno::
                     //  name already exists
                     throw container::ElementExistException();
                 }
-                else
-                {
-                    SCTAB nPosition = rDoc.GetTableCount();
-                    bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aName,
-                                                                 true, true );
-                    if (bDone)
-                        pSheetObj->InitInsertSheet( pDocShell, nPosition );
-                    //  set document and new range in the object
-                }
+                SCTAB nPosition = rDoc.GetTableCount();
+                bDone = pDocShell->GetDocFunc().InsertTable( nPosition, aName,
+                                                             true, true );
+                if (bDone)
+                    pSheetObj->InitInsertSheet( pDocShell, nPosition );
+                //  set document and new range in the object
             }
             else
                 bIllArg = true;
diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx
index 6bc9a7024f65..bae9c8791190 100644
--- a/sd/source/core/stlfamily.cxx
+++ b/sd/source/core/stlfamily.cxx
@@ -441,10 +441,7 @@ Reference< XInterface > SAL_CALL SdStyleFamily::createInstance()
     {
         throw IllegalAccessException();
     }
-    else
-    {
-        return Reference< XInterface >( static_cast< XStyle* >( SdStyleSheet::CreateEmptyUserStyle( *mxPool.get(), mnFamily ) ) );
-    }
+    return Reference< XInterface >( static_cast< XStyle* >( SdStyleSheet::CreateEmptyUserStyle( *mxPool.get(), mnFamily ) ) );
 }
 
 Reference< XInterface > SAL_CALL SdStyleFamily::createInstanceWithArguments( const Sequence< Any >&  )
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 27d80a3f6fac..14c36e4a845f 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -937,80 +937,79 @@ void SAL_CALL SdStyleSheet::setPropertyValue( const OUString& aPropertyName, con
     {
         throw UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this));
     }
-    else
+
+    if( pEntry->nWID == WID_STYLE_HIDDEN )
     {
-        if( pEntry->nWID == WID_STYLE_HIDDEN )
-        {
-            bool bValue = false;
-            if ( aValue >>= bValue )
-                SetHidden( bValue );
-            return;
-        }
-        if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
-            return; // not yet implemented for styles
+        bool bValue = false;
+        if ( aValue >>= bValue )
+            SetHidden( bValue );
+        return;
+    }
+    if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
+        return; // not yet implemented for styles
 
-        if( pEntry->nWID == WID_STYLE_FAMILY )
-            throw PropertyVetoException();
+    if( pEntry->nWID == WID_STYLE_FAMILY )
+        throw PropertyVetoException();
 
-        if( (pEntry->nWID == EE_PARA_NUMBULLET) && (GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) )
-        {
-            OUString aStr;
-            const sal_uInt32 nTempHelpId = GetHelpId( aStr );
+    if( (pEntry->nWID == EE_PARA_NUMBULLET) && (GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) )
+    {
+        OUString aStr;
+        const sal_uInt32 nTempHelpId = GetHelpId( aStr );
 
-            if( (nTempHelpId >= HID_PSEUDOSHEET_OUTLINE2) && (nTempHelpId <= HID_PSEUDOSHEET_OUTLINE9) )
-                return;
-        }
+        if( (nTempHelpId >= HID_PSEUDOSHEET_OUTLINE2) && (nTempHelpId <= HID_PSEUDOSHEET_OUTLINE9) )
+            return;
+    }
 
-        SfxItemSet &rStyleSet = GetItemSet();
+    SfxItemSet &rStyleSet = GetItemSet();
 
-        if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+    if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+    {
+        BitmapMode eMode;
+        if( aValue >>= eMode )
         {
-            BitmapMode eMode;
-            if( aValue >>= eMode )
-            {
-                rStyleSet.Put( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) );
-                rStyleSet.Put( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) );
-                return;
-            }
-            throw IllegalArgumentException();
+            rStyleSet.Put( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) );
+            rStyleSet.Put( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) );
+            return;
         }
+        throw IllegalArgumentException();
+    }
 
-        SfxItemSet aSet( GetPool().GetPool(),   {{pEntry->nWID, pEntry->nWID}});
-        aSet.Put( rStyleSet );
+    SfxItemSet aSet( GetPool().GetPool(),   {{pEntry->nWID, pEntry->nWID}});
+    aSet.Put( rStyleSet );
 
-        if( !aSet.Count() )
-        {
-            if( EE_PARA_NUMBULLET == pEntry->nWID )
-            {
-                vcl::Font aBulletFont;
-                SdStyleSheetPool::PutNumBulletItem( this, aBulletFont );
-                aSet.Put( rStyleSet );
-            }
-            else
-            {
-                aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) );
-            }
-        }
-
-        if( pEntry->nMemberId == MID_NAME &&
-            ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT ||
-              pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ||
-              pEntry->nWID == XATTR_LINESTART || pEntry->nWID == XATTR_LINEEND || pEntry->nWID == XATTR_LINEDASH) )
+    if( !aSet.Count() )
+    {
+        if( EE_PARA_NUMBULLET == pEntry->nWID )
         {
-            OUString aTempName;
-            if(!(aValue >>= aTempName ))
-                throw IllegalArgumentException();
-
-            SvxShape::SetFillAttribute( pEntry->nWID, aTempName, aSet );
+            vcl::Font aBulletFont;
+            SdStyleSheetPool::PutNumBulletItem( this, aBulletFont );
+            aSet.Put( rStyleSet );
         }
-        else if(!SvxUnoTextRangeBase::SetPropertyValueHelper( pEntry, aValue, aSet ))
+        else
         {
-            SvxItemPropertySet_setPropertyValue( pEntry, aValue, aSet );
+            aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) );
         }
+    }
 
-        rStyleSet.Put( aSet );
-        Broadcast(SfxHint(SfxHintId::DataChanged));
+    if( pEntry->nMemberId == MID_NAME &&
+        ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT ||
+          pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ||
+          pEntry->nWID == XATTR_LINESTART || pEntry->nWID == XATTR_LINEEND || pEntry->nWID == XATTR_LINEDASH) )
+    {
+        OUString aTempName;
+        if(!(aValue >>= aTempName ))
+            throw IllegalArgumentException();
+
+        SvxShape::SetFillAttribute( pEntry->nWID, aTempName, aSet );
     }
+    else if(!SvxUnoTextRangeBase::SetPropertyValueHelper( pEntry, aValue, aSet ))
+    {
+        SvxItemPropertySet_setPropertyValue( pEntry, aValue, aSet );
+    }
+
+    rStyleSet.Put( aSet );
+    Broadcast(SfxHint(SfxHintId::DataChanged));
+
 }
 
 Any SAL_CALL SdStyleSheet::getPropertyValue( const OUString& PropertyName )
@@ -1024,99 +1023,98 @@ Any SAL_CALL SdStyleSheet::getPropertyValue( const OUString& PropertyName )
     {
         throw UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
     }
-    else
-    {
-        Any aAny;
 
-        if( pEntry->nWID == WID_STYLE_FAMILY )
+    Any aAny;
+
+    if( pEntry->nWID == WID_STYLE_FAMILY )
+    {
+        if( nFamily == SD_STYLE_FAMILY_MASTERPAGE )
         {
-            if( nFamily == SD_STYLE_FAMILY_MASTERPAGE )
-            {
-                const OUString aLayoutName( GetName() );
-                aAny <<= aLayoutName.copy( 0, aLayoutName.indexOf( SD_LT_SEPARATOR) );
-            }
-            else
-            {
-                aAny <<= GetFamilyString(nFamily);
-            }
+            const OUString aLayoutName( GetName() );
+            aAny <<= aLayoutName.copy( 0, aLayoutName.indexOf( SD_LT_SEPARATOR) );
         }
-        else if( pEntry->nWID == WID_STYLE_DISPNAME )
+        else
         {
-            OUString aDisplayName;
-            if ( nFamily == SD_STYLE_FAMILY_MASTERPAGE )
-            {
-                const SdStyleSheet* pStyleSheet = GetPseudoStyleSheet();
-                if (pStyleSheet != nullptr)
-                    aDisplayName = pStyleSheet->GetDisplayName();
-            }
-
-            if (aDisplayName.isEmpty())
-                aDisplayName = GetDisplayName();
-
-            aAny <<= aDisplayName;
+            aAny <<= GetFamilyString(nFamily);
         }
-        else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
+    }
+    else if( pEntry->nWID == WID_STYLE_DISPNAME )
+    {
+        OUString aDisplayName;
+        if ( nFamily == SD_STYLE_FAMILY_MASTERPAGE )
         {
-            aAny <<= false;
+            const SdStyleSheet* pStyleSheet = GetPseudoStyleSheet();
+            if (pStyleSheet != nullptr)
+                aDisplayName = pStyleSheet->GetDisplayName();
         }
-        else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
-        {
-            SfxItemSet &rStyleSet = GetItemSet();
 
-            const XFillBmpStretchItem* pStretchItem = rStyleSet.GetItem<XFillBmpStretchItem>(XATTR_FILLBMP_STRETCH);
-            const XFillBmpTileItem* pTileItem = rStyleSet.GetItem<XFillBmpTileItem>(XATTR_FILLBMP_TILE);
+        if (aDisplayName.isEmpty())
+            aDisplayName = GetDisplayName();
 
-            if( pStretchItem && pTileItem )
-            {
-                if( pTileItem->GetValue() )
-                    aAny <<= BitmapMode_REPEAT;
-                else if( pStretchItem->GetValue() )
-                    aAny <<= BitmapMode_STRETCH;
-                else
-                    aAny <<= BitmapMode_NO_REPEAT;
-            }
-        }
-        else if( pEntry->nWID == WID_STYLE_HIDDEN )
+        aAny <<= aDisplayName;
+    }
+    else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
+    {
+        aAny <<= false;
+    }
+    else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+    {
+        SfxItemSet &rStyleSet = GetItemSet();
+
+        const XFillBmpStretchItem* pStretchItem = rStyleSet.GetItem<XFillBmpStretchItem>(XATTR_FILLBMP_STRETCH);
+        const XFillBmpTileItem* pTileItem = rStyleSet.GetItem<XFillBmpTileItem>(XATTR_FILLBMP_TILE);
+
+        if( pStretchItem && pTileItem )
         {
-            aAny <<= IsHidden( );
+            if( pTileItem->GetValue() )
+                aAny <<= BitmapMode_REPEAT;
+            else if( pStretchItem->GetValue() )
+                aAny <<= BitmapMode_STRETCH;
+            else
+                aAny <<= BitmapMode_NO_REPEAT;
         }
-        else
-        {
-            SfxItemSet aSet( GetPool().GetPool(),   {{pEntry->nWID, pEntry->nWID}});
+    }
+    else if( pEntry->nWID == WID_STYLE_HIDDEN )
+    {
+        aAny <<= IsHidden( );
+    }
+    else
+    {
+        SfxItemSet aSet( GetPool().GetPool(),   {{pEntry->nWID, pEntry->nWID}});
 
-            const SfxPoolItem* pItem;
-            SfxItemSet& rStyleSet = GetItemSet();
+        const SfxPoolItem* pItem;
+        SfxItemSet& rStyleSet = GetItemSet();
 
-            if( rStyleSet.GetItemState( pEntry->nWID, true, &pItem ) == SfxItemState::SET )
-                aSet.Put(  *pItem );
+        if( rStyleSet.GetItemState( pEntry->nWID, true, &pItem ) == SfxItemState::SET )
+            aSet.Put(  *pItem );
 
-            if( !aSet.Count() )
-                aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) );
+        if( !aSet.Count() )
+            aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) );
 
-            if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pEntry, aAny ))
-                return aAny;
+        if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pEntry, aAny ))
+            return aAny;
 
-            // Get value of ItemSet
-            aAny = SvxItemPropertySet_getPropertyValue( pEntry, aSet );
-        }
+        // Get value of ItemSet
+        aAny = SvxItemPropertySet_getPropertyValue( pEntry, aSet );
+    }
 
-        if( pEntry->aType != aAny.getValueType() )
+    if( pEntry->aType != aAny.getValueType() )
+    {
+        // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
+        if( ( pEntry->aType == ::cppu::UnoType<sal_Int16>::get()) && aAny.getValueType() == ::cppu::UnoType<sal_Int32>::get() )
         {
-            // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
-            if( ( pEntry->aType == ::cppu::UnoType<sal_Int16>::get()) && aAny.getValueType() == ::cppu::UnoType<sal_Int32>::get() )
-            {
-                sal_Int32 nValue = 0;
-                aAny >>= nValue;
-                aAny <<= (sal_Int16)nValue;
-            }
-            else
-            {
-                OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
-            }
+            sal_Int32 nValue = 0;
+            aAny >>= nValue;
+            aAny <<= (sal_Int16)nValue;
+        }
+        else
+        {
+            OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
         }
-
-        return aAny;
     }
+
+    return aAny;
+
 }
 
 void SAL_CALL SdStyleSheet::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >&  ) {}
diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx
index 41e973cf8246..764fb7ed5d9d 100644
--- a/sd/source/ui/unoidl/unopback.cxx
+++ b/sd/source/ui/unoidl/unopback.cxx
@@ -210,49 +210,47 @@ void SAL_CALL SdUnoPageBackground::setPropertyValue( const OUString& aPropertyNa
     {
         throw beans::UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this));
     }
-    else
+
+    if( mpSet )
     {
-        if( mpSet )
+        if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
         {
-            if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
+            drawing::BitmapMode eMode;
+            if( aValue >>= eMode )
             {
-                drawing::BitmapMode eMode;
-                if( aValue >>= eMode )
-                {
-                    mpSet->Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
-                    mpSet->Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
-                    return;
-                }
-                throw lang::IllegalArgumentException();
+                mpSet->Put( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) );
+                mpSet->Put( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) );
+                return;
             }
+            throw lang::IllegalArgumentException();
+        }
 
-            SfxItemPool& rPool = *mpSet->GetPool();
-            SfxItemSet aSet( rPool, {{pEntry->nWID, pEntry->nWID}});
-            aSet.Put( *mpSet );
-
-            if( !aSet.Count() )
-                aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
+        SfxItemPool& rPool = *mpSet->GetPool();
+        SfxItemSet aSet( rPool, {{pEntry->nWID, pEntry->nWID}});
+        aSet.Put( *mpSet );
 
-            if( pEntry->nMemberId == MID_NAME && ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ) )
-            {
-                OUString aName;
-                if(!(aValue >>= aName ))
-                    throw lang::IllegalArgumentException();
+        if( !aSet.Count() )
+            aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
 
-                SvxShape::SetFillAttribute( pEntry->nWID, aName, aSet );
-            }
-            else
-            {
-                SvxItemPropertySet_setPropertyValue( pEntry, aValue, aSet );
-            }
+        if( pEntry->nMemberId == MID_NAME && ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ) )
+        {
+            OUString aName;
+            if(!(aValue >>= aName ))
+                throw lang::IllegalArgumentException();
 
-            mpSet->Put( aSet );
+            SvxShape::SetFillAttribute( pEntry->nWID, aName, aSet );
         }
         else
         {
-            if(pEntry && pEntry->nWID)
-                mpPropSet->setPropertyValue( pEntry, aValue );
+            SvxItemPropertySet_setPropertyValue( pEntry, aValue, aSet );
         }
+
+        mpSet->Put( aSet );
+    }
+    else
+    {
+        if(pEntry && pEntry->nWID)
+            mpPropSet->setPropertyValue( pEntry, aValue );
     }
 }
 
@@ -267,44 +265,42 @@ uno::Any SAL_CALL SdUnoPageBackground::getPropertyValue( const OUString& Propert
     {
         throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
     }
-    else
+
+    if( mpSet )
     {
-        if( mpSet )
+        if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
         {
-            if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
-            {
-                const XFillBmpStretchItem* pStretchItem = mpSet->GetItem<XFillBmpStretchItem>(XATTR_FILLBMP_STRETCH);
-                const XFillBmpTileItem* pTileItem = mpSet->GetItem<XFillBmpTileItem>(XATTR_FILLBMP_TILE);
+            const XFillBmpStretchItem* pStretchItem = mpSet->GetItem<XFillBmpStretchItem>(XATTR_FILLBMP_STRETCH);
+            const XFillBmpTileItem* pTileItem = mpSet->GetItem<XFillBmpTileItem>(XATTR_FILLBMP_TILE);
 
-                if( pStretchItem && pTileItem )
-                {
-                    if( pTileItem->GetValue() )
-                        aAny <<= drawing::BitmapMode_REPEAT;
-                    else if( pStretchItem->GetValue() )
-                        aAny <<= drawing::BitmapMode_STRETCH;
-                    else
-                        aAny <<= drawing::BitmapMode_NO_REPEAT;
-                }
-            }
-            else
+            if( pStretchItem && pTileItem )
             {
-                SfxItemPool& rPool = *mpSet->GetPool();
-                SfxItemSet aSet( rPool, {{pEntry->nWID, pEntry->nWID}});
-                aSet.Put( *mpSet );
-
-                if( !aSet.Count() )
-                    aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
-
-                // get value from ItemSet
-                aAny = SvxItemPropertySet_getPropertyValue( pEntry, aSet );
+                if( pTileItem->GetValue() )
+                    aAny <<= drawing::BitmapMode_REPEAT;
+                else if( pStretchItem->GetValue() )
+                    aAny <<= drawing::BitmapMode_STRETCH;
+                else
+                    aAny <<= drawing::BitmapMode_NO_REPEAT;
             }
         }
         else
         {
-            if(pEntry && pEntry->nWID)
-                aAny = mpPropSet->getPropertyValue( pEntry );
+            SfxItemPool& rPool = *mpSet->GetPool();
+            SfxItemSet aSet( rPool, {{pEntry->nWID, pEntry->nWID}});
+            aSet.Put( *mpSet );
+
+            if( !aSet.Count() )
+                aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
+
+            // get value from ItemSet
+            aAny = SvxItemPropertySet_getPropertyValue( pEntry, aSet );
         }
     }
+    else
+    {
+        if(pEntry && pEntry->nWID)
+            aAny = mpPropSet->getPropertyValue( pEntry );
+    }
     return aAny;
 }
 
diff --git a/sdext/source/presenter/PresenterPaneFactory.cxx b/sdext/source/presenter/PresenterPaneFactory.cxx
index e9a5f950557e..94f6335cdd79 100644
--- a/sdext/source/presenter/PresenterPaneFactory.cxx
+++ b/sdext/source/presenter/PresenterPaneFactory.cxx
@@ -92,12 +92,9 @@ void PresenterPaneFactory::Register (const Reference<frame::XController>& rxCont
         {
             throw RuntimeException();
         }
-        else
-        {
-            xCC->addResourceFactory(
-                "private:resource/pane/Presenter/*",
-                this);
-        }
+        xCC->addResourceFactory(
+            "private:resource/pane/Presenter/*",
+             this);
     }
     catch (RuntimeException&)
     {
diff --git a/sdext/source/presenter/PresenterViewFactory.cxx b/sdext/source/presenter/PresenterViewFactory.cxx
index c471da4d71ab..983a17996e6c 100644
--- a/sdext/source/presenter/PresenterViewFactory.cxx
+++ b/sdext/source/presenter/PresenterViewFactory.cxx
@@ -150,15 +150,12 @@ void PresenterViewFactory::Register (const Reference<frame::XController>& rxCont
         {
             throw RuntimeException();
         }
-        else
-        {
-            mxConfigurationController->addResourceFactory(msCurrentSlidePreviewViewURL, this);
-            mxConfigurationController->addResourceFactory(msNextSlidePreviewViewURL, this);
-            mxConfigurationController->addResourceFactory(msNotesViewURL, this);
-            mxConfigurationController->addResourceFactory(msToolBarViewURL, this);
-            mxConfigurationController->addResourceFactory(msSlideSorterURL, this);
-            mxConfigurationController->addResourceFactory(msHelpViewURL, this);
-        }
+        mxConfigurationController->addResourceFactory(msCurrentSlidePreviewViewURL, this);
+        mxConfigurationController->addResourceFactory(msNextSlidePreviewViewURL, this);
+        mxConfigurationController->addResourceFactory(msNotesViewURL, this);
+        mxConfigurationController->addResourceFactory(msToolBarViewURL, this);
+        mxConfigurationController->addResourceFactory(msSlideSorterURL, this);
+        mxConfigurationController->addResourceFactory(msHelpViewURL, this);
     }
     catch (RuntimeException&)
     {
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 3e02827bbe6e..e5c85169c7c9 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -404,10 +404,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
             {
                 throw css::lang::IllegalArgumentException();
             }
-            else
-            {
-                aSetPaperSize = impl_Size_Struct2Object(aTempSize);
-            }
+            aSetPaperSize = impl_Size_Struct2Object(aTempSize);
         }
 
         // PrinterTray-Property
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 944485fbc4bf..a18de4f77171 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -310,34 +310,31 @@ const ::rtl::OUString TabBar::GetDeckIdForIndex (const sal_Int32 nIndex) const
 {
     if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size())
         throw RuntimeException();
-    else
-        return maItems[nIndex].msDeckId;
+    return maItems[nIndex].msDeckId;
 }
 
 void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
 {
     if (nIndex<0 || static_cast<size_t>(nIndex) >= maItems.size())
         throw RuntimeException();
-    else
-    {
-        maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden;
 
-        std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(maItems[nIndex].msDeckId);
-        if (xDeckDescriptor)
-        {
-            xDeckDescriptor->mbIsEnabled = ! maItems[nIndex].mbIsHidden;
+    maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden;
 
-            Context aContext;
-            aContext.msApplication = pParentSidebarController->GetCurrentContext().msApplication;
-            // leave aContext.msContext on default 'any' ... this func is used only for decks
-            // and we don't have context-sensitive decks anyway
+    std::shared_ptr<DeckDescriptor> xDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(maItems[nIndex].msDeckId);
+    if (xDeckDescriptor)
+    {
+        xDeckDescriptor->mbIsEnabled = ! maItems[nIndex].mbIsHidden;
 
-            xDeckDescriptor->maContextList.ToggleVisibilityForContext(
-                aContext, xDeckDescriptor->mbIsEnabled );
-        }
+        Context aContext;
+        aContext.msApplication = pParentSidebarController->GetCurrentContext().msApplication;
+        // leave aContext.msContext on default 'any' ... this func is used only for decks
+        // and we don't have context-sensitive decks anyway
 
-        Layout();
+        xDeckDescriptor->maContextList.ToggleVisibilityForContext(
+            aContext, xDeckDescriptor->mbIsEnabled );
     }
+
+    Layout();
 }
 
 void TabBar::RestoreHideFlags()
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx
index 60c7d0b916c4..c6bd06327f67 100644
--- a/starmath/source/accessibility.cxx
+++ b/starmath/source/accessibility.cxx
@@ -448,65 +448,63 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde
 
     if (!pWin)
         throw RuntimeException();
-    else
-    {
-        // get accessible text
-        SmViewShell *pView = pWin->GetView();
-        SmDocShell  *pDoc  = pView ? pView->GetDoc() : nullptr;
-        if (!pDoc)
-            throw RuntimeException();
-        OUString aTxt( GetAccessibleText_Impl() );
-        if (!(0 <= nIndex  &&  nIndex <= aTxt.getLength()))   // aTxt.getLength() is valid
-            throw IndexOutOfBoundsException();
-
-        // find a reasonable rectangle for position aTxt.getLength().
-        bool bWasBehindText = (nIndex == aTxt.getLength());
-        if (bWasBehindText && nIndex)
-            --nIndex;
-
-        const SmNode *pTree = pDoc->GetFormulaTree();
-        const SmNode *pNode = pTree->FindNodeWithAccessibleIndex( nIndex );
-        //! pNode may be 0 if the index belongs to a char that was inserted
-        //! only for the accessible text!
-        if (pNode)
-        {
-            sal_Int32 nAccIndex = pNode->GetAccessibleIndex();
-            OSL_ENSURE( nAccIndex >= 0, "invalid accessible index" );
-            OSL_ENSURE( nIndex >= nAccIndex, "index out of range" );
-
-            OUStringBuffer aBuf;
-            pNode->GetAccessibleText(aBuf);
-            OUString aNodeText = aBuf.makeStringAndClear();
-            sal_Int32 nNodeIndex = nIndex - nAccIndex;
-            if (0 <= nNodeIndex  &&  nNodeIndex < aNodeText.getLength())
-            {
-                // get appropriate rectangle
-                Point aOffset(pNode->GetTopLeft() - pTree->GetTopLeft());
-                Point aTLPos (pWin->GetFormulaDrawPos() + aOffset);
-                aTLPos.X() -= 0;
-                Size  aSize (pNode->GetSize());
 
-                long* pXAry = new long[ aNodeText.getLength() ];
-                pWin->SetFont( pNode->GetFont() );
-                pWin->GetTextArray( aNodeText, pXAry, 0, aNodeText.getLength() );
-                aTLPos.X()    += nNodeIndex > 0 ? pXAry[nNodeIndex - 1] : 0;
-                aSize.Width()  = nNodeIndex > 0 ? pXAry[nNodeIndex] - pXAry[nNodeIndex - 1] : pXAry[nNodeIndex];
-                delete[] pXAry;
+    // get accessible text
+    SmViewShell *pView = pWin->GetView();
+    SmDocShell  *pDoc  = pView ? pView->GetDoc() : nullptr;
+    if (!pDoc)
+        throw RuntimeException();
+    OUString aTxt( GetAccessibleText_Impl() );
+    if (!(0 <= nIndex  &&  nIndex <= aTxt.getLength()))   // aTxt.getLength() is valid
+        throw IndexOutOfBoundsException();
 
-                aTLPos = pWin->LogicToPixel( aTLPos );
-                aSize  = pWin->LogicToPixel( aSize );
-                aRes.X = aTLPos.X();
-                aRes.Y = aTLPos.Y();
-                aRes.Width  = aSize.Width();
-                aRes.Height = aSize.Height();
-            }
-        }
+    // find a reasonable rectangle for position aTxt.getLength().
+    bool bWasBehindText = (nIndex == aTxt.getLength());
+    if (bWasBehindText && nIndex)
+        --nIndex;
 
-        // take rectangle from last character and move it to the right
-        if (bWasBehindText)
-            aRes.X += aRes.Width;
+    const SmNode *pTree = pDoc->GetFormulaTree();
+    const SmNode *pNode = pTree->FindNodeWithAccessibleIndex( nIndex );
+    //! pNode may be 0 if the index belongs to a char that was inserted
+    //! only for the accessible text!
+    if (pNode)
+    {
+        sal_Int32 nAccIndex = pNode->GetAccessibleIndex();
+        OSL_ENSURE( nAccIndex >= 0, "invalid accessible index" );
+        OSL_ENSURE( nIndex >= nAccIndex, "index out of range" );
+
+        OUStringBuffer aBuf;
+        pNode->GetAccessibleText(aBuf);
+        OUString aNodeText = aBuf.makeStringAndClear();
+        sal_Int32 nNodeIndex = nIndex - nAccIndex;
+        if (0 <= nNodeIndex  &&  nNodeIndex < aNodeText.getLength())
+        {
+            // get appropriate rectangle
+            Point aOffset(pNode->GetTopLeft() - pTree->GetTopLeft());
+            Point aTLPos (pWin->GetFormulaDrawPos() + aOffset);
+            aTLPos.X() -= 0;
+            Size  aSize (pNode->GetSize());
+
+            long* pXAry = new long[ aNodeText.getLength() ];
+            pWin->SetFont( pNode->GetFont() );
+            pWin->GetTextArray( aNodeText, pXAry, 0, aNodeText.getLength() );
+            aTLPos.X()    += nNodeIndex > 0 ? pXAry[nNodeIndex - 1] : 0;
+            aSize.Width()  = nNodeIndex > 0 ? pXAry[nNodeIndex] - pXAry[nNodeIndex - 1] : pXAry[nNodeIndex];
+            delete[] pXAry;
+
+            aTLPos = pWin->LogicToPixel( aTLPos );
+            aSize  = pWin->LogicToPixel( aSize );
+            aRes.X = aTLPos.X();
+            aRes.Y = aTLPos.Y();
+            aRes.Width  = aSize.Width();
+            aRes.Height = aSize.Height();
+        }
     }
 
+    // take rectangle from last character and move it to the right
+    if (bWasBehindText)
+        aRes.X += aRes.Width;
+
     return aRes;
 }
 
@@ -701,25 +699,24 @@ sal_Bool SAL_CALL SmGraphicAccessible::copyText(
 
     if (!pWin)
         throw RuntimeException();
-    else
+
+    Reference< datatransfer::clipboard::XClipboard > xClipboard = pWin->GetClipboard();
+    if ( xClipboard.is() )
     {
-        Reference< datatransfer::clipboard::XClipboard > xClipboard = pWin->GetClipboard();
-        if ( xClipboard.is() )
-        {
-            OUString sText( getTextRange(nStartIndex, nEndIndex) );
+        OUString sText( getTextRange(nStartIndex, nEndIndex) );
 
-            vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
-            SolarMutexReleaser aReleaser;
-            xClipboard->setContents( pDataObj, nullptr );
+        vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+        SolarMutexReleaser aReleaser;
+        xClipboard->setContents( pDataObj, nullptr );
 
-            Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
-            if( xFlushableClipboard.is() )
-                xFlushableClipboard->flushClipboard();
+        Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
+        if( xFlushableClipboard.is() )
+            xFlushableClipboard->flushClipboard();
 
-            bReturn = true;
-        }
+        bReturn = true;
     }
 
+
     return bReturn;
 }
 
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index a9604f6b766e..d1e3ff9d2cb0 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -154,28 +154,26 @@ void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xSha
     {
         throw uno::RuntimeException();
     }
-    else
-    {
-        SdrObjList& rList = *pSdrShape->GetObjList();
 
-        const size_t nObjCount = rList.GetObjCount();
-        size_t nObjNum = 0;
-        while( nObjNum < nObjCount )
-        {
-            if(rList.GetObj( nObjNum ) == pSdrShape )
-                break;
-            nObjNum++;
-        }
+    SdrObjList& rList = *pSdrShape->GetObjList();
 
-        if( nObjNum < nObjCount )
-        {
-            SdrObject* pObject = rList.NbcRemoveObject( nObjNum );
-            SdrObject::Free( pObject );
-        }
-        else
-        {
-            SAL_WARN( "svx", "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
-        }
+    const size_t nObjCount = rList.GetObjCount();
+    size_t nObjNum = 0;
+    while( nObjNum < nObjCount )
+    {
+        if(rList.GetObj( nObjNum ) == pSdrShape )
+            break;
+        nObjNum++;
+    }
+
+    if( nObjNum < nObjCount )
+    {
+        SdrObject* pObject = rList.NbcRemoveObject( nObjNum );
+        SdrObject::Free( pObject );
+    }
+    else
+    {
+        SAL_WARN( "svx", "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
     }
 }
 
diff --git a/svx/source/unogallery/unogaltheme.cxx b/svx/source/unogallery/unogaltheme.cxx
index f035bc174b22..f1d53c8f2aa7 100644
--- a/svx/source/unogallery/unogaltheme.cxx
+++ b/svx/source/unogallery/unogaltheme.cxx
@@ -135,13 +135,10 @@ uno::Any SAL_CALL GalleryTheme::getByIndex( ::sal_Int32 nIndex )
         {
             throw lang::IndexOutOfBoundsException();
         }
-        else
-        {
-            const GalleryObject* pObj = mpTheme->ImplGetGalleryObject( nIndex );
+        const GalleryObject* pObj = mpTheme->ImplGetGalleryObject( nIndex );
 
-            if( pObj )
-                aRet <<= uno::Reference< gallery::XGalleryItem >( new GalleryItem( *this, *pObj ) );
-        }
+        if( pObj )
+            aRet <<= uno::Reference< gallery::XGalleryItem >( new GalleryItem( *this, *pObj ) );
     }
 
     return aRet;
@@ -291,8 +288,7 @@ void SAL_CALL GalleryTheme::removeByIndex( sal_Int32 nIndex )
     {
         if( ( nIndex < 0 ) || ( nIndex >= getCount() ) )
             throw lang::IndexOutOfBoundsException();
-        else
-            mpTheme->RemoveObject( nIndex );
+        mpTheme->RemoveObject( nIndex );
     }
 }
 
diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx
index f11dcb279331..c497a86d830e 100644
--- a/svx/source/unogallery/unogalthemeprovider.cxx
+++ b/svx/source/unogallery/unogalthemeprovider.cxx
@@ -166,10 +166,8 @@ uno::Any SAL_CALL GalleryThemeProvider::getByName( const OUString& rName )
     {
         throw container::NoSuchElementException();
     }
-    else
-    {
-        aRet <<= uno::Reference< gallery::XGalleryTheme >( new ::unogallery::GalleryTheme( rName ) );
-    }
+
+    aRet <<= uno::Reference< gallery::XGalleryTheme >( new ::unogallery::GalleryTheme( rName ) );
 
     return aRet;
 }
@@ -239,10 +237,8 @@ void SAL_CALL GalleryThemeProvider::removeByName( const OUString& rName )
     {
         throw container::NoSuchElementException();
     }
-    else
-    {
-        mpGallery->RemoveTheme( rName );
-    }
+
+    mpGallery->RemoveTheme( rName );
 }
 
 }
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index e25061c79c33..73d1b437e4d6 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -3138,9 +3138,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getHyperLinkIndex( sal_Int32 nCharInde
 
     if (nRet == -1)
         throw lang::IndexOutOfBoundsException();
-    else
-        return nRet;
-    //return nRet;
+     return nRet;
 }
 
 // #i71360#, #i108125# - adjustments for change tracking text markup
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 03dac9d63e22..b7a40b0d66fb 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -1997,13 +1997,12 @@ uno::Sequence< OUString > SAL_CALL SwChartDataSequence::generateLabel(
         SwTable* pTable = pTableFormat ? SwTable::FindTable( pTableFormat ) : nullptr;
         if (!pTableFormat || !pTable || pTable->IsTableComplex())
             throw uno::RuntimeException();
-        else
-        {
-            const OUString aCellRange( GetCellRangeName( *pTableFormat, *m_pTableCursor ) );
-            OSL_ENSURE( !aCellRange.isEmpty(), "failed to get cell range" );
-            bOk = FillRangeDescriptor( aDesc, aCellRange );
-            OSL_ENSURE( bOk, "failed to get SwRangeDescriptor" );
-        }
+
+        const OUString aCellRange( GetCellRangeName( *pTableFormat, *m_pTableCursor ) );
+        OSL_ENSURE( !aCellRange.isEmpty(), "failed to get cell range" );
+        bOk = FillRangeDescriptor( aDesc, aCellRange );
+        OSL_ENSURE( bOk, "failed to get SwRangeDescriptor" );
+
         if (bOk)
         {
             aDesc.Normalize();
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index a112acc2e4b5..2dc746ca6f7f 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1121,54 +1121,51 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
                         // set property <TextRange> not valid for to-page anchored shapes
                         throw lang::IllegalArgumentException();
                     }
-                    else
+
+                    std::unique_ptr<SwUnoInternalPaM> pInternalPam(
+                                    new SwUnoInternalPaM( *(pFormat->GetDoc()) ));
+                    uno::Reference< text::XTextRange > xRg;
+                    aValue >>= xRg;
+                    if (!::sw::XTextRangeToSwPaM(*pInternalPam, xRg) )
                     {
-                        std::unique_ptr<SwUnoInternalPaM> pInternalPam(
-                                        new SwUnoInternalPaM( *(pFormat->GetDoc()) ));
-                        uno::Reference< text::XTextRange > xRg;
-                        aValue >>= xRg;
-                        if (!::sw::XTextRangeToSwPaM(*pInternalPam, xRg) )
-                        {
-                            throw uno::RuntimeException();
-                        }
+                        throw uno::RuntimeException();
+                    }
 
-                        if (aAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR)
-                        {
-                            //delete old SwFormatFlyCnt
-                            //With AnchorAsCharacter the current TextAttribute has to be deleted.
-                            //Tbis removes the frame format too.
-                            //To prevent this the connection between format and attribute has to be broken before.
-                            const SwPosition *pPos = aAnchor.GetContentAnchor();
-                            SwTextNode *pTextNode = pPos->nNode.GetNode().GetTextNode();
-                            SAL_WARN_IF( !pTextNode->HasHints(), "sw.uno", "Missing FlyInCnt-Hint." );
-                            const sal_Int32 nIdx = pPos->nContent.GetIndex();
-                            SwTextAttr * const pHint =
+                    if (aAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR)
+                    {
+                        //delete old SwFormatFlyCnt
+                        //With AnchorAsCharacter the current TextAttribute has to be deleted.
+                        //Tbis removes the frame format too.
+                        //To prevent this the connection between format and attribute has to be broken before.
+                        const SwPosition *pPos = aAnchor.GetContentAnchor();
+                        SwTextNode *pTextNode = pPos->nNode.GetNode().GetTextNode();
+                        SAL_WARN_IF( !pTextNode->HasHints(), "sw.uno", "Missing FlyInCnt-Hint." );
+                        const sal_Int32 nIdx = pPos->nContent.GetIndex();
+                        SwTextAttr * const pHint =
                                 pTextNode->GetTextAttrForCharAt(
-                                    nIdx, RES_TXTATR_FLYCNT );
-                            assert(pHint && "Missing Hint.");
-                            SAL_WARN_IF( pHint->Which() != RES_TXTATR_FLYCNT,
-                                        "sw.uno", "Missing FlyInCnt-Hint." );
-                            SAL_WARN_IF( pHint->GetFlyCnt().GetFrameFormat() != pFormat,
-                                        "sw.uno", "Wrong TextFlyCnt-Hint." );
-                            const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt())
-                                .SetFlyFormat();
-
-                            //The connection is removed now the attribute can be deleted.
-                            pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx );
-                            //create a new one
-                            SwTextNode *pNd = pInternalPam->GetNode().GetTextNode();
-                            SAL_WARN_IF( !pNd, "sw.uno", "Cursor not at TextNode." );
-                            SwFormatFlyCnt aFormat( pFormat );
-                            pNd->InsertItem(aFormat, pInternalPam->GetPoint()
-                                    ->nContent.GetIndex(), 0 );
-                        }
-                        else
-                        {
-                            aAnchor.SetAnchor( pInternalPam->GetPoint() );
-                            aSet.Put(aAnchor);
-                            pFormat->SetFormatAttr(aSet);
-                        }
-
+                                nIdx, RES_TXTATR_FLYCNT );
+                        assert(pHint && "Missing Hint.");
+                        SAL_WARN_IF( pHint->Which() != RES_TXTATR_FLYCNT,
+                                    "sw.uno", "Missing FlyInCnt-Hint." );
+                        SAL_WARN_IF( pHint->GetFlyCnt().GetFrameFormat() != pFormat,
+                                    "sw.uno", "Wrong TextFlyCnt-Hint." );
+                        const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt())
+                            .SetFlyFormat();
+
+                        //The connection is removed now the attribute can be deleted.
+                        pTextNode->DeleteAttributes( RES_TXTATR_FLYCNT, nIdx );
+                        //create a new one
+                        SwTextNode *pNd = pInternalPam->GetNode().GetTextNode();
+                        SAL_WARN_IF( !pNd, "sw.uno", "Cursor not at TextNode." );
+                        SwFormatFlyCnt aFormat( pFormat );
+                        pNd->InsertItem(aFormat, pInternalPam->GetPoint()
+                                ->nContent.GetIndex(), 0 );
+                    }
+                    else
+                    {
+                        aAnchor.SetAnchor( pInternalPam->GetPoint() );
+                        aSet.Put(aAnchor);
+                        pFormat->SetFormatAttr(aSet);
                     }
                 }
                 else if (pEntry->nWID == FN_TEXT_BOX)
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 9616c94718f6..ffc325c1cfec 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -2458,8 +2458,7 @@ void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any&
                 sal_Int8 nTmp = 0;
                 if (! ( aValue >>= nTmp ) )
                     throw IllegalArgumentException();
-                else
-                    nSepLineVertAlign = (style::VerticalAlignment)nTmp;
+                nSepLineVertAlign = (style::VerticalAlignment)nTmp;
             }
             else
                 nSepLineVertAlign = eAlign;
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 646a802b61de..48a3ff6109f1 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1883,22 +1883,20 @@ void SwXText::Impl::ConvertCell(
             {
                 throw lang::IllegalArgumentException();
             }
-            else
+
+            m_pDoc->getIDocumentContentOperations().SplitNode(*aStartCellPam.Start(), false);
+            sal_uLong const nNewIndex(aStartCellPam.Start()->nNode.GetIndex());
+            if (nNewIndex != nStartCellNodeIndex)
             {
-                m_pDoc->getIDocumentContentOperations().SplitNode(*aStartCellPam.Start(), false);
-                sal_uLong const nNewIndex(aStartCellPam.Start()->nNode.GetIndex());
-                if (nNewIndex != nStartCellNodeIndex)
+                // aStartCellPam now points to the 2nd node
+                // the last cell may *also* point to 2nd node now - fix it!
+                assert(nNewIndex == nStartCellNodeIndex + 1);
+                if (pLastCell->aEnd.GetIndex() == nNewIndex)
                 {
-                    // aStartCellPam now points to the 2nd node
-                    // the last cell may *also* point to 2nd node now - fix it!
-                    assert(nNewIndex == nStartCellNodeIndex + 1);
-                    if (pLastCell->aEnd.GetIndex() == nNewIndex)
+                    --pLastCell->aEnd;
+                    if (pLastCell->aStart.GetIndex() == nNewIndex)
                     {
-                        --pLastCell->aEnd;
-                        if (pLastCell->aStart.GetIndex() == nNewIndex)
-                        {
-                            --pLastCell->aStart;
-                        }
+                        --pLastCell->aStart;
                     }
                 }
             }
diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx
index e68f614c3729..871b24520a6f 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -1034,44 +1034,42 @@ uno::Any SAL_CALL SwXMailMerge::getPropertyValue(
     const SfxItemPropertySimpleEntry* pCur = m_pPropSet->getPropertyMap().getByName( rPropertyName );
     if (!pCur)
         throw UnknownPropertyException();
-    else
+
+    switch (pCur->nWID)
     {
-        switch (pCur->nWID)
-        {
-            case WID_SELECTION :                aRet <<= m_aSelection;  break;
-            case WID_RESULT_SET :               aRet <<= m_xResultSet;  break;
-            case WID_CONNECTION :               aRet <<= m_xConnection;  break;
-            case WID_MODEL :                    aRet <<= m_xModel;  break;
-            case WID_DATA_SOURCE_NAME :         aRet <<= m_aDataSourceName;  break;
-            case WID_DATA_COMMAND :             aRet <<= m_aDataCommand;  break;
-            case WID_FILTER :                   aRet <<= m_aFilter;  break;
-            case WID_DOCUMENT_URL :             aRet <<= m_aDocumentURL;  break;
-            case WID_OUTPUT_URL :               aRet <<= m_aOutputURL;  break;
-            case WID_DATA_COMMAND_TYPE :        aRet <<= m_nDataCommandType;  break;
-            case WID_OUTPUT_TYPE :              aRet <<= m_nOutputType;  break;
-            case WID_ESCAPE_PROCESSING :        aRet <<= m_bEscapeProcessing;  break;
-            case WID_SINGLE_PRINT_JOBS :        aRet <<= m_bSinglePrintJobs;  break;
-            case WID_FILE_NAME_FROM_COLUMN :    aRet <<= m_bFileNameFromColumn;  break;
-            case WID_FILE_NAME_PREFIX :         aRet <<= m_aFileNamePrefix;  break;
-            case WID_MAIL_SUBJECT:              aRet <<= m_sSubject; break;
-            case WID_ADDRESS_FROM_COLUMN:       aRet <<= m_sAddressFromColumn; break;
-            case WID_SEND_AS_HTML:              aRet <<= m_bSendAsHTML; break;
-            case WID_SEND_AS_ATTACHMENT:        aRet <<= m_bSendAsAttachment; break;
-            case WID_MAIL_BODY:                 aRet <<= m_sMailBody; break;
-            case WID_ATTACHMENT_NAME:           aRet <<= m_sAttachmentName; break;
-            case WID_ATTACHMENT_FILTER:         aRet <<= m_sAttachmentFilter;break;
-            case WID_PRINT_OPTIONS:             aRet <<= m_aPrintSettings; break;
-            case WID_SAVE_AS_SINGLE_FILE:       aRet <<= m_bSaveAsSingleFile; break;
-            case WID_SAVE_FILTER:               aRet <<= m_sSaveFilter; break;
-            case WID_SAVE_FILTER_OPTIONS:       aRet <<= m_sSaveFilterOptions; break;
-            case WID_SAVE_FILTER_DATA:          aRet <<= m_aSaveFilterData; break;
-            case WID_COPIES_TO:                 aRet <<= m_aCopiesTo; break;
-            case WID_BLIND_COPIES_TO:           aRet <<= m_aBlindCopiesTo;break;
-            case WID_IN_SERVER_PASSWORD:        aRet <<= m_sInServerPassword; break;
-            case WID_OUT_SERVER_PASSWORD:       aRet <<= m_sOutServerPassword; break;
-            default :
-                OSL_FAIL("unknown WID");
-        }
+        case WID_SELECTION :                aRet <<= m_aSelection;  break;
+        case WID_RESULT_SET :               aRet <<= m_xResultSet;  break;
+        case WID_CONNECTION :               aRet <<= m_xConnection;  break;
+        case WID_MODEL :                    aRet <<= m_xModel;  break;
+        case WID_DATA_SOURCE_NAME :         aRet <<= m_aDataSourceName;  break;

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list