[Libreoffice-commits] core.git: connectivity/source libreofficekit/qa libreofficekit/source oox/source sal/rtl sax/source sdext/source shell/source starmath/source svl/source svtools/source sw/source test/source unotest/source uui/source writerperfect/source xmlhelp/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 11 09:21:30 UTC 2020


 connectivity/source/drivers/odbc/OConnection.cxx                    |   24 
 libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx |   68 -
 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx            |   36 
 libreofficekit/qa/tilebench/tilebench.cxx                           |   46 -
 libreofficekit/source/gtk/tilebuffer.cxx                            |   28 
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx                 |   36 
 sal/rtl/ustring.cxx                                                 |   24 
 sax/source/tools/fastattribs.cxx                                    |   12 
 sdext/source/presenter/PresenterAccessibility.cxx                   |  156 ++--
 sdext/source/presenter/PresenterProtocolHandler.cxx                 |   23 
 shell/source/backends/kf5be/kf5backend.cxx                          |   26 
 starmath/source/smmod.cxx                                           |   22 
 svl/source/passwordcontainer/passwordcontainer.cxx                  |   26 
 svtools/source/brwbox/editbrowsebox2.cxx                            |   28 
 svtools/source/control/valueset.cxx                                 |   70 -
 svtools/source/uno/generictoolboxcontroller.cxx                     |   34 
 sw/source/core/layout/wsfrm.cxx                                     |   34 
 sw/source/uibase/uiview/view.cxx                                    |  386 +++++-----
 test/source/screenshot_test.cxx                                     |   42 -
 test/source/sheet/xnamedranges.cxx                                  |   26 
 unotest/source/cpp/officeconnection.cxx                             |   41 -
 uui/source/secmacrowarnings.cxx                                     |   24 
 writerperfect/source/writer/exp/XMLBase64ImportContext.cxx          |   30 
 xmlhelp/source/cxxhelp/provider/db.cxx                              |   68 -
 xmlhelp/source/cxxhelp/provider/urlparameter.cxx                    |   24 
 25 files changed, 667 insertions(+), 667 deletions(-)

New commits:
commit 2d582244680e7f6dec6e4a466e276f93ccb01dc9
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 10 20:47:32 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 11 11:20:43 2020 +0200

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

diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx
index 26a549814cf3..53a8f8fb1905 100644
--- a/connectivity/source/drivers/odbc/OConnection.cxx
+++ b/connectivity/source/drivers/odbc/OConnection.cxx
@@ -60,21 +60,21 @@ OConnection::~OConnection()
     if(!isClosed(  ))
         close();
 
-    if ( SQL_NULL_HANDLE != m_aConnectionHandle )
-    {
-        SQLRETURN rc;
-
-        if (!m_bClosed)
-        {
-            rc = N3SQLDisconnect( m_aConnectionHandle );
-            OSL_ENSURE( rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO, "Failure from SQLDisconnect" );
-        }
+    if ( SQL_NULL_HANDLE == m_aConnectionHandle )
+        return;
 
-        rc = N3SQLFreeHandle( SQL_HANDLE_DBC, m_aConnectionHandle );
-        OSL_ENSURE( rc == SQL_SUCCESS , "Failure from SQLFreeHandle for connection");
+    SQLRETURN rc;
 
-        m_aConnectionHandle = SQL_NULL_HANDLE;
+    if (!m_bClosed)
+    {
+        rc = N3SQLDisconnect( m_aConnectionHandle );
+        OSL_ENSURE( rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO, "Failure from SQLDisconnect" );
     }
+
+    rc = N3SQLFreeHandle( SQL_HANDLE_DBC, m_aConnectionHandle );
+    OSL_ENSURE( rc == SQL_SUCCESS , "Failure from SQLFreeHandle for connection");
+
+    m_aConnectionHandle = SQL_NULL_HANDLE;
 }
 
 oslGenericFunction OConnection::getOdbcFunction(ODBC3SQLFunctionId _nIndex)  const
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
index 794774acfe52..90b96e57488a 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx
@@ -52,44 +52,44 @@ void LOKDocViewSigHandlers::commandChanged(LOKDocView* pDocView, char* pPayload,
     GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(pDocView)));
     std::string aPayload(pPayload);
     size_t nPosition = aPayload.find('=');
-    if (nPosition != std::string::npos)
+    if (nPosition == std::string::npos)
+        return;
+
+    const std::string aKey = aPayload.substr(0, nPosition);
+    const std::string aValue = aPayload.substr(nPosition + 1);
+    GtkToolItem* pItem = gtv_application_window_find_tool_by_unocommand(window, aKey);
+    if (pItem != nullptr)
     {
-        const std::string aKey = aPayload.substr(0, nPosition);
-        const std::string aValue = aPayload.substr(nPosition + 1);
-        GtkToolItem* pItem = gtv_application_window_find_tool_by_unocommand(window, aKey);
-        if (pItem != nullptr)
-        {
-            if (aValue == "true" || aValue == "false") {
-                bool bEdit = aValue == "true";
-                if (bool(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pItem))) != bEdit)
-                {
-                    // Avoid invoking lok_doc_view_post_command().
-                    // FIXME: maybe block/unblock the signal (see
-                    // g_signal_handlers_block_by_func) ?
-                    gtv_application_window_set_toolbar_broadcast(window, false);
-                    gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(pItem), bEdit);
-                    gtv_application_window_set_toolbar_broadcast(window, true);
+        if (aValue == "true" || aValue == "false") {
+            bool bEdit = aValue == "true";
+            if (bool(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(pItem))) != bEdit)
+            {
+                // Avoid invoking lok_doc_view_post_command().
+                // FIXME: maybe block/unblock the signal (see
+                // g_signal_handlers_block_by_func) ?
+                gtv_application_window_set_toolbar_broadcast(window, false);
+                gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(pItem), bEdit);
+                gtv_application_window_set_toolbar_broadcast(window, true);
 
-                }
-            } else if (aValue == "enabled" || aValue == "disabled") {
-                bool bSensitive = aValue == "enabled";
-                gtk_widget_set_sensitive(GTK_WIDGET(pItem), bSensitive);
-
-                // Remember state, so in case edit is disable and enabled
-                // later, the correct sensitivity can be restored.
-                GtvMainToolbar* pMainToolbar = gtv_application_window_get_main_toolbar(window);
-                gtv_main_toolbar_set_sensitive_internal(pMainToolbar, pItem, bSensitive);
             }
+        } else if (aValue == "enabled" || aValue == "disabled") {
+            bool bSensitive = aValue == "enabled";
+            gtk_widget_set_sensitive(GTK_WIDGET(pItem), bSensitive);
+
+            // Remember state, so in case edit is disable and enabled
+            // later, the correct sensitivity can be restored.
+            GtvMainToolbar* pMainToolbar = gtv_application_window_get_main_toolbar(window);
+            gtv_main_toolbar_set_sensitive_internal(pMainToolbar, pItem, bSensitive);
         }
-        else if (aKey == ".uno:TrackedChangeIndex")
-        {
-            std::string aText("Current redline: ");
-            if (aValue.empty())
-                aText += "none";
-            else
-                aText += aValue;
-            gtk_label_set_text(GTK_LABEL(window->redlinelabel), aText.c_str());
-        }
+    }
+    else if (aKey == ".uno:TrackedChangeIndex")
+    {
+        std::string aText("Current redline: ");
+        if (aValue.empty())
+            aText += "none";
+        else
+            aText += aValue;
+        gtk_label_set_text(GTK_LABEL(window->redlinelabel), aText.c_str());
     }
 }
 
diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
index df4146628cc1..fef712ceef0a 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
@@ -27,28 +27,28 @@ void btn_clicked(GtkWidget* pButton, gpointer)
     GtvApplicationWindow* window = GTV_APPLICATION_WINDOW(gtk_widget_get_toplevel(pButton));
     GtkToolButton* pItem = GTK_TOOL_BUTTON(pButton);
     const gchar* label = gtk_tool_button_get_label(pItem);
-    if (gtv_application_window_get_toolbar_broadcast(window) && g_str_has_prefix(label, ".uno:"))
-    {
-        std::string aArguments;
-        if (g_strcmp0(label, ".uno:InsertAnnotation") == 0)
-        {
-            std::map<std::string, std::string> aEntries;
-            aEntries["Text"] = "";
-            GtvHelpers::userPromptDialog(GTK_WINDOW(window), "Insert Comment", aEntries);
+    if (!(gtv_application_window_get_toolbar_broadcast(window) && g_str_has_prefix(label, ".uno:")))
+        return;
 
-            boost::property_tree::ptree aTree;
-            aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string");
-            aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]);
+    std::string aArguments;
+    if (g_strcmp0(label, ".uno:InsertAnnotation") == 0)
+    {
+        std::map<std::string, std::string> aEntries;
+        aEntries["Text"] = "";
+        GtvHelpers::userPromptDialog(GTK_WINDOW(window), "Insert Comment", aEntries);
 
-            std::stringstream aStream;
-            boost::property_tree::write_json(aStream, aTree);
-            aArguments = aStream.str();
-        }
+        boost::property_tree::ptree aTree;
+        aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string");
+        aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]);
 
-        bool bNotify = g_strcmp0(label, ".uno:Save") == 0;
-        if (window->lokdocview)
-            lok_doc_view_post_command(LOK_DOC_VIEW(window->lokdocview), label, aArguments.c_str(), bNotify);
+        std::stringstream aStream;
+        boost::property_tree::write_json(aStream, aTree);
+        aArguments = aStream.str();
     }
+
+    bool bNotify = g_strcmp0(label, ".uno:Save") == 0;
+    if (window->lokdocview)
+        lok_doc_view_post_command(LOK_DOC_VIEW(window->lokdocview), label, aArguments.c_str(), bNotify);
 }
 
 void doCopy(GtkWidget* pButton, gpointer /*pItem*/)
diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx
index 8f06cc16b2fd..978b7aa5eaa0 100644
--- a/libreofficekit/qa/tilebench/tilebench.cxx
+++ b/libreofficekit/qa/tilebench/tilebench.cxx
@@ -488,33 +488,33 @@ static void kitCallback(int nType, const char* pPayload, void* pData)
     nDialogId = aRoot.get<unsigned>("id");
     const std::string aAction = aRoot.get<std::string>("action");
 
-    if (aAction == "created")
-    {
-        const std::string aType = aRoot.get<std::string>("type");
-        const std::string aSize = aRoot.get<std::string>("size");
-        int nWidth = atoi(aSize.c_str());
-        int nHeight = 400;
-        const char *pComma = strstr(aSize.c_str(), ", ");
-        if (pComma)
-            nHeight = atoi(pComma + 2);
-        std::cerr << "Size " << aSize << " is " << nWidth << ", " << nHeight << "\n";
-
-        if (aType == "dialog")
-        {
-            aTimes.emplace_back(); // complete wait for dialog
+    if (aAction != "created")
+        return;
 
-            unsigned char *pBuffer = new unsigned char[nWidth * nHeight * 4];
+    const std::string aType = aRoot.get<std::string>("type");
+    const std::string aSize = aRoot.get<std::string>("size");
+    int nWidth = atoi(aSize.c_str());
+    int nHeight = 400;
+    const char *pComma = strstr(aSize.c_str(), ", ");
+    if (pComma)
+        nHeight = atoi(pComma + 2);
+    std::cerr << "Size " << aSize << " is " << nWidth << ", " << nHeight << "\n";
 
-            aTimes.emplace_back("render dialog");
-            pDocument->paintWindow(nDialogId, pBuffer, 0, 0, nWidth, nHeight);
-            dumpTile("dialog", nWidth, nHeight, pDocument->getTileMode(), pBuffer);
-            aTimes.emplace_back();
+    if (aType != "dialog")
+        return;
 
-            delete[] pBuffer;
+    aTimes.emplace_back(); // complete wait for dialog
 
-            bDialogRendered = true;
-        }
-    }
+    unsigned char *pBuffer = new unsigned char[nWidth * nHeight * 4];
+
+    aTimes.emplace_back("render dialog");
+    pDocument->paintWindow(nDialogId, pBuffer, 0, 0, nWidth, nHeight);
+    dumpTile("dialog", nWidth, nHeight, pDocument->getTileMode(), pBuffer);
+    aTimes.emplace_back();
+
+    delete[] pBuffer;
+
+    bDialogRendered = true;
 }
 
 static void testDialog( Document *pDocument, const char *uno_cmd )
