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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 30 06:28:35 UTC 2020


 sc/source/ui/app/client.cxx               |  148 ++---
 sc/source/ui/app/drwtrans.cxx             |   82 +-
 sc/source/ui/app/inputhdl.cxx             |  874 +++++++++++++++---------------
 sc/source/ui/app/inputwin.cxx             |  346 +++++------
 sc/source/ui/app/scmod.cxx                |  256 ++++----
 sc/source/ui/app/transobj.cxx             |  228 +++----
 sc/source/ui/cctrl/cbnumberformat.cxx     |   20 
 sc/source/ui/cctrl/checklistmenu.cxx      |  120 ++--
 sc/source/ui/condformat/condformatdlg.cxx |   46 -
 sc/source/ui/dbgui/consdlg.cxx            |   32 -
 sc/source/ui/dbgui/csvgrid.cxx            |   82 +-
 sc/source/ui/dbgui/csvruler.cxx           |  100 +--
 sc/source/ui/dbgui/csvtablebox.cxx        |   62 +-
 sc/source/ui/dbgui/dbnamdlg.cxx           |  226 +++----
 sc/source/ui/dbgui/filtdlg.cxx            |  156 ++---
 sc/source/ui/dbgui/foptmgr.cxx            |   62 +-
 sc/source/ui/dbgui/imoptdlg.cxx           |   64 +-
 sc/source/ui/dbgui/sfiltdlg.cxx           |   90 +--
 sc/source/ui/dbgui/validate.cxx           |  125 ++--
 sc/source/ui/docshell/dbdocfun.cxx        |  246 ++++----
 sc/source/ui/docshell/dbdocimp.cxx        |   36 -
 sc/source/ui/docshell/docfunc.cxx         |  227 +++----
 sc/source/ui/docshell/docsh2.cxx          |   62 +-
 sc/source/ui/docshell/docsh3.cxx          |   24 
 sc/source/ui/docshell/docsh4.cxx          |  110 +--
 sc/source/ui/docshell/docsh5.cxx          |   44 -
 sc/source/ui/docshell/docsh6.cxx          |   26 
 sc/source/ui/docshell/externalrefmgr.cxx  |   86 +-
 sc/source/ui/drawfunc/drawsh.cxx          |   44 -
 sc/source/ui/drawfunc/drawsh2.cxx         |  128 ++--
 sc/source/ui/drawfunc/drtxtob.cxx         |  128 ++--
 31 files changed, 2141 insertions(+), 2139 deletions(-)

New commits:
commit 5f646281f777019a4e91c467f1d6f8a7f2083ffd
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 29 16:13:56 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 30 08:27:52 2020 +0200

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

diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx
index b58efdf5218d..a121531c4782 100644
--- a/sc/source/ui/app/client.cxx
+++ b/sc/source/ui/app/client.cxx
@@ -96,42 +96,42 @@ void ScClient::RequestNewObjectArea( tools::Rectangle& aLogicRect )
 
     sal_uInt16 nTab = pViewSh->GetViewData().GetTabNo();
     SdrPage* pPage = pModel->GetPage(static_cast<sal_uInt16>(static_cast<sal_Int16>(nTab)));
-    if ( pPage && aLogicRect != aOldRect )
+    if ( !(pPage && aLogicRect != aOldRect) )
+        return;
+
+    Point aPos;
+    Size aSize = pPage->GetSize();
+    if ( aSize.Width() < 0 )
     {
-        Point aPos;
-        Size aSize = pPage->GetSize();
-        if ( aSize.Width() < 0 )
-        {
-            aPos.setX( aSize.Width() + 1 );       // negative
-            aSize.setWidth( -aSize.Width() );     // positive
-        }
-        tools::Rectangle aPageRect( aPos, aSize );
+        aPos.setX( aSize.Width() + 1 );       // negative
+        aSize.setWidth( -aSize.Width() );     // positive
+    }
+    tools::Rectangle aPageRect( aPos, aSize );
 
-        if (aLogicRect.Right() > aPageRect.Right())
-        {
-            long nDiff = aLogicRect.Right() - aPageRect.Right();
-            aLogicRect.AdjustLeft( -nDiff );
-            aLogicRect.AdjustRight( -nDiff );
-        }
-        if (aLogicRect.Bottom() > aPageRect.Bottom())
-        {
-            long nDiff = aLogicRect.Bottom() - aPageRect.Bottom();
-            aLogicRect.AdjustTop( -nDiff );
-            aLogicRect.AdjustBottom( -nDiff );
-        }
+    if (aLogicRect.Right() > aPageRect.Right())
+    {
+        long nDiff = aLogicRect.Right() - aPageRect.Right();
+        aLogicRect.AdjustLeft( -nDiff );
+        aLogicRect.AdjustRight( -nDiff );
+    }
+    if (aLogicRect.Bottom() > aPageRect.Bottom())
+    {
+        long nDiff = aLogicRect.Bottom() - aPageRect.Bottom();
+        aLogicRect.AdjustTop( -nDiff );
+        aLogicRect.AdjustBottom( -nDiff );
+    }
 
-        if (aLogicRect.Left() < aPageRect.Left())
-        {
-            long nDiff = aLogicRect.Left() - aPageRect.Left();
-            aLogicRect.AdjustRight( -nDiff );
-            aLogicRect.AdjustLeft( -nDiff );
-        }
-        if (aLogicRect.Top() < aPageRect.Top())
-        {
-            long nDiff = aLogicRect.Top() - aPageRect.Top();
-            aLogicRect.AdjustBottom( -nDiff );
-            aLogicRect.AdjustTop( -nDiff );
-        }
+    if (aLogicRect.Left() < aPageRect.Left())
+    {
+        long nDiff = aLogicRect.Left() - aPageRect.Left();
+        aLogicRect.AdjustRight( -nDiff );
+        aLogicRect.AdjustLeft( -nDiff );
+    }
+    if (aLogicRect.Top() < aPageRect.Top())
+    {
+        long nDiff = aLogicRect.Top() - aPageRect.Top();
+        aLogicRect.AdjustBottom( -nDiff );
+        aLogicRect.AdjustTop( -nDiff );
     }
 }
 
@@ -147,30 +147,30 @@ void ScClient::ObjectAreaChanged()
 
     // Take over position and size into document
     SdrOle2Obj* pDrawObj = GetDrawObj();
-    if (pDrawObj)
-    {
-        tools::Rectangle aNewRectangle(GetScaledObjArea());
-
-        // #i118524# if sheared/rotated, center to non-rotated LogicRect
-        pDrawObj->setSuppressSetVisAreaSize(true);
-
-        if(pDrawObj->GetGeoStat().nRotationAngle || pDrawObj->GetGeoStat().nShearAngle)
-        {
-            pDrawObj->SetLogicRect( aNewRectangle );
+    if (!pDrawObj)
+        return;
 
-            const tools::Rectangle& rBoundRect = pDrawObj->GetCurrentBoundRect();
-            const Point aDelta(aNewRectangle.Center() - rBoundRect.Center());
+    tools::Rectangle aNewRectangle(GetScaledObjArea());
 
-            aNewRectangle.Move(aDelta.X(), aDelta.Y());
-        }
+    // #i118524# if sheared/rotated, center to non-rotated LogicRect
+    pDrawObj->setSuppressSetVisAreaSize(true);
 
+    if(pDrawObj->GetGeoStat().nRotationAngle || pDrawObj->GetGeoStat().nShearAngle)
+    {
         pDrawObj->SetLogicRect( aNewRectangle );
-        pDrawObj->setSuppressSetVisAreaSize(false);
 
-        //  set document modified (SdrModel::SetChanged is not used)
-        pViewSh->GetViewData().GetDocShell()->SetDrawModified();
-        pViewSh->ScrollToObject(pDrawObj);
+        const tools::Rectangle& rBoundRect = pDrawObj->GetCurrentBoundRect();
+        const Point aDelta(aNewRectangle.Center() - rBoundRect.Center());
+
+        aNewRectangle.Move(aDelta.X(), aDelta.Y());
     }
+
+    pDrawObj->SetLogicRect( aNewRectangle );
+    pDrawObj->setSuppressSetVisAreaSize(false);
+
+    //  set document modified (SdrModel::SetChanged is not used)
+    pViewSh->GetViewData().GetDocShell()->SetDrawModified();
+    pViewSh->ScrollToObject(pDrawObj);
 }
 
 void ScClient::ViewChanged()
@@ -200,32 +200,32 @@ void ScClient::ViewChanged()
 
     // Take over position and size into document
     SdrOle2Obj* pDrawObj = GetDrawObj();
-    if (pDrawObj)
+    if (!pDrawObj)
+        return;
+
+    tools::Rectangle aLogicRect = pDrawObj->GetLogicRect();
+    Fraction aFractX = GetScaleWidth() * aVisSize.Width();
+    Fraction aFractY = GetScaleHeight() * aVisSize.Height();
+    aVisSize = Size( static_cast<long>(aFractX), static_cast<long>(aFractY) ); // Scaled for Draw model
+
+    //  pClientData->SetObjArea before pDrawObj->SetLogicRect, so that we don't
+    //  calculate wrong scalings:
+    //Rectangle aObjArea = aLogicRect;
+    //aObjArea.SetSize( aVisSize );          // Document size from the server
+    //SetObjArea( aObjArea );
+
+    SfxViewShell* pSfxViewSh = GetViewShell();
+    ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( pSfxViewSh  );
+    if ( pViewSh )
     {
-        tools::Rectangle aLogicRect = pDrawObj->GetLogicRect();
-        Fraction aFractX = GetScaleWidth() * aVisSize.Width();
-        Fraction aFractY = GetScaleHeight() * aVisSize.Height();
-        aVisSize = Size( static_cast<long>(aFractX), static_cast<long>(aFractY) ); // Scaled for Draw model
-
-        //  pClientData->SetObjArea before pDrawObj->SetLogicRect, so that we don't
-        //  calculate wrong scalings:
-        //Rectangle aObjArea = aLogicRect;
-        //aObjArea.SetSize( aVisSize );          // Document size from the server
-        //SetObjArea( aObjArea );
-
-        SfxViewShell* pSfxViewSh = GetViewShell();
-        ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( pSfxViewSh  );
-        if ( pViewSh )
+        vcl::Window* pWin = pViewSh->GetActiveWin();
+        if ( pWin->LogicToPixel( aVisSize ) != pWin->LogicToPixel( aLogicRect.GetSize() ) )
         {
-            vcl::Window* pWin = pViewSh->GetActiveWin();
-            if ( pWin->LogicToPixel( aVisSize ) != pWin->LogicToPixel( aLogicRect.GetSize() ) )
-            {
-                aLogicRect.SetSize( aVisSize );
-                pDrawObj->SetLogicRect( aLogicRect );
+            aLogicRect.SetSize( aVisSize );
+            pDrawObj->SetLogicRect( aLogicRect );
 
-                // set document modified (SdrModel::SetChanged is not used)
-                pViewSh->GetViewData().GetDocShell()->SetDrawModified();
-            }
+            // set document modified (SdrModel::SetChanged is not used)
+            pViewSh->GetViewData().GetDocShell()->SetDrawModified();
         }
     }
 }
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index ac338fa2c115..dcb90a5e06ed 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -685,57 +685,57 @@ void ScDrawTransferObj::CreateOLEData()
 
 void ScDrawTransferObj::InitDocShell()
 {
-    if ( !m_aDocShellRef.is() )
-    {
-        ScDocShell* pDocSh = new ScDocShell;
-        m_aDocShellRef = pDocSh;      // ref must be there before InitNew
+    if ( m_aDocShellRef.is() )
+        return;
 
-        pDocSh->DoInitNew();
+    ScDocShell* pDocSh = new ScDocShell;
+    m_aDocShellRef = pDocSh;      // ref must be there before InitNew
 
-        ScDocument& rDestDoc = pDocSh->GetDocument();
-        rDestDoc.InitDrawLayer( pDocSh );
+    pDocSh->DoInitNew();
 
-        SdrModel* pDestModel = rDestDoc.GetDrawLayer();
-        // #i71538# use complete SdrViews
-        // SdrExchangeView aDestView( pDestModel );
-        SdrView aDestView(*pDestModel);
-        aDestView.ShowSdrPage(aDestView.GetModel()->GetPage(0));
-        aDestView.Paste(
-            *m_pModel,
-            Point(m_aSrcSize.Width()/2, m_aSrcSize.Height()/2),
-            nullptr, SdrInsertFlags::NONE);
+    ScDocument& rDestDoc = pDocSh->GetDocument();
+    rDestDoc.InitDrawLayer( pDocSh );
 
-        // put objects to right layer (see ScViewFunc::PasteDataFormat for SotClipboardFormatId::DRAWING)
+    SdrModel* pDestModel = rDestDoc.GetDrawLayer();
+    // #i71538# use complete SdrViews
+    // SdrExchangeView aDestView( pDestModel );
+    SdrView aDestView(*pDestModel);
+    aDestView.ShowSdrPage(aDestView.GetModel()->GetPage(0));
+    aDestView.Paste(
+        *m_pModel,
+        Point(m_aSrcSize.Width()/2, m_aSrcSize.Height()/2),
+        nullptr, SdrInsertFlags::NONE);
 
-        SdrPage* pPage = pDestModel->GetPage(0);
-        if (pPage)
+    // put objects to right layer (see ScViewFunc::PasteDataFormat for SotClipboardFormatId::DRAWING)
+
+    SdrPage* pPage = pDestModel->GetPage(0);
+    if (pPage)
+    {
+        SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
+        SdrObject* pObject = aIter.Next();
+        while (pObject)
         {
-            SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
-            SdrObject* pObject = aIter.Next();
-            while (pObject)
-            {
-                if ( dynamic_cast<const SdrUnoObj*>( pObject) !=  nullptr )
-                    pObject->NbcSetLayer(SC_LAYER_CONTROLS);
-                else
-                    pObject->NbcSetLayer(SC_LAYER_FRONT);
-                pObject = aIter.Next();
-            }
+            if ( dynamic_cast<const SdrUnoObj*>( pObject) !=  nullptr )
+                pObject->NbcSetLayer(SC_LAYER_CONTROLS);
+            else
+                pObject->NbcSetLayer(SC_LAYER_FRONT);
+            pObject = aIter.Next();
         }
+    }
 
-        tools::Rectangle aDestArea( Point(), m_aSrcSize );
-        pDocSh->SetVisArea( aDestArea );
+    tools::Rectangle aDestArea( Point(), m_aSrcSize );
+    pDocSh->SetVisArea( aDestArea );
 
-        ScViewOptions aViewOpt( rDestDoc.GetViewOptions() );
-        aViewOpt.SetOption( VOPT_GRID, false );
-        rDestDoc.SetViewOptions( aViewOpt );
+    ScViewOptions aViewOpt( rDestDoc.GetViewOptions() );
+    aViewOpt.SetOption( VOPT_GRID, false );
+    rDestDoc.SetViewOptions( aViewOpt );
 
-        ScViewData aViewData( pDocSh, nullptr );
-        aViewData.SetTabNo( 0 );
-        aViewData.SetScreen( aDestArea );
-        aViewData.SetCurX( 0 );
-        aViewData.SetCurY( 0 );
-        pDocSh->UpdateOle(&aViewData, true);
-    }
+    ScViewData aViewData( pDocSh, nullptr );
+    aViewData.SetTabNo( 0 );
+    aViewData.SetScreen( aDestArea );
+    aViewData.SetCurX( 0 );
+    aViewData.SetCurY( 0 );
+    pDocSh->UpdateOle(&aViewData, true);
 }
 
 namespace
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index a62887cbbb50..b130cb87a0b4 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -564,24 +564,24 @@ void ScInputHandler::SetDocumentDisposing( bool b )
 
 static void lcl_Replace( EditView* pView, const OUString& rNewStr, const ESelection& rOldSel )
 {
-    if ( pView )
-    {
-        ESelection aOldSel = pView->GetSelection();
-        if (aOldSel.HasRange())
-            pView->SetSelection( ESelection( aOldSel.nEndPara, aOldSel.nEndPos,
-                                             aOldSel.nEndPara, aOldSel.nEndPos ) );
+    if ( !pView )
+        return;
 
-        EditEngine* pEngine = pView->GetEditEngine();
-        pEngine->QuickInsertText( rNewStr, rOldSel );
+    ESelection aOldSel = pView->GetSelection();
+    if (aOldSel.HasRange())
+        pView->SetSelection( ESelection( aOldSel.nEndPara, aOldSel.nEndPos,
+                                         aOldSel.nEndPara, aOldSel.nEndPos ) );
 
-        // Dummy InsertText for Update and Paint
-        // To do that we need to cancel the selection from above (before QuickInsertText)
-        pView->InsertText( EMPTY_OUSTRING );
+    EditEngine* pEngine = pView->GetEditEngine();
+    pEngine->QuickInsertText( rNewStr, rOldSel );
 
-        sal_Int32 nLen = pEngine->GetTextLen(0);
-        ESelection aSel( 0, nLen, 0, nLen );
-        pView->SetSelection( aSel ); // Set cursor to the end
-    }
+    // Dummy InsertText for Update and Paint
+    // To do that we need to cancel the selection from above (before QuickInsertText)
+    pView->InsertText( EMPTY_OUSTRING );
+
+    sal_Int32 nLen = pEngine->GetTextLen(0);
+    ESelection aSel( 0, nLen, 0, nLen );
+    pView->SetSelection( aSel ); // Set cursor to the end
 }
 
 void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew )
