tdf#120703 PVS: V560 A part of conditional expression is always true/false

Change-Id: If173f42302553b164267909a0a3156bb25a6d558
Reviewed-on: https://gerrit.libreoffice.org/63957
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 8588121..871545f 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -558,7 +558,7 @@
            (*m_pMemoStream).ReadUInt16( m_aMemoHeader.db_size );
            if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size != 512)  // 1 is also for dBase 3
                m_aMemoHeader.db_typ  = MemodBaseIV;
            else if (m_aMemoHeader.db_size > 1 && m_aMemoHeader.db_size == 512)
            else if (m_aMemoHeader.db_size == 512)
            {
                // There are files using size specification, though they are dBase-files
                char sHeader[4];
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index aab6661..3df5480 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -1305,12 +1305,11 @@

bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList )
{
    static const sal_uInt16 gFontSizeWichMap[] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL, 0 };

    const SvxFontItem* pFontItem = &rSet.Get( EE_CHAR_FONTINFO );
    if( !pFontItem || !pFontList )
    if (!pFontList)
        return false;

    static const sal_uInt16 gFontSizeWichMap[] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL, 0 };
    const SvxFontItem& rFontItem = rSet.Get(EE_CHAR_FONTINFO);
    bool bRet = false;

    const sal_uInt16* pWhich = gFontSizeWichMap;
@@ -1321,7 +1320,7 @@
        const MapUnit eUnit = rSet.GetPool()->GetMetric( *pWhich );
        nHeight = OutputDevice::LogicToLogic(nHeight * 10, eUnit, MapUnit::MapPoint);

        FontMetric aFontMetric = pFontList->Get( pFontItem->GetFamilyName(), pFontItem->GetStyleName() );
        FontMetric aFontMetric = pFontList->Get( rFontItem.GetFamilyName(), rFontItem.GetStyleName() );
        const sal_IntPtr* pAry = pFontList->GetSizeAry( aFontMetric );

        if( bGrow )
diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx
index 12fb9e2..c9f16b6 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -625,7 +625,7 @@
        aItems.Put( aHeightItemCTL );

        // Paragraph margins, when Heading:
        if ( !nHLevel || ((nHLevel >= 1) && (nHLevel <= 6)) )
        if (nHLevel <= 6)
        {
            SvxULSpaceItem aULSpaceItem( EE_PARA_ULSPACE );
            aULSpaceItem.SetUpper( static_cast<sal_uInt16>(OutputDevice::LogicToLogic( 42, MapUnit::Map10thMM, eUnit )) );
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index a41f5c1..151fbc3 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -3905,7 +3905,7 @@
    sal_uInt32      nLen = static_cast<sal_uInt32>(rId.getLength());
    const sal_Char* pData = rId.getStr();
    GraphicType     eType( rObject.GetType() );
    if ( nLen && pData && ( eType != GraphicType::NONE ) )
    if (nLen && (eType != GraphicType::NONE))
    {
        mnIdentifier[ 0 ] = rtl_crc32( 0,pData, nLen );
        mnIdentifier[ 1 ] = 0;
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index ccf4562..e98d34a 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1360,11 +1360,10 @@
    CurrentFactor pFacToken( this );

    OpCode eOp = mpToken->GetOpCode();
    if( eOp == ocPush || eOp == ocColRowNameAuto || eOp == ocMatRef ||
            eOp == ocDBArea || eOp == ocTableRef
            || (!mbJumpCommandReorder && ((eOp == ocName) || (eOp == ocDBArea)
            || (eOp == ocTableRef) || (eOp == ocColRowName) || (eOp == ocBad)))
        )
    if (eOp == ocPush || eOp == ocColRowNameAuto || eOp == ocMatRef || eOp == ocDBArea
        || eOp == ocTableRef
        || (!mbJumpCommandReorder && ((eOp == ocName) || (eOp == ocColRowName) || (eOp == ocBad)))
       )
    {
        PutCode( mpToken );
        eOp = NextToken();
diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx
index 2e83e32..5a8b39f 100644
--- a/jvmfwk/source/fwkbase.cxx
+++ b/jvmfwk/source/fwkbase.cxx
@@ -365,9 +365,7 @@
            "Using bootstrap parameter " UNO_JAVA_JFW_ENV_JREHOME
                " with JAVA_HOME = " << pJRE);
    }
    else if (getMode() == JFW_MODE_DIRECT
        && !bEnvJRE
        && !bJRE)
    else if (getMode() == JFW_MODE_DIRECT && !bJRE)
    {
        throw FrameworkException(
            JFW_E_CONFIGURATION,
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 3d4c2f3..bb760bd 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -584,7 +584,7 @@

                                ++nArrRow;
                            }
                            else if (bRowHidden && nLastHiddenRow >= 0)
                            else if (nLastHiddenRow >= 0)
                            {
                                nCurRow = nLastHiddenRow;
                                if (nCurRow > nThisRow)
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index aadb8e1..bdc832c 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -3219,7 +3219,7 @@
    if (!bHasRefs)
    {
        bHasColRowNames = (formula::FormulaTokenArrayPlainIterator(*pCode).GetNextColRowName() != nullptr);
        bHasRefs = bHasRefs || bHasColRowNames;
        bHasRefs = bHasColRowNames;
    }
    bool bOnRefMove = pCode->IsRecalcModeOnRefMove();

@@ -3347,7 +3347,7 @@
    if (!bHasRefs)
    {
        bHasColRowNames = (formula::FormulaTokenArrayPlainIterator(*pCode).GetNextColRowName() != nullptr);
        bHasRefs = bHasRefs || bHasColRowNames;
        bHasRefs = bHasColRowNames;
    }
    bool bOnRefMove = pCode->IsRecalcModeOnRefMove();

diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index 221f274f..c45bca6 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -217,10 +217,7 @@
    OSL_ENSURE( pMedStrm, "::ScExportExcel5 - medium without output stream" );
    if( !pMedStrm ) return SCERR_IMPORT_OPEN;           // should not happen

    ErrCode eRet = SCERR_IMPORT_UNKNOWN_BIFF;
    if( eFormat == ExpBiff5 || eFormat == ExpBiff8 )
        eRet = lcl_ExportExcelBiff( rMedium, pDocument, pMedStrm, eFormat == ExpBiff8, eNach );

    ErrCode eRet = lcl_ExportExcelBiff(rMedium, pDocument, pMedStrm, eFormat == ExpBiff8, eNach);
    return eRet;
}

diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 242c3fc..d688bf7 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -265,7 +265,7 @@
                    SvxLinkInsertMode eMode = pHyper->GetInsertMode();

                    bool bDone = false;
                    if ( pOutView && ( eMode == HLINK_DEFAULT || eMode == HLINK_FIELD ) )
                    if (eMode == HLINK_DEFAULT || eMode == HLINK_FIELD)
                    {
                        const SvxFieldItem* pFieldItem = pOutView->GetFieldAtSelection();
                        if (pFieldItem)
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index 65a3f0b..d0cd385 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -487,7 +487,7 @@
                        else
                        {
                            // move handle with index nHandleIndex
                            if(pHdl && (nX || nY))
                            if (nX || nY)
                            {
                                // now move the Handle (nX, nY)
                                Point aStartPoint(pHdl->GetPos());
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index ba3896e..cc4fa6f 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -393,7 +393,7 @@
                    pStyleSheet = &(pStylePool->Make( aStyleName, eFamily,
                                                      SfxStyleSearchBits::UserDefined ) );

                    if ( pStyleSheet && pStyleSheet->HasParentSupport() )
                    if (pStyleSheet->HasParentSupport())
                        pStyleSheet->SetParent(aRefName);
                }
                break;
@@ -2180,7 +2180,7 @@
                        rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
                        rSet.InvalidateItem(SID_FRAME_LINECOLOR);
                    }
                    else if( !bCol && !bColDisable) // if no line available
                    else if (!bCol) // if no line available
                    {
                        aCol = COL_AUTO;
                        rSet.Put( SvxColorItem(aCol, SID_FRAME_LINECOLOR ) );
diff --git a/scaddins/source/analysis/financial.cxx b/scaddins/source/analysis/financial.cxx
index 0b66bd8..3ae91c8 100644
--- a/scaddins/source/analysis/financial.cxx
+++ b/scaddins/source/analysis/financial.cxx
@@ -126,7 +126,7 @@
{
    double fPmt, fPpmt;

    if( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0.0 || nEndPer > nNumPeriods  || nNumPeriods <= 0 ||
    if( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0.0 || nEndPer > nNumPeriods ||
        fVal <= 0.0 || ( nPayType != 0 && nPayType != 1 ) )
        throw css::lang::IllegalArgumentException();

@@ -164,7 +164,7 @@
{
    double fPmt, fIpmt;

    if( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0.0 || nEndPer > nNumPeriods  || nNumPeriods <= 0 ||
    if( nStartPer < 1 || nEndPer < nStartPer || fRate <= 0.0 || nEndPer > nNumPeriods ||
        fVal <= 0.0 || ( nPayType != 0 && nPayType != 1 ) )
        throw css::lang::IllegalArgumentException();

diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index ac64ac4..ddf4866 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -722,7 +722,7 @@
                    else
                    {
                        // move handle with index nHandleIndex
                        if(pHdl && (nX || nY))
                        if (nX || nY)
                        {
                            // now move the Handle (nX, nY)
                            Point aStartPoint(pHdl->GetPos());
diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx
index 365a3b5..ec8cdbb 100644
--- a/sd/source/ui/view/drviews1.cxx
+++ b/sd/source/ui/view/drviews1.cxx
@@ -632,22 +632,22 @@
/// inherited from sd::ViewShell
SdPage* DrawViewShell::getCurrentPage() const
{
    const sal_Int32 nPageCount = (meEditMode == EditMode::Page)?
    const sal_uInt16 nPageCount = (meEditMode == EditMode::Page)?
                                    GetDoc()->GetSdPageCount(mePageKind):
                                    GetDoc()->GetMasterSdPageCount(mePageKind);

    sal_Int32 nCurrentPage = maTabControl->GetCurPagePos();
    DBG_ASSERT( (nPageCount>0) && (nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!" );
    if( (nPageCount < 0) || (nCurrentPage>=nPageCount) )
    sal_uInt16 nCurrentPage = maTabControl->GetCurPagePos();
    DBG_ASSERT((nCurrentPage<nPageCount), "sd::DrawViewShell::getCurrentPage(), illegal page index!");
    if (nCurrentPage >= nPageCount)
        nCurrentPage = 0; // play safe here

    if (meEditMode == EditMode::Page)
    {
        return GetDoc()->GetSdPage(static_cast<sal_uInt16>(nCurrentPage), mePageKind);
        return GetDoc()->GetSdPage(nCurrentPage, mePageKind);
    }
    else // EditMode::MasterPage
    {
        return GetDoc()->GetMasterSdPage(static_cast<sal_uInt16>(nCurrentPage), mePageKind);
        return GetDoc()->GetMasterSdPage(nCurrentPage, mePageKind);
    }
}

diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx
index 7fc6766..73c1e72 100644
--- a/sd/source/ui/view/drviews7.cxx
+++ b/sd/source/ui/view/drviews7.cxx
@@ -1836,7 +1836,7 @@
                {
                    nLeft = static_cast<const SvxLongLRSpaceItem*>(pPoolItem)->GetLeft();
                    nRight = static_cast<const SvxLongLRSpaceItem*>(pPoolItem)->GetRight();
                    if (nLeft != -1 && nUpper == -1)
                    if (nLeft != -1)
                    {
                        nUpper  = pPage->GetUpperBorder();
                        nLower  = pPage->GetLowerBorder();
@@ -1851,7 +1851,7 @@
                {
                    nUpper = static_cast<const SvxLongULSpaceItem*>(pPoolItem)->GetUpper();
                    nLower = static_cast<const SvxLongULSpaceItem*>(pPoolItem)->GetLower();
                    if (nLeft == -1 && nUpper != -1)
                    if (nUpper != -1)
                    {
                        nLeft   = pPage->GetLeftBorder();
                        nRight  = pPage->GetRightBorder();
diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx
index de870e3..9c54081 100644
--- a/svtools/source/config/extcolorcfg.cxx
+++ b/svtools/source/config/extcolorcfg.cxx
@@ -491,7 +491,7 @@
        m_bBroadcastWhenUnlocked = ExtendedColorConfig::m_pImpl != nullptr;
        if ( m_bBroadcastWhenUnlocked )
        {
            if ( ExtendedColorConfig::m_pImpl && ExtendedColorConfig::m_pImpl->m_bIsBroadcastEnabled )
            if (ExtendedColorConfig::m_pImpl->m_bIsBroadcastEnabled)
            {
                m_bBroadcastWhenUnlocked = false;
                ExtendedColorConfig::m_pImpl->Broadcast(SfxHint(SfxHintId::ColorsChanged));
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 6db43dd..15a4198 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -1218,8 +1218,7 @@
            pOutDev = const_cast<OutputDevice*>(m_pView->GetActualOutDev());
        else
        {// find OutDev
            SdrPageView* pPageView = m_pView->GetSdrPageView();
            if( pPageView && !pOutDev )
            if (SdrPageView* pPageView = m_pView->GetSdrPageView())
            {
                // const SdrPageViewWinList& rWinList = pPageView->GetWinList();
                // const SdrPageViewWindows& rPageViewWindows = pPageView->GetPageViewWindows();
@@ -1368,8 +1367,7 @@
            pOutDev = const_cast<OutputDevice*>(m_pView->GetActualOutDev());
        else
        {// find OutDev
            SdrPageView* pPageView = m_pView->GetSdrPageView();
            if( pPageView && !pOutDev )
            if (SdrPageView* pPageView = m_pView->GetSdrPageView())
            {
                // const SdrPageViewWinList& rWinList = pPageView->GetWinList();
                // const SdrPageViewWindows& rPageViewWindows = pPageView->GetPageViewWindows();
diff --git a/svx/source/gallery2/galexpl.cxx b/svx/source/gallery2/galexpl.cxx
index ce8dea4..1f5122f 100644
--- a/svx/source/gallery2/galexpl.cxx
+++ b/svx/source/gallery2/galexpl.cxx
@@ -213,7 +213,7 @@
                    if( nActPos++ == nSdrModelPos )
                    {
                        if( pModel )
                            bRet = bRet || pTheme->GetModel( i, *pModel );
                            bRet = pTheme->GetModel(i, *pModel);

                        if( pThumb )
                            bRet = bRet || pTheme->GetThumb( i, *pThumb );
diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
index 577db70..659acaf 100644
--- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
+++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
@@ -65,15 +65,13 @@

    ::sfx2::SvBaseLink* lcl_FindNextRemovableLink( const ::sfx2::SvBaseLinks& rLinks )
    {
        for(const auto & rLink : rLinks)
        for (const auto& rLinkIter : rLinks)
        {
            ::sfx2::SvBaseLink* pLnk = &(*rLink);
            if( pLnk &&
                ( OBJECT_CLIENT_GRF == pLnk->GetObjType() ||
                  OBJECT_CLIENT_FILE == pLnk->GetObjType() ) &&
                  dynamic_cast<const SwBaseLink*>( pLnk) !=  nullptr )
            ::sfx2::SvBaseLink& rLnk = *rLinkIter;
            if ((OBJECT_CLIENT_GRF == rLnk.GetObjType() || OBJECT_CLIENT_FILE == rLnk.GetObjType())
                && dynamic_cast<const SwBaseLink*>(&rLnk) != nullptr)
            {
                    tools::SvRef<sfx2::SvBaseLink> xLink = pLnk;
                    tools::SvRef<sfx2::SvBaseLink> xLink(&rLnk);

                    OUString sFName;
                    sfx2::LinkManager::GetDisplayNames( xLink.get(), nullptr, &sFName );
@@ -81,7 +79,7 @@
                    INetURLObject aURL( sFName );
                    if( INetProtocol::File == aURL.GetProtocol() ||
                        INetProtocol::Cid == aURL.GetProtocol() )
                        return pLnk;
                        return &rLnk;
            }
        }
        return nullptr;
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 0fa554a..70436dd 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -633,7 +633,7 @@
                // adjust loop counter
                if ( bMovedForward )
                    ++i;
                else if ( !bMovedForward && i > 0 )
                else if (i > 0)
                    --i;
            }

diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 5da40eb..f876793 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -2213,22 +2213,22 @@
        // Do NOT copy AutoNumRules into the template
        const SfxPoolItem* pItem;
        const SwNumRule* pRule = nullptr;
        if( SfxItemState::SET == pSet->GetItemState( RES_BREAK, false ) ||
            SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC,false ) ||
            ( SfxItemState::SET == pSet->GetItemState( RES_PARATR_NUMRULE,
                false, &pItem ) && nullptr != (pRule = GetDoc()->FindNumRulePtr(
                static_cast<const SwNumRuleItem*>(pItem)->GetValue() )) &&
                pRule && pRule->IsAutoRule() )
            )
        if (SfxItemState::SET == pSet->GetItemState(RES_BREAK, false)
            || SfxItemState::SET == pSet->GetItemState(RES_PAGEDESC, false)
            || (SfxItemState::SET == pSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem)
                && nullptr != (pRule = GetDoc()->FindNumRulePtr(
                        static_cast<const SwNumRuleItem*>(pItem)->GetValue()))
                && pRule->IsAutoRule()))
        {
            SfxItemSet aSet( *pSet );
            aSet.ClearItem( RES_BREAK );
            aSet.ClearItem( RES_PAGEDESC );

            if( pRule || (SfxItemState::SET == pSet->GetItemState( RES_PARATR_NUMRULE,
                false, &pItem ) && nullptr != (pRule = GetDoc()->FindNumRulePtr(
                static_cast<const SwNumRuleItem*>(pItem)->GetValue() )) &&
                pRule && pRule->IsAutoRule() ))
            if (pRule
                || (SfxItemState::SET == pSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem)
                    && nullptr != (pRule = GetDoc()->FindNumRulePtr(
                            static_cast<const SwNumRuleItem*>(pItem)->GetValue()))
                    && pRule->IsAutoRule()))
                aSet.ClearItem( RES_PARATR_NUMRULE );

            if( aSet.Count() )
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 80526cc..2495fc8 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -154,17 +154,16 @@
}

/// update tables of content
void SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet )
void SwEditShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
{
    OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOX) !=  nullptr,  "no TOXBaseSection!" );
    SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOX));
    OSL_ENSURE(pTOX, "no current listing");
    if( pTOX && nullptr != pTOX->GetFormat()->GetSectionNode() )
    assert(dynamic_cast<const SwTOXBaseSection*>(&rTOX) && "no TOXBaseSection!");
    SwTOXBaseSection& rTOXSect = static_cast<SwTOXBaseSection&>(const_cast<SwTOXBase&>(rTOX));
    if (rTOXSect.GetFormat()->GetSectionNode())
    {
        SwDoc* pMyDoc = GetDoc();
        SwDocShell* pDocSh = pMyDoc->GetDocShell();

        bool bInIndex = pTOX == GetCurTOX();
        bool bInIndex = &rTOX == GetCurTOX();
        SET_CURR_SHELL( this );
        StartAllAction();

@@ -174,17 +173,17 @@
        pMyDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::TOXCHANGE, nullptr);

        // create listing stub
        pTOX->Update(pSet);
        rTOXSect.Update(pSet);

        // correct Cursor
        if( bInIndex )
            pTOX->SetPosAtStartEnd( *GetCursor()->GetPoint() );
            rTOXSect.SetPosAtStartEnd(*GetCursor()->GetPoint());

        // start formatting
        CalcLayout();

        // insert page numbering
        pTOX->UpdatePageNum();
        rTOXSect.UpdatePageNum();

        pMyDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::TOXCHANGE, nullptr);

diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index d94ee5c8..107bb3f 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -978,7 +978,6 @@
    StartAllAction();
    StartUndo();

    long nNewPage;
    SwRootFrame* pTmpRootFrame = GetLayout();
    sal_uInt16 nMaxPage = pTmpRootFrame->GetPageNum();
    bool bTmpAssert = false;
@@ -989,13 +988,11 @@
            // FlyFormat is still valid, therefore process

            SwFormatAnchor aNewAnchor( pFormat->GetAnchor() );
            if ((RndStdIds::FLY_AT_PAGE != aNewAnchor.GetAnchorId()) ||
                0 >= ( nNewPage = aNewAnchor.GetPageNum() + 1 ) )
                // Anchor has been changed or invalid page number,
                // therefore: do not change!
            if (RndStdIds::FLY_AT_PAGE != aNewAnchor.GetAnchorId())
                // Anchor has been changed, therefore: do not change!
                continue;

            if( sal_uInt16(nNewPage) > nMaxPage )
            sal_uInt16 nNewPage = aNewAnchor.GetPageNum() + 1;
            if (nNewPage > nMaxPage)
            {
                if ( RES_DRAWFRMFMT == pFormat->Which() )
                    pFormat->CallSwClientNotify(sw::DrawFrameFormatHint(sw::DrawFrameFormatHintId::PAGE_OUT_OF_BOUNDS));
@@ -1003,7 +1000,7 @@
                    pFormat->DelFrames();
                bTmpAssert = true;
            }
            aNewAnchor.SetPageNum( sal_uInt16(nNewPage) );
            aNewAnchor.SetPageNum(nNewPage);
            mxDoc->SetAttr( aNewAnchor, *pFormat );
        }
    }
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index ae1259c..4abc8f1 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -348,14 +348,14 @@

bool SwFEShell::MoveAnchor( SwMove nDir )
{
    const SdrMarkList* pMrkList;
    if( !Imp()->GetDrawView() ||
        nullptr == (pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList()) ||
        1 != pMrkList->GetMarkCount())
    if (!Imp()->GetDrawView())
        return false;
    const SdrMarkList& pMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
    if (1 != pMrkList.GetMarkCount())
        return false;
    SwFrame* pOld;
    SwFlyFrame* pFly = nullptr;
    SdrObject *pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj();
    SdrObject *pObj = pMrkList.GetMark( 0 )->GetMarkedSdrObj();
    if (SwVirtFlyDrawObj* pVirtO = dynamic_cast<SwVirtFlyDrawObj*>(pObj))
    {
        pFly = pVirtO->GetFlyFrame();
@@ -1546,7 +1546,7 @@
                (pVirtO && pVirtO->IsTextBox()) ||
                ( eType == GotoObjFlags::DrawSimple && lcl_IsControlGroup( pObj ) ) ||
                ( eType == GotoObjFlags::DrawControl && !lcl_IsControlGroup( pObj ) ) ||
                ( pFilter && !pFilter->includeObject( *pObj ) ) )
                !pFilter->includeObject( *pObj ) )
                continue;
            if (pVirtO)
            {
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index a38f9f9..a0c0ece 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -395,8 +395,8 @@
        }

        bGoingUp = !(bGoingFwdOrBwd || bGoingDown);

        if ( !bFwd && bGoingDown && p )
        assert(p);
        if (!bFwd && bGoingDown)
        {
                while ( p->GetNext() )
                    p = p->GetNext();
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 6dde1f6..6806326 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -123,7 +123,7 @@
    }

    // #i28701# - use new method <GetPageFrame()>
    if( !GetPageFrame() && GetAnchorFrame() && GetAnchorFrame()->IsInFly() )
    if( !GetPageFrame() && GetAnchorFrame()->IsInFly() )
    {
        SwFlyFrame* pFly = AnchorFrame()->FindFlyFrame();
        SwPageFrame *pPageFrame = pFly ? pFly->FindPageFrame() : nullptr;
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index ef0d950..7cc0b07 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -1346,7 +1346,7 @@
            }
            if ( !bEnd && pSibling )
                nCmpPos = ::lcl_FindFootnotePos( pDoc, pSibling->GetAttr() );
            if ( pSibling && pLastSib && (pSibling != pLastSib) )
            if (pSibling && (pSibling != pLastSib))
            {
                // too far?
                if ( (nLastPos < nCmpPos) && (nCmpPos > nStPos) )
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 24d91cb..7d5bcf6 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2561,12 +2561,11 @@
bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont )
{
    const vcl::Font& rFnt = pFont ? *pFont : GetOut().GetFont();
    bool bPrt = GetShell() && ! GetShell()->GetWin();
    Color nNewColor = COL_BLACK;
    bool bChgFntColor = false;
    bool bChgLineColor = false;

    if( bPrt && GetShell() && GetShell()->GetViewOptions()->IsBlackFont() )
    if (GetShell() && !GetShell()->GetWin() && GetShell()->GetViewOptions()->IsBlackFont())
    {
        if ( COL_BLACK != rFnt.GetColor() )
            bChgFntColor = true;
@@ -2582,7 +2581,7 @@
        // LineColor has to be changed if:
        // 1. IsAlwaysAutoColor is set

        bChgLineColor = ! bPrt && GetShell() &&
        bChgLineColor = GetShell() && GetShell()->GetWin() &&
                GetShell()->GetAccessibilityOptions()->IsAlwaysAutoColor();

        bChgFntColor = COL_AUTO == rFnt.GetColor() || bChgLineColor;
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index f5720c7..73105e2 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -133,7 +133,7 @@
    if (!pAction)
        return nRet;

    if (m_pView && !m_bRepair)
    if (!m_bRepair)
    {
        // If another view created the first redo action, prevent redoing it from this view.
        ViewShellId nViewShellId = m_pView->GetViewShellId();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 016851c..a7851e4 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3188,10 +3188,10 @@
            // If there is a shadow, and it's not the regular 'Bottom-Right',
            // then write only the 'shadowed' sides of the border
            if  (
                    ( ( rOptions.aShadowLocation == SvxShadowLocation::TopLeft     || rOptions.aShadowLocation == SvxShadowLocation::TopRight      )    &&  *pBrd == SvxBoxItemLine::TOP   )  ||
                    ( ( rOptions.aShadowLocation == SvxShadowLocation::TopLeft     || rOptions.aShadowLocation == SvxShadowLocation::BottomLeft    )    &&  *pBrd == SvxBoxItemLine::LEFT  )  ||
                    ( ( rOptions.aShadowLocation == SvxShadowLocation::BottomLeft  || rOptions.aShadowLocation == SvxShadowLocation::BottomRight   )    &&  *pBrd == SvxBoxItemLine::BOTTOM)  ||
                    ( ( rOptions.aShadowLocation == SvxShadowLocation::TopRight    || rOptions.aShadowLocation == SvxShadowLocation::BottomRight   )    &&  *pBrd == SvxBoxItemLine::RIGHT )
                    ((rOptions.aShadowLocation == SvxShadowLocation::TopLeft    || rOptions.aShadowLocation == SvxShadowLocation::TopRight  ) && *pBrd == SvxBoxItemLine::TOP   ) ||
                    ((rOptions.aShadowLocation == SvxShadowLocation::TopLeft    || rOptions.aShadowLocation == SvxShadowLocation::BottomLeft) && *pBrd == SvxBoxItemLine::LEFT  ) ||
                    ((rOptions.aShadowLocation == SvxShadowLocation::BottomLeft                                                             ) && *pBrd == SvxBoxItemLine::BOTTOM) ||
                    ((rOptions.aShadowLocation == SvxShadowLocation::TopRight                                                               ) && *pBrd == SvxBoxItemLine::RIGHT )
                )
            {
                bWriteShadow = true;
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 23ceeca..1dcf34f 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1284,7 +1284,7 @@
        else
        {
            // move handle with index nHandleIndex
            if(pHdl && (nX || nY))
            if (nX || nY)
            {
                if( SdrHdlKind::Anchor == pHdl->GetKind() ||
                    SdrHdlKind::Anchor_TR == pHdl->GetKind() )
@@ -3114,8 +3114,7 @@
                    // only try to select frame, if pointer already was
                    // switched accordingly
                    if ( m_aActHitType != SdrHitKind::NONE && !rSh.IsSelFrameMode() &&
                        !GetView().GetViewFrame()->GetDispatcher()->IsLocked() &&
                        !bExecDrawTextLink)
                        !GetView().GetViewFrame()->GetDispatcher()->IsLocked())
                    {
                        // Test if there is a draw object at that position and if it should be selected.
                        bool bShould = rSh.ShouldObjectBeSelected(aDocPos);
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx
index 52c8a12..5ada2a6 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -883,7 +883,7 @@
        return pSh->MoveFieldType( nullptr, bNext, SwFieldIds::Database );
    }

    return pTyp && pSh && pSh->MoveFieldType( pTyp, bNext );
    return pTyp && pSh->MoveFieldType(pTyp, bNext);
}

// insert field types
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 59220ac..7e70ddb 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -152,7 +152,7 @@
                }
            }
        }
        if ( !bNegative && bCurrency && !aStr.isEmpty() )
        if (!bNegative && !aStr.isEmpty())
        {
            sal_uInt16 nFormat = rLocaleDataWrappper.getCurrNegativeFormat();
            if ( (nFormat == 3) || (nFormat == 6)  || // $1- || 1-$
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index 3413d55..cfef2ec 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -368,11 +368,10 @@
                                            const OUString& rLiteralMask,
                                            bool bSameMask )
{
    sal_uInt16 nFormatFlags = 0;
    OUString aText = pEdit->GetText();

    // remove leading blanks
    if ( bSameMask && !(nFormatFlags & PATTERN_FORMAT_EMPTYLITERALS) && !rEditMask.isEmpty() )
    if (bSameMask && !rEditMask.isEmpty())
    {
        sal_Int32 i = 0;
        sal_Int32 nMaxLen = aText.getLength();
@@ -390,7 +389,7 @@
        aText = aText.copy( i );
    }

    OUString aNewText = ImplPatternReformat( aText, rEditMask, rLiteralMask, nFormatFlags );
    OUString aNewText = ImplPatternReformat(aText, rEditMask, rLiteralMask, 0);
    if ( aNewText != aText )
    {
        // adjust selection such that it remains at the end if it was there before
@@ -399,7 +398,7 @@
        if ( nMaxSel >= aText.getLength() )
        {
            sal_Int32 nMaxPos = aNewText.getLength();
            ImplPatternMaxPos( aNewText, rEditMask, nFormatFlags, bSameMask, nMaxSel, nMaxPos );
            ImplPatternMaxPos(aNewText, rEditMask, 0, bSameMask, nMaxSel, nMaxPos);
            if ( aSel.Min() == aSel.Max() )
            {
                aSel.Min() = nMaxPos;
@@ -1757,7 +1756,7 @@
                        Reformat();
                }
            }
            else if ( !bTextLen && IsEmptyFieldValueEnabled() )
            else
            {
                ResetLastDate();
                SetEmptyFieldValueData( true );
@@ -1859,7 +1858,7 @@
            bool bTextLen = !GetText().isEmpty();
            if ( bTextLen || !IsEmptyFieldValueEnabled() )
                Reformat();
            else if ( !bTextLen && IsEmptyFieldValueEnabled() )
            else
            {
                ResetLastDate();
                SetEmptyFieldValueData( true );
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 5e9bed4..56a03ec 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1810,8 +1810,7 @@

        PropertyMap * pTargetContext = rContext.get();

        if (pSectionContext != nullptr &&
            nSprmId == NS_ooxml::LN_EG_SectPrContents_textDirection)
        if (pSectionContext)
        {
            pTargetContext = pSectionContext;
        }
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index ae045d5..1a0238e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1489,7 +1489,7 @@

                // tdf#118521 set paragraph top or bottom margin based on the paragraph style
                // if we already set the other margin with direct formatting
                if ( pParaContext && m_xPreviousParagraph.is() )
                if (m_xPreviousParagraph)
                {
                    const bool bTopSet = pParaContext->isSet(PROP_PARA_TOP_MARGIN);
                    const bool bBottomSet = pParaContext->isSet(PROP_PARA_BOTTOM_MARGIN);
@@ -1519,7 +1519,7 @@

                // Left, Right, and Hanging settings are also grouped. Ensure that all or none are set.
                // m_xPreviousParagraph was set earlier, so really it still is the current paragraph...
                if ( pParaContext && m_xPreviousParagraph.is() )
                if (m_xPreviousParagraph)
                {
                    const bool bLeftSet  = pParaContext->isSet(PROP_PARA_LEFT_MARGIN);
                    const bool bRightSet = pParaContext->isSet(PROP_PARA_RIGHT_MARGIN);