diff --git a/libreofficekit/source/gtk/tilebuffer.cxx b/libreofficekit/source/gtk/tilebuffer.cxx
index 82f0253d9e82..6836031661bc 100644
--- a/libreofficekit/source/gtk/tilebuffer.cxx
+++ b/libreofficekit/source/gtk/tilebuffer.cxx
@@ -61,21 +61,21 @@ void TileBuffer::setInvalid(int x, int y, float fZoom, GTask* task,
 {
     int index = x * m_nWidth + y;
     GError* error = nullptr;
-    if (m_mTiles.find(index) != m_mTiles.end())
-    {
-        m_mTiles[index].valid = false;
+    if (m_mTiles.find(index) == m_mTiles.end())
+        return;
 
-        LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE);
-        pLOEvent->m_nPaintTileX = x;
-        pLOEvent->m_nPaintTileY = y;
-        pLOEvent->m_fPaintTileZoom = fZoom;
-        g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
-        g_thread_pool_push(lokThreadPool, g_object_ref(task), &error);
-        if (error != nullptr)
-        {
-            g_warning("Unable to call LOK_PAINT_TILE: %s", error->message);
-            g_clear_error(&error);
-        }
+    m_mTiles[index].valid = false;
+
+    LOEvent* pLOEvent = new LOEvent(LOK_PAINT_TILE);
+    pLOEvent->m_nPaintTileX = x;
+    pLOEvent->m_nPaintTileY = y;
+    pLOEvent->m_fPaintTileZoom = fZoom;
+    g_task_set_task_data(task, pLOEvent, LOEvent::destroy);
+    g_thread_pool_push(lokThreadPool, g_object_ref(task), &error);
+    if (error != nullptr)
+    {
+        g_warning("Unable to call LOK_PAINT_TILE: %s", error->message);
+        g_clear_error(&error);
     }
 }
 
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index e4980991795a..f81aa774402b 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -456,26 +456,26 @@ namespace
 void ApplyConstraintToLayout(const Constraint& rConstraint, LayoutPropertyMap& rProperties)
 {
     const LayoutPropertyMap::const_iterator aRef = rProperties.find(rConstraint.msRefForName);
-    if (aRef != rProperties.end())
+    if (aRef == rProperties.end())
+        return;
+
+    const LayoutProperty::const_iterator aRefType = aRef->second.find(rConstraint.mnRefType);
+    if (aRefType != aRef->second.end())
+        rProperties[rConstraint.msForName][rConstraint.mnType]
+            = aRefType->second * rConstraint.mfFactor;
+    else
     {
-        const LayoutProperty::const_iterator aRefType = aRef->second.find(rConstraint.mnRefType);
-        if (aRefType != aRef->second.end())
-            rProperties[rConstraint.msForName][rConstraint.mnType]
-                = aRefType->second * rConstraint.mfFactor;
+        // Values are never in EMU, while oox::drawingml::Shape position and size are always in
+        // EMU.
+        double fUnitFactor = 0;
+        if (isFontUnit(rConstraint.mnRefType))
+            // Points -> EMU.
+            fUnitFactor = EMU_PER_PT;
         else
-        {
-            // Values are never in EMU, while oox::drawingml::Shape position and size are always in
-            // EMU.
-            double fUnitFactor = 0;
-            if (isFontUnit(rConstraint.mnRefType))
-                // Points -> EMU.
-                fUnitFactor = EMU_PER_PT;
-            else
-                // Millimeters -> EMU.
-                fUnitFactor = EMU_PER_HMM * 100;
-            rProperties[rConstraint.msForName][rConstraint.mnType]
-                = rConstraint.mfValue * fUnitFactor;
-        }
+            // Millimeters -> EMU.
+            fUnitFactor = EMU_PER_HMM * 100;
+        rProperties[rConstraint.msForName][rConstraint.mnType]
+            = rConstraint.mfValue * fUnitFactor;
     }
 }
 }
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index 66e2fe03ce9d..d3bf1daedc78 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -543,20 +543,20 @@ void SAL_CALL rtl_uString_newFromAscii( rtl_uString** ppThis,
 
     *ppThis = rtl_uString_ImplAlloc( nLen );
     OSL_ASSERT(*ppThis != nullptr);
-    if ( *ppThis )
-    {
-        sal_Unicode* pBuffer = (*ppThis)->buffer;
-        do
-        {
-            assert(static_cast<unsigned char>(*pCharStr) < 0x80); // ASCII range
-            *pBuffer = *pCharStr;
-            pBuffer++;
-            pCharStr++;
-        }
-        while ( *pCharStr );
+    if ( !(*ppThis) )
+        return;
 
-        RTL_LOG_STRING_NEW( *ppThis );
+    sal_Unicode* pBuffer = (*ppThis)->buffer;
+    do
+    {
+        assert(static_cast<unsigned char>(*pCharStr) < 0x80); // ASCII range
+        *pBuffer = *pCharStr;
+        pBuffer++;
+        pCharStr++;
     }
+    while ( *pCharStr );
+
+    RTL_LOG_STRING_NEW( *ppThis );
 }
 
 void SAL_CALL rtl_uString_newFromCodePoints(
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 3df391c86150..c021e892f91e 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -85,13 +85,13 @@ void FastAttributeList::add( sal_Int32 nToken, const char* pValue, size_t nValue
     if (maAttributeValues.back() > mnChunkLength)
     {
         const sal_Int32 newLen = std::max(mnChunkLength * 2, maAttributeValues.back());
-        if (auto p = static_cast<char*>(realloc(mpChunk, newLen)))
-        {
-            mnChunkLength = newLen;
-            mpChunk = p;
-        }
-        else
+        auto p = static_cast<char*>(realloc(mpChunk, newLen));
+        if (!p)
             throw std::bad_alloc();
+
+        mnChunkLength = newLen;
+        mpChunk = p;
+
     }
     strncpy(mpChunk + nWritePosition, pValue, nValueLength);
     mpChunk[nWritePosition + nValueLength] = '\0';
diff --git a/sdext/source/presenter/PresenterAccessibility.cxx b/sdext/source/presenter/PresenterAccessibility.cxx
index e82a0755b17c..14474f224e61 100644
--- a/sdext/source/presenter/PresenterAccessibility.cxx
+++ b/sdext/source/presenter/PresenterAccessibility.cxx
@@ -594,27 +594,27 @@ void PresenterAccessible::UpdateAccessibilityHierarchy (
         }
     }
 
-    if (mxNotesContentWindow != rxNotesContentWindow)
+    if (mxNotesContentWindow == rxNotesContentWindow)
+        return;
+
+    if (mpAccessibleNotes.is())
     {
-        if (mpAccessibleNotes.is())
-        {
-            mpAccessibleConsole->RemoveChild(mpAccessibleNotes);
-            mpAccessibleNotes = nullptr;
-        }
+        mpAccessibleConsole->RemoveChild(mpAccessibleNotes);
+        mpAccessibleNotes = nullptr;
+    }
 
-        mxNotesContentWindow = rxNotesContentWindow;
-        mxNotesBorderWindow = rxNotesBorderWindow;
+    mxNotesContentWindow = rxNotesContentWindow;
+    mxNotesBorderWindow = rxNotesBorderWindow;
 
-        if (mxNotesContentWindow.is())
-        {
-            mpAccessibleNotes = AccessibleNotes::Create(
-                mxComponentContext,
-                lang::Locale(),
-                mxNotesContentWindow,
-                mxNotesBorderWindow,
-                rpNotesTextView);
-            mpAccessibleConsole->AddChild(mpAccessibleNotes.get());
-        }
+    if (mxNotesContentWindow.is())
+    {
+        mpAccessibleNotes = AccessibleNotes::Create(
+            mxComponentContext,
+            lang::Locale(),
+            mxNotesContentWindow,
+            mxNotesBorderWindow,
+            rpNotesTextView);
+        mpAccessibleConsole->AddChild(mpAccessibleNotes.get());
     }
 }
 
@@ -746,23 +746,23 @@ void PresenterAccessible::AccessibleObject::SetWindow (
 {
     Reference<awt::XWindow2> xContentWindow (rxContentWindow, UNO_QUERY);
 
-    if (mxContentWindow.get() != xContentWindow.get())
-    {
-        if (mxContentWindow.is())
-        {
-            mxContentWindow->removeWindowListener(this);
-        }
+    if (mxContentWindow.get() == xContentWindow.get())
+        return;
 
-        mxContentWindow = xContentWindow;
-        mxBorderWindow.set(rxBorderWindow, UNO_QUERY);
+    if (mxContentWindow.is())
+    {
+        mxContentWindow->removeWindowListener(this);
+    }
 
-        if (mxContentWindow.is())
-        {
-            mxContentWindow->addWindowListener(this);
-        }
+    mxContentWindow = xContentWindow;
+    mxBorderWindow.set(rxBorderWindow, UNO_QUERY);
 
-        UpdateStateSet();
+    if (mxContentWindow.is())
+    {
+        mxContentWindow->addWindowListener(this);
     }
+
+    UpdateStateSet();
 }
 
 void PresenterAccessible::AccessibleObject::SetAccessibleParent (
@@ -987,19 +987,19 @@ sal_Int32 SAL_CALL PresenterAccessible::AccessibleObject::getBackground()
 void SAL_CALL PresenterAccessible::AccessibleObject::addAccessibleEventListener (
     const Reference<XAccessibleEventListener>& rxListener)
 {
-    if (rxListener.is())
-    {
-        const osl::MutexGuard aGuard(m_aMutex);
+    if (!rxListener.is())
+        return;
 
-        if (rBHelper.bDisposed || rBHelper.bInDispose)
-        {
-            uno::Reference<uno::XInterface> xThis (static_cast<XWeak*>(this), UNO_QUERY);
-            rxListener->disposing (lang::EventObject(xThis));
-        }
-        else
-        {
-            maListeners.push_back(rxListener);
-        }
+    const osl::MutexGuard aGuard(m_aMutex);
+
+    if (rBHelper.bDisposed || rBHelper.bInDispose)
+    {
+        uno::Reference<uno::XInterface> xThis (static_cast<XWeak*>(this), UNO_QUERY);
+        rxListener->disposing (lang::EventObject(xThis));
+    }
+    else
+    {
+        maListeners.push_back(rxListener);
     }
 }
 
@@ -1700,44 +1700,44 @@ void AccessibleNotes::SetTextView (
 
     mpTextView = rpTextView;
 
-    if (mpTextView)
-    {
-        // Create a new set of children, one for each paragraph.
-        const sal_Int32 nParagraphCount (mpTextView->GetParagraphCount());
-        for (sal_Int32 nIndex=0; nIndex<nParagraphCount; ++nIndex)
-        {
-            rtl::Reference<PresenterAccessible::AccessibleParagraph> pParagraph (
-                new PresenterAccessible::AccessibleParagraph(
-                    css::lang::Locale(),
-                    "Paragraph"+OUString::number(nIndex),
-                    rpTextView->GetParagraph(nIndex),
-                    nIndex));
-            pParagraph->LateInitialization();
-            pParagraph->SetWindow(mxContentWindow, mxBorderWindow);
-            pParagraph->SetAccessibleParent(this);
-            aChildren.emplace_back(pParagraph.get());
-        }
-        maChildren.swap(aChildren);
-        FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
+    if (!mpTextView)
+        return;
 
-        // Dispose the old children. (This will remove them from the focus
-        // manager).
-        for (const auto& rxChild : aChildren)
-        {
-            Reference<lang::XComponent> xComponent (static_cast<XWeak*>(rxChild.get()), UNO_QUERY);
-            if (xComponent.is())
-                xComponent->dispose();
-        }
+    // Create a new set of children, one for each paragraph.
+    const sal_Int32 nParagraphCount (mpTextView->GetParagraphCount());
+    for (sal_Int32 nIndex=0; nIndex<nParagraphCount; ++nIndex)
+    {
+        rtl::Reference<PresenterAccessible::AccessibleParagraph> pParagraph (
+            new PresenterAccessible::AccessibleParagraph(
+                css::lang::Locale(),
+                "Paragraph"+OUString::number(nIndex),
+                rpTextView->GetParagraph(nIndex),
+                nIndex));
+        pParagraph->LateInitialization();
+        pParagraph->SetWindow(mxContentWindow, mxBorderWindow);
+        pParagraph->SetAccessibleParent(this);
+        aChildren.emplace_back(pParagraph.get());
+    }
+    maChildren.swap(aChildren);
+    FireAccessibleEvent(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
 
-        // This class acts as a controller of who broadcasts caret motion
-        // events and handles text changes.  Register the corresponding
-        // listeners here.
-        mpTextView->GetCaret()->SetCaretMotionBroadcaster(
-            [this](sal_Int32 a, sal_Int32 b, sal_Int32 c, sal_Int32 d)
-                { return this->NotifyCaretChange(a, b, c, d); });
-        mpTextView->SetTextChangeBroadcaster(
-            [this]() { return SetTextView(mpTextView); });
+    // Dispose the old children. (This will remove them from the focus
+    // manager).
+    for (const auto& rxChild : aChildren)
+    {
+        Reference<lang::XComponent> xComponent (static_cast<XWeak*>(rxChild.get()), UNO_QUERY);
+        if (xComponent.is())
+            xComponent->dispose();
     }
+
+    // This class acts as a controller of who broadcasts caret motion
+    // events and handles text changes.  Register the corresponding
+    // listeners here.
+    mpTextView->GetCaret()->SetCaretMotionBroadcaster(
+        [this](sal_Int32 a, sal_Int32 b, sal_Int32 c, sal_Int32 d)
+            { return this->NotifyCaretChange(a, b, c, d); });
+    mpTextView->SetTextChangeBroadcaster(
+        [this]() { return SetTextView(mpTextView); });
 }
 
 void AccessibleNotes::SetWindow (
diff --git a/sdext/source/presenter/PresenterProtocolHandler.cxx b/sdext/source/presenter/PresenterProtocolHandler.cxx
index fcceaee4ce16..ff2cf4f251c5 100644
--- a/sdext/source/presenter/PresenterProtocolHandler.cxx
+++ b/sdext/source/presenter/PresenterProtocolHandler.cxx
@@ -602,18 +602,19 @@ void PauseResumeCommand::Execute()
     if ( ! pWindowManager.is())
         return;
 
-    if (IPresentationTime* pPresentationTime = mpPresenterController->GetPresentationTime())
+    IPresentationTime* pPresentationTime = mpPresenterController->GetPresentationTime();
+    if (!pPresentationTime)
+        return;
+
+    if(pPresentationTime->isPaused())
     {
-        if(pPresentationTime->isPaused())
-        {
-            pPresentationTime->setPauseStatus(false);
-            pWindowManager->SetPauseState(false);
-        }
-        else
-        {
-            pPresentationTime->setPauseStatus(true);
-            pWindowManager->SetPauseState(true);
-        }
+        pPresentationTime->setPauseStatus(false);
+        pWindowManager->SetPauseState(false);
+    }
+    else
+    {
+        pPresentationTime->setPauseStatus(true);
+        pWindowManager->SetPauseState(true);
     }
 }
 
diff --git a/shell/source/backends/kf5be/kf5backend.cxx b/shell/source/backends/kf5be/kf5backend.cxx
index 9948e41a9888..3d2041c334d8 100644
--- a/shell/source/backends/kf5be/kf5backend.cxx
+++ b/shell/source/backends/kf5be/kf5backend.cxx
@@ -190,22 +190,22 @@ void initQApp(std::map<OUString, css::beans::Optional<css::uno::Any>>& rSettings
 Service::Service()
 {
     css::uno::Reference<css::uno::XCurrentContext> context(css::uno::getCurrentContext());
-    if (context.is())
-    {
-        OUString desktop;
-        context->getValueByName("system.desktop-environment") >>= desktop;
+    if (!context.is())
+        return;
+
+    OUString desktop;
+    context->getValueByName("system.desktop-environment") >>= desktop;
 
-        if (desktop == "PLASMA5")
+    if (desktop == "PLASMA5")
+    {
+        if (!qApp) // no qt event loop yet
         {
-            if (!qApp) // no qt event loop yet
-            {
-                // so we start one and read KDE settings
-                initQApp(m_KDESettings);
-            }
-            else // someone else (most likely kde/qt vclplug) has started qt event loop
-                // all that is left to do is to read KDE settings
-                readKDESettings(m_KDESettings);
+            // so we start one and read KDE settings
+            initQApp(m_KDESettings);
         }
+        else // someone else (most likely kde/qt vclplug) has started qt event loop
+            // all that is left to do is to read KDE settings
+            readKDESettings(m_KDESettings);
     }
 }
 
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index 9404692c861d..208d6677f6c7 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -145,18 +145,18 @@ svtools::ColorConfig & SmModule::GetColorConfig()
 
 void SmModule::ConfigurationChanged(utl::ConfigurationBroadcaster* pBrdCst, ConfigurationHints)
 {
-    if (pBrdCst == mpColorConfig.get())
+    if (pBrdCst != mpColorConfig.get())
+        return;
+
+    SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+    while (pViewShell)
     {
-        SfxViewShell* pViewShell = SfxViewShell::GetFirst();
-        while (pViewShell)
-        {
-            // FIXME: What if pViewShell is for a different document,
-            // but OTOH Math is presumably never used through
-            // LibreOfficeKit, so maybe an irrelevant concern?
-            if (dynamic_cast<const SmViewShell *>(pViewShell) != nullptr)
-                pViewShell->GetWindow()->Invalidate();
-            pViewShell = SfxViewShell::GetNext(*pViewShell);
-        }
+        // FIXME: What if pViewShell is for a different document,
+        // but OTOH Math is presumably never used through
+        // LibreOfficeKit, so maybe an irrelevant concern?
+        if (dynamic_cast<const SmViewShell *>(pViewShell) != nullptr)
+            pViewShell->GetWindow()->Invalidate();
+        pViewShell = SfxViewShell::GetNext(*pViewShell);
     }
 }
 
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index fe90321e6398..51fb129cddb1 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -926,23 +926,23 @@ void SAL_CALL PasswordContainer::removePersistent( const OUString& aURL, const O
     auto aNPIter = std::find_if(aIter->second.begin(), aIter->second.end(),
         [&aName](const NamePassRecord& rNPRecord) { return rNPRecord.GetUserName() == aName; });
 
-    if (aNPIter != aIter->second.end())
+    if (aNPIter == aIter->second.end())
+        return;
+
+    if( aNPIter->HasPasswords( PERSISTENT_RECORD ) )
     {
-        if( aNPIter->HasPasswords( PERSISTENT_RECORD ) )
-        {
-            // TODO/LATER: should the password be converted to MemoryPassword?
-            aNPIter->RemovePasswords( PERSISTENT_RECORD );
+        // TODO/LATER: should the password be converted to MemoryPassword?
+        aNPIter->RemovePasswords( PERSISTENT_RECORD );
 
-            if ( m_pStorageFile )
-                m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName )
-        }
+        if ( m_pStorageFile )
+            m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName )
+    }
 
-        if( !aNPIter->HasPasswords( MEMORY_RECORD ) )
-            aIter->second.erase( aNPIter );
+    if( !aNPIter->HasPasswords( MEMORY_RECORD ) )
+        aIter->second.erase( aNPIter );
 
-        if( aIter->second.empty() )
-            m_aContainer.erase( aIter );
-    }
+    if( aIter->second.empty() )
+        m_aContainer.erase( aIter );
 }
 
 void SAL_CALL PasswordContainer::removeAllPersistent()
diff --git a/svtools/source/brwbox/editbrowsebox2.cxx b/svtools/source/brwbox/editbrowsebox2.cxx
index 7c84cf5eb805..a3505877be18 100644
--- a/svtools/source/brwbox/editbrowsebox2.cxx
+++ b/svtools/source/brwbox/editbrowsebox2.cxx
@@ -146,25 +146,25 @@ void EditBrowseBox::DetermineFocus( const GetFocusFlags _nGetFocusFlags )
     long nRows = GetRowCount();
     sal_uInt16 nCols = ColCount();
 
-    if ( ( nRows > 0 ) && ( nCols > 0 ) )
+    if (( nRows <= 0 ) || ( nCols <= 0 ))
+        return;
+
+    if ( _nGetFocusFlags & GetFocusFlags::Forward )
     {
-        if ( _nGetFocusFlags & GetFocusFlags::Forward )
+        if ( GetColumnId( 0 ) != HandleColumnId )
         {
-            if ( GetColumnId( 0 ) != HandleColumnId )
-            {
-                GoToRowColumnId( 0, GetColumnId( 0 ) );
-            }
-            else
-            {   // the first column is the handle column -> not focussable
-                if ( nCols > 1 )
-                    GoToRowColumnId( 0, GetColumnId( 1 ) );
-            }
+            GoToRowColumnId( 0, GetColumnId( 0 ) );
         }
-        else if ( _nGetFocusFlags & GetFocusFlags::Backward )
-        {
-            GoToRowColumnId( nRows - 1, GetColumnId( nCols -1 ) );
+        else
+        {   // the first column is the handle column -> not focussable
+            if ( nCols > 1 )
+                GoToRowColumnId( 0, GetColumnId( 1 ) );
         }
     }
+    else if ( _nGetFocusFlags & GetFocusFlags::Backward )
+    {
+        GoToRowColumnId( nRows - 1, GetColumnId( nCols -1 ) );
+    }
 }
 
 tools::Rectangle EditBrowseBox::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 _nIndex)
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 86621636ea64..74a09e613d26 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -760,54 +760,54 @@ void ValueSet::SelectItem( sal_uInt16 nItemId )
         Invalidate();
     }
 
-    if( ImplHasAccessibleListeners() )
+    if( !ImplHasAccessibleListeners() )
+        return;
+
+    // focus event (deselect)
+    if( nOldItem )
     {
-        // focus event (deselect)
-        if( nOldItem )
+        const size_t nPos = GetItemPos( nItemId );
+
+        if( nPos != VALUESET_ITEM_NOTFOUND )
         {
-            const size_t nPos = GetItemPos( nItemId );
+            ValueItemAcc* pItemAcc = ValueItemAcc::getImplementation(
+                mItemList[nPos]->GetAccessible( false/*bIsTransientChildrenDisabled*/ ) );
 
-            if( nPos != VALUESET_ITEM_NOTFOUND )
+            if( pItemAcc )
             {
-                ValueItemAcc* pItemAcc = ValueItemAcc::getImplementation(
-                    mItemList[nPos]->GetAccessible( false/*bIsTransientChildrenDisabled*/ ) );
-
-                if( pItemAcc )
-                {
-                    Any aOldAny;
-                    Any aNewAny;
-                    aOldAny <<= Reference<XInterface>(static_cast<cppu::OWeakObject*>(pItemAcc));
-                    ImplFireAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny );
-                }
+                Any aOldAny;
+                Any aNewAny;
+                aOldAny <<= Reference<XInterface>(static_cast<cppu::OWeakObject*>(pItemAcc));
+                ImplFireAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny );
             }
         }
+    }
 
-        // focus event (select)
-        const size_t nPos = GetItemPos( mnSelItemId );
+    // focus event (select)
+    const size_t nPos = GetItemPos( mnSelItemId );
 
-        ValueSetItem* pItem;
-        if( nPos != VALUESET_ITEM_NOTFOUND )
-            pItem = mItemList[nPos].get();
-        else
-            pItem = mpNoneItem.get();
+    ValueSetItem* pItem;
+    if( nPos != VALUESET_ITEM_NOTFOUND )
+        pItem = mItemList[nPos].get();
+    else
+        pItem = mpNoneItem.get();
 
-        ValueItemAcc* pItemAcc = nullptr;
-        if (pItem != nullptr)
-            pItemAcc = ValueItemAcc::getImplementation( pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ ) );
+    ValueItemAcc* pItemAcc = nullptr;
+    if (pItem != nullptr)
+        pItemAcc = ValueItemAcc::getImplementation( pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ ) );
 