@@ -867,25 +867,25 @@ void ScInputHandler::UpdateRefDevice()
 
 void ScInputHandler::ImplCreateEditEngine()
 {
-    if ( !mpEditEngine )
+    if ( mpEditEngine )
+        return;
+
+    if ( pActiveViewSh )
     {
-        if ( pActiveViewSh )
-        {
-            ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
-            mpEditEngine = std::make_unique<ScFieldEditEngine>(&rDoc, rDoc.GetEnginePool(), rDoc.GetEditPool());
-        }
-        else
-            mpEditEngine = std::make_unique<ScFieldEditEngine>(nullptr, EditEngine::CreatePool(), nullptr, true);
+        ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
+        mpEditEngine = std::make_unique<ScFieldEditEngine>(&rDoc, rDoc.GetEnginePool(), rDoc.GetEditPool());
+    }
+    else
+        mpEditEngine = std::make_unique<ScFieldEditEngine>(nullptr, EditEngine::CreatePool(), nullptr, true);
 
-        mpEditEngine->SetWordDelimiters( ScEditUtil::ModifyDelimiters( mpEditEngine->GetWordDelimiters() ) );
-        UpdateRefDevice();      // also sets MapMode
-        mpEditEngine->SetPaperSize( Size( 1000000, 1000000 ) );
-        pEditDefaults.reset( new SfxItemSet( mpEditEngine->GetEmptyItemSet() ) );
+    mpEditEngine->SetWordDelimiters( ScEditUtil::ModifyDelimiters( mpEditEngine->GetWordDelimiters() ) );
+    UpdateRefDevice();      // also sets MapMode
+    mpEditEngine->SetPaperSize( Size( 1000000, 1000000 ) );
+    pEditDefaults.reset( new SfxItemSet( mpEditEngine->GetEmptyItemSet() ) );
 
-        mpEditEngine->SetControlWord( mpEditEngine->GetControlWord() | EEControlBits::AUTOCORRECT );
-        mpEditEngine->SetReplaceLeadingSingleQuotationMark( false );
-        mpEditEngine->SetModifyHdl( LINK( this, ScInputHandler, ModifyHdl ) );
-    }
+    mpEditEngine->SetControlWord( mpEditEngine->GetControlWord() | EEControlBits::AUTOCORRECT );
+    mpEditEngine->SetReplaceLeadingSingleQuotationMark( false );
+    mpEditEngine->SetModifyHdl( LINK( this, ScInputHandler, ModifyHdl ) );
 }
 
 void ScInputHandler::UpdateAutoCorrFlag()
@@ -906,54 +906,54 @@ void ScInputHandler::UpdateAutoCorrFlag()
 
 void ScInputHandler::UpdateSpellSettings( bool bFromStartTab )
 {
-    if ( pActiveViewSh )
-    {
-        ScViewData& rViewData = pActiveViewSh->GetViewData();
-        bool bOnlineSpell = rViewData.GetDocument()->GetDocOptions().IsAutoSpell();
+    if ( !pActiveViewSh )
+        return;
 
-        //  SetDefaultLanguage is independent of the language attributes,
-        //  ScGlobal::GetEditDefaultLanguage is always used.
-        //  It must be set every time in case the office language was changed.
+    ScViewData& rViewData = pActiveViewSh->GetViewData();
+    bool bOnlineSpell = rViewData.GetDocument()->GetDocOptions().IsAutoSpell();
 
-        mpEditEngine->SetDefaultLanguage( ScGlobal::GetEditDefaultLanguage() );
+    //  SetDefaultLanguage is independent of the language attributes,
+    //  ScGlobal::GetEditDefaultLanguage is always used.
+    //  It must be set every time in case the office language was changed.
 
-        //  if called for changed options, update flags only if already editing
-        //  if called from StartTable, always update flags
+    mpEditEngine->SetDefaultLanguage( ScGlobal::GetEditDefaultLanguage() );
 
-        if ( bFromStartTab || eMode != SC_INPUT_NONE )
-        {
-            EEControlBits nCntrl = mpEditEngine->GetControlWord();
-            EEControlBits nOld = nCntrl;
-            if( bOnlineSpell )
-                nCntrl |= EEControlBits::ONLINESPELLING;
-            else
-                nCntrl &= ~EEControlBits::ONLINESPELLING;
-            // No AutoCorrect for Symbol Font (EditEngine does no evaluate Default)
-            if ( pLastPattern && pLastPattern->IsSymbolFont() )
-                nCntrl &= ~EEControlBits::AUTOCORRECT;
-            else
-                nCntrl |= EEControlBits::AUTOCORRECT;
-            if ( nCntrl != nOld )
-                mpEditEngine->SetControlWord(nCntrl);
-
-            ScDocument* pDoc = rViewData.GetDocument();
-            pDoc->ApplyAsianEditSettings( *mpEditEngine );
-            mpEditEngine->SetDefaultHorizontalTextDirection(
-                pDoc->GetEditTextDirection( rViewData.GetTabNo() ) );
-            mpEditEngine->SetFirstWordCapitalization( false );
-        }
+    //  if called for changed options, update flags only if already editing
+    //  if called from StartTable, always update flags
 
-        //  Language is set separately, so the speller is needed only if online spelling is active
-        if ( bOnlineSpell ) {
-            css::uno::Reference<css::linguistic2::XSpellChecker1> xXSpellChecker1( LinguMgr::GetSpellChecker() );
-            mpEditEngine->SetSpeller( xXSpellChecker1 );
-        }
+    if ( bFromStartTab || eMode != SC_INPUT_NONE )
+    {
+        EEControlBits nCntrl = mpEditEngine->GetControlWord();
+        EEControlBits nOld = nCntrl;
+        if( bOnlineSpell )
+            nCntrl |= EEControlBits::ONLINESPELLING;
+        else
+            nCntrl &= ~EEControlBits::ONLINESPELLING;
+        // No AutoCorrect for Symbol Font (EditEngine does no evaluate Default)
+        if ( pLastPattern && pLastPattern->IsSymbolFont() )
+            nCntrl &= ~EEControlBits::AUTOCORRECT;
+        else
+            nCntrl |= EEControlBits::AUTOCORRECT;
+        if ( nCntrl != nOld )
+            mpEditEngine->SetControlWord(nCntrl);
 
-        bool bHyphen = pLastPattern && pLastPattern->GetItem(ATTR_HYPHENATE).GetValue();
-        if ( bHyphen ) {
-            css::uno::Reference<css::linguistic2::XHyphenator> xXHyphenator( LinguMgr::GetHyphenator() );
-            mpEditEngine->SetHyphenator( xXHyphenator );
-        }
+        ScDocument* pDoc = rViewData.GetDocument();
+        pDoc->ApplyAsianEditSettings( *mpEditEngine );
+        mpEditEngine->SetDefaultHorizontalTextDirection(
+            pDoc->GetEditTextDirection( rViewData.GetTabNo() ) );
+        mpEditEngine->SetFirstWordCapitalization( false );
+    }
+
+    //  Language is set separately, so the speller is needed only if online spelling is active
+    if ( bOnlineSpell ) {
+        css::uno::Reference<css::linguistic2::XSpellChecker1> xXSpellChecker1( LinguMgr::GetSpellChecker() );
+        mpEditEngine->SetSpeller( xXSpellChecker1 );
+    }
+
+    bool bHyphen = pLastPattern && pLastPattern->GetItem(ATTR_HYPHENATE).GetValue();
+    if ( bHyphen ) {
+        css::uno::Reference<css::linguistic2::XHyphenator> xXHyphenator( LinguMgr::GetHyphenator() );
+        mpEditEngine->SetHyphenator( xXHyphenator );
     }
 }
 
@@ -962,49 +962,49 @@ void ScInputHandler::UpdateSpellSettings( bool bFromStartTab )
 //  The other types are defined in ScDocument::GetFormulaEntries
 void ScInputHandler::GetFormulaData()
 {
-    if ( pActiveViewSh )
-    {
-        ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
+    if ( !pActiveViewSh )
+        return;
 
-        if ( pFormulaData )
-            pFormulaData->clear();
-        else
-        {
-            pFormulaData.reset( new ScTypedCaseStrSet );
-        }
+    ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
 
-        if( pFormulaDataPara )
-            pFormulaDataPara->clear();
-        else
-            pFormulaDataPara.reset( new ScTypedCaseStrSet );
+    if ( pFormulaData )
+        pFormulaData->clear();
+    else
+    {
+        pFormulaData.reset( new ScTypedCaseStrSet );
+    }
+
+    if( pFormulaDataPara )
+        pFormulaDataPara->clear();
+    else
+        pFormulaDataPara.reset( new ScTypedCaseStrSet );
 
-        const OUString aParenthesesReplacement( cParenthesesReplacement);
-        const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
-        sal_uInt32 nListCount = pFuncList->GetCount();
-        for(sal_uInt32 i=0;i<nListCount;i++)
+    const OUString aParenthesesReplacement( cParenthesesReplacement);
+    const ScFunctionList* pFuncList = ScGlobal::GetStarCalcFunctionList();
+    sal_uInt32 nListCount = pFuncList->GetCount();
+    for(sal_uInt32 i=0;i<nListCount;i++)
+    {
+        const ScFuncDesc* pDesc = pFuncList->GetFunction( i );
+        if ( pDesc->mxFuncName )
         {
-            const ScFuncDesc* pDesc = pFuncList->GetFunction( i );
-            if ( pDesc->mxFuncName )
+            const sal_Unicode* pName = pDesc->mxFuncName->getStr();
+            const sal_Int32 nLen = pDesc->mxFuncName->getLength();
+            // fdo#75264 fill maFormulaChar with all characters used in formula names
+            for ( sal_Int32 j = 0; j < nLen; j++ )
             {
-                const sal_Unicode* pName = pDesc->mxFuncName->getStr();
-                const sal_Int32 nLen = pDesc->mxFuncName->getLength();
-                // fdo#75264 fill maFormulaChar with all characters used in formula names
-                for ( sal_Int32 j = 0; j < nLen; j++ )
-                {
-                    sal_Unicode c = pName[ j ];
-                    maFormulaChar.insert( c );
-                }
-                OUString aFuncName = *pDesc->mxFuncName + aParenthesesReplacement;
-                pFormulaData->insert(ScTypedStrData(aFuncName, 0.0, ScTypedStrData::Standard));
-                pDesc->initArgumentInfo();
-                OUString aEntry = pDesc->getSignature();
-                pFormulaDataPara->insert(ScTypedStrData(aEntry, 0.0, ScTypedStrData::Standard));
+                sal_Unicode c = pName[ j ];
+                maFormulaChar.insert( c );
             }
+            OUString aFuncName = *pDesc->mxFuncName + aParenthesesReplacement;
+            pFormulaData->insert(ScTypedStrData(aFuncName, 0.0, ScTypedStrData::Standard));
+            pDesc->initArgumentInfo();
+            OUString aEntry = pDesc->getSignature();
+            pFormulaDataPara->insert(ScTypedStrData(aEntry, 0.0, ScTypedStrData::Standard));
         }
-        miAutoPosFormula = pFormulaData->end();
-        rDoc.GetFormulaEntries( *pFormulaData );
-        rDoc.GetFormulaEntries( *pFormulaDataPara );
     }
+    miAutoPosFormula = pFormulaData->end();
+    rDoc.GetFormulaEntries( *pFormulaData );
+    rDoc.GetFormulaEntries( *pFormulaDataPara );
 }
 
 IMPL_LINK( ScInputHandler, ShowHideTipVisibleParentListener, VclWindowEvent&, rEvent, void )
@@ -1220,21 +1220,21 @@ void ScInputHandler::ShowTipCursor()
     HideTipBelow();
     EditView* pActiveView = pTopView ? pTopView : pTableView;
 
-    if ( bFormulaMode && pActiveView && pFormulaDataPara && mpEditEngine->GetParagraphCount() == 1 )
-    {
-        OUString aParagraph = mpEditEngine->GetText( 0 );
-        ESelection aSel = pActiveView->GetSelection();
-        aSel.Adjust();
+    if ( !(bFormulaMode && pActiveView && pFormulaDataPara && mpEditEngine->GetParagraphCount() == 1) )
+        return;
+
+    OUString aParagraph = mpEditEngine->GetText( 0 );
+    ESelection aSel = pActiveView->GetSelection();
+    aSel.Adjust();
 
-        if ( aParagraph.getLength() < aSel.nEndPos )
-            return;
+    if ( aParagraph.getLength() < aSel.nEndPos )
+        return;
 
-        if ( aSel.nEndPos > 0 )
-        {
-            OUString aSelText( aParagraph.copy( 0, aSel.nEndPos ));
+    if ( aSel.nEndPos > 0 )
+    {
+        OUString aSelText( aParagraph.copy( 0, aSel.nEndPos ));
 
-            ShowArgumentsTip( aSelText );
-        }
+        ShowArgumentsTip( aSelText );
     }
 }
 
@@ -1246,20 +1246,20 @@ void ScInputHandler::ShowTip( const OUString& rText )
     HideTipBelow();
 
     EditView* pActiveView = pTopView ? pTopView : pTableView;
-    if (pActiveView)
-    {
-        Point aPos;
-        pTipVisibleParent = pActiveView->GetWindow();
-        vcl::Cursor* pCur = pActiveView->GetCursor();
-        if (pCur)
-            aPos = pTipVisibleParent->LogicToPixel( pCur->GetPos() );
-        aPos = pTipVisibleParent->OutputToScreenPixel( aPos );
-        tools::Rectangle aRect( aPos, aPos );
+    if (!pActiveView)
+        return;
 
-        QuickHelpFlags const nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom;
-        nTipVisible = Help::ShowPopover(pTipVisibleParent, aRect, rText, nAlign);
-        pTipVisibleParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleParentListener ) );
-    }
+    Point aPos;
+    pTipVisibleParent = pActiveView->GetWindow();
+    vcl::Cursor* pCur = pActiveView->GetCursor();
+    if (pCur)
+        aPos = pTipVisibleParent->LogicToPixel( pCur->GetPos() );
+    aPos = pTipVisibleParent->OutputToScreenPixel( aPos );
+    tools::Rectangle aRect( aPos, aPos );
+
+    QuickHelpFlags const nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom;
+    nTipVisible = Help::ShowPopover(pTipVisibleParent, aRect, rText, nAlign);
+    pTipVisibleParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleParentListener ) );
 }
 
 void ScInputHandler::ShowTipBelow( const OUString& rText )