-        if( pItemAcc )
-        {
-            Any aOldAny;
-            Any aNewAny;
-            aNewAny <<= Reference<XInterface>(static_cast<cppu::OWeakObject*>(pItemAcc));
-            ImplFireAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny);
-        }
-
-        // selection event
+    if( pItemAcc )
+    {
         Any aOldAny;
         Any aNewAny;
-        ImplFireAccessibleEvent(AccessibleEventId::SELECTION_CHANGED, aOldAny, aNewAny);
+        aNewAny <<= Reference<XInterface>(static_cast<cppu::OWeakObject*>(pItemAcc));
+        ImplFireAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny);
     }
+
+    // selection event
+    Any aOldAny;
+    Any aNewAny;
+    ImplFireAccessibleEvent(AccessibleEventId::SELECTION_CHANGED, aOldAny, aNewAny);
 }
 
 void ValueSet::SetNoSelection()
diff --git a/svtools/source/uno/generictoolboxcontroller.cxx b/svtools/source/uno/generictoolboxcontroller.cxx
index 570805632b53..57f7f5553b44 100644
--- a/svtools/source/uno/generictoolboxcontroller.cxx
+++ b/svtools/source/uno/generictoolboxcontroller.cxx
@@ -180,27 +180,27 @@ void GenericToolboxController::statusChanged( const FeatureStateEvent& Event )
         m_xToolbox->SetItemBits( m_nID, nItemBits );
     }
 
-    if (m_pToolbox)
-    {
-        OString sId = m_aCommandURL.toUtf8();
+    if (!m_pToolbox)
+        return;
 
-        m_pToolbox->set_item_sensitive(sId, Event.IsEnabled);
+    OString sId = m_aCommandURL.toUtf8();
 
-        bool        bValue;
-        OUString    aStrValue;
+    m_pToolbox->set_item_sensitive(sId, Event.IsEnabled);
 
-        if ( Event.State >>= bValue )
-        {
-            // Boolean, treat it as checked/unchecked
-            m_pToolbox->set_item_active(sId, bValue);
-        }
-        else if ( Event.State >>= aStrValue )
-        {
-            m_pToolbox->set_item_label(sId, aStrValue);
-        }
-        else
-            m_pToolbox->set_item_active(sId, false);
+    bool        bValue;
+    OUString    aStrValue;
+
+    if ( Event.State >>= bValue )
+    {
+        // Boolean, treat it as checked/unchecked
+        m_pToolbox->set_item_active(sId, bValue);
+    }
+    else if ( Event.State >>= aStrValue )
+    {
+        m_pToolbox->set_item_label(sId, aStrValue);
     }
+    else
+        m_pToolbox->set_item_active(sId, false);
 }
 
 IMPL_STATIC_LINK( GenericToolboxController, ExecuteHdl_Impl, void*, p, void )
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 9d93cf61733f..04035710861a 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -689,31 +689,31 @@ void SwFrame::InvalidatePage( const SwPageFrame *pPage ) const
     }
     pRoot->SetIdleFlags();
 