@@ -1267,23 +1267,23 @@ void ScInputHandler::ShowTipBelow( const OUString& rText )
     HideTipBelow();
 
     EditView* pActiveView = pTopView ? pTopView : pTableView;
-    if ( pActiveView )
+    if ( !pActiveView )
+        return;
+
+    Point aPos;
+    pTipVisibleSecParent = pActiveView->GetWindow();
+    vcl::Cursor* pCur = pActiveView->GetCursor();
+    if ( pCur )
     {
-        Point aPos;
-        pTipVisibleSecParent = pActiveView->GetWindow();
-        vcl::Cursor* pCur = pActiveView->GetCursor();
-        if ( pCur )
-        {
-            Point aLogicPos = pCur->GetPos();
-            aLogicPos.AdjustY(pCur->GetHeight() );
-            aPos = pTipVisibleSecParent->LogicToPixel( aLogicPos );
-        }
-        aPos = pTipVisibleSecParent->OutputToScreenPixel( aPos );
-        tools::Rectangle aRect( aPos, aPos );
-        QuickHelpFlags const nAlign = QuickHelpFlags::Left | QuickHelpFlags::Top | QuickHelpFlags::NoEvadePointer;
-        nTipVisibleSec = Help::ShowPopover(pTipVisibleSecParent, aRect, rText, nAlign);
-        pTipVisibleSecParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleSecParentListener ) );
+        Point aLogicPos = pCur->GetPos();
+        aLogicPos.AdjustY(pCur->GetHeight() );
+        aPos = pTipVisibleSecParent->LogicToPixel( aLogicPos );
     }
+    aPos = pTipVisibleSecParent->OutputToScreenPixel( aPos );
+    tools::Rectangle aRect( aPos, aPos );
+    QuickHelpFlags const nAlign = QuickHelpFlags::Left | QuickHelpFlags::Top | QuickHelpFlags::NoEvadePointer;
+    nTipVisibleSec = Help::ShowPopover(pTipVisibleSecParent, aRect, rText, nAlign);
+    pTipVisibleSecParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleSecParentListener ) );
 }
 
 bool ScInputHandler::GetFuncName( OUString& aStart, OUString& aResult )
@@ -1454,68 +1454,68 @@ void ScInputHandler::UseFormulaData()
     EditView* pActiveView = pTopView ? pTopView : pTableView;
 
     // Formulas may only have 1 paragraph
-    if ( pActiveView && pFormulaData && mpEditEngine->GetParagraphCount() == 1 )
-    {
-        OUString aParagraph = mpEditEngine->GetText( 0 );
-        ESelection aSel = pActiveView->GetSelection();
-        aSel.Adjust();
+    if ( !(pActiveView && pFormulaData && mpEditEngine->GetParagraphCount() == 1) )
+        return;
 
-        // Due to differences between table and input cell (e.g clipboard with line breaks),
-        // the selection may not be in line with the EditEngine anymore.
-        // Just return without any indication as to why.
-        if ( aSel.nEndPos > aParagraph.getLength() )
-            return;
-
-        if ( aParagraph.getLength() > aSel.nEndPos &&
-             ( ScGlobal::getCharClassPtr()->isLetterNumeric( aParagraph, aSel.nEndPos ) ||
-               aParagraph[ aSel.nEndPos ] == '_' ||
-               aParagraph[ aSel.nEndPos ] == '.' ||
-               aParagraph[ aSel.nEndPos ] == '$'   ) )
-            return;
-
-        //  Is the cursor at the end of a word?
-        if ( aSel.nEndPos > 0 )
-        {
-            OUString aSelText( aParagraph.copy( 0, aSel.nEndPos ));
+    OUString aParagraph = mpEditEngine->GetText( 0 );
+    ESelection aSel = pActiveView->GetSelection();
+    aSel.Adjust();
+
+    // Due to differences between table and input cell (e.g clipboard with line breaks),
+    // the selection may not be in line with the EditEngine anymore.
+    // Just return without any indication as to why.
+    if ( aSel.nEndPos > aParagraph.getLength() )
+        return;
+
+    if ( aParagraph.getLength() > aSel.nEndPos &&
+         ( ScGlobal::getCharClassPtr()->isLetterNumeric( aParagraph, aSel.nEndPos ) ||
+           aParagraph[ aSel.nEndPos ] == '_' ||
+           aParagraph[ aSel.nEndPos ] == '.' ||
+           aParagraph[ aSel.nEndPos ] == '$'   ) )
+        return;
 
-            OUString aText;
-            if ( GetFuncName( aSelText, aText ) )
+    //  Is the cursor at the end of a word?
+    if ( aSel.nEndPos <= 0 )
+        return;
+
+    OUString aSelText( aParagraph.copy( 0, aSel.nEndPos ));
+
+    OUString aText;
+    if ( GetFuncName( aSelText, aText ) )
+    {
+        // function name is incomplete:
+        // show matching functions name as tip above cell
+        ::std::vector<OUString> aNewVec;
+        miAutoPosFormula = pFormulaData->end();
+        miAutoPosFormula = findTextAll(*pFormulaData, miAutoPosFormula, aText, aNewVec, false);
+        if (miAutoPosFormula != pFormulaData->end())
+        {
+            // check if partial function name is not between quotes
+            sal_Unicode cBetweenQuotes = 0;
+            for ( int n = 0; n < aSelText.getLength(); n++ )
             {
-                // function name is incomplete:
-                // show matching functions name as tip above cell
-                ::std::vector<OUString> aNewVec;
-                miAutoPosFormula = pFormulaData->end();
-                miAutoPosFormula = findTextAll(*pFormulaData, miAutoPosFormula, aText, aNewVec, false);
-                if (miAutoPosFormula != pFormulaData->end())
+                if (cBetweenQuotes)
                 {
-                    // check if partial function name is not between quotes
-                    sal_Unicode cBetweenQuotes = 0;
-                    for ( int n = 0; n < aSelText.getLength(); n++ )
-                    {
-                        if (cBetweenQuotes)
-                        {
-                            if (aSelText[n] == cBetweenQuotes)
-                                cBetweenQuotes = 0;
-                        }
-                        else if ( aSelText[ n ] == '"' )
-                            cBetweenQuotes = '"';
-                        else if ( aSelText[ n ] == '\'' )
-                            cBetweenQuotes = '\'';
-                    }
-                    if ( cBetweenQuotes )
-                        return;  // we're between quotes
-
-                    ShowFuncList(aNewVec);
-                    aAutoSearch = aText;
+                    if (aSelText[n] == cBetweenQuotes)
+                        cBetweenQuotes = 0;
                 }
-                return;
+                else if ( aSelText[ n ] == '"' )
+                    cBetweenQuotes = '"';
+                else if ( aSelText[ n ] == '\'' )
+                    cBetweenQuotes = '\'';
             }
+            if ( cBetweenQuotes )
+                return;  // we're between quotes
 
-            // function name is complete:
-            // show tip below the cell with function name and arguments of function
-            ShowArgumentsTip( aSelText );
+            ShowFuncList(aNewVec);
+            aAutoSearch = aText;
         }
+        return;
     }
+
+    // function name is complete:
+    // show tip below the cell with function name and arguments of function
+    ShowArgumentsTip( aSelText );
 }
 
 void ScInputHandler::NextFormulaEntry( bool bBack )
@@ -1541,95 +1541,95 @@ namespace {
 
 void completeFunction( EditView* pView, const OUString& rInsert, bool& rParInserted )
 {
-    if (pView)
+    if (!pView)
+        return;
+
+    ESelection aSel = pView->GetSelection();
+
+    bool bNoInitialLetter = false;
+    OUString aOld = pView->GetEditEngine()->GetText(0);
+    // in case we want just insert a function and not completing
+    if ( comphelper::LibreOfficeKit::isActive() )
     {
-        ESelection aSel = pView->GetSelection();
+        ESelection aSelRange = aSel;
+        --aSelRange.nStartPos;
+        --aSelRange.nEndPos;
+        pView->SetSelection(aSelRange);
+        pView->SelectCurrentWord();
 
-        bool bNoInitialLetter = false;
-        OUString aOld = pView->GetEditEngine()->GetText(0);
-        // in case we want just insert a function and not completing
-        if ( comphelper::LibreOfficeKit::isActive() )
+        if ( aOld == "=" )
         {
-            ESelection aSelRange = aSel;
-            --aSelRange.nStartPos;
-            --aSelRange.nEndPos;
+            bNoInitialLetter = true;
+            aSelRange.nStartPos = 1;
+            aSelRange.nEndPos = 1;
             pView->SetSelection(aSelRange);
-            pView->SelectCurrentWord();
-
-            if ( aOld == "=" )
-            {
-                bNoInitialLetter = true;
-                aSelRange.nStartPos = 1;
-                aSelRange.nEndPos = 1;
-                pView->SetSelection(aSelRange);
-            }
-            else if ( pView->GetSelected().startsWith("()") )
-            {
-                bNoInitialLetter = true;
-                ++aSelRange.nStartPos;
-                ++aSelRange.nEndPos;
-                pView->SetSelection(aSelRange);
-            }
         }
-
-        if(!bNoInitialLetter)
+        else if ( pView->GetSelected().startsWith("()") )
         {
-            const sal_Int32 nMinLen = std::max(aSel.nEndPos - aSel.nStartPos, sal_Int32(1));
-            // Since transliteration service is used to test for match, the replaced string could be
-            // longer than rInsert, so in order to find longest match before the cursor, test whole
-            // string from start to current cursor position (don't limit to length of rInsert)
-            // Disclaimer: I really don't know if a match longer than rInsert is actually possible,
-            // so the above is based on assumptions how "transliteration" might possibly work. If
-            // it's in fact impossible, an optimization would be useful to limit aSel.nStartPos to
-            // std::max(sal_Int32(0), aSel.nEndPos - rInsert.getLength()).
-            aSel.nStartPos = 0;
-            pView->SetSelection(aSel);
-            const OUString aAll = pView->GetSelected();
-            OUString aMatch;
-            for (sal_Int32 n = aAll.getLength(); n >= nMinLen && aMatch.isEmpty(); --n)
-            {
-                const OUString aTest = aAll.copy(aAll.getLength() - n); // n trailing chars
-                if (ScGlobal::GetpTransliteration()->isMatch(aTest, rInsert))
-                    aMatch = aTest; // Found => break the loop
-            }
-
-            aSel.nStartPos = aSel.nEndPos - aMatch.getLength();
-            pView->SetSelection(aSel);
+            bNoInitialLetter = true;
+            ++aSelRange.nStartPos;
+            ++aSelRange.nEndPos;
+            pView->SetSelection(aSelRange);
         }
+    }
 
-        OUString aInsStr = rInsert;
-        sal_Int32 nInsLen = aInsStr.getLength();
-        bool bDoParen = ( nInsLen > 1 && aInsStr[nInsLen-2] == '('
-                                      && aInsStr[nInsLen-1] == ')' );
-        if ( bDoParen )
+    if(!bNoInitialLetter)
+    {
+        const sal_Int32 nMinLen = std::max(aSel.nEndPos - aSel.nStartPos, sal_Int32(1));
+        // Since transliteration service is used to test for match, the replaced string could be
+        // longer than rInsert, so in order to find longest match before the cursor, test whole
+        // string from start to current cursor position (don't limit to length of rInsert)
+        // Disclaimer: I really don't know if a match longer than rInsert is actually possible,
+        // so the above is based on assumptions how "transliteration" might possibly work. If
+        // it's in fact impossible, an optimization would be useful to limit aSel.nStartPos to
+        // std::max(sal_Int32(0), aSel.nEndPos - rInsert.getLength()).
+        aSel.nStartPos = 0;
+        pView->SetSelection(aSel);
+        const OUString aAll = pView->GetSelected();
+        OUString aMatch;
+        for (sal_Int32 n = aAll.getLength(); n >= nMinLen && aMatch.isEmpty(); --n)
         {
-            // Do not insert parentheses after function names if there already are some
-            // (e.g. if the function name was edited).
-            ESelection aWordSel = pView->GetSelection();
+            const OUString aTest = aAll.copy(aAll.getLength() - n); // n trailing chars
+            if (ScGlobal::GetpTransliteration()->isMatch(aTest, rInsert))
+                aMatch = aTest; // Found => break the loop
+        }
 
-            // aWordSel.EndPos points one behind string if word at end
-            if (aWordSel.nEndPos < aOld.getLength())
+        aSel.nStartPos = aSel.nEndPos - aMatch.getLength();
+        pView->SetSelection(aSel);
+    }
+
+    OUString aInsStr = rInsert;
+    sal_Int32 nInsLen = aInsStr.getLength();
+    bool bDoParen = ( nInsLen > 1 && aInsStr[nInsLen-2] == '('
+                                  && aInsStr[nInsLen-1] == ')' );
+    if ( bDoParen )
+    {
+        // Do not insert parentheses after function names if there already are some
+        // (e.g. if the function name was edited).
+        ESelection aWordSel = pView->GetSelection();
+
+        // aWordSel.EndPos points one behind string if word at end
+        if (aWordSel.nEndPos < aOld.getLength())
+        {
+            sal_Unicode cNext = aOld[aWordSel.nEndPos];
+            if ( cNext == '(' )
             {
-                sal_Unicode cNext = aOld[aWordSel.nEndPos];
-                if ( cNext == '(' )
-                {
-                    bDoParen = false;
-                    aInsStr = aInsStr.copy( 0, nInsLen - 2 ); // Skip parentheses
-                }
+                bDoParen = false;
+                aInsStr = aInsStr.copy( 0, nInsLen - 2 ); // Skip parentheses
             }
         }
+    }
 
-        pView->InsertText( aInsStr );
+    pView->InsertText( aInsStr );
 
-        if ( bDoParen ) // Put cursor between parentheses
-        {
-            aSel = pView->GetSelection();
-            --aSel.nStartPos;
-            --aSel.nEndPos;
-            pView->SetSelection(aSel);
+    if ( bDoParen ) // Put cursor between parentheses
+    {
+        aSel = pView->GetSelection();
+        --aSel.nStartPos;
+        --aSel.nEndPos;
+        pView->SetSelection(aSel);
 
-            rParInserted = true;
-        }
+        rParInserted = true;
     }
 }
 
@@ -1664,37 +1664,37 @@ void ScInputHandler::PasteFunctionData()
 
 void ScInputHandler::LOKPasteFunctionData(const OUString& rFunctionName)
 {
-    if (pActiveViewSh && (pTopView || pTableView))
+    if (!(pActiveViewSh && (pTopView || pTableView)))
+        return;
+
+    bool bEdit = false;
+    OUString aFormula;
+    EditView* pEditView = pTopView ? pTopView : pTableView;
+    const EditEngine* pEditEngine = pEditView->GetEditEngine();
+    if (pEditEngine)
     {
-        bool bEdit = false;
-        OUString aFormula;
-        EditView* pEditView = pTopView ? pTopView : pTableView;
-        const EditEngine* pEditEngine = pEditView->GetEditEngine();
-        if (pEditEngine)
-        {
-            aFormula = pEditEngine->GetText(0);
-            bEdit = aFormula.getLength() > 1 && (aFormula[0] == '=' || aFormula[0] == '+' || aFormula[0] == '-');
-        }
+        aFormula = pEditEngine->GetText(0);
+        bEdit = aFormula.getLength() > 1 && (aFormula[0] == '=' || aFormula[0] == '+' || aFormula[0] == '-');
+    }
 
-        if ( !bEdit )
-        {
-            OUString aNewFormula('=');
-            if ( aFormula.startsWith("=") )
-                aNewFormula = aFormula;
+    if ( !bEdit )
+    {
+        OUString aNewFormula('=');
+        if ( aFormula.startsWith("=") )
+            aNewFormula = aFormula;
 
-            InputReplaceSelection( aNewFormula );
-        }
+        InputReplaceSelection( aNewFormula );
+    }
 
-        if (pFormulaData)
-        {
-            OUString aNew;
-            ScTypedCaseStrSet::const_iterator aPos = findText(*pFormulaData, pFormulaData->begin(), rFunctionName, aNew, /* backward = */false);
+    if (pFormulaData)
+    {
+        OUString aNew;
+        ScTypedCaseStrSet::const_iterator aPos = findText(*pFormulaData, pFormulaData->begin(), rFunctionName, aNew, /* backward = */false);
 
-            if (aPos != pFormulaData->end())
-            {
-                miAutoPosFormula = aPos;
-                PasteFunctionData();
-            }
+        if (aPos != pFormulaData->end())
+        {
+            miAutoPosFormula = aPos;
+            PasteFunctionData();
         }
     }
 }
@@ -1900,92 +1900,92 @@ void ScInputHandler::SkipClosingPar()
 
 void ScInputHandler::GetColData()
 {
-    if ( pActiveViewSh )
-    {
-        ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
+    if ( !pActiveViewSh )
+        return;
 
-        if ( pColumnData )
-            pColumnData->clear();
-        else
-            pColumnData.reset( new ScTypedCaseStrSet );
+    ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument();
 
-        std::vector<ScTypedStrData> aEntries;
-        rDoc.GetDataEntries(
-            aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aEntries, true);
-        if (!aEntries.empty())
-            pColumnData->insert(aEntries.begin(), aEntries.end());
+    if ( pColumnData )
+        pColumnData->clear();
+    else
+        pColumnData.reset( new ScTypedCaseStrSet );
 
-        miAutoPosColumn = pColumnData->end();
-    }
+    std::vector<ScTypedStrData> aEntries;
+    rDoc.GetDataEntries(
+        aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab(), aEntries, true);
+    if (!aEntries.empty())
+        pColumnData->insert(aEntries.begin(), aEntries.end());
+
+    miAutoPosColumn = pColumnData->end();
 }
 
 void ScInputHandler::UseColData() // When typing
 {
     EditView* pActiveView = pTopView ? pTopView : pTableView;
-    if ( pActiveView && pColumnData )
-    {
-        //  Only change when cursor is at the end
-        ESelection aSel = pActiveView->GetSelection();
-        aSel.Adjust();
+    if ( !(pActiveView && pColumnData) )
+        return;
 
-        sal_Int32 nParCnt = mpEditEngine->GetParagraphCount();
-        if ( aSel.nEndPara+1 == nParCnt )
-        {
-            sal_Int32 nParLen = mpEditEngine->GetTextLen( aSel.nEndPara );
-            if ( aSel.nEndPos == nParLen )
-            {
-                OUString aText = GetEditText(mpEditEngine.get());
-                if (!aText.isEmpty())
-                {
-                    OUString aNew;
-                    miAutoPosColumn = pColumnData->end();
-                    miAutoPosColumn = findText(*pColumnData, miAutoPosColumn, aText, aNew, false);
-                    if (miAutoPosColumn != pColumnData->end())
-                    {
-                        // Strings can contain line endings (e.g. due to dBase import),
-                        // which would result in multiple paragraphs here, which is not desirable.
-                        //! Then GetExactMatch doesn't work either
-                        lcl_RemoveLineEnd( aNew );
+    //  Only change when cursor is at the end
+    ESelection aSel = pActiveView->GetSelection();
+    aSel.Adjust();
 
-                        // Keep paragraph, just append the rest
-                        //! Exact replacement in EnterHandler !!!
-                        // One Space between paragraphs:
-                        sal_Int32 nEdLen = mpEditEngine->GetTextLen() + nParCnt - 1;
-                        OUString aIns = aNew.copy(nEdLen);
+    sal_Int32 nParCnt = mpEditEngine->GetParagraphCount();
+    if ( aSel.nEndPara+1 != nParCnt )
+        return;
 
-                        // Selection must be "backwards", so the cursor stays behind the last
-                        // typed character
-                        ESelection aSelection( aSel.nEndPara, aSel.nEndPos + aIns.getLength(),
-                                               aSel.nEndPara, aSel.nEndPos );
+    sal_Int32 nParLen = mpEditEngine->GetTextLen( aSel.nEndPara );
+    if ( aSel.nEndPos != nParLen )
+        return;
 
-                        // When editing in input line, apply to both edit views
-                        if ( pTableView )
-                        {
-                            pTableView->InsertText( aIns );
-                            pTableView->SetSelection( aSelection );
-                        }
-                        if ( pTopView )
-                        {
-                            pTopView->InsertText( aIns );
-                            pTopView->SetSelection( aSelection );
-                        }
+    OUString aText = GetEditText(mpEditEngine.get());
+    if (aText.isEmpty())
+        return;
 
-                        aAutoSearch = aText; // To keep searching - nAutoPos is set
+    OUString aNew;
+    miAutoPosColumn = pColumnData->end();
+    miAutoPosColumn = findText(*pColumnData, miAutoPosColumn, aText, aNew, false);
+    if (miAutoPosColumn != pColumnData->end())
+    {
+        // Strings can contain line endings (e.g. due to dBase import),
+        // which would result in multiple paragraphs here, which is not desirable.
+        //! Then GetExactMatch doesn't work either
+        lcl_RemoveLineEnd( aNew );
 
-                        if (aText.getLength() == aNew.getLength())
-                        {
-                            // If the inserted text is found, consume TAB only if there's more coming
-                            OUString aDummy;
-                            ScTypedCaseStrSet::const_iterator itNextPos =
-                                findText(*pColumnData, miAutoPosColumn, aText, aDummy, false);
-                            bUseTab = itNextPos != pColumnData->end();
-                        }
-                        else
-                            bUseTab = true;
-                    }
-                }
-            }
+        // Keep paragraph, just append the rest
+        //! Exact replacement in EnterHandler !!!
+        // One Space between paragraphs:
+        sal_Int32 nEdLen = mpEditEngine->GetTextLen() + nParCnt - 1;
+        OUString aIns = aNew.copy(nEdLen);
+
+        // Selection must be "backwards", so the cursor stays behind the last
+        // typed character
+        ESelection aSelection( aSel.nEndPara, aSel.nEndPos + aIns.getLength(),
+                               aSel.nEndPara, aSel.nEndPos );
+
+        // When editing in input line, apply to both edit views
+        if ( pTableView )
+        {
+            pTableView->InsertText( aIns );
+            pTableView->SetSelection( aSelection );
         }
+        if ( pTopView )
+        {
+            pTopView->InsertText( aIns );
+            pTopView->SetSelection( aSelection );
+        }
+
+        aAutoSearch = aText; // To keep searching - nAutoPos is set
+
+        if (aText.getLength() == aNew.getLength())
+        {
+            // If the inserted text is found, consume TAB only if there's more coming
+            OUString aDummy;
+            ScTypedCaseStrSet::const_iterator itNextPos =
+                findText(*pColumnData, miAutoPosColumn, aText, aDummy, false);
+            bUseTab = itNextPos != pColumnData->end();
+        }
+        else
+            bUseTab = true;
     }
 }
 
@@ -2712,30 +2712,30 @@ void ScInputHandler::ShowRefFrame()
     // checks in NotifyChange, and lead to keeping the wrong value in pActiveViewSh.
     // A local variable is used instead.
     ScTabViewShell* pVisibleSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current()  );
-    if ( pRefViewSh && pRefViewSh != pVisibleSh )
+    if ( !(pRefViewSh && pRefViewSh != pVisibleSh) )
+        return;
+
+    bool bFound = false;
+    SfxViewFrame* pRefFrame = pRefViewSh->GetViewFrame();
+    SfxViewFrame* pOneFrame = SfxViewFrame::GetFirst();
+    while ( pOneFrame && !bFound )
     {
-        bool bFound = false;
-        SfxViewFrame* pRefFrame = pRefViewSh->GetViewFrame();
-        SfxViewFrame* pOneFrame = SfxViewFrame::GetFirst();
-        while ( pOneFrame && !bFound )
-        {
-            if ( pOneFrame == pRefFrame )
-                bFound = true;
-            pOneFrame = SfxViewFrame::GetNext( *pOneFrame );
-        }
+        if ( pOneFrame == pRefFrame )
+            bFound = true;
+        pOneFrame = SfxViewFrame::GetNext( *pOneFrame );
+    }
 
-        if (bFound)
-        {
-            // We count on Activate working synchronously here
-            // (pActiveViewSh is set while doing so)
-            pRefViewSh->SetActive(); // Appear and SetViewFrame
+    if (bFound)
+    {
+        // We count on Activate working synchronously here
+        // (pActiveViewSh is set while doing so)
+        pRefViewSh->SetActive(); // Appear and SetViewFrame
 
-            //  pLastState is set correctly in the NotifyChange from the Activate
-        }
-        else
-        {
-            OSL_FAIL("ViewFrame for reference input is not here anymore");
-        }
+        //  pLastState is set correctly in the NotifyChange from the Activate
+    }
+    else
+    {
+        OSL_FAIL("ViewFrame for reference input is not here anymore");
     }
 }
 
@@ -2757,34 +2757,34 @@ void ScInputHandler::RemoveSelection()
 void ScInputHandler::InvalidateAttribs()
 {
     SfxViewFrame* pViewFrm = SfxViewFrame::Current();
-    if (pViewFrm)
-    {
-        SfxBindings& rBindings = pViewFrm->GetBindings();
+    if (!pViewFrm)
+        return;
 
-        rBindings.Invalidate( SID_ATTR_CHAR_FONT );
-        rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
-        rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
+    SfxBindings& rBindings = pViewFrm->GetBindings();
 
-        rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT );
-        rBindings.Invalidate( SID_ATTR_CHAR_POSTURE );
-        rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
-        rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
-        rBindings.Invalidate( SID_ULINE_VAL_NONE );
-        rBindings.Invalidate( SID_ULINE_VAL_SINGLE );
-        rBindings.Invalidate( SID_ULINE_VAL_DOUBLE );
-        rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
+    rBindings.Invalidate( SID_ATTR_CHAR_FONT );
+    rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
+    rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
 
-        rBindings.Invalidate( SID_HYPERLINK_GETLINK );
+    rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT );
+    rBindings.Invalidate( SID_ATTR_CHAR_POSTURE );
+    rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
+    rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
+    rBindings.Invalidate( SID_ULINE_VAL_NONE );
+    rBindings.Invalidate( SID_ULINE_VAL_SINGLE );
+    rBindings.Invalidate( SID_ULINE_VAL_DOUBLE );
+    rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
 
-        rBindings.Invalidate( SID_ATTR_CHAR_KERNING );
-        rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
-        rBindings.Invalidate( SID_SET_SUB_SCRIPT );
-        rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
-        rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED );
+    rBindings.Invalidate( SID_HYPERLINK_GETLINK );
 
-        rBindings.Invalidate( SID_SAVEDOC );
-        rBindings.Invalidate( SID_DOC_MODIFIED );
-    }
+    rBindings.Invalidate( SID_ATTR_CHAR_KERNING );
+    rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
+    rBindings.Invalidate( SID_SET_SUB_SCRIPT );
+    rBindings.Invalidate( SID_ATTR_CHAR_STRIKEOUT );
+    rBindings.Invalidate( SID_ATTR_CHAR_SHADOWED );
+
+    rBindings.Invalidate( SID_SAVEDOC );
+    rBindings.Invalidate( SID_DOC_MODIFIED );
 }
 
 // --------------- public methods --------------------------------------------