-    if (IsTextFrame())
+    if (!IsTextFrame())
+        return;
+
+    SwTextFrame const*const pText(static_cast<SwTextFrame const*>(this));
+    if (sw::MergedPara const*const pMergedPara = pText->GetMergedPara())
     {
-        SwTextFrame const*const pText(static_cast<SwTextFrame const*>(this));
-        if (sw::MergedPara const*const pMergedPara = pText->GetMergedPara())
+        SwTextNode const* pNode(nullptr);
+        for (auto const& e : pMergedPara->extents)
         {
-            SwTextNode const* pNode(nullptr);
-            for (auto const& e : pMergedPara->extents)
+            if (e.pNode != pNode)
             {
-                if (e.pNode != pNode)
+                pNode = e.pNode;
+                if (pNode->IsGrammarCheckDirty())
                 {
-                    pNode = e.pNode;
-                    if (pNode->IsGrammarCheckDirty())
-                    {
-                        pRoot->SetNeedGrammarCheck( true );
-                        break;
-                    }
+                    pRoot->SetNeedGrammarCheck( true );
+                    break;
                 }
             }
         }
-        else
+    }
+    else
+    {
+        if (pText->GetTextNodeFirst()->IsGrammarCheckDirty())
         {
-            if (pText->GetTextNodeFirst()->IsGrammarCheckDirty())
-            {
-                pRoot->SetNeedGrammarCheck( true );
-            }
+            pRoot->SetNeedGrammarCheck( true );
         }
     }
 }
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 2899138301d2..94b400346895 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1160,121 +1160,121 @@ static bool lcl_IsOwnDocument( SwView& rView )
 
 void SwView::ReadUserData( const OUString &rUserData, bool bBrowse )
 {
-    if ( rUserData.indexOf(';')>=0 && // more than one token
+    if ( !(rUserData.indexOf(';')>=0 && // more than one token
         // For document without layout only in the onlinelayout or
         // while forward/backward
-         (!m_pWrtShell->IsNewLayout() || m_pWrtShell->GetViewOptions()->getBrowseMode() || bBrowse) )
-    {
-        bool bIsOwnDocument = lcl_IsOwnDocument( *this );
+         (!m_pWrtShell->IsNewLayout() || m_pWrtShell->GetViewOptions()->getBrowseMode() || bBrowse)) )
+        return;
 
-        CurrShell aCurr(m_pWrtShell.get());
+    bool bIsOwnDocument = lcl_IsOwnDocument( *this );
 
-        sal_Int32 nPos = 0;
+    CurrShell aCurr(m_pWrtShell.get());
 
-        // No it is *not* a good idea to call GetToken within Point constr. immediately,
-        // because which parameter is evaluated first?
-        long nX = rUserData.getToken( 0, ';', nPos ).toInt32(),
-             nY = rUserData.getToken( 0, ';', nPos ).toInt32();
-        Point aCursorPos( nX, nY );
+    sal_Int32 nPos = 0;
 
-        sal_uInt16 nZoomFactor =
-            static_cast< sal_uInt16 >( rUserData.getToken(0, ';', nPos ).toInt32() );
+    // No it is *not* a good idea to call GetToken within Point constr. immediately,
+    // because which parameter is evaluated first?
+    long nX = rUserData.getToken( 0, ';', nPos ).toInt32(),
+         nY = rUserData.getToken( 0, ';', nPos ).toInt32();
+    Point aCursorPos( nX, nY );
 
-        long nLeft  = rUserData.getToken(0, ';', nPos ).toInt32(),
-             nTop   = rUserData.getToken(0, ';', nPos ).toInt32(),
-             nRight = rUserData.getToken(0, ';', nPos ).toInt32(),
-             nBottom= rUserData.getToken(0, ';', nPos ).toInt32();
+    sal_uInt16 nZoomFactor =
+        static_cast< sal_uInt16 >( rUserData.getToken(0, ';', nPos ).toInt32() );
 
-        const long nAdd = m_pWrtShell->GetViewOptions()->getBrowseMode() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
-        if ( nBottom <= (m_pWrtShell->GetDocSize().Height()+nAdd) )
-        {
-            m_pWrtShell->EnableSmooth( false );
+    long nLeft  = rUserData.getToken(0, ';', nPos ).toInt32(),
+         nTop   = rUserData.getToken(0, ';', nPos ).toInt32(),
+         nRight = rUserData.getToken(0, ';', nPos ).toInt32(),
+         nBottom= rUserData.getToken(0, ';', nPos ).toInt32();
 
-            const tools::Rectangle aVis( nLeft, nTop, nRight, nBottom );
+    const long nAdd = m_pWrtShell->GetViewOptions()->getBrowseMode() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
+    if ( nBottom > (m_pWrtShell->GetDocSize().Height()+nAdd) )
+        return;
 
-            sal_Int32 nOff = 0;
-            SvxZoomType eZoom;
-            if( !m_pWrtShell->GetViewOptions()->getBrowseMode() )
-                eZoom = static_cast<SvxZoomType>(static_cast<sal_uInt16>(rUserData.getToken(nOff, ';', nPos ).toInt32()));
-            else
-            {
-                eZoom = SvxZoomType::PERCENT;
-                ++nOff;
-            }
+    m_pWrtShell->EnableSmooth( false );
+
+    const tools::Rectangle aVis( nLeft, nTop, nRight, nBottom );
 
-            bool bSelectObj = (0 != rUserData.getToken( nOff, ';', nPos ).toInt32())
-                                && m_pWrtShell->IsObjSelectable( aCursorPos );
+    sal_Int32 nOff = 0;
+    SvxZoomType eZoom;
+    if( !m_pWrtShell->GetViewOptions()->getBrowseMode() )
+        eZoom = static_cast<SvxZoomType>(static_cast<sal_uInt16>(rUserData.getToken(nOff, ';', nPos ).toInt32()));
+    else
+    {
+        eZoom = SvxZoomType::PERCENT;
+        ++nOff;
+    }
 
-            // restore editing position
-            m_pViewImpl->SetRestorePosition(aCursorPos, bSelectObj);
-            // set flag value to avoid macro execution.
-            bool bSavedFlagValue = m_pWrtShell->IsMacroExecAllowed();
-            m_pWrtShell->SetMacroExecAllowed( false );
+    bool bSelectObj = (0 != rUserData.getToken( nOff, ';', nPos ).toInt32())
+                        && m_pWrtShell->IsObjSelectable( aCursorPos );
+
+    // restore editing position
+    m_pViewImpl->SetRestorePosition(aCursorPos, bSelectObj);
+    // set flag value to avoid macro execution.
+    bool bSavedFlagValue = m_pWrtShell->IsMacroExecAllowed();
+    m_pWrtShell->SetMacroExecAllowed( false );
 // os: changed: The user data has to be read if the view is switched back from page preview
 // go to the last editing position when opening own files
-            if(m_bOldShellWasPagePreview || bIsOwnDocument)
-            {
-                m_pWrtShell->SwCursorShell::SetCursor( aCursorPos, !bSelectObj );
-                if( bSelectObj )
-                {
-                    m_pWrtShell->SelectObj( aCursorPos );
-                    m_pWrtShell->EnterSelFrameMode( &aCursorPos );
-                }
-            }
+    if(m_bOldShellWasPagePreview || bIsOwnDocument)
+    {
+        m_pWrtShell->SwCursorShell::SetCursor( aCursorPos, !bSelectObj );
+        if( bSelectObj )
+        {
+            m_pWrtShell->SelectObj( aCursorPos );
+            m_pWrtShell->EnterSelFrameMode( &aCursorPos );
+        }
+    }
 
-            // reset flag value
-            m_pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
+    // reset flag value
+    m_pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
 
-            // set visible area before applying
-            // information from print preview. Otherwise, the applied information
-            // is lost.
+    // set visible area before applying
+    // information from print preview. Otherwise, the applied information
+    // is lost.
 // os: changed: The user data has to be read if the view is switched back from page preview
 // go to the last editing position when opening own files
-            if(m_bOldShellWasPagePreview || bIsOwnDocument )
-            {
-                if ( bBrowse )
-                    SetVisArea( aVis.TopLeft() );
-                else
-                    SetVisArea( aVis );
-            }
+    if(m_bOldShellWasPagePreview || bIsOwnDocument )
+    {
+        if ( bBrowse )
+            SetVisArea( aVis.TopLeft() );
+        else
+            SetVisArea( aVis );
+    }
 
-            //apply information from print preview - if available
-            if( !m_sNewCursorPos.isEmpty() )
-            {
-                sal_Int32 nIdx{ 0 };
-                const long nXTmp = m_sNewCursorPos.getToken( 0, ';', nIdx ).toInt32();
-                const long nYTmp = m_sNewCursorPos.getToken( 0, ';', nIdx ).toInt32();
-                Point aCursorPos2( nXTmp, nYTmp );
-                bSelectObj = m_pWrtShell->IsObjSelectable( aCursorPos2 );
-
-                m_pWrtShell->SwCursorShell::SetCursor( aCursorPos2 );
-                if( bSelectObj )
-                {
-                    m_pWrtShell->SelectObj( aCursorPos2 );
-                    m_pWrtShell->EnterSelFrameMode( &aCursorPos2 );
-                }
-                m_pWrtShell->MakeSelVisible();
-                m_sNewCursorPos.clear();
-            }
-            else if(USHRT_MAX != m_nNewPage)
-            {
-                m_pWrtShell->GotoPage(m_nNewPage, true);
-                m_nNewPage = USHRT_MAX;
-            }
+    //apply information from print preview - if available
+    if( !m_sNewCursorPos.isEmpty() )
+    {
+        sal_Int32 nIdx{ 0 };
+        const long nXTmp = m_sNewCursorPos.getToken( 0, ';', nIdx ).toInt32();
+        const long nYTmp = m_sNewCursorPos.getToken( 0, ';', nIdx ).toInt32();
+        Point aCursorPos2( nXTmp, nYTmp );
+        bSelectObj = m_pWrtShell->IsObjSelectable( aCursorPos2 );
+
+        m_pWrtShell->SwCursorShell::SetCursor( aCursorPos2 );
+        if( bSelectObj )
+        {
+            m_pWrtShell->SelectObj( aCursorPos2 );
+            m_pWrtShell->EnterSelFrameMode( &aCursorPos2 );
+        }
+        m_pWrtShell->MakeSelVisible();
+        m_sNewCursorPos.clear();
+    }
+    else if(USHRT_MAX != m_nNewPage)
+    {
+        m_pWrtShell->GotoPage(m_nNewPage, true);
+        m_nNewPage = USHRT_MAX;
+    }
 
-            SelectShell();
+    SelectShell();
 
-            m_pWrtShell->StartAction();
-            const SwViewOption* pVOpt = m_pWrtShell->GetViewOptions();
-            if( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom )
-                SetZoom( eZoom, nZoomFactor);
+    m_pWrtShell->StartAction();
+    const SwViewOption* pVOpt = m_pWrtShell->GetViewOptions();
+    if( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom )
+        SetZoom( eZoom, nZoomFactor);
 
-            m_pWrtShell->LockView( true );
-            m_pWrtShell->EndAction();
-            m_pWrtShell->LockView( false );
-            m_pWrtShell->EnableSmooth( true );
-        }
-    }
+    m_pWrtShell->LockView( true );
+    m_pWrtShell->EndAction();
+    m_pWrtShell->LockView( false );
+    m_pWrtShell->EnableSmooth( true );
 }
 
 void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >& rSequence )
@@ -1381,129 +1381,129 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >
         // delegate further
         GetViewImpl()->GetUNOObject_Impl()->getViewSettings()->setPropertyValue("ShowOnlineLayout", uno::Any(bBrowseMode));
     }
-    if (bGotVisibleBottom)
-    {
-        Point aCursorPos( nX, nY );
-        const long nAdd = m_pWrtShell->GetViewOptions()->getBrowseMode() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
-        if (nBottom <= (m_pWrtShell->GetDocSize().Height()+nAdd) )
-        {
-            m_pWrtShell->EnableSmooth( false );
-            const tools::Rectangle aVis( nLeft, nTop, nRight, nBottom );
+    if (!bGotVisibleBottom)
+        return;
 
-            SvxZoomType eZoom;
-            if ( !m_pWrtShell->GetViewOptions()->getBrowseMode() )
-                eZoom = static_cast < SvxZoomType > ( nZoomType );
-            else
-            {
-                eZoom = SvxZoomType::PERCENT;
-            }
-            if (bGotIsSelectedFrame)
-            {
-                bool bSelectObj = bSelectedFrame && m_pWrtShell->IsObjSelectable( aCursorPos );
+    Point aCursorPos( nX, nY );
+    const long nAdd = m_pWrtShell->GetViewOptions()->getBrowseMode() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
+    if (nBottom > (m_pWrtShell->GetDocSize().Height()+nAdd) )
+        return;
 
-                // set flag value to avoid macro execution.
-                bool bSavedFlagValue = m_pWrtShell->IsMacroExecAllowed();
-                m_pWrtShell->SetMacroExecAllowed( false );
-// os: changed: The user data has to be read if the view is switched back from page preview
-// go to the last editing position when opening own files
-                m_pViewImpl->SetRestorePosition(aCursorPos, bSelectObj);
-                if(m_bOldShellWasPagePreview|| bIsOwnDocument)
-                {
-                    m_pWrtShell->SwCursorShell::SetCursor( aCursorPos, !bSelectObj );
+    m_pWrtShell->EnableSmooth( false );
+    const tools::Rectangle aVis( nLeft, nTop, nRight, nBottom );
 
-                    // Update the shell to toggle Header/Footer edit if needed
-                    bool bInHeader = true;
-                    if ( m_pWrtShell->IsInHeaderFooter( &bInHeader ) )
-                    {
-                        if ( !bInHeader )
-                        {
-                            m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Footer, true );
-                            m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Header, false );
-                        }
-                        else
-                        {
-                            m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Header, true );
-                            m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Footer, false );
-                        }
+    SvxZoomType eZoom;
+    if ( !m_pWrtShell->GetViewOptions()->getBrowseMode() )
+        eZoom = static_cast < SvxZoomType > ( nZoomType );
+    else
+    {
+        eZoom = SvxZoomType::PERCENT;
+    }
+    if (bGotIsSelectedFrame)
+    {
+        bool bSelectObj = bSelectedFrame && m_pWrtShell->IsObjSelectable( aCursorPos );
 
-                        // Force repaint
-                        m_pWrtShell->GetWin()->Invalidate();
-                    }
-                    if ( m_pWrtShell->IsInHeaderFooter() != m_pWrtShell->IsHeaderFooterEdit() )
-                        m_pWrtShell->ToggleHeaderFooterEdit();
+        // set flag value to avoid macro execution.
+        bool bSavedFlagValue = m_pWrtShell->IsMacroExecAllowed();
+        m_pWrtShell->SetMacroExecAllowed( false );
+// os: changed: The user data has to be read if the view is switched back from page preview
+// go to the last editing position when opening own files
+        m_pViewImpl->SetRestorePosition(aCursorPos, bSelectObj);
+        if(m_bOldShellWasPagePreview|| bIsOwnDocument)
+        {
+            m_pWrtShell->SwCursorShell::SetCursor( aCursorPos, !bSelectObj );
 
-                    if( bSelectObj )
-                    {
-                        m_pWrtShell->SelectObj( aCursorPos );
-                        m_pWrtShell->EnterSelFrameMode( &aCursorPos );
-                    }
+            // Update the shell to toggle Header/Footer edit if needed
+            bool bInHeader = true;
+            if ( m_pWrtShell->IsInHeaderFooter( &bInHeader ) )
+            {
+                if ( !bInHeader )
+                {
+                    m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Footer, true );
+                    m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Header, false );
+                }
+                else
+                {
+                    m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Header, true );
+                    m_pWrtShell->SetShowHeaderFooterSeparator( FrameControlType::Footer, false );
                 }
 
-                // reset flag value
-                m_pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
+                // Force repaint
+                m_pWrtShell->GetWin()->Invalidate();
             }
-            SelectShell();
+            if ( m_pWrtShell->IsInHeaderFooter() != m_pWrtShell->IsHeaderFooterEdit() )
+                m_pWrtShell->ToggleHeaderFooterEdit();
+
+            if( bSelectObj )
+            {
+                m_pWrtShell->SelectObj( aCursorPos );
+                m_pWrtShell->EnterSelFrameMode( &aCursorPos );
+            }
+        }
+
+        // reset flag value
+        m_pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
+    }
+    SelectShell();
 
-            // Set ViewLayoutSettings
-            const bool bSetViewLayoutSettings = bGotViewLayoutColumns && bGotViewLayoutBookMode &&
-                                                ( pVOpt->GetViewLayoutColumns() != nViewLayoutColumns || pVOpt->IsViewLayoutBookMode() != bViewLayoutBookMode );
+    // Set ViewLayoutSettings
+    const bool bSetViewLayoutSettings = bGotViewLayoutColumns && bGotViewLayoutBookMode &&
+                                        ( pVOpt->GetViewLayoutColumns() != nViewLayoutColumns || pVOpt->IsViewLayoutBookMode() != bViewLayoutBookMode );
 
-            const bool bSetViewSettings = bGotZoomType && bGotZoomFactor &&
-                                          ( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom );
+    const bool bSetViewSettings = bGotZoomType && bGotZoomFactor &&
+                                  ( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom );
 
-            // In case we have a 'fixed' view layout of 2 or more columns,
-            // we have to apply the view options *before* starting the action.
-            // Otherwise the SetZoom function cannot work correctly, because
-            // the view layout hasn't been calculated.
-            const bool bZoomNeedsViewLayout = bSetViewLayoutSettings &&
-                                              1 < nViewLayoutColumns &&
-                                              bSetViewSettings &&
-                                              eZoom != SvxZoomType::PERCENT;
+    // In case we have a 'fixed' view layout of 2 or more columns,
+    // we have to apply the view options *before* starting the action.
+    // Otherwise the SetZoom function cannot work correctly, because
+    // the view layout hasn't been calculated.
+    const bool bZoomNeedsViewLayout = bSetViewLayoutSettings &&
+                                      1 < nViewLayoutColumns &&
+                                      bSetViewSettings &&
+                                      eZoom != SvxZoomType::PERCENT;
 
-            if ( !bZoomNeedsViewLayout )
-                m_pWrtShell->StartAction();
+    if ( !bZoomNeedsViewLayout )
+        m_pWrtShell->StartAction();
 
-            if ( bSetViewLayoutSettings )
-                SetViewLayout( nViewLayoutColumns, bViewLayoutBookMode, true );
+    if ( bSetViewLayoutSettings )
+        SetViewLayout( nViewLayoutColumns, bViewLayoutBookMode, true );
 
-            if ( bZoomNeedsViewLayout )
-                m_pWrtShell->StartAction();
+    if ( bZoomNeedsViewLayout )
+        m_pWrtShell->StartAction();
 
-            if ( bSetViewSettings )
-                SetZoom( eZoom, nZoomFactor, true );
+    if ( bSetViewSettings )
+        SetZoom( eZoom, nZoomFactor, true );
 
 // os: changed: The user data has to be read if the view is switched back from page preview
 // go to the last editing position when opening own files