@@ -4146,33 +4146,33 @@ void ScInputHandler::ResetDelayTimer()
 
 IMPL_LINK_NOARG( ScInputHandler, DelayTimer, Timer*, void )
 {
-    if ( nullptr == pLastState || SC_MOD()->IsFormulaMode() || SC_MOD()->IsRefDialogOpen())
+    if ( !(nullptr == pLastState || SC_MOD()->IsFormulaMode() || SC_MOD()->IsRefDialogOpen()))
+        return;
+
+    //! New method at ScModule to query if function autopilot is open
+    SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+    if ( pViewFrm && pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) )
     {
-        //! New method at ScModule to query if function autopilot is open
-        SfxViewFrame* pViewFrm = SfxViewFrame::Current();
-        if ( pViewFrm && pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) )
+        if ( pInputWin)
         {
-            if ( pInputWin)
-            {
-                pInputWin->EnableButtons( false );
-                pInputWin->Disable();
-            }
+            pInputWin->EnableButtons( false );
+            pInputWin->Disable();
         }
-        else if ( !bFormulaMode ) // Keep formula e.g. for help
-        {
-            bInOwnChange = true; // disable ModifyHdl (reset below)
-
-            pActiveViewSh = nullptr;
-            mpEditEngine->SetTextCurrentDefaults( EMPTY_OUSTRING );
-            if ( pInputWin )
-            {
-                pInputWin->SetPosString( EMPTY_OUSTRING );
-                pInputWin->SetTextString( EMPTY_OUSTRING );
-                pInputWin->Disable();
-            }
+    }
+    else if ( !bFormulaMode ) // Keep formula e.g. for help
+    {
+        bInOwnChange = true; // disable ModifyHdl (reset below)
 
-            bInOwnChange = false;
+        pActiveViewSh = nullptr;
+        mpEditEngine->SetTextCurrentDefaults( EMPTY_OUSTRING );
+        if ( pInputWin )
+        {
+            pInputWin->SetPosString( EMPTY_OUSTRING );
+            pInputWin->SetTextString( EMPTY_OUSTRING );
+            pInputWin->Disable();
         }
+
+        bInOwnChange = false;
     }
 }
 
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index c67c8963327e..a867220207f4 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -527,19 +527,19 @@ void ScInputWindow::NotifyLOKClient()
     if (comphelper::LibreOfficeKit::isActive() && !GetLOKNotifier() && mpViewShell)
         SetLOKNotifier(mpViewShell);
 
-    if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
-    {
-        Size aSize = GetSizePixel();
-        if (!aSize.IsEmpty())
-        {
-            std::vector<vcl::LOKPayloadItem> aItems;
-            aItems.emplace_back("type", "calc-input-win");
-            aItems.emplace_back(std::make_pair("position", Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
-            aItems.emplace_back(std::make_pair("size", aSize.toString()));
-            aItems.emplace_back("lines", OString::number(aTextWindow.GetNumLines()));
-            pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
-        }
+    const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
+    if (!pNotifier)
+        return;
 
+    Size aSize = GetSizePixel();
+    if (!aSize.IsEmpty())
+    {
+        std::vector<vcl::LOKPayloadItem> aItems;
+        aItems.emplace_back("type", "calc-input-win");
+        aItems.emplace_back(std::make_pair("position", Point(GetOutOffXPixel(), GetOutOffYPixel()).toString()));
+        aItems.emplace_back(std::make_pair("size", aSize.toString()));
+        aItems.emplace_back("lines", OString::number(aTextWindow.GetNumLines()));
+        pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);
     }
 }
 
@@ -551,29 +551,29 @@ void ScInputWindow::SetFuncString( const OUString& rString, bool bDoEdit )
     aTextWindow.StartEditEngine();
 
     ScModule* pScMod = SC_MOD();
-    if ( pScMod->IsEditMode() )
-    {
-        if ( bDoEdit )
-            aTextWindow.GrabFocus();
-        aTextWindow.SetTextString( rString );
-        EditView* pView = aTextWindow.GetEditView();
-        if (pView)
-        {
-            sal_Int32 nLen = rString.getLength();
+    if ( !pScMod->IsEditMode() )
+        return;
 
-            if ( nLen > 0 )
-            {
-                nLen--;
-                pView->SetSelection( ESelection( 0, nLen, 0, nLen ) );
-            }
+    if ( bDoEdit )
+        aTextWindow.GrabFocus();
+    aTextWindow.SetTextString( rString );
+    EditView* pView = aTextWindow.GetEditView();
+    if (!pView)
+        return;
 
-            pScMod->InputChanged(pView);
-            if ( bDoEdit )
-                SetOkCancelMode(); // Not the case if immediately followed by Enter/Cancel
+    sal_Int32 nLen = rString.getLength();
 
-            pView->SetEditEngineUpdateMode(true);
-        }
+    if ( nLen > 0 )
+    {
+        nLen--;
+        pView->SetSelection( ESelection( 0, nLen, 0, nLen ) );
     }
+
+    pScMod->InputChanged(pView);
+    if ( bDoEdit )
+        SetOkCancelMode(); // Not the case if immediately followed by Enter/Cancel
+
+    pView->SetEditEngineUpdateMode(true);
 }
 
 void ScInputWindow::SetPosString( const OUString& rStr )
@@ -595,20 +595,20 @@ void ScInputWindow::SetOkCancelMode()
     SfxViewFrame* pViewFrm = SfxViewFrame::Current();
     EnableButtons( pViewFrm && !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) );
 
-    if (!bIsOkCancelMode)
-    {
-        EnableItem  ( SID_INPUT_SUM,   false );
-        EnableItem  ( SID_INPUT_EQUAL, false );
-        HideItem    ( SID_INPUT_SUM );
-        HideItem    ( SID_INPUT_EQUAL );
+    if (bIsOkCancelMode)
+        return;
 
-        ShowItem    ( SID_INPUT_CANCEL, true );
-        ShowItem    ( SID_INPUT_OK,     true );
-        EnableItem  ( SID_INPUT_CANCEL, true );
-        EnableItem  ( SID_INPUT_OK,     true );
+    EnableItem  ( SID_INPUT_SUM,   false );
+    EnableItem  ( SID_INPUT_EQUAL, false );
+    HideItem    ( SID_INPUT_SUM );
+    HideItem    ( SID_INPUT_EQUAL );
 
-        bIsOkCancelMode = true;
-    }
+    ShowItem    ( SID_INPUT_CANCEL, true );
+    ShowItem    ( SID_INPUT_OK,     true );
+    EnableItem  ( SID_INPUT_CANCEL, true );
+    EnableItem  ( SID_INPUT_OK,     true );
+
+    bIsOkCancelMode = true;
 }
 
 void ScInputWindow::SetSumAssignMode()
@@ -617,22 +617,22 @@ void ScInputWindow::SetSumAssignMode()
     SfxViewFrame* pViewFrm = SfxViewFrame::Current();
     EnableButtons( pViewFrm && !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) );
 
-    if (bIsOkCancelMode)
-    {
-        EnableItem  ( SID_INPUT_CANCEL, false );
-        EnableItem  ( SID_INPUT_OK,     false );
-        HideItem    ( SID_INPUT_CANCEL );
-        HideItem    ( SID_INPUT_OK );
+    if (!bIsOkCancelMode)
+        return;
 
-        ShowItem    ( SID_INPUT_SUM,    true );
-        ShowItem    ( SID_INPUT_EQUAL,  true );
-        EnableItem  ( SID_INPUT_SUM,    true );
-        EnableItem  ( SID_INPUT_EQUAL,  true );
+    EnableItem  ( SID_INPUT_CANCEL, false );
+    EnableItem  ( SID_INPUT_OK,     false );
+    HideItem    ( SID_INPUT_CANCEL );
+    HideItem    ( SID_INPUT_OK );
 
-        bIsOkCancelMode = false;
+    ShowItem    ( SID_INPUT_SUM,    true );
+    ShowItem    ( SID_INPUT_EQUAL,  true );
+    EnableItem  ( SID_INPUT_SUM,    true );
+    EnableItem  ( SID_INPUT_EQUAL,  true );
 
-        SetFormulaMode(false); // No editing -> no formula
-    }
+    bIsOkCancelMode = false;
+
+    SetFormulaMode(false); // No editing -> no formula
 }
 
 void ScInputWindow::SetFormulaMode( bool bSet )
@@ -824,36 +824,36 @@ void ScInputWindow::AutoSum( bool& bRangeFinder, bool& bSubTotal, OpCode eCode )
 {
     ScModule* pScMod = SC_MOD();
     ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current()  );
-    if ( pViewSh )
-    {
-        const OUString aFormula = pViewSh->DoAutoSum(bRangeFinder, bSubTotal, eCode);
-        if ( !aFormula.isEmpty() )
-        {
-            SetFuncString( aFormula );
-            const sal_Int32 aOpen = aFormula.indexOf('(');
-            const sal_Int32 aLen  = aFormula.getLength();
-            if (bRangeFinder && pScMod->IsEditMode())
-            {
-                ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh );
-                if ( pHdl )
-                {
-                    pHdl->InitRangeFinder( aFormula );
+    if ( !pViewSh )
+        return;
 
-                    //! SetSelection at the InputHandler?
-                    //! Set bSelIsRef?
-                    if ( aOpen != -1 && aLen > aOpen )
-                    {
-                        ESelection aSel( 0, aOpen + (bSubTotal ? 3 : 1), 0, aLen-1 );
-                        EditView* pTableView = pHdl->GetTableView();
-                        if ( pTableView )
-                            pTableView->SetSelection( aSel );
-                        EditView* pTopView = pHdl->GetTopView();
-                        if ( pTopView )
-                            pTopView->SetSelection( aSel );
-                    }
-                }
-            }
-        }
+    const OUString aFormula = pViewSh->DoAutoSum(bRangeFinder, bSubTotal, eCode);
+    if ( aFormula.isEmpty() )
+        return;
+
+    SetFuncString( aFormula );
+    const sal_Int32 aOpen = aFormula.indexOf('(');
+    const sal_Int32 aLen  = aFormula.getLength();
+    if (!(bRangeFinder && pScMod->IsEditMode()))
+        return;
+
+    ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh );
+    if ( !pHdl )
+        return;
+
+    pHdl->InitRangeFinder( aFormula );
+
+    //! SetSelection at the InputHandler?
+    //! Set bSelIsRef?
+    if ( aOpen != -1 && aLen > aOpen )
+    {
+        ESelection aSel( 0, aOpen + (bSubTotal ? 3 : 1), 0, aLen-1 );
+        EditView* pTableView = pHdl->GetTableView();
+        if ( pTableView )
+            pTableView->SetSelection( aSel );
+        EditView* pTopView = pHdl->GetTopView();
+        if ( pTopView )
+            pTopView->SetSelection( aSel );
     }
 }
 
@@ -1081,39 +1081,39 @@ void ScInputBarGroup::TriggerToolboxLayout()
     if ( !mnVertOffset )
         mnVertOffset = rParent.GetItemPosRect( rParent.GetItemCount() - 1 ).Top();
 
-    if ( pViewFrm )
-    {
-        Reference< css::beans::XPropertySet > xPropSet( pViewFrm->GetFrame().GetFrameInterface(), UNO_QUERY );
-        Reference< css::frame::XLayoutManager > xLayoutManager;
+    if ( !pViewFrm )
+        return;
 
-        if ( xPropSet.is() )
-        {
-            css::uno::Any aValue = xPropSet->getPropertyValue("LayoutManager");
-            aValue >>= xLayoutManager;
-        }
+    Reference< css::beans::XPropertySet > xPropSet( pViewFrm->GetFrame().GetFrameInterface(), UNO_QUERY );
+    Reference< css::frame::XLayoutManager > xLayoutManager;
 
-        if ( xLayoutManager.is() )
-        {
-            xLayoutManager->lock();
-            DataChangedEvent aFakeUpdate( DataChangedEventType::SETTINGS, nullptr,  AllSettingsFlags::STYLE );
-
-            // this basically will trigger the repositioning of the
-            // items in the toolbar from ImplFormat ( which is controlled by
-            // mnWinHeight ) which in turn is updated in ImplCalcItem which is
-            // controlled by mbCalc. Additionally the ImplFormat above is
-            // controlled via mbFormat. It seems the easiest way to get these
-            // booleans set is to send in the fake event below.
-            rParent.DataChanged( aFakeUpdate);
-
-            // highest item in toolbar will have been calculated via the
-            // event above. Call resize on InputBar to pick up the height
-            // change
-            rParent.Resize();
-
-            // unlock relayouts the toolbars in the 4 quadrants
-            xLayoutManager->unlock();
-        }
+    if ( xPropSet.is() )
+    {
+        css::uno::Any aValue = xPropSet->getPropertyValue("LayoutManager");
+        aValue >>= xLayoutManager;
     }
+
+    if ( !xLayoutManager.is() )
+        return;
+
+    xLayoutManager->lock();
+    DataChangedEvent aFakeUpdate( DataChangedEventType::SETTINGS, nullptr,  AllSettingsFlags::STYLE );
+
+    // this basically will trigger the repositioning of the
+    // items in the toolbar from ImplFormat ( which is controlled by
+    // mnWinHeight ) which in turn is updated in ImplCalcItem which is
+    // controlled by mbCalc. Additionally the ImplFormat above is
+    // controlled via mbFormat. It seems the easiest way to get these
+    // booleans set is to send in the fake event below.
+    rParent.DataChanged( aFakeUpdate);
+
+    // highest item in toolbar will have been calculated via the
+    // event above. Call resize on InputBar to pick up the height
+    // change
+    rParent.Resize();
+
+    // unlock relayouts the toolbars in the 4 quadrants
+    xLayoutManager->unlock();
 }
 
 void ScInputBarGroup::TextGrabFocus()
@@ -2277,21 +2277,21 @@ void ScPosWnd::FillFunctions()
 
 void ScPosWnd::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
-    if ( !bFormulaMode )
+    if ( bFormulaMode )
+        return;
+
+    // Does the list of range names need updating?
+    if ( dynamic_cast<const SfxEventHint*>(&rHint) )
     {
-        // Does the list of range names need updating?
-        if ( dynamic_cast<const SfxEventHint*>(&rHint) )
-        {
-            SfxEventHintId nEventId = static_cast<const SfxEventHint*>(&rHint)->GetEventId();
-            if ( nEventId == SfxEventHintId::ActivateDoc )
-                FillRangeNames();
-        }
-        else
-        {
-            const SfxHintId nHintId = rHint.GetId();
-            if ( nHintId == SfxHintId::ScAreasChanged || nHintId == SfxHintId::ScNavigatorUpdateAll)
-                FillRangeNames();
-        }
+        SfxEventHintId nEventId = static_cast<const SfxEventHint*>(&rHint)->GetEventId();
+        if ( nEventId == SfxEventHintId::ActivateDoc )
+            FillRangeNames();
+    }
+    else
+    {
+        const SfxHintId nHintId = rHint.GetId();
+        if ( nHintId == SfxHintId::ScAreasChanged || nHintId == SfxHintId::ScNavigatorUpdateAll)
+            FillRangeNames();
     }
 }
 
@@ -2362,53 +2362,53 @@ IMPL_LINK_NOARG(ScPosWnd, ModifyHdl, weld::ComboBox&, void)
         return;
     }
 
-    if (!bFormulaMode)
-    {
-        // determine the action that would be taken for the current input
+    if (bFormulaMode)
+        return;
 
-        ScNameInputType eType = lcl_GetInputType(m_xWidget->get_active_text());      // uses current view
-        const char* pStrId = nullptr;
-        switch ( eType )
-        {
-            case SC_NAME_INPUT_CELL:
-                pStrId = STR_NAME_INPUT_CELL;
-                break;
-            case SC_NAME_INPUT_RANGE:
-            case SC_NAME_INPUT_NAMEDRANGE:
-                pStrId = STR_NAME_INPUT_RANGE;      // named range or range reference
-                break;
-            case SC_NAME_INPUT_DATABASE:
-                pStrId = STR_NAME_INPUT_DBRANGE;
-                break;
-            case SC_NAME_INPUT_ROW:
-                pStrId = STR_NAME_INPUT_ROW;
-                break;
-            case SC_NAME_INPUT_SHEET:
-                pStrId = STR_NAME_INPUT_SHEET;
-                break;
-            case SC_NAME_INPUT_DEFINE:
-                pStrId = STR_NAME_INPUT_DEFINE;
-                break;
-            default:
-                // other cases (error): no tip help
-                break;
-        }
+    // determine the action that would be taken for the current input
 
-        if (pStrId)
-        {
-            // show the help tip at the text cursor position
-            Point aPos;
-            vcl::Cursor* pCur = GetCursor();
-            if (pCur)
-                aPos = LogicToPixel( pCur->GetPos() );
-            aPos = OutputToScreenPixel( aPos );
-            tools::Rectangle aRect( aPos, aPos );
-
-            OUString aText = ScResId(pStrId);
-            QuickHelpFlags const nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom;
-            nTipVisible = Help::ShowPopover(this, aRect, aText, nAlign);
-        }
+    ScNameInputType eType = lcl_GetInputType(m_xWidget->get_active_text());      // uses current view
+    const char* pStrId = nullptr;
+    switch ( eType )
+    {
+        case SC_NAME_INPUT_CELL:
+            pStrId = STR_NAME_INPUT_CELL;
+            break;
+        case SC_NAME_INPUT_RANGE:
+        case SC_NAME_INPUT_NAMEDRANGE:
+            pStrId = STR_NAME_INPUT_RANGE;      // named range or range reference
+            break;
+        case SC_NAME_INPUT_DATABASE:
+            pStrId = STR_NAME_INPUT_DBRANGE;
+            break;
+        case SC_NAME_INPUT_ROW:
+            pStrId = STR_NAME_INPUT_ROW;
+            break;
+        case SC_NAME_INPUT_SHEET:
+            pStrId = STR_NAME_INPUT_SHEET;
+            break;
+        case SC_NAME_INPUT_DEFINE:
+            pStrId = STR_NAME_INPUT_DEFINE;
+            break;
+        default:
+            // other cases (error): no tip help
+            break;
     }
+
+    if (!pStrId)
+        return;
+
+    // show the help tip at the text cursor position
+    Point aPos;
+    vcl::Cursor* pCur = GetCursor();
+    if (pCur)
+        aPos = LogicToPixel( pCur->GetPos() );
+    aPos = OutputToScreenPixel( aPos );
+    tools::Rectangle aRect( aPos, aPos );
+
+    OUString aText = ScResId(pStrId);
+    QuickHelpFlags const nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom;
+    nTipVisible = Help::ShowPopover(this, aRect, aText, nAlign);
 }
 
 void ScPosWnd::DoEnter()
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index db559c4ce4a9..8c9bf33d3056 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -686,34 +686,34 @@ const ScDocOptions& ScModule::GetDocOptions()
 
 void ScModule::InsertEntryToLRUList(sal_uInt16 nFIndex)
 {
-    if(nFIndex != 0)
-    {
-        const ScAppOptions& rAppOpt = GetAppOptions();
-        sal_uInt16 nLRUFuncCount = std::min( rAppOpt.GetLRUFuncListCount(), sal_uInt16(LRU_MAX) );
-        sal_uInt16* pLRUListIds = rAppOpt.GetLRUFuncList();
+    if(nFIndex == 0)
+        return;
 
-        sal_uInt16  aIdxList[LRU_MAX];
-        sal_uInt16  n = 0;
-        bool    bFound = false;
+    const ScAppOptions& rAppOpt = GetAppOptions();
+    sal_uInt16 nLRUFuncCount = std::min( rAppOpt.GetLRUFuncListCount(), sal_uInt16(LRU_MAX) );
+    sal_uInt16* pLRUListIds = rAppOpt.GetLRUFuncList();
 
-        while ((n < LRU_MAX) && n<nLRUFuncCount)                        // Iterate through old list
-        {
-            if (!bFound && (pLRUListIds[n]== nFIndex))
-                bFound = true;                                          // First hit!
-            else if (bFound)
-                aIdxList[n  ] = pLRUListIds[n];                         // Copy after hit
-            else if ((n+1) < LRU_MAX)
-                aIdxList[n+1] = pLRUListIds[n];                         // Move before hit
-            n++;
-        }
-        if (!bFound && (n < LRU_MAX))                                   // Entry not found?
-            n++;                                                        // One more
-        aIdxList[0] = nFIndex;                                          // Current on Top
+    sal_uInt16  aIdxList[LRU_MAX];
+    sal_uInt16  n = 0;
+    bool    bFound = false;
 
-        ScAppOptions aNewOpts(rAppOpt);                                 // Let App know
-        aNewOpts.SetLRUFuncList(aIdxList, n);
-        SetAppOptions(aNewOpts);
+    while ((n < LRU_MAX) && n<nLRUFuncCount)                        // Iterate through old list
+    {
+        if (!bFound && (pLRUListIds[n]== nFIndex))
+            bFound = true;                                          // First hit!
+        else if (bFound)
+            aIdxList[n  ] = pLRUListIds[n];                         // Copy after hit
+        else if ((n+1) < LRU_MAX)
+            aIdxList[n+1] = pLRUListIds[n];                         // Move before hit
+        n++;
     }
+    if (!bFound && (n < LRU_MAX))                                   // Entry not found?
+        n++;                                                        // One more
+    aIdxList[0] = nFIndex;                                          // Current on Top
+
+    ScAppOptions aNewOpts(rAppOpt);                                 // Let App know
+    aNewOpts.SetLRUFuncList(aIdxList, n);
+    SetAppOptions(aNewOpts);
 }
 
 void ScModule::SetAppOptions( const ScAppOptions& rOpt )
@@ -1255,45 +1255,45 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
     }
 
     // update ref device (for all documents)
-    if ( bUpdateRefDev )
+    if ( !bUpdateRefDev )
+        return;
+
+    // for all documents: recalc output factor, update row heights
+    SfxObjectShell* pObjSh = SfxObjectShell::GetFirst();
+    while ( pObjSh )
     {
-        // for all documents: recalc output factor, update row heights
-        SfxObjectShell* pObjSh = SfxObjectShell::GetFirst();
-        while ( pObjSh )
+        if ( dynamic_cast<const ScDocShell *>(pObjSh) != nullptr )
         {
-            if ( dynamic_cast<const ScDocShell *>(pObjSh) != nullptr )
-            {
-                ScDocShell* pOneDocSh = static_cast<ScDocShell*>(pObjSh);
-                pOneDocSh->CalcOutputFactor();
-                SCTAB nTabCount = pOneDocSh->GetDocument().GetTableCount();
-                for (SCTAB nTab=0; nTab<nTabCount; nTab++)
-                    pOneDocSh->AdjustRowHeight( 0, pDocSh->GetDocument().MaxRow(), nTab );
-            }
-            pObjSh = SfxObjectShell::GetNext( *pObjSh );
+            ScDocShell* pOneDocSh = static_cast<ScDocShell*>(pObjSh);
+            pOneDocSh->CalcOutputFactor();
+            SCTAB nTabCount = pOneDocSh->GetDocument().GetTableCount();
+            for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+                pOneDocSh->AdjustRowHeight( 0, pDocSh->GetDocument().MaxRow(), nTab );
         }
+        pObjSh = SfxObjectShell::GetNext( *pObjSh );
+    }
 