-            if(m_bOldShellWasPagePreview||bIsOwnDocument)
+    if(m_bOldShellWasPagePreview||bIsOwnDocument)
+    {
+        if ( bGotVisibleLeft && bGotVisibleTop )
+        {
+            Point aTopLeft(aVis.TopLeft());
+            // make sure the document is still centered
+            const SwTwips lBorder = IsDocumentBorder() ? DOCUMENTBORDER : 2 * DOCUMENTBORDER;
+            SwTwips nEditWidth = GetEditWin().GetOutputSize().Width();
+            if(nEditWidth > (m_aDocSz.Width() + lBorder ))
+                aTopLeft.setX( ( m_aDocSz.Width() + lBorder - nEditWidth  ) / 2 );
+            else
             {
-                if ( bGotVisibleLeft && bGotVisibleTop )
-                {
-                    Point aTopLeft(aVis.TopLeft());
-                    // make sure the document is still centered
-                    const SwTwips lBorder = IsDocumentBorder() ? DOCUMENTBORDER : 2 * DOCUMENTBORDER;
-                    SwTwips nEditWidth = GetEditWin().GetOutputSize().Width();
-                    if(nEditWidth > (m_aDocSz.Width() + lBorder ))
-                        aTopLeft.setX( ( m_aDocSz.Width() + lBorder - nEditWidth  ) / 2 );
-                    else
-                    {
-                        //check if the values are possible
-                        long nXMax = m_pHScrollbar->GetRangeMax() - m_pHScrollbar->GetVisibleSize();
-                        if( aTopLeft.X() > nXMax )
-                            aTopLeft.setX( nXMax < 0 ? 0 : nXMax );
-                    }
-                    SetVisArea( aTopLeft );
-                }
-                else if (bGotVisibleLeft && bGotVisibleTop && bGotVisibleRight && bGotVisibleBottom )
-                    SetVisArea( aVis );
+                //check if the values are possible
+                long nXMax = m_pHScrollbar->GetRangeMax() - m_pHScrollbar->GetVisibleSize();
+                if( aTopLeft.X() > nXMax )
+                    aTopLeft.setX( nXMax < 0 ? 0 : nXMax );
             }
-
-            m_pWrtShell->LockView( true );
-            m_pWrtShell->EndAction();
-            m_pWrtShell->LockView( false );
-            m_pWrtShell->EnableSmooth( true );
+            SetVisArea( aTopLeft );
         }
+        else if (bGotVisibleLeft && bGotVisibleTop && bGotVisibleRight && bGotVisibleBottom )
+            SetVisArea( aVis );
     }
 
+    m_pWrtShell->LockView( true );
+    m_pWrtShell->EndAction();
+    m_pWrtShell->LockView( false );
+    m_pWrtShell->EnableSmooth( true );
+
 }
 
 void SwView::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue >& rSequence )
diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx
index ea26f80c47a6..9d02a67b896b 100644
--- a/test/source/screenshot_test.cxx
+++ b/test/source/screenshot_test.cxx
@@ -197,27 +197,27 @@ void ScreenshotTest::dumpDialogToPath(weld::Builder& rBuilder)
 
 void ScreenshotTest::dumpDialogToPath(const OString& rUIXMLDescription)
 {
-    if (!rUIXMLDescription.isEmpty())
-    {
-        bool bNonConforming = rUIXMLDescription == "modules/swriter/ui/sidebarstylepresets.ui" ||
-                              rUIXMLDescription == "modules/swriter/ui/sidebartheme.ui" ||
-                              rUIXMLDescription == "modules/swriter/ui/notebookbar.ui" ||
-                              rUIXMLDescription == "modules/scalc/ui/sidebaralignment.ui" ||
-                              rUIXMLDescription == "modules/scalc/ui/sidebarcellappearance.ui" ||
-                              rUIXMLDescription == "modules/scalc/ui/sidebarnumberformat.ui" ||
-                              rUIXMLDescription == "sfx/ui/helpbookmarkpage.ui" ||
-                              rUIXMLDescription == "sfx/ui/helpcontentpage.ui" ||
-                              rUIXMLDescription == "sfx/ui/helpindexpage.ui" ||
-                              rUIXMLDescription == "sfx/ui/helpsearchpage.ui" ||
-                              rUIXMLDescription == "sfx/ui/startcenter.ui" ||
-                              rUIXMLDescription == "svx/ui/datanavigator.ui" ||
-                              rUIXMLDescription == "svx/ui/xformspage.ui" ||
-                              rUIXMLDescription == "modules/dbreport/ui/conditionwin.ui";
-        if (bNonConforming) // skip these broken ones
-            return;
-        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(mxParentWidget.get(), OStringToOUString(rUIXMLDescription, RTL_TEXTENCODING_UTF8)));
-        dumpDialogToPath(*xBuilder);
-    }
+    if (rUIXMLDescription.isEmpty())
+        return;
+
+    bool bNonConforming = rUIXMLDescription == "modules/swriter/ui/sidebarstylepresets.ui" ||
+                          rUIXMLDescription == "modules/swriter/ui/sidebartheme.ui" ||
+                          rUIXMLDescription == "modules/swriter/ui/notebookbar.ui" ||
+                          rUIXMLDescription == "modules/scalc/ui/sidebaralignment.ui" ||
+                          rUIXMLDescription == "modules/scalc/ui/sidebarcellappearance.ui" ||
+                          rUIXMLDescription == "modules/scalc/ui/sidebarnumberformat.ui" ||
+                          rUIXMLDescription == "sfx/ui/helpbookmarkpage.ui" ||
+                          rUIXMLDescription == "sfx/ui/helpcontentpage.ui" ||
+                          rUIXMLDescription == "sfx/ui/helpindexpage.ui" ||
+                          rUIXMLDescription == "sfx/ui/helpsearchpage.ui" ||
+                          rUIXMLDescription == "sfx/ui/startcenter.ui" ||
+                          rUIXMLDescription == "svx/ui/datanavigator.ui" ||
+                          rUIXMLDescription == "svx/ui/xformspage.ui" ||
+                          rUIXMLDescription == "modules/dbreport/ui/conditionwin.ui";
+    if (bNonConforming) // skip these broken ones
+        return;
+    std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(mxParentWidget.get(), OStringToOUString(rUIXMLDescription, RTL_TEXTENCODING_UTF8)));
+    dumpDialogToPath(*xBuilder);
 }
 
 void ScreenshotTest::processAllKnownDialogs()
diff --git a/test/source/sheet/xnamedranges.cxx b/test/source/sheet/xnamedranges.cxx
index c4d272cdcc39..25726ca9e739 100644
--- a/test/source/sheet/xnamedranges.cxx
+++ b/test/source/sheet/xnamedranges.cxx
@@ -146,20 +146,18 @@ void XNamedRanges::testRemoveByName()
     bool bHasIt = xNamedRanges->hasByName(maNameToRemove);
     CPPUNIT_ASSERT_MESSAGE("NamedRange initial1 does not exist, can't remove it", bHasIt);
 
-    if (bHasIt)
-    {
-        // remove existing
-        sal_Int32 nInitialCount = xIndex->getCount();
-        xNamedRanges->removeByName(maNameToRemove);
-        sal_Int32 nNewCount = xIndex->getCount();
-        CPPUNIT_ASSERT_EQUAL_MESSAGE("NamedRange initial1 not removed", nNewCount,
-                                     nInitialCount - 1);
-        CPPUNIT_ASSERT_MESSAGE("Wrong NamedRange removed, initial1 still present",
-                               !xNamedRanges->hasByName(maNameToRemove));
-        // try to remove non existing
-        xNamedRanges->removeByName(
-            "dummyNonExistingNamedRange"); // an exception should be raised here
-    }
+    if (!bHasIt)
+        return;
+
+    // remove existing
+    sal_Int32 nInitialCount = xIndex->getCount();
+    xNamedRanges->removeByName(maNameToRemove);
+    sal_Int32 nNewCount = xIndex->getCount();
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("NamedRange initial1 not removed", nNewCount, nInitialCount - 1);
+    CPPUNIT_ASSERT_MESSAGE("Wrong NamedRange removed, initial1 still present",
+                           !xNamedRanges->hasByName(maNameToRemove));
+    // try to remove non existing
+    xNamedRanges->removeByName("dummyNonExistingNamedRange"); // an exception should be raised here
 }
 
 void XNamedRanges::testOutputList()