-        // for all (tab-) views:
-        SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> );
-        while ( pSh )
-        {
-            ScTabViewShell* pOneViewSh = static_cast<ScTabViewShell*>(pSh);
+    // for all (tab-) views:
+    SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> );
+    while ( pSh )
+    {
+        ScTabViewShell* pOneViewSh = static_cast<ScTabViewShell*>(pSh);
 
-            // set ref-device for EditEngine
-            ScInputHandler* pHdl = GetInputHdl(pOneViewSh);
-            if (pHdl)
-                pHdl->UpdateRefDevice();
+        // set ref-device for EditEngine
+        ScInputHandler* pHdl = GetInputHdl(pOneViewSh);
+        if (pHdl)
+            pHdl->UpdateRefDevice();
 
-            // update view scale
-            ScViewData& rViewData = pOneViewSh->GetViewData();
-            pOneViewSh->SetZoom( rViewData.GetZoomX(), rViewData.GetZoomY(), false );
+        // update view scale
+        ScViewData& rViewData = pOneViewSh->GetViewData();
+        pOneViewSh->SetZoom( rViewData.GetZoomX(), rViewData.GetZoomY(), false );
 
-            // repaint
-            pOneViewSh->PaintGrid();
-            pOneViewSh->PaintTop();
-            pOneViewSh->PaintLeft();
+        // repaint
+        pOneViewSh->PaintGrid();
+        pOneViewSh->PaintTop();
+        pOneViewSh->PaintLeft();
 
-            pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
-        }
+        pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
     }
 }
 
@@ -1430,34 +1430,34 @@ void ScModule::InputTurnOffWinEngine()
 void ScModule::ActivateInputWindow( const OUString* pStrFormula, bool bMatrix )
 {
     ScInputHandler* pHdl = GetInputHdl();
-    if ( pHdl )
+    if ( !pHdl )
+        return;
+
+    ScInputWindow* pWin = pHdl->GetInputWindow();
+    if ( pStrFormula )
     {
-        ScInputWindow* pWin = pHdl->GetInputWindow();
-        if ( pStrFormula )
+        // Take over formula
+        if ( pWin )
         {
-            // Take over formula
-            if ( pWin )
-            {
-                pWin->SetFuncString( *pStrFormula, false );
-                // SetSumAssignMode due to sal_False not necessary
-            }
-            ScEnterMode nMode = bMatrix ? ScEnterMode::MATRIX : ScEnterMode::NORMAL;
-            pHdl->EnterHandler( nMode );
-
-            // Without Invalidate the selection remains active, if the formula has not changed
-            if (pWin)
-                pWin->TextInvalidate();
+            pWin->SetFuncString( *pStrFormula, false );
+            // SetSumAssignMode due to sal_False not necessary
         }
-        else
+        ScEnterMode nMode = bMatrix ? ScEnterMode::MATRIX : ScEnterMode::NORMAL;
+        pHdl->EnterHandler( nMode );
+
+        // Without Invalidate the selection remains active, if the formula has not changed
+        if (pWin)
+            pWin->TextInvalidate();
+    }
+    else
+    {
+        // Cancel
+        if ( pWin )
         {
-            // Cancel
-            if ( pWin )
-            {
-                pWin->SetFuncString( EMPTY_OUSTRING, false );
-                // SetSumAssignMode due to sal_False no necessary
-            }
-            pHdl->CancelHandler();
+            pWin->SetFuncString( EMPTY_OUSTRING, false );
+            // SetSumAssignMode due to sal_False no necessary
         }
+        pHdl->CancelHandler();
     }
 }
 