diff --git a/unotest/source/cpp/officeconnection.cxx b/unotest/source/cpp/officeconnection.cxx
index 7a15161031e5..fbd63f385abe 100644
--- a/unotest/source/cpp/officeconnection.cxx
+++ b/unotest/source/cpp/officeconnection.cxx
@@ -110,27 +110,28 @@ void OfficeConnection::setUp() {
 }
 
 void OfficeConnection::tearDown() {
-    if (process_ != nullptr) {
-        if (context_.is()) {
-            css::uno::Reference< css::frame::XDesktop2 > desktop = css::frame::Desktop::create( context_ );
-            context_.clear();
-            try {
-                CPPUNIT_ASSERT(desktop->terminate());
-                desktop.clear();
-            } catch (css::lang::DisposedException &) {}
-                // it appears that DisposedExceptions can already happen while
-                // receiving the response of the terminate call
-        }
-        CPPUNIT_ASSERT_EQUAL(osl_Process_E_None, osl_joinProcess(process_));
-        oslProcessInfo info;
-        info.Size = sizeof info;
-        CPPUNIT_ASSERT_EQUAL(
-            osl_Process_E_None,
-            osl_getProcessInfo(process_, osl_Process_EXITCODE, &info));
-        CPPUNIT_ASSERT_EQUAL(oslProcessExitCode(0), info.Code);
-        osl_freeProcessHandle(process_);
-        process_ = nullptr; // guard against subsequent calls to isStillAlive
+    if (process_ == nullptr)
+        return;
+
+    if (context_.is()) {
+        css::uno::Reference< css::frame::XDesktop2 > desktop = css::frame::Desktop::create( context_ );
+        context_.clear();
+        try {
+            CPPUNIT_ASSERT(desktop->terminate());
+            desktop.clear();
+        } catch (css::lang::DisposedException &) {}
+            // it appears that DisposedExceptions can already happen while
+            // receiving the response of the terminate call
     }
+    CPPUNIT_ASSERT_EQUAL(osl_Process_E_None, osl_joinProcess(process_));
+    oslProcessInfo info;
+    info.Size = sizeof info;
+    CPPUNIT_ASSERT_EQUAL(
+        osl_Process_E_None,
+        osl_getProcessInfo(process_, osl_Process_EXITCODE, &info));
+    CPPUNIT_ASSERT_EQUAL(oslProcessExitCode(0), info.Code);
+    osl_freeProcessHandle(process_);
+    process_ = nullptr; // guard against subsequent calls to isStillAlive
 }
 
 
diff --git a/uui/source/secmacrowarnings.cxx b/uui/source/secmacrowarnings.cxx
index 2f987b241fe9..1f048f0cb663 100644
--- a/uui/source/secmacrowarnings.cxx
+++ b/uui/source/secmacrowarnings.cxx
@@ -158,21 +158,21 @@ void MacroWarning::SetStorage( const css::uno::Reference < css::embed::XStorage
     mxStore = rxStore;
     maODFVersion = aODFVersion;
     sal_Int32   nCnt = rInfos.getLength();
-    if( mxStore.is() && nCnt > 0 )
-    {
-        mpInfos = &rInfos;
-        OUString aCN_Id("CN");
-        OUStringBuffer s = GetContentPart( rInfos[ 0 ].Signer->getSubjectName(), aCN_Id );
+    if( !(mxStore.is() && nCnt > 0) )
+        return;
 
-        for( sal_Int32 i = 1 ; i < nCnt ; ++i )
-        {
-            s.append("\n");
-            s.append(GetContentPart( rInfos[ i ].Signer->getSubjectName(), aCN_Id ));
-        }
+    mpInfos = &rInfos;
+    OUString aCN_Id("CN");
+    OUStringBuffer s = GetContentPart( rInfos[ 0 ].Signer->getSubjectName(), aCN_Id );
 
-        mxSignsFI->set_label(s.makeStringAndClear());
-        mxViewSignsBtn->set_sensitive(true);
+    for( sal_Int32 i = 1 ; i < nCnt ; ++i )
+    {
+        s.append("\n");
+        s.append(GetContentPart( rInfos[ i ].Signer->getSubjectName(), aCN_Id ));
     }
+
+    mxSignsFI->set_label(s.makeStringAndClear());
+    mxViewSignsBtn->set_sensitive(true);
 }
 
 void MacroWarning::SetCertificate( const css::uno::Reference< css::security::XCertificate >& _rxCert )
diff --git a/writerperfect/source/writer/exp/XMLBase64ImportContext.cxx b/writerperfect/source/writer/exp/XMLBase64ImportContext.cxx
index f281e39a4556..a7780e2d57db 100644
--- a/writerperfect/source/writer/exp/XMLBase64ImportContext.cxx
+++ b/writerperfect/source/writer/exp/XMLBase64ImportContext.cxx
@@ -36,23 +36,23 @@ void XMLBase64ImportContext::characters(const OUString& rChars)
 {
     OUString aTrimmedChars(rChars.trim());
 
-    if (!aTrimmedChars.isEmpty())
-    {
-        OUString aChars;
-        if (!m_aBase64CharsLeft.isEmpty())
-        {
-            aChars = m_aBase64CharsLeft + aTrimmedChars;
-            m_aBase64CharsLeft.clear();
-        }
-        else
-            aChars = aTrimmedChars;
+    if (aTrimmedChars.isEmpty())
+        return;
 
-        uno::Sequence<sal_Int8> aBuffer((aChars.getLength() / 4) * 3);
-        const sal_Int32 nCharsDecoded = comphelper::Base64::decodeSomeChars(aBuffer, aChars);
-        m_aStream.WriteBytes(aBuffer.getArray(), aBuffer.getLength());
-        if (nCharsDecoded != aChars.getLength())
-            m_aBase64CharsLeft = aChars.copy(nCharsDecoded);
+    OUString aChars;
+    if (!m_aBase64CharsLeft.isEmpty())
+    {
+        aChars = m_aBase64CharsLeft + aTrimmedChars;
+        m_aBase64CharsLeft.clear();
     }
+    else
+        aChars = aTrimmedChars;
+
+    uno::Sequence<sal_Int8> aBuffer((aChars.getLength() / 4) * 3);
+    const sal_Int32 nCharsDecoded = comphelper::Base64::decodeSomeChars(aBuffer, aChars);
+    m_aStream.WriteBytes(aBuffer.getArray(), aBuffer.getLength());
+    if (nCharsDecoded != aChars.getLength())
+        m_aBase64CharsLeft = aChars.copy(nCharsDecoded);
 }
 
 const librevenge::RVNGBinaryData& XMLBase64ImportContext::getBinaryData() const
diff --git a/xmlhelp/source/cxxhelp/provider/db.cxx b/xmlhelp/source/cxxhelp/provider/db.cxx
index f8a38ecd8199..1e376e83e32d 100644
--- a/xmlhelp/source/cxxhelp/provider/db.cxx
+++ b/xmlhelp/source/cxxhelp/provider/db.cxx
@@ -77,47 +77,47 @@ void Hdf::createHashMap( bool bOptimizeForPerformance )
     }
 
     Reference< XInputStream > xIn = m_xSFA->openFileRead( m_aFileURL );
-    if( xIn.is() )
-    {
-        Sequence< sal_Int8 > aData;
-        sal_Int32 nSize = m_xSFA->getSize( m_aFileURL );
-        sal_Int32 nRead = xIn->readBytes( aData, nSize );
+    if( !xIn.is() )
+        return;
 
-        const char* pData = reinterpret_cast<const char*>(aData.getConstArray());
-        int iPos = 0;
-        while( iPos < nRead )
-        {
-            HDFData aDBKey;
-            if( !implReadLenAndData( pData, iPos, aDBKey ) )
-                break;
+    Sequence< sal_Int8 > aData;
+    sal_Int32 nSize = m_xSFA->getSize( m_aFileURL );
+    sal_Int32 nRead = xIn->readBytes( aData, nSize );
 
-            OString aOKeyStr = aDBKey.getData();
+    const char* pData = reinterpret_cast<const char*>(aData.getConstArray());
+    int iPos = 0;
+    while( iPos < nRead )
+    {
+        HDFData aDBKey;
+        if( !implReadLenAndData( pData, iPos, aDBKey ) )
+            break;
 
-            // Read val len
-            const char* pStartPtr = pData + iPos;
-            char* pEndPtr;
-            sal_Int32 nValLen = strtol( pStartPtr, &pEndPtr, 16 );
-            if( pEndPtr == pStartPtr )
-                break;
+        OString aOKeyStr = aDBKey.getData();
 
-            iPos += (pEndPtr - pStartPtr) + 1;
+        // Read val len
+        const char* pStartPtr = pData + iPos;
+        char* pEndPtr;
+        sal_Int32 nValLen = strtol( pStartPtr, &pEndPtr, 16 );
+        if( pEndPtr == pStartPtr )
+            break;
 
-            if( bOptimizeForPerformance )
-            {
-                const char* pValSrc = pData + iPos;
-                OString aValStr( pValSrc, nValLen );
-                (*m_pStringToDataMap)[aOKeyStr] = aValStr;
-            }
-            else
-            {
-                // store value start position
-                (*m_pStringToValPosMap)[aOKeyStr] = std::pair<int,int>( iPos, nValLen );
-            }
-            iPos += nValLen + 1;
-        }
+        iPos += (pEndPtr - pStartPtr) + 1;
 
-        xIn->closeInput();
+        if( bOptimizeForPerformance )
+        {
+            const char* pValSrc = pData + iPos;
+            OString aValStr( pValSrc, nValLen );
+            (*m_pStringToDataMap)[aOKeyStr] = aValStr;
+        }
+        else
+        {
+            // store value start position
+            (*m_pStringToValPosMap)[aOKeyStr] = std::pair<int,int>( iPos, nValLen );
+        }
+        iPos += nValLen + 1;
     }
+
+    xIn->closeInput();
 }
 
 void Hdf::releaseHashMap()
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index 2ec811373c76..b43411df75ac 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -260,20 +260,20 @@ void URLParameter::readHelpDataFile()
         }
     }
 
-    if( bSuccess )
+    if( !bSuccess )
+        return;
+
+    DbtToStringConverter converter( pData );
+    m_aTitle = converter.getTitle();
+    m_pDatabases->replaceName( m_aTitle );
+    m_aPath  = converter.getFile();
+    m_aJar   = converter.getDatabase();
+    if( !aExtensionPath.isEmpty() )
     {
-        DbtToStringConverter converter( pData );
-        m_aTitle = converter.getTitle();
-        m_pDatabases->replaceName( m_aTitle );
-        m_aPath  = converter.getFile();
-        m_aJar   = converter.getDatabase();
-        if( !aExtensionPath.isEmpty() )
-        {
-            m_aJar = "?" + aExtensionPath + "?" + m_aJar;
-            m_aExtensionRegistryPath = aExtensionRegistryPath;
-        }
-        m_aTag   = converter.getHash();
+        m_aJar = "?" + aExtensionPath + "?" + m_aJar;
+        m_aExtensionRegistryPath = aExtensionRegistryPath;
     }
+    m_aTag   = converter.getHash();
 }
 
 


More information about the Libreoffice-commits mailing list