@@ -1468,47 +1468,47 @@ void ScModule::SetRefDialog( sal_uInt16 nId, bool bVis, SfxViewFrame* pViewFrm )
 {
     //TODO: Move reference dialog handling to view
     //      Just keep function autopilot here for references to other documents
-    if ( m_nCurRefDlgId == 0 || ( nId == m_nCurRefDlgId && !bVis )
-       || ( comphelper::LibreOfficeKit::isActive() ) )
-    {
-        if ( !pViewFrm )
-            pViewFrm = SfxViewFrame::Current();
+    if ( !(m_nCurRefDlgId == 0 || ( nId == m_nCurRefDlgId && !bVis )
+       || ( comphelper::LibreOfficeKit::isActive() )) )
+        return;
 
-        // bindings update causes problems with update of stylist if
-        // current style family has changed
-        //if ( pViewFrm )
-        //  pViewFrm->GetBindings().Update();       // to avoid trouble in LockDispatcher
+    if ( !pViewFrm )
+        pViewFrm = SfxViewFrame::Current();
 
-        // before SetChildWindow
-        if ( comphelper::LibreOfficeKit::isActive() )
-        {
-            if ( bVis )
-                m_nCurRefDlgId = nId;
-        }
-        else
-        {
-            m_nCurRefDlgId = bVis ? nId : 0;
-        }
+    // bindings update causes problems with update of stylist if
+    // current style family has changed
+    //if ( pViewFrm )
+    //  pViewFrm->GetBindings().Update();       // to avoid trouble in LockDispatcher
 
-        if ( pViewFrm )
-        {
-            //  store the dialog id also in the view shell
-            SfxViewShell* pViewSh = pViewFrm->GetViewShell();
-            if (ScTabViewShell* pTabViewSh = dynamic_cast<ScTabViewShell*>(pViewSh))
-                pTabViewSh->SetCurRefDlgId(m_nCurRefDlgId);
-            else
-            {
-                // no ScTabViewShell - possible for example from a Basic macro
-                bVis = false;
-                m_nCurRefDlgId = 0;   // don't set nCurRefDlgId if no dialog is created
-            }
+    // before SetChildWindow
+    if ( comphelper::LibreOfficeKit::isActive() )
+    {
+        if ( bVis )
+            m_nCurRefDlgId = nId;
+    }
+    else
+    {
+        m_nCurRefDlgId = bVis ? nId : 0;
+    }
 
-            pViewFrm->SetChildWindow( nId, bVis );
+    if ( pViewFrm )
+    {
+        //  store the dialog id also in the view shell
+        SfxViewShell* pViewSh = pViewFrm->GetViewShell();
+        if (ScTabViewShell* pTabViewSh = dynamic_cast<ScTabViewShell*>(pViewSh))
+            pTabViewSh->SetCurRefDlgId(m_nCurRefDlgId);
+        else
+        {
+            // no ScTabViewShell - possible for example from a Basic macro
+            bVis = false;
+            m_nCurRefDlgId = 0;   // don't set nCurRefDlgId if no dialog is created
         }
 
-        SfxApplication* pSfxApp = SfxGetpApp();
-        pSfxApp->Broadcast( SfxHint( SfxHintId::ScRefModeChanged ) );
+        pViewFrm->SetChildWindow( nId, bVis );
     }
+
+    SfxApplication* pSfxApp = SfxGetpApp();
+    pSfxApp->Broadcast( SfxHint( SfxHintId::ScRefModeChanged ) );
 }
 
 static SfxChildWindow* lcl_GetChildWinFromCurrentView( sal_uInt16 nId )
@@ -1756,26 +1756,26 @@ void ScModule::EndReference()
     // We also annul the ZoomIn again in RefDialogs
 
     //FIXME: ShowRefFrame at InputHdl, if the Function AutoPilot is open?
-    if ( m_nCurRefDlgId )
-    {
-        SfxChildWindow* pChildWnd = nullptr;
+    if ( !m_nCurRefDlgId )
+        return;
 
-        if ( comphelper::LibreOfficeKit::isActive() )
-            pChildWnd = lcl_GetChildWinFromCurrentView( m_nCurRefDlgId );
-        else
-            pChildWnd = lcl_GetChildWinFromAnyView( m_nCurRefDlgId );
+    SfxChildWindow* pChildWnd = nullptr;
 
-        OSL_ENSURE( pChildWnd, "NoChildWin" );
-        if ( pChildWnd )
+    if ( comphelper::LibreOfficeKit::isActive() )
+        pChildWnd = lcl_GetChildWinFromCurrentView( m_nCurRefDlgId );
+    else
+        pChildWnd = lcl_GetChildWinFromAnyView( m_nCurRefDlgId );
+
+    OSL_ENSURE( pChildWnd, "NoChildWin" );
+    if ( pChildWnd )
+    {
+        if (pChildWnd->GetController())
         {
-            if (pChildWnd->GetController())
+            IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
+            assert(pRefDlg);
+            if(pRefDlg)
             {
-                IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
-                assert(pRefDlg);
-                if(pRefDlg)
-                {
-                    pRefDlg->SetActive();
-                }
+                pRefDlg->SetActive();
             }
         }
     }
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index fd75eeac6486..ddb7ce5b670f 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -663,153 +663,153 @@ ScMarkData ScTransferObj::GetSourceMarkData() const
 
 void ScTransferObj::InitDocShell(bool bLimitToPageSize)
 {
-    if ( !m_aDocShellRef.is() )
-    {
-        ScDocShell* pDocSh = new ScDocShell;
-        m_aDocShellRef = pDocSh;      // ref must be there before InitNew
+    if ( m_aDocShellRef.is() )
+        return;
 
-        pDocSh->DoInitNew();
+    ScDocShell* pDocSh = new ScDocShell;
+    m_aDocShellRef = pDocSh;      // ref must be there before InitNew
 
-        ScDocument& rDestDoc = pDocSh->GetDocument();
-        ScMarkData aDestMark(rDestDoc.GetSheetLimits());
-        aDestMark.SelectTable( 0, true );
+    pDocSh->DoInitNew();
 
-        rDestDoc.SetDocOptions( m_pDoc->GetDocOptions() );   // #i42666#
+    ScDocument& rDestDoc = pDocSh->GetDocument();
+    ScMarkData aDestMark(rDestDoc.GetSheetLimits());
+    aDestMark.SelectTable( 0, true );
 
-        OUString aTabName;
-        m_pDoc->GetName( m_aBlock.aStart.Tab(), aTabName );
-        rDestDoc.RenameTab( 0, aTabName );
+    rDestDoc.SetDocOptions( m_pDoc->GetDocOptions() );   // #i42666#
 
-        rDestDoc.CopyStdStylesFrom( m_pDoc.get() );
+    OUString aTabName;
+    m_pDoc->GetName( m_aBlock.aStart.Tab(), aTabName );
+    rDestDoc.RenameTab( 0, aTabName );
 
-        SCCOL nStartX = m_aBlock.aStart.Col();
-        SCROW nStartY = m_aBlock.aStart.Row();
-        SCCOL nEndX = m_aBlock.aEnd.Col();
-        SCROW nEndY = m_aBlock.aEnd.Row();
+    rDestDoc.CopyStdStylesFrom( m_pDoc.get() );
 
-        //  widths / heights
-        //  (must be copied before CopyFromClip, for drawing objects)
+    SCCOL nStartX = m_aBlock.aStart.Col();
+    SCROW nStartY = m_aBlock.aStart.Row();
+    SCCOL nEndX = m_aBlock.aEnd.Col();
+    SCROW nEndY = m_aBlock.aEnd.Row();
 
-        SCCOL nCol;
-        SCTAB nSrcTab = m_aBlock.aStart.Tab();
-        rDestDoc.SetLayoutRTL(0, m_pDoc->IsLayoutRTL(nSrcTab));
-        for (nCol=nStartX; nCol<=nEndX; nCol++)
-            if ( m_pDoc->ColHidden(nCol, nSrcTab) )
-                rDestDoc.ShowCol( nCol, 0, false );
-            else
-                rDestDoc.SetColWidth( nCol, 0, m_pDoc->GetColWidth( nCol, nSrcTab ) );
+    //  widths / heights
+    //  (must be copied before CopyFromClip, for drawing objects)
 
-        if (nStartY > 0)
-        {
-            // Set manual height for all previous rows so we can ensure
-            // that visible area will not change due to autoheight
-            rDestDoc.SetManualHeight(0, nStartY - 1, 0, true);
-        }
-        for (SCROW nRow = nStartY; nRow <= nEndY; ++nRow)
+    SCCOL nCol;
+    SCTAB nSrcTab = m_aBlock.aStart.Tab();
+    rDestDoc.SetLayoutRTL(0, m_pDoc->IsLayoutRTL(nSrcTab));
+    for (nCol=nStartX; nCol<=nEndX; nCol++)
+        if ( m_pDoc->ColHidden(nCol, nSrcTab) )
+            rDestDoc.ShowCol( nCol, 0, false );
+        else
+            rDestDoc.SetColWidth( nCol, 0, m_pDoc->GetColWidth( nCol, nSrcTab ) );
+
+    if (nStartY > 0)
+    {
+        // Set manual height for all previous rows so we can ensure
+        // that visible area will not change due to autoheight
+        rDestDoc.SetManualHeight(0, nStartY - 1, 0, true);
+    }
+    for (SCROW nRow = nStartY; nRow <= nEndY; ++nRow)
+    {
+        if ( m_pDoc->RowHidden(nRow, nSrcTab) )
+            rDestDoc.ShowRow( nRow, 0, false );
+        else
         {
-            if ( m_pDoc->RowHidden(nRow, nSrcTab) )
-                rDestDoc.ShowRow( nRow, 0, false );
-            else
-            {
-                rDestDoc.SetRowHeight( nRow, 0, m_pDoc->GetOriginalHeight( nRow, nSrcTab ) );
+            rDestDoc.SetRowHeight( nRow, 0, m_pDoc->GetOriginalHeight( nRow, nSrcTab ) );
 
-                //  if height was set manually, that flag has to be copied, too
-                bool bManual = m_pDoc->IsManualRowHeight(nRow, nSrcTab);
-                rDestDoc.SetManualHeight(nRow, nRow, 0, bManual);
-            }
+            //  if height was set manually, that flag has to be copied, too
+            bool bManual = m_pDoc->IsManualRowHeight(nRow, nSrcTab);
+            rDestDoc.SetManualHeight(nRow, nRow, 0, bManual);
         }
+    }
 
-        if (m_pDoc->GetDrawLayer() || m_pDoc->HasNotes())
-            pDocSh->MakeDrawLayer();
+    if (m_pDoc->GetDrawLayer() || m_pDoc->HasNotes())
+        pDocSh->MakeDrawLayer();
 
-        //  cell range is copied to the original position, but on the first sheet
-        //  -> bCutMode must be set
-        //  pDoc is always a Clipboard-document
+    //  cell range is copied to the original position, but on the first sheet
+    //  -> bCutMode must be set
+    //  pDoc is always a Clipboard-document
 
-        ScRange aDestRange( nStartX,nStartY,0, nEndX,nEndY,0 );
-        bool bWasCut = m_pDoc->IsCutMode();
-        if (!bWasCut)
-            m_pDoc->SetClipArea( aDestRange, true );          // Cut
-        rDestDoc.CopyFromClip( aDestRange, aDestMark, InsertDeleteFlags::ALL, nullptr, m_pDoc.get(), false );
-        m_pDoc->SetClipArea( aDestRange, bWasCut );
+    ScRange aDestRange( nStartX,nStartY,0, nEndX,nEndY,0 );
+    bool bWasCut = m_pDoc->IsCutMode();
+    if (!bWasCut)
+        m_pDoc->SetClipArea( aDestRange, true );          // Cut
+    rDestDoc.CopyFromClip( aDestRange, aDestMark, InsertDeleteFlags::ALL, nullptr, m_pDoc.get(), false );
+    m_pDoc->SetClipArea( aDestRange, bWasCut );
 
-        StripRefs( m_pDoc.get(), nStartX,nStartY, nEndX,nEndY, &rDestDoc );
+    StripRefs( m_pDoc.get(), nStartX,nStartY, nEndX,nEndY, &rDestDoc );
 
-        ScRange aMergeRange = aDestRange;
-        rDestDoc.ExtendMerge( aMergeRange, true );
+    ScRange aMergeRange = aDestRange;
+    rDestDoc.ExtendMerge( aMergeRange, true );
 
-        m_pDoc->CopyDdeLinks( &rDestDoc );         // copy values of DDE Links
+    m_pDoc->CopyDdeLinks( &rDestDoc );         // copy values of DDE Links
 
-        //  page format (grid etc) and page size (maximum size for ole object)
+    //  page format (grid etc) and page size (maximum size for ole object)
 
-        Size aPaperSize = SvxPaperInfo::GetPaperSize( PAPER_A4 );       // Twips
-        ScStyleSheetPool* pStylePool = m_pDoc->GetStyleSheetPool();
-        OUString aStyleName = m_pDoc->GetPageStyle( m_aBlock.aStart.Tab() );
-        SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aStyleName, SfxStyleFamily::Page );
-        if (pStyleSheet)
-        {
-            const SfxItemSet& rSourceSet = pStyleSheet->GetItemSet();
-            aPaperSize = rSourceSet.Get(ATTR_PAGE_SIZE).GetSize();
+    Size aPaperSize = SvxPaperInfo::GetPaperSize( PAPER_A4 );       // Twips
+    ScStyleSheetPool* pStylePool = m_pDoc->GetStyleSheetPool();
+    OUString aStyleName = m_pDoc->GetPageStyle( m_aBlock.aStart.Tab() );
+    SfxStyleSheetBase* pStyleSheet = pStylePool->Find( aStyleName, SfxStyleFamily::Page );
+    if (pStyleSheet)
+    {
+        const SfxItemSet& rSourceSet = pStyleSheet->GetItemSet();
+        aPaperSize = rSourceSet.Get(ATTR_PAGE_SIZE).GetSize();
 
-            // CopyStyleFrom copies SetItems with correct pool
-            ScStyleSheetPool* pDestPool = rDestDoc.GetStyleSheetPool();
-            pDestPool->CopyStyleFrom( pStylePool, aStyleName, SfxStyleFamily::Page );
-        }
+        // CopyStyleFrom copies SetItems with correct pool
+        ScStyleSheetPool* pDestPool = rDestDoc.GetStyleSheetPool();
+        pDestPool->CopyStyleFrom( pStylePool, aStyleName, SfxStyleFamily::Page );
+    }
 
-        ScViewData aViewData( pDocSh, nullptr );
-        aViewData.SetScreen( nStartX,nStartY, nEndX,nEndY );
-        aViewData.SetCurX( nStartX );
-        aViewData.SetCurY( nStartY );
+    ScViewData aViewData( pDocSh, nullptr );
+    aViewData.SetScreen( nStartX,nStartY, nEndX,nEndY );
+    aViewData.SetCurX( nStartX );
+    aViewData.SetCurY( nStartY );
 
-        rDestDoc.SetViewOptions( m_pDoc->GetViewOptions() );
+    rDestDoc.SetViewOptions( m_pDoc->GetViewOptions() );
 
-        //      Size
-        //! get while copying sizes
+    //      Size
+    //! get while copying sizes
 
-        long nPosX = 0;
-        long nPosY = 0;
+    long nPosX = 0;
+    long nPosY = 0;
 
-        for (nCol=0; nCol<nStartX; nCol++)
-            nPosX += rDestDoc.GetColWidth( nCol, 0 );
-        nPosY += rDestDoc.GetRowHeight( 0, nStartY-1, 0 );
-        nPosX = static_cast<long>( nPosX * HMM_PER_TWIPS );
-        nPosY = static_cast<long>( nPosY * HMM_PER_TWIPS );
+    for (nCol=0; nCol<nStartX; nCol++)
+        nPosX += rDestDoc.GetColWidth( nCol, 0 );
+    nPosY += rDestDoc.GetRowHeight( 0, nStartY-1, 0 );
+    nPosX = static_cast<long>( nPosX * HMM_PER_TWIPS );
+    nPosY = static_cast<long>( nPosY * HMM_PER_TWIPS );
 
-        aPaperSize.setWidth( aPaperSize.Width() * 2 );       // limit OLE object to double of page size
-        aPaperSize.setHeight( aPaperSize.Height() * 2 );
+    aPaperSize.setWidth( aPaperSize.Width() * 2 );       // limit OLE object to double of page size
+    aPaperSize.setHeight( aPaperSize.Height() * 2 );
 
-        long nSizeX = 0;
-        long nSizeY = 0;
-        for (nCol=nStartX; nCol<=nEndX; nCol++)
-        {
-            long nAdd = rDestDoc.GetColWidth( nCol, 0 );
-            if ( bLimitToPageSize && nSizeX+nAdd > aPaperSize.Width() && nSizeX )   // above limit?
-                break;
-            nSizeX += nAdd;
-        }
-        for (SCROW nRow=nStartY; nRow<=nEndY; nRow++)
-        {
-            long nAdd = rDestDoc.GetRowHeight( nRow, 0 );
-            if ( bLimitToPageSize && nSizeY+nAdd > aPaperSize.Height() && nSizeY )  // above limit?
-                break;
-            nSizeY += nAdd;
-        }
-        nSizeX = static_cast<long>( nSizeX * HMM_PER_TWIPS );
-        nSizeY = static_cast<long>( nSizeY * HMM_PER_TWIPS );
+    long nSizeX = 0;
+    long nSizeY = 0;
+    for (nCol=nStartX; nCol<=nEndX; nCol++)
+    {
+        long nAdd = rDestDoc.GetColWidth( nCol, 0 );
+        if ( bLimitToPageSize && nSizeX+nAdd > aPaperSize.Width() && nSizeX )   // above limit?
+            break;
+        nSizeX += nAdd;
+    }
+    for (SCROW nRow=nStartY; nRow<=nEndY; nRow++)
+    {
+        long nAdd = rDestDoc.GetRowHeight( nRow, 0 );
+        if ( bLimitToPageSize && nSizeY+nAdd > aPaperSize.Height() && nSizeY )  // above limit?
+            break;
+        nSizeY += nAdd;
+    }
+    nSizeX = static_cast<long>( nSizeX * HMM_PER_TWIPS );
+    nSizeY = static_cast<long>( nSizeY * HMM_PER_TWIPS );
 
 //      pDocSh->SetVisAreaSize( Size(nSizeX,nSizeY) );
 
-        tools::Rectangle aNewArea( Point(nPosX,nPosY), Size(nSizeX,nSizeY) );
-        //TODO/LATER: why twice?!
-        //pDocSh->SvInPlaceObject::SetVisArea( aNewArea );
-        pDocSh->SetVisArea( aNewArea );
+    tools::Rectangle aNewArea( Point(nPosX,nPosY), Size(nSizeX,nSizeY) );
+    //TODO/LATER: why twice?!
+    //pDocSh->SvInPlaceObject::SetVisArea( aNewArea );
+    pDocSh->SetVisArea( aNewArea );
 
-        pDocSh->UpdateOle(&aViewData, true);
+    pDocSh->UpdateOle(&aViewData, true);
 
-        //! SetDocumentModified?
-        if ( rDestDoc.IsChartListenerCollectionNeedsUpdate() )
-            rDestDoc.UpdateChartListenerCollection();
-    }
+    //! SetDocumentModified?
+    if ( rDestDoc.IsChartListenerCollectionNeedsUpdate() )
+        rDestDoc.UpdateChartListenerCollection();
 }
 
 SfxObjectShell* ScTransferObj::SetDrawClipDoc( bool bAnyOle )
diff --git a/sc/source/ui/cctrl/cbnumberformat.cxx b/sc/source/ui/cctrl/cbnumberformat.cxx
index 9407b08e491c..05d7281ab96d 100644
--- a/sc/source/ui/cctrl/cbnumberformat.cxx
+++ b/sc/source/ui/cctrl/cbnumberformat.cxx
@@ -68,18 +68,18 @@ void ScNumberFormat::GetFocus()
 IMPL_STATIC_LINK(ScNumberFormat, NumFormatSelectHdl, weld::ComboBox&, rBox, void)
 {
     auto* pCurSh = SfxViewFrame::Current();
-    if (pCurSh)
+    if (!pCurSh)
+        return;
+
+    SfxDispatcher* pDisp = pCurSh->GetBindings().GetDispatcher();
+    if (pDisp)
     {
-        SfxDispatcher* pDisp = pCurSh->GetBindings().GetDispatcher();
-        if (pDisp)
-        {
-            const sal_Int32 nVal = rBox.get_active();
-            SfxUInt16Item aItem(SID_NUMBER_TYPE_FORMAT, nVal);
-            pDisp->ExecuteList(SID_NUMBER_TYPE_FORMAT,
-                    SfxCallMode::RECORD, {&aItem});
+        const sal_Int32 nVal = rBox.get_active();
+        SfxUInt16Item aItem(SID_NUMBER_TYPE_FORMAT, nVal);
+        pDisp->ExecuteList(SID_NUMBER_TYPE_FORMAT,
+                SfxCallMode::RECORD, {&aItem});
 
-            pCurSh->GetWindow().GrabFocus();
-        }
+        pCurSh->GetWindow().GrabFocus();
     }
 }
 
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 123cc1824bdf..a369aff364e5 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -332,22 +332,22 @@ void ScCheckListMenuControl::selectMenuItem(size_t nPos, bool bSubMenuTimer)
     }
 
 
-    if (nPos != MENU_NOT_SELECTED)
-    {
-        ScCheckListMenuWindow* pParentMenu = mxFrame->GetParentMenu();
-        if (pParentMenu)
-            pParentMenu->get_widget().setSubMenuFocused(this);
+    if (nPos == MENU_NOT_SELECTED)
+        return;
 
-        if (bSubMenuTimer)
+    ScCheckListMenuWindow* pParentMenu = mxFrame->GetParentMenu();
+    if (pParentMenu)
+        pParentMenu->get_widget().setSubMenuFocused(this);
+
+    if (bSubMenuTimer)
+    {
+        if (maMenuItems[nPos].mxSubMenuWin)
         {
-            if (maMenuItems[nPos].mxSubMenuWin)
-            {
-                ScCheckListMenuWindow* pSubMenu = maMenuItems[nPos].mxSubMenuWin.get();
-                queueLaunchSubMenu(nPos, pSubMenu);
-            }
-            else
-                queueCloseSubMenu();
+            ScCheckListMenuWindow* pSubMenu = maMenuItems[nPos].mxSubMenuWin.get();
+            queueLaunchSubMenu(nPos, pSubMenu);
         }
+        else
+            queueCloseSubMenu();
     }
 }
 
@@ -932,35 +932,35 @@ std::unique_ptr<weld::TreeIter> ScCheckListMenuControl::FindEntry(const weld::Tr
 void ScCheckListMenuControl::GetRecursiveChecked(const weld::TreeIter* pEntry, std::unordered_set<OUString>& vOut,
                                                  OUString& rLabel)
 {
-    if (mxChecks->get_toggle(*pEntry) == TRISTATE_TRUE)
-    {
-        // We have to hash parents and children together.
-        // Per convention for easy access in getResult()
-        // "child;parent;grandparent" while descending.
-        if (rLabel.isEmpty())
-            rLabel = mxChecks->get_text(*pEntry, 0);
-        else
-            rLabel = mxChecks->get_text(*pEntry, 0) + ";" + rLabel;
+    if (mxChecks->get_toggle(*pEntry) != TRISTATE_TRUE)
+        return;
 
-        // Prerequisite: the selection mechanism guarantees that if a child is
-        // selected then also the parent is selected, so we only have to
-        // inspect the children in case the parent is selected.
-        if (mxChecks->iter_has_child(*pEntry))
-        {
-            std::unique_ptr<weld::TreeIter> xChild(mxChecks->make_iterator(pEntry));
-            bool bChild = mxChecks->iter_children(*xChild);
-            while (bChild)
-            {
-                OUString aLabel = rLabel;
-                GetRecursiveChecked(xChild.get(), vOut, aLabel);
-                if (!aLabel.isEmpty() && aLabel != rLabel)
-                    vOut.insert(aLabel);
-                bChild = mxChecks->iter_next_sibling(*xChild);
-            }
-            // Let the caller not add the parent alone.
-            rLabel.clear();
-        }
+    // We have to hash parents and children together.
+    // Per convention for easy access in getResult()
+    // "child;parent;grandparent" while descending.
+    if (rLabel.isEmpty())
+        rLabel = mxChecks->get_text(*pEntry, 0);
+    else
+        rLabel = mxChecks->get_text(*pEntry, 0) + ";" + rLabel;
+
+    // Prerequisite: the selection mechanism guarantees that if a child is
+    // selected then also the parent is selected, so we only have to
+    // inspect the children in case the parent is selected.
+    if (!mxChecks->iter_has_child(*pEntry))
+        return;
+

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list