tdf#120703 PVS: V547 Expression is always true/false

Change-Id: I0b3c407331bfa1fa0c5003250d327d4f26de3643
Reviewed-on: https://gerrit.libreoffice.org/63235
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
index c432454..df87e4d 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -411,10 +411,7 @@
    if (nIndex!=0 || !m_bIsDropDownBox)
        throw css::lang::IndexOutOfBoundsException();

    if (m_bIsDropDownBox)
        return OUString(RID_STR_ACC_ACTION_TOGGLEPOPUP);

    return OUString();
    return OUString(RID_STR_ACC_ACTION_TOGGLEPOPUP);
}

Reference< XAccessibleKeyBinding > VCLXAccessibleBox::getAccessibleActionKeyBinding( sal_Int32 nIndex )
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 69dae82..c813146 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -3219,12 +3219,9 @@
    }
    else
    {
        if ( !bVBAEnabled )
        {
            if( bRaiseErrors )
                Error( ERRCODE_BASIC_NEEDS_OBJECT );
            bOk = false;
        }
        if( bRaiseErrors )
            Error( ERRCODE_BASIC_NEEDS_OBJECT );
        bOk = false;
    }
    return bOk;
}
diff --git a/chart2/source/view/axes/Tickmarks_Equidistant.cxx b/chart2/source/view/axes/Tickmarks_Equidistant.cxx
index 7b31997..85a6a49 100644
--- a/chart2/source/view/axes/Tickmarks_Equidistant.cxx
+++ b/chart2/source/view/axes/Tickmarks_Equidistant.cxx
@@ -311,8 +311,8 @@
void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) const
{
    //create point sequences for each tick depth
    sal_Int32 nDepthCount = getTickDepth();
    sal_Int32 nMaxMajorTickCount = getMaxTickCount(0);
    const sal_Int32 nDepthCount = getTickDepth();
    const sal_Int32 nMaxMajorTickCount = getMaxTickCount(0);

    if (nDepthCount <= 0 || nMaxMajorTickCount <= 0)
        return;
@@ -333,8 +333,7 @@
        return;
    aAllTicks[0].realloc(nRealMajorTickCount);

    if(nDepthCount>0)
        addSubTicks( 1, aAllTicks );
    addSubTicks(1, aAllTicks);

    //so far we have added all ticks between the outer major tick marks
    //this was necessary to create sub ticks correctly
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 85da43f53..0b488ab 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -1589,10 +1589,8 @@
    if (!m_aAxisProperties.m_bDisplayLabels)
        return;

    std::unique_ptr< TickFactory2D > apTickFactory2D( createTickFactory2D() );
    std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
    TickFactory2D* pTickFactory2D = apTickFactory2D.get();
    if( !pTickFactory2D )
        return;

    //get the transformed screen values for all tickmarks in aAllTickInfos
    pTickFactory2D->updateScreenValues( m_aAllTickInfos );
@@ -1644,10 +1642,8 @@
    if (!m_aAxisProperties.m_bDisplayLabels)
        return;

    std::unique_ptr< TickFactory2D > apTickFactory2D( createTickFactory2D() );
    std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
    TickFactory2D* pTickFactory2D = apTickFactory2D.get();
    if( !pTickFactory2D )
        return;

    //get the transformed screen values for all tickmarks in aAllTickInfos
    pTickFactory2D->updateScreenValues( m_aAllTickInfos );
@@ -1682,10 +1678,8 @@
    if (!m_aAxisProperties.m_bDisplayLabels)
        return;

    std::unique_ptr< TickFactory2D > apTickFactory2D( createTickFactory2D() );
    std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
    TickFactory2D* pTickFactory2D = apTickFactory2D.get();
    if( !pTickFactory2D )
        return;

    //update positions of all existing text shapes
    pTickFactory2D->updateScreenValues( m_aAllTickInfos );
@@ -1778,10 +1772,8 @@
    if( !prepareShapeCreation() )
        return;

    std::unique_ptr< TickFactory2D > apTickFactory2D( createTickFactory2D() );
    std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
    TickFactory2D* pTickFactory2D = apTickFactory2D.get();
    if( !pTickFactory2D )
        return;

    //create line shapes
    if(m_nDimension==2)
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index e9a9e6d..548ecef 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -2517,14 +2517,7 @@

ShapeFactory* ShapeFactory::getOrCreateShapeFactory(const uno::Reference< lang::XMultiServiceFactory>& xFactory)
{
    static ShapeFactory* pShapeFactory = nullptr;

    if (pShapeFactory)
        return pShapeFactory;

    if (!pShapeFactory)
        pShapeFactory = new ShapeFactory(xFactory);

    static ShapeFactory* pShapeFactory = new ShapeFactory(xFactory);
    return pShapeFactory;
}

diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
index 08a403dd..a6369125 100644
--- a/cui/source/dialogs/srchxtra.cxx
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -82,8 +82,7 @@
            pList = m_pFontList.get();
        }

        if ( pList )
            static_cast<SvxCharNamePage&>(rPage).
        static_cast<SvxCharNamePage&>(rPage).
                SetFontList( SvxFontListItem( pList, SID_ATTR_CHAR_FONTLIST ) );
        static_cast<SvxCharNamePage&>(rPage).EnableSearchMode();
    }
diff --git a/cui/source/tabpages/textanim.cxx b/cui/source/tabpages/textanim.cxx
index d5e27cf..7a73a7d 100644
--- a/cui/source/tabpages/textanim.cxx
+++ b/cui/source/tabpages/textanim.cxx
@@ -143,31 +143,17 @@

    if( !pItem )
        pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIKIND );
    if( pItem )
    {
        eAniKind = static_cast<const SdrTextAniKindItem*>(pItem)->GetValue();
        m_xLbEffect->set_active( sal::static_int_cast< sal_Int32 >(eAniKind) );
    }
    else
        m_xLbEffect->set_active(-1);

    eAniKind = static_cast<const SdrTextAniKindItem*>(pItem)->GetValue();
    m_xLbEffect->set_active(sal::static_int_cast<sal_Int32>(eAniKind));
    m_xLbEffect->save_value();

    // animation direction
    pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANIDIRECTION );
    if( !pItem )
        pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDIRECTION );
    if( pItem )
    {
        SdrTextAniDirection eValue = static_cast<const SdrTextAniDirectionItem*>(pItem)->GetValue();
        SelectDirection( eValue );
    }
    else
    {
        m_xBtnUp->set_active( false );
        m_xBtnLeft->set_active( false );
        m_xBtnRight->set_active( false );
        m_xBtnDown->set_active( false );
    }

    SelectDirection(static_cast<const SdrTextAniDirectionItem*>(pItem)->GetValue());
    m_aUpState = m_xBtnUp->get_state();
    m_aLeftState = m_xBtnLeft->get_state();
    m_aRightState = m_xBtnRight->get_state();
@@ -177,66 +163,46 @@
    pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANISTARTINSIDE );
    if( !pItem )
        pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTARTINSIDE );
    if( pItem )
    {
        m_xTsbStartInside->set_inconsistent(false);
        bool bValue = static_cast<const SdrTextAniStartInsideItem*>(pItem)->GetValue();
        if( bValue )
            m_xTsbStartInside->set_state( TRISTATE_TRUE );
        else
            m_xTsbStartInside->set_state( TRISTATE_FALSE );
    }

    if (static_cast<const SdrTextAniStartInsideItem*>(pItem)->GetValue())
        m_xTsbStartInside->set_state(TRISTATE_TRUE);
    else
        m_xTsbStartInside->set_state( TRISTATE_INDET );
        m_xTsbStartInside->set_state(TRISTATE_FALSE);
    m_xTsbStartInside->save_state();

    // Stop inside
    pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANISTOPINSIDE );
    if( !pItem )
        pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTOPINSIDE );
    if( pItem )
    {
        m_xTsbStopInside->set_inconsistent(false);
        bool bValue = static_cast<const SdrTextAniStopInsideItem*>(pItem)->GetValue();
        if( bValue )
            m_xTsbStopInside->set_state( TRISTATE_TRUE );
        else
            m_xTsbStopInside->set_state( TRISTATE_FALSE );
    }

    if (static_cast<const SdrTextAniStopInsideItem*>(pItem)->GetValue())
        m_xTsbStopInside->set_state(TRISTATE_TRUE);
    else
        m_xTsbStopInside->set_state( TRISTATE_INDET );
        m_xTsbStopInside->set_state(TRISTATE_FALSE);
    m_xTsbStopInside->save_state();

    // quantity
    pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANICOUNT );
    if( !pItem )
        pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANICOUNT );
    if( pItem )

    long nValue = static_cast<long>(static_cast<const SdrTextAniCountItem*>(pItem)->GetValue());
    m_xNumFldCount->set_value(nValue);
    if (nValue == 0)
    {
        m_xTsbEndless->set_inconsistent(false);
        long nValue = static_cast<long>(static_cast<const SdrTextAniCountItem*>(pItem)->GetValue());
        m_xNumFldCount->set_value(nValue);
        if( nValue == 0 )
        if (eAniKind == SdrTextAniKind::Slide)
        {
            if( eAniKind == SdrTextAniKind::Slide )
            {
                m_xTsbEndless->set_state( TRISTATE_FALSE );
                m_xTsbEndless->set_sensitive(false);
            }
            else
            {
                m_xTsbEndless->set_state( TRISTATE_TRUE );
                m_xNumFldCount->set_text("");
            }
            m_xTsbEndless->set_state(TRISTATE_FALSE);
            m_xTsbEndless->set_sensitive(false);
        }
        else
            m_xTsbEndless->set_state( TRISTATE_FALSE );
        {
            m_xTsbEndless->set_state(TRISTATE_TRUE);
            m_xNumFldCount->set_text("");
        }
    }
    else
    {
        m_xNumFldCount->set_text("");
        m_xTsbEndless->set_state( TRISTATE_INDET );
    }
        m_xTsbEndless->set_state(TRISTATE_FALSE);
    m_xTsbEndless->save_state();
    m_xNumFldCount->save_value();

@@ -244,24 +210,16 @@
    pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANIDELAY );
    if( !pItem )
        pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDELAY );
    if( pItem )

    nValue = static_cast<long>(static_cast<const SdrTextAniDelayItem*>(pItem)->GetValue());
    m_xMtrFldDelay->set_value(nValue, FieldUnit::NONE);
    if (nValue == 0)
    {
        m_xTsbAuto->set_inconsistent(false);
        long nValue = static_cast<long>(static_cast<const SdrTextAniDelayItem*>(pItem)->GetValue());
        m_xMtrFldDelay->set_value(nValue, FieldUnit::NONE);
        if( nValue == 0 )
        {
            m_xTsbAuto->set_state( TRISTATE_TRUE );
            m_xMtrFldDelay->set_text("");
        }
        else
            m_xTsbAuto->set_state( TRISTATE_FALSE );
        m_xTsbAuto->set_state(TRISTATE_TRUE);
        m_xMtrFldDelay->set_text("");
    }
    else
    {
        m_xMtrFldDelay->set_text("");
        m_xTsbAuto->set_state( TRISTATE_INDET );
    }
        m_xTsbAuto->set_state(TRISTATE_FALSE);
    m_xTsbAuto->save_state();
    m_xMtrFldDelay->save_value();

@@ -269,40 +227,31 @@
    pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANIAMOUNT );
    if( !pItem )
        pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIAMOUNT );
    if( pItem )

    nValue = static_cast<long>(static_cast<const SdrTextAniAmountItem*>(pItem)->GetValue());
    if (nValue <= 0)
    {
        m_xTsbPixel->set_inconsistent(false);
        long nValue = static_cast<long>(static_cast<const SdrTextAniAmountItem*>(pItem)->GetValue());
        if( nValue <= 0 )
        {
            m_xTsbPixel->set_state( TRISTATE_TRUE );
            nValue = -nValue;
            if( nValue == 0 )
                nValue++;
            m_xMtrFldAmount->set_unit( FieldUnit::CUSTOM );
            m_xMtrFldAmount->set_digits(0);
        m_xTsbPixel->set_state(TRISTATE_TRUE);
        nValue = -nValue;
        if (nValue == 0)
            nValue++;
        m_xMtrFldAmount->set_unit(FieldUnit::CUSTOM);
        m_xMtrFldAmount->set_digits(0);

            m_xMtrFldAmount->set_increments(1, 10, FieldUnit::NONE);
            m_xMtrFldAmount->set_range(1, 100, FieldUnit::NONE);
            m_xMtrFldAmount->set_value(nValue, FieldUnit::NONE);
        }
        else
        {
            m_xTsbPixel->set_state( TRISTATE_FALSE );
            m_xMtrFldAmount->set_unit( eFUnit );
            m_xMtrFldAmount->set_digits(2);

            m_xMtrFldAmount->set_increments(10, 100, FieldUnit::NONE);
            m_xMtrFldAmount->set_range(1, 10000, FieldUnit::NONE);

            SetMetricValue( *m_xMtrFldAmount, nValue, eUnit );
        }
        m_xMtrFldAmount->set_increments(1, 10, FieldUnit::NONE);
        m_xMtrFldAmount->set_range(1, 100, FieldUnit::NONE);
        m_xMtrFldAmount->set_value(nValue, FieldUnit::NONE);
    }
    else
    {
        m_xMtrFldAmount->set_sensitive(false);
        m_xMtrFldAmount->set_text("");
        m_xTsbPixel->set_state( TRISTATE_INDET );
        m_xTsbPixel->set_state(TRISTATE_FALSE);
        m_xMtrFldAmount->set_unit(eFUnit);
        m_xMtrFldAmount->set_digits(2);

        m_xMtrFldAmount->set_increments(10, 100, FieldUnit::NONE);
        m_xMtrFldAmount->set_range(1, 10000, FieldUnit::NONE);

        SetMetricValue(*m_xMtrFldAmount, nValue, eUnit);
    }
    m_xTsbPixel->save_state();
    m_xMtrFldAmount->save_value();
diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx
index b80cfd3..0a6d369 100644
--- a/cui/source/tabpages/textattr.cxx
+++ b/cui/source/tabpages/textattr.cxx
@@ -116,52 +116,31 @@
    MapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );

    const SfxPoolItem* pItem = GetItem( *rAttrs, SDRATTR_TEXT_LEFTDIST );

    if( !pItem )
        pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LEFTDIST );
    if( pItem )
    {
        long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
        SetMetricValue( *m_xMtrFldLeft, nValue, eUnit );
    }
    else
        m_xMtrFldLeft->set_text("");

    SetMetricValue(*m_xMtrFldLeft, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
    m_xMtrFldLeft->save_value();

    pItem = GetItem( *rAttrs, SDRATTR_TEXT_RIGHTDIST );
    if( !pItem )
        pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_RIGHTDIST );
    if( pItem )
    {
        long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
        SetMetricValue( *m_xMtrFldRight, nValue, eUnit );
    }
    else
        m_xMtrFldRight->set_text("");

    SetMetricValue(*m_xMtrFldRight, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
    m_xMtrFldRight->save_value();

    pItem = GetItem( *rAttrs, SDRATTR_TEXT_UPPERDIST );
    if( !pItem )
        pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_UPPERDIST );
    if( pItem )
    {
        long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
        SetMetricValue( *m_xMtrFldTop, nValue, eUnit );
    }
    else
        m_xMtrFldTop->set_text("");

    SetMetricValue(*m_xMtrFldTop, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
    m_xMtrFldTop->save_value();

    pItem = GetItem( *rAttrs, SDRATTR_TEXT_LOWERDIST );
    if( !pItem )
        pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LOWERDIST );
    if( pItem )
    {
        long nValue = static_cast<const SdrMetricItem*>(pItem)->GetValue();
        SetMetricValue( *m_xMtrFldBottom, nValue, eUnit );
    }
    else
        m_xMtrFldBottom->set_text("");

    SetMetricValue(*m_xMtrFldBottom, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
    m_xMtrFldBottom->save_value();

    // adjust to height and autogrowsize
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index ab2ba01..f84fba0 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -932,65 +932,63 @@
    // Found [ \t]+[A-Z0-9]+ until here. Test now on the paragraph separator.
    // all three can happen, but not more than once!
    const sal_Unicode* pExceptStt = nullptr;
    if( !bAtStart )
    bool bContinue = true;
    Flags nFlag = Flags::NONE;
    do
    {
        bool bContinue = true;
        Flags nFlag = Flags::NONE;
        do {
            switch( *pStr )
            {
        switch (*pStr)
        {
            // Western and Asian full stop
            case '.':
            case 0x3002 :
            case 0xFF0E :
            case 0x3002:
            case 0xFF0E:
            {
                if (pStr >= pStart + 2 && *(pStr - 2) == '.')
                {
                    if (pStr >= pStart + 2 && *(pStr-2) == '.')
                    {
                        //e.g. text "f.o.o. word": Now currently considering
                        //capitalizing word but second last character of
                        //previous word is a .  So probably last word is an
                        //anagram that ends in . and not truly the end of a
                        //previous sentence, so don't autocapitalize this word
                        return;
                    }
                    if( nFlag & Flags::FullStop )
                        return;  // no valid separator -> no replacement
                    nFlag |= Flags::FullStop;
                    pExceptStt = pStr;
                    //e.g. text "f.o.o. word": Now currently considering
                    //capitalizing word but second last character of
                    //previous word is a .  So probably last word is an
                    //anagram that ends in . and not truly the end of a
                    //previous sentence, so don't autocapitalize this word
                    return;
                }
                break;
                if (nFlag & Flags::FullStop)
                    return; // no valid separator -> no replacement
                nFlag |= Flags::FullStop;
                pExceptStt = pStr;
            }
            break;
            case '!':
            case 0xFF01 :
                {
                    if( nFlag & Flags::ExclamationMark )
                        return;   // no valid separator -> no replacement
                    nFlag |= Flags::ExclamationMark;
                }
                break;
            case 0xFF01:
            {
                if (nFlag & Flags::ExclamationMark)
                    return; // no valid separator -> no replacement
                nFlag |= Flags::ExclamationMark;
            }
            break;
            case '?':
            case 0xFF1F :
                {
                    if( nFlag & Flags::QuestionMark)
                        return;   // no valid separator -> no replacement
                    nFlag |= Flags::QuestionMark;
                }
                break;
            case 0xFF1F:
            {
                if (nFlag & Flags::QuestionMark)
                    return; // no valid separator -> no replacement
                nFlag |= Flags::QuestionMark;
            }
            break;
            default:
                if( nFlag == Flags::NONE )
                    return;       // no valid separator -> no replacement
                if (nFlag == Flags::NONE)
                    return; // no valid separator -> no replacement
                else
                    bContinue = false;
                break;
            }
        }

            if( bContinue && pStr-- == pStart )
            {
                return;       // no valid separator -> no replacement
            }
        } while( bContinue );
        if( Flags::FullStop != nFlag )
            pExceptStt = nullptr;
    }
        if (bContinue && pStr-- == pStart)
        {
            return; // no valid separator -> no replacement
        }
    } while (bContinue);
    if (Flags::FullStop != nFlag)
        pExceptStt = nullptr;

    if( 2 > ( pStr - pStart ) )
        return;
diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx
index 71afb18..27281c3 100644
--- a/editeng/source/uno/unoipset.cxx
+++ b/editeng/source/uno/unoipset.cxx
@@ -157,32 +157,28 @@
        pItem = &pPool->GetDefaultItem( pMap->nWID );
    }

    DBG_ASSERT( pItem, "Got no default for item!" );
    if( pItem )
    uno::Any aValue(rVal);

    const MapUnit eMapUnit = pPool ? pPool->GetMetric(pMap->nWID) : MapUnit::Map100thMM;

    // check for needed metric translation
    if ((pMap->nMoreFlags & PropertyMoreFlags::METRIC_ITEM) && eMapUnit != MapUnit::Map100thMM)
    {
        uno::Any aValue( rVal );
        if (!bDontConvertNegativeValues || SvxUnoCheckForPositiveValue(aValue))
            SvxUnoConvertFromMM(eMapUnit, aValue);
    }

        const MapUnit eMapUnit = pPool ? pPool->GetMetric(pMap->nWID) : MapUnit::Map100thMM;
    std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());

        // check for needed metric translation
        if( (pMap->nMoreFlags & PropertyMoreFlags::METRIC_ITEM) && eMapUnit != MapUnit::Map100thMM )
        {
            if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aValue ) )
                SvxUnoConvertFromMM( eMapUnit, aValue );
        }
    sal_uInt8 nMemberId = pMap->nMemberId;
    if (eMapUnit == MapUnit::Map100thMM)
        nMemberId &= (~CONVERT_TWIPS);

        std::unique_ptr<SfxPoolItem> pNewItem( pItem->Clone() );

        sal_uInt8 nMemberId = pMap->nMemberId;
        if( eMapUnit == MapUnit::Map100thMM )
            nMemberId &= (~CONVERT_TWIPS);

        if( pNewItem->PutValue( aValue, nMemberId ) )
        {
            // Set new item in item set
            pNewItem->SetWhich( pMap->nWID );
            rSet.Put( *pNewItem );
        }
    if (pNewItem->PutValue(aValue, nMemberId))
    {
        // Set new item in item set
        pNewItem->SetWhich(pMap->nWID);
        rSet.Put(*pNewItem);
    }
}

diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index f1b4874..6885804 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1124,7 +1124,7 @@
        }

        if( bUnknownPropertyFound )
            return !bUnknownPropertyFound;
            return false;

        if( nWID != 0 )
            eItemState = pSet->GetItemState( nWID, false );
@@ -1145,7 +1145,7 @@
                    rState = beans::PropertyState_AMBIGUOUS_VALUE;
        }
    }
    return !bUnknownPropertyFound;
    return true;
}

void SAL_CALL SvxUnoTextRangeBase::setPropertyToDefault( const OUString& PropertyName )
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index f04466e..ec8c46d 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -1927,7 +1927,6 @@
{
    try
    {
        bool bFail = false;
        if( pvar->vt != VT_DISPATCH)
            throw BridgeRuntimeError("[automation bridge] UnoConversionUtilities<T>::dispatchExObject2Sequence \n"
                                     "Conversion of dispatch object to Sequence failed!");
@@ -2038,10 +2037,6 @@
        anySeq.setValue( &p_uno_Seq, pDesc);
        uno_destructData( &p_uno_Seq, pDesc, cpp_release);
        typelib_typedescription_release( pDesc);

        if (bFail)
            throw BridgeRuntimeError(
                "[automation bridge] Conversion of ValueObject failed ");
    }
    catch (const BridgeRuntimeError &)
    {
diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx
index bdca73f..b28df28 100644
--- a/extensions/source/propctrlr/stringrepresentation.cxx
+++ b/extensions/source/propctrlr/stringrepresentation.cxx
@@ -338,14 +338,12 @@

        // loop through the elements and concatenate the string representations of the integers
        // (separated by a line break)
        const ElementType* pElements = _rElements.getConstArray();
        const ElementType* pElementsEnd = pElements + _rElements.getLength();
        for ( ; pElements != pElementsEnd; ++pElements )
        for (const auto& rElement : _rElements)
        {
            sCompose.append( OUString( _rTransformer( *pElements ) ) );
            if ( pElements != pElementsEnd )
                sCompose.append("\n");
            sCompose.append(OUString(_rTransformer(rElement)));
            sCompose.append("\n");
        }
        sCompose.stripEnd('\n');

        return sCompose.makeStringAndClear();
    }
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 7617eaf..fb91a7b 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -650,33 +650,30 @@
                bOk = false;
            }
        }
        else
        else // bOk
        {
            if( bOk )
            try
            {
                Reference< XFlushable > xFlushable( mxFilterContainer, UNO_QUERY );
                if( xFlushable.is() )
                    xFlushable->flush();
            }
            catch( const Exception& )
            {
                OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception caught!" );
                bOk = false;
            }

            if( !bOk )
            {
                // we failed to add the filter, so lets remove the type
                try
                {
                    Reference< XFlushable > xFlushable( mxFilterContainer, UNO_QUERY );
                    if( xFlushable.is() )
                        xFlushable->flush();
                    mxTypeDetection->removeByName( pFilterEntry->maType );
                }
                catch( const Exception& )
                {
                    OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception caught!" );
                    bOk = false;
                }

                if( !bOk )
                {
                    // we failed to add the filter, so lets remove the type
                    try
                    {
                        mxTypeDetection->removeByName( pFilterEntry->maType );
                    }
                    catch( const Exception& )
                    {
                        OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception caught!" );
                    }
                }

            }
diff --git a/i18npool/source/textconversion/textconversion_ko.cxx b/i18npool/source/textconversion/textconversion_ko.cxx
index f09aa50..0e0a9bd 100644
--- a/i18npool/source/textconversion/textconversion_ko.cxx
+++ b/i18npool/source/textconversion/textconversion_ko.cxx
@@ -325,8 +325,7 @@
                aBuf.append(str + start, result.Boundary.startPos - start); // append skip portion
            aBuf.append(result.Candidates[0]); // append converted portion
        } else {
            if (length + nStartPos > start)
                aBuf.append(str + start, length + nStartPos - start); // append last portion
            aBuf.append(str + start, length + nStartPos - start); // append last portion
            break;
        }
    }
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
index a9d8455..7711a9e 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
@@ -79,8 +79,7 @@
    {
        if (pCur < pEnd && rtl::isAsciiDigit(static_cast<unsigned char>(*pCur)))
        {
            if (pCur < pEnd)
                pCur ++;
            pCur ++;
            nPartPos ++;
        }
        //if  correct separator then form integer
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 3469fda..c048d2e 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -1299,8 +1299,6 @@
    uno::Sequence < beans::PropertyValue > aProps;

    // export sub streams for package, else full stream into a file
    bool bErr = false;

    uno::Reference< beans::XPropertySet> xProp(_xStorageToSaveTo,uno::UNO_QUERY);
    if ( xProp.is() )
    {
@@ -1349,44 +1347,23 @@
    aDelegatorArguments[nArgsLen++] <<= xObjectResolver;

    uno::Reference<XComponent> xCom(static_cast<OWeakObject*>(this),uno::UNO_QUERY);
    if( !bErr )
    {
        xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("settings.xml")));
        WriteThroughComponent(
            xCom, "settings.xml",
            "com.sun.star.comp.report.XMLSettingsExporter",
            aDelegatorArguments, aProps, _xStorageToSaveTo );
    }
    // Try to write to settings.xml, meta.xml, and styles.xml; only really care about success of
    // write to content.xml (keeping logic of commit 94ccba3eebc83b58e74e18f0e028c6a995ce6aa6)
    xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("settings.xml")));
    WriteThroughComponent(xCom, "settings.xml", "com.sun.star.comp.report.XMLSettingsExporter",
                          aDelegatorArguments, aProps, _xStorageToSaveTo);

    if( !bErr )
    {
        xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("meta.xml")));
        WriteThroughComponent(
            xCom, "meta.xml",
            "com.sun.star.comp.report.XMLMetaExporter",
            aDelegatorArguments, aProps, _xStorageToSaveTo );
    }
    xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("meta.xml")));
    WriteThroughComponent(xCom, "meta.xml", "com.sun.star.comp.report.XMLMetaExporter",
                          aDelegatorArguments, aProps, _xStorageToSaveTo);

    if( !bErr )
    {
        xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("styles.xml")));
        WriteThroughComponent(
            xCom, "styles.xml",
            "com.sun.star.comp.report.XMLStylesExporter",
            aDelegatorArguments, aProps, _xStorageToSaveTo );
    }
    xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("styles.xml")));
    WriteThroughComponent(xCom, "styles.xml", "com.sun.star.comp.report.XMLStylesExporter",
                          aDelegatorArguments, aProps, _xStorageToSaveTo);

    if ( !bErr )
    {
        xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
        if( !WriteThroughComponent(
                xCom, "content.xml",
                "com.sun.star.comp.report.ExportFilter",
                aDelegatorArguments, aProps, _xStorageToSaveTo ) )
        {
            bErr = true;
        }
    }
    xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
    bool bOk = WriteThroughComponent(xCom, "content.xml", "com.sun.star.comp.report.ExportFilter",
                                     aDelegatorArguments, aProps, _xStorageToSaveTo);

    uno::Any aImage;
    uno::Reference< embed::XVisualObject > xCurrentController(getCurrentController(),uno::UNO_QUERY);
@@ -1403,7 +1380,7 @@
        m_pImpl->m_pObjectContainer->InsertGraphicStreamDirectly(xStream, "report", "image/png");
    }

    if ( !bErr )
    if (bOk)
    {
        bool bPersist = false;
        if ( _xStorageToSaveTo == m_pImpl->m_xStorage )
diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx
index 008792b..a50d13d 100644
--- a/reportdesign/source/ui/report/propbrw.cxx
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -340,7 +340,7 @@
        Reference< lang::XServiceInfo > xServiceInfo( xNameCont->getByName("ReportComponent"), UNO_QUERY );
        if ( xServiceInfo.is() )
        {
            const char* pResId = nullptr;
            const char* pResId;
            if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT ) )
            {
                pResId = RID_STR_PROPTITLE_FIXEDTEXT;
@@ -384,10 +384,7 @@
                return aName;
            }

            if (pResId)
            {
                aName += RptResId(pResId);
            }
            aName += RptResId(pResId);
        }
    }
    else    // multiselection
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 41cf8ca..6608876 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2932,30 +2932,19 @@
                bSingle = false;    // no difference in this range
            }
        }
        if (bSingle)
        {
            if (nEndRow-nStartRow < 20)
            {
                if (!bChanged)
                    bChanged = lcl_pixelSizeChanged(*mpRowHeights, nStartRow, nEndRow, nNewHeight, nPPTY);

                mpRowHeights->setValue(nStartRow, nEndRow, nNewHeight);
            }
            else
            {
                SCROW nMid = (nStartRow+nEndRow) / 2;
                if (SetRowHeightRange( nStartRow, nMid, nNewHeight, 1.0 ))
                    bChanged = true;
                if (SetRowHeightRange( nMid+1, nEndRow, nNewHeight, 1.0 ))
                    bChanged = true;
            }
        if (!bSingle || nEndRow - nStartRow < 20)
        {
            bChanged = lcl_pixelSizeChanged(*mpRowHeights, nStartRow, nEndRow, nNewHeight, nPPTY);
            mpRowHeights->setValue(nStartRow, nEndRow, nNewHeight);
        }
        else
        {
            if (!bChanged)
                bChanged = lcl_pixelSizeChanged(*mpRowHeights, nStartRow, nEndRow, nNewHeight, nPPTY);

            mpRowHeights->setValue(nStartRow, nEndRow, nNewHeight);
            SCROW nMid = (nStartRow + nEndRow) / 2;
            if (SetRowHeightRange(nStartRow, nMid, nNewHeight, 1.0))
                bChanged = true;
            if (SetRowHeightRange(nMid + 1, nEndRow, nNewHeight, 1.0))
                bChanged = true;
        }

        if (bChanged)
diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx
index 9a3953a..b7e790eca 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -286,7 +286,7 @@
        auto pAttList = sax_fastparser::FastSerializerHelper::createAttrList();
        // TODO In same cases, disable listing of items, as it is done in MS Excel.
        // Exporting savePivotCacheRecordsXml method needs to be updated accordingly
        bool bListItems = true;
        //bool bListItems = true;

        std::set<ScDPItemData::Type> aDPTypesWithoutBlank = aDPTypes;
        aDPTypesWithoutBlank.erase(ScDPItemData::Empty);
@@ -352,7 +352,7 @@
            pAttList->add(XML_maxDate, XclXmlUtils::ToOString(GetExcelFormattedDate(fMax, GetFormatter())));
        }

        if (bListItems)
        //if (bListItems) // see TODO above
        {
            pAttList->add(XML_count, OString::number(static_cast<long>(rFieldItems.size())));
        }
@@ -360,7 +360,7 @@

        pDefStrm->startElement(XML_sharedItems, xAttributeList);

        if (bListItems)
        //if (bListItems) // see TODO above
        {
            it = rFieldItems.begin();
            for (; it != itEnd; ++it)
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index b70086e..46bf153 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -890,15 +890,15 @@
    const char* pUnderline = lcl_GetUnderlineStyle( rFontData.GetScUnderline(), bHaveUnderline );
    const char* pVertAlign = lcl_ToVerticalAlignmentRun( rFontData.GetScEscapement(), bHaveVertAlign );

    lcl_WriteValue( pStream, XML_b,          rFontData.mnWeight > 400 ? ToPsz( rFontData.mnWeight > 400 ) : nullptr );
    lcl_WriteValue( pStream, XML_i,          rFontData.mbItalic ? ToPsz( rFontData.mbItalic ) : nullptr );
    lcl_WriteValue( pStream, XML_strike,     rFontData.mbStrikeout ? ToPsz( rFontData.mbStrikeout ) : nullptr );
    lcl_WriteValue( pStream, XML_b,          rFontData.mnWeight > 400 ? ToPsz( true ) : nullptr );
    lcl_WriteValue( pStream, XML_i,          rFontData.mbItalic       ? ToPsz( true ) : nullptr );
    lcl_WriteValue( pStream, XML_strike,     rFontData.mbStrikeout    ? ToPsz( true ) : nullptr );
    // OOXTODO: lcl_WriteValue( rStream, XML_condense, );    // mac compatibility setting
    // OOXTODO: lcl_WriteValue( rStream, XML_extend, );      // compatibility setting
    lcl_WriteValue( pStream, XML_outline,    rFontData.mbOutline ? ToPsz( rFontData.mbOutline ) : nullptr );
    lcl_WriteValue( pStream, XML_shadow,     rFontData.mbShadow ? ToPsz( rFontData.mbShadow ) : nullptr );
    lcl_WriteValue( pStream, XML_u,          bHaveUnderline ? pUnderline : nullptr );
    lcl_WriteValue( pStream, XML_vertAlign,  bHaveVertAlign ? pVertAlign : nullptr );
    lcl_WriteValue( pStream, XML_outline,    rFontData.mbOutline      ? ToPsz( true ) : nullptr );
    lcl_WriteValue( pStream, XML_shadow,     rFontData.mbShadow       ? ToPsz( true ) : nullptr );
    lcl_WriteValue( pStream, XML_u,          bHaveUnderline           ? pUnderline    : nullptr );
    lcl_WriteValue( pStream, XML_vertAlign,  bHaveVertAlign           ? pVertAlign    : nullptr );
    lcl_WriteValue( pStream, XML_sz,         OString::number( rFontData.mnHeight / 20.0 ).getStr() );  // Twips->Pt
    if( rFontData.maColor != Color( 0xFF, 0xFF, 0xFF, 0xFF ) )
        pStream->singleElement( XML_color,
diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx
index 14c84e8..73a51c2 100644
--- a/sc/source/filter/qpro/qproform.cxx
+++ b/sc/source/filter/qpro/qproform.cxx
@@ -158,8 +158,7 @@
        aPool << eParam[ nLast ];
        for( nCount = nLast - 1 ; nCount >= 0 ; nCount-- )
        {
            if( nCount != -1 )
                aPool << ocSep << eParam[ nCount ];
            aPool << ocSep << eParam[ nCount ];
        }
    }

diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index c984492..49e7b58 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -659,73 +659,71 @@
    ScChangeAction* pChangeAction = pTrack->GetAction(pAction->nActionNumber);
    if (pChangeAction)
    {
        assert(dynamic_cast<ScChangeActionContent*>(pChangeAction));
        ScChangeActionContent* pChangeActionContent = static_cast<ScChangeActionContent*>(pChangeAction);
        if (pChangeActionContent)
        if (pChangeActionContent->IsTopContent() && !pChangeActionContent->IsDeletedIn())
        {
            if (pChangeActionContent->IsTopContent() && !pChangeActionContent->IsDeletedIn())
            sal_Int32 nCol, nRow, nTab, nCol2, nRow2, nTab2;
            pAction->aBigRange.GetVars(nCol, nRow, nTab, nCol2, nRow2, nTab2);
            if ((nCol >= 0) && (nCol <= MAXCOL) &&
                (nRow >= 0) && (nRow <= MAXROW) &&
                (nTab >= 0) && (nTab <= MAXTAB))
            {
                sal_Int32 nCol, nRow, nTab, nCol2, nRow2, nTab2;
                pAction->aBigRange.GetVars(nCol, nRow, nTab, nCol2, nRow2, nTab2);
                if ((nCol >= 0) && (nCol <= MAXCOL) &&
                    (nRow >= 0) && (nRow <= MAXROW) &&
                    (nTab >= 0) && (nTab <= MAXTAB))
                ScAddress aAddress (static_cast<SCCOL>(nCol),
                                    static_cast<SCROW>(nRow),
                                    static_cast<SCTAB>(nTab));
                ScCellValue aCell;
                aCell.assign(*pDoc, aAddress);
                if (!aCell.isEmpty())
                {
                    ScAddress aAddress (static_cast<SCCOL>(nCol),
                                        static_cast<SCROW>(nRow),
                                        static_cast<SCTAB>(nTab));
                    ScCellValue aCell;
                    aCell.assign(*pDoc, aAddress);
                    if (!aCell.isEmpty())
                    ScCellValue aNewCell;
                    if (aCell.meType != CELLTYPE_FORMULA)
                    {
                        ScCellValue aNewCell;
                        if (aCell.meType != CELLTYPE_FORMULA)
                        aNewCell = aCell;
                        pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
                        pChangeActionContent->SetNewValue(aCell, pDoc);
                    }
                    else
                    {
                        ScMatrixMode nMatrixFlag = aCell.mpFormula->GetMatrixFlag();
                        OUString sFormula;
                        // With GRAM_ODFF reference detection is faster on compilation.
                        /* FIXME: new cell should be created with a clone
                         * of the token array instead. Any reason why this
                         * wasn't done? */
                        aCell.mpFormula->GetFormula(sFormula, formula::FormulaGrammar::GRAM_ODFF);

                        // #i87826# [Collaboration] Rejected move destroys formulas
                        // FIXME: adjust ScFormulaCell::GetFormula(), so that the right formula string
                        //        is returned and no further string handling is necessary
                        OUString sFormula2;
                        if ( nMatrixFlag != ScMatrixMode::NONE )
                        {
                            aNewCell = aCell;
                            pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
                            pChangeActionContent->SetNewValue(aCell, pDoc);
                            sFormula2 = sFormula.copy( 2, sFormula.getLength() - 3 );
                        }
                        else
                        {
                            ScMatrixMode nMatrixFlag = aCell.mpFormula->GetMatrixFlag();
                            OUString sFormula;
                            // With GRAM_ODFF reference detection is faster on compilation.
                            /* FIXME: new cell should be created with a clone
                             * of the token array instead. Any reason why this
                             * wasn't done? */
                            aCell.mpFormula->GetFormula(sFormula, formula::FormulaGrammar::GRAM_ODFF);

                            // #i87826# [Collaboration] Rejected move destroys formulas
                            // FIXME: adjust ScFormulaCell::GetFormula(), so that the right formula string
                            //        is returned and no further string handling is necessary
                            OUString sFormula2;
                            if ( nMatrixFlag != ScMatrixMode::NONE )
                            {
                                sFormula2 = sFormula.copy( 2, sFormula.getLength() - 3 );
                            }
                            else
                            {
                                sFormula2 = sFormula.copy( 1 );
                            }

                            aNewCell.meType = CELLTYPE_FORMULA;
                            aNewCell.mpFormula = new ScFormulaCell(pDoc, aAddress, sFormula2,formula::FormulaGrammar::GRAM_ODFF, nMatrixFlag);
                            if (nMatrixFlag == ScMatrixMode::Formula)
                            {
                                SCCOL nCols;
                                SCROW nRows;
                                aCell.mpFormula->GetMatColsRows(nCols, nRows);
                                aNewCell.mpFormula->SetMatColsRows(nCols, nRows);
                            }
                            aNewCell.mpFormula->SetInChangeTrack(true);
                            pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
                            // #i40704# don't overwrite the formula string via SetNewValue()
                            sFormula2 = sFormula.copy( 1 );
                        }

                        aNewCell.meType = CELLTYPE_FORMULA;
                        aNewCell.mpFormula = new ScFormulaCell(pDoc, aAddress, sFormula2,formula::FormulaGrammar::GRAM_ODFF, nMatrixFlag);
                        if (nMatrixFlag == ScMatrixMode::Formula)
                        {
                            SCCOL nCols;
                            SCROW nRows;
                            aCell.mpFormula->GetMatColsRows(nCols, nRows);
                            aNewCell.mpFormula->SetMatColsRows(nCols, nRows);
                        }
                        aNewCell.mpFormula->SetInChangeTrack(true);
                        pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
                        // #i40704# don't overwrite the formula string via SetNewValue()
                    }
                }
                else
                {
                    OSL_FAIL("wrong cell position");
                }
            }
            else
            {
                OSL_FAIL("wrong cell position");
            }
        }
    }
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 9634019..f2ce094 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1478,14 +1478,9 @@
                else
                {
                    assert(nPrevIndex >= 0 && "coverity#1438402");
                    if (nRow < nEndRow)
                    {
                        ScRowFormatRanges* pTempRowFormatRanges = new ScRowFormatRanges(pRowFormatRanges.get());
                        OpenAndCloseRow(nPrevIndex, nRow - nEqualRows, nEqualRows, bPrevHidden, bPrevFiltered);
                        pRowFormatRanges.reset(pTempRowFormatRanges);
                    }
                    else
                        OpenAndCloseRow(nPrevIndex, nRow - nEqualRows, nEqualRows, bPrevHidden, bPrevFiltered);
                    ScRowFormatRanges* pTempRowFormatRanges = new ScRowFormatRanges(pRowFormatRanges.get());
                    OpenAndCloseRow(nPrevIndex, nRow - nEqualRows, nEqualRows, bPrevHidden, bPrevFiltered);
                    pRowFormatRanges.reset(pTempRowFormatRanges);
                    nEqualRows = 1;
                    nPrevIndex = nIndex;
                    bPrevHidden = bHidden;
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index c7807ce..583c89c 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -495,11 +495,8 @@
        case SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT:
            {
                ScTabEditEngine* pEngine = static_cast<ScTabEditEngine*>(pUserObject);
                if ( nUserObjectId == SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT )
                {
                    pEngine->Write( *rxOStm, EETextFormat::Xml );
                    bRet = ( rxOStm->GetError() == ERRCODE_NONE );
                }
                pEngine->Write(*rxOStm, EETextFormat::Xml);
                bRet = (rxOStm->GetError() == ERRCODE_NONE);
            }
            break;

diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx
index 6b33a09..ea96222 100644
--- a/sc/source/ui/view/tabvwsh2.cxx
+++ b/sc/source/ui/view/tabvwsh2.cxx
@@ -184,18 +184,15 @@
    nDrawSfxId = nNewId;
    sDrawCustom.clear();    // value is set below for custom shapes

    if ( nNewId != SID_DRAW_CHART )             // chart not with DrawShell
    if (nNewId == SID_DRAW_TEXT || nNewId == SID_DRAW_TEXT_VERTICAL
        || nNewId == SID_DRAW_TEXT_MARQUEE || nNewId == SID_DRAW_NOTEEDIT)
        SetDrawTextShell(true);
    else
    {
        if ( nNewId == SID_DRAW_TEXT || nNewId == SID_DRAW_TEXT_VERTICAL ||
                nNewId == SID_DRAW_TEXT_MARQUEE || nNewId == SID_DRAW_NOTEEDIT )
            SetDrawTextShell( true );
        if (bEx || pView->GetMarkedObjectList().GetMarkCount() != 0)
            SetDrawShellOrSub();
        else
        {
            if ( bEx || pView->GetMarkedObjectList().GetMarkCount() != 0 )
                SetDrawShellOrSub();
            else
                SetDrawShell( false );
        }
            SetDrawShell(false);
    }

    if (pTabView->GetDrawFuncPtr())
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 207d288..6d9bf0b 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -368,22 +368,18 @@
                }
            }

            if (pViewShell != nullptr)
            if (SfxDispatcher* pDispatcher = pViewShell->GetDispatcher())
            {
                SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
                if (pDispatcher != nullptr)
                {
                    mbContextMenuOpen = true;
                    if (!rEvent.IsMouseEvent())
                        pDispatcher->ExecutePopup(aPopupId, pWindow, &aMenuLocation);
                    else
                        pDispatcher->ExecutePopup(aPopupId);
                    mbContextMenuOpen = false;
                    mrSlideSorter.GetView().UpdatePageUnderMouse();
                    ::rtl::Reference<SelectionFunction> pFunction(GetCurrentSelectionFunction());
                    if (pFunction.is())
                        pFunction->ResetMouseAnchor();
                }
                mbContextMenuOpen = true;
                if (!rEvent.IsMouseEvent())
                    pDispatcher->ExecutePopup(aPopupId, pWindow, &aMenuLocation);
                else
                    pDispatcher->ExecutePopup(aPopupId);
                mbContextMenuOpen = false;
                mrSlideSorter.GetView().UpdatePageUnderMouse();
                ::rtl::Reference<SelectionFunction> pFunction(GetCurrentSelectionFunction());
                if (pFunction.is())
                    pFunction->ResetMouseAnchor();
            }
            if (pPage == nullptr)
            {
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index bdd6153..c7b8b6b 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -797,13 +797,10 @@

    uno::Reference< drawing::XDrawPage > xPage;

    if( mpDoc )
    {
        initializeDocument();
        SdPage* pPage = mpDoc->GetMasterSdPage( 0, PageKind::Handout );
        if( pPage )
            xPage.set( pPage->getUnoPage(), uno::UNO_QUERY );
    }
    initializeDocument();
    SdPage* pPage = mpDoc->GetMasterSdPage(0, PageKind::Handout);
    if (pPage)
        xPage.set(pPage->getUnoPage(), uno::UNO_QUERY);
    return xPage;
}

@@ -956,7 +953,7 @@

    if( aServiceSpecifier == "com.sun.star.document.ExportEmbeddedObjectResolver" )
    {
        ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : nullptr;
        comphelper::IEmbeddedHelper* pPersist = mpDoc->GetPersist();
        if( nullptr == pPersist )
            throw lang::DisposedException();

@@ -965,7 +962,7 @@

    if( aServiceSpecifier == "com.sun.star.document.ImportEmbeddedObjectResolver" )
    {
        ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : nullptr;
        comphelper::IEmbeddedHelper* pPersist = mpDoc->GetPersist();
        if( nullptr == pPersist )
            throw lang::DisposedException();

diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx
index 1f0a1a0..aed0fb2 100644
--- a/sd/source/ui/unoidl/unopback.cxx
+++ b/sd/source/ui/unoidl/unopback.cxx
@@ -402,20 +402,17 @@
        throw beans::UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this));

    uno::Any aAny;
    if( mpSet )
    if (pEntry->nWID == OWN_ATTR_FILLBMP_MODE)
    {
        if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
        {
            aAny <<= drawing::BitmapMode_REPEAT;
        }
        else
        {
            SfxItemPool& rPool = *mpSet->GetPool();
            SfxItemSet aSet( rPool, {{pEntry->nWID, pEntry->nWID}});
            aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
        aAny <<= drawing::BitmapMode_REPEAT;
    }
    else
    {
        SfxItemPool& rPool = *mpSet->GetPool();
        SfxItemSet aSet(rPool, { { pEntry->nWID, pEntry->nWID } });
        aSet.Put(rPool.GetDefaultItem(pEntry->nWID));

            aAny = SvxItemPropertySet_getPropertyValue( pEntry, aSet );
        }
        aAny = SvxItemPropertySet_getPropertyValue(pEntry, aSet);
    }
    return aAny;
}
diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx
index d4c6543..7be7281 100644
--- a/sd/source/ui/unoidl/unosrch.cxx
+++ b/sd/source/ui/unoidl/unosrch.cxx
@@ -789,14 +789,11 @@

uno::Any SAL_CALL SdUnoFindAllAccess::getByIndex( sal_Int32 Index )
{
    uno::Any aAny;

    if( Index < 0 || Index >= getCount() )
        throw lang::IndexOutOfBoundsException();

    const uno::Reference< uno::XInterface >  *pRefs = maSequence.getConstArray();
    if(pRefs)
        aAny <<= pRefs[ Index ];
    uno::Any aAny;
    aAny <<= maSequence[Index];
    return aAny;
}

diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index ccf09ff..d9fe8fb 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -935,18 +935,6 @@
                {
                    svt::EmbeddedObjectRef aObjRef( xObj, aObjDesc.mnViewAspect );

                    // try to get the replacement image from the clipboard
                    Graphic aGraphic;
                    SotClipboardFormatId nGrFormat = SotClipboardFormatId::NONE;

                    // insert replacement image ( if there is one ) into the object helper
                    if ( nGrFormat != SotClipboardFormatId::NONE )
                    {
                        datatransfer::DataFlavor aDataFlavor;
                        SotExchange::GetFormatDataFlavor( nGrFormat, aDataFlavor );
                        aObjRef.SetGraphic( aGraphic, aDataFlavor.MimeType );
                    }

                    Size aSize;
                    if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
                    {
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 0398ff0..5b4bc87 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -399,13 +399,10 @@
    if(pWin)
        SetActiveWindow(pWin);

    if(!bReturn)
    {
        // give key input first to SfxViewShell to give CTRL+Key
        // (e.g. CTRL+SHIFT+'+', to front) priority.
        OSL_ASSERT (GetViewShell()!=nullptr);
        bReturn = GetViewShell()->KeyInput(rKEvt);
    }
    // give key input first to SfxViewShell to give CTRL+Key
    // (e.g. CTRL+SHIFT+'+', to front) priority.
    OSL_ASSERT(GetViewShell() != nullptr);
    bReturn = GetViewShell()->KeyInput(rKEvt);

    const size_t OriCount = GetView()->GetMarkedObjectList().GetMarkCount();
    if(!bReturn)
diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx
index c588b2c..0d42099 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -501,12 +501,12 @@
                        basegfx::B2DRange aSvgCanvasRange; // viewport
                        double fW = 0.0; // dummy values
                        double fH = 0.0;
                        if(getViewBox())
                        if (const basegfx::B2DRange* pBox = getViewBox())
                        {
                            // SVG 1.1 defines in section 7.7 that a negative value for width or height
                            // in viewBox is an error and that 0.0 disables rendering
                            const double fViewBoxWidth = getViewBox()->getWidth();
                            const double fViewBoxHeight = getViewBox()->getHeight();
                            const double fViewBoxWidth = pBox->getWidth();
                            const double fViewBoxHeight = pBox->getHeight();
                            if(basegfx::fTools::more(fViewBoxWidth,0.0) && basegfx::fTools::more(fViewBoxHeight,0.0))
                            {
                                // The intrinsic aspect ratio of the svg element is given by absolute values of svg width and svg height
@@ -542,14 +542,10 @@
                                    // We get viewport >= content, therefore no clipping.
                                    bNeedsMapping = false;

                                    const basegfx::B2DRange aChildRange(
                                        aSequence.getB2DRange(
                                            drawinglayer::geometry::ViewInformation2D()));

                                    const double fChildWidth(getViewBox() ? getViewBox()->getWidth() : aChildRange.getWidth());
                                    const double fChildHeight(getViewBox() ? getViewBox()->getHeight() : aChildRange.getHeight());
                                    const double fLeft(getViewBox() ? getViewBox()->getMinX()  : aChildRange.getMinX());
                                    const double fTop (getViewBox() ? getViewBox()->getMinY() : aChildRange.getMinY());
                                    const double fChildWidth(pBox->getWidth());
                                    const double fChildHeight(pBox->getHeight());
                                    const double fLeft(pBox->getMinX());
                                    const double fTop(pBox->getMinY());
                                    if ( fChildWidth / fViewBoxWidth > fChildHeight / fViewBoxHeight )
                                    {  // expand y
                                        fW = fChildWidth;
@@ -572,7 +568,7 @@
                                    const SvgAspectRatio& rRatio = getSvgAspectRatio().isSet()? getSvgAspectRatio() : aRatioDefault;

                                    basegfx::B2DHomMatrix aViewBoxMapping;
                                    aViewBoxMapping = rRatio.createMapping(aSvgCanvasRange, *getViewBox());
                                    aViewBoxMapping = rRatio.createMapping(aSvgCanvasRange, *pBox);
                                    // no need to check ratio here for slice, the outermost Svg will
                                    // be clipped anyways (see below)

diff --git a/svx/source/accessibility/ShapeTypeHandler.cxx b/svx/source/accessibility/ShapeTypeHandler.cxx
index c569700..e645438 100644
--- a/svx/source/accessibility/ShapeTypeHandler.cxx
+++ b/svx/source/accessibility/ShapeTypeHandler.cxx
@@ -269,33 +269,22 @@
            pResourceId = STR_ObjNameSingulRECT;
            break;
        case DRAWING_CUSTOM:
            {
                pResourceId = STR_ObjNameSingulCUSTOMSHAPE;
            pResourceId = STR_ObjNameSingulCUSTOMSHAPE;

                SvxShape* pShape = SvxShape::getImplementation( rxShape );
                if (pShape)
            if (SvxShape* pShape = SvxShape::getImplementation(rxShape))
            {
                if (auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->GetSdrObject()))
                {
                    SdrObject *pSdrObj = pShape->GetSdrObject();
                    if (pSdrObj)
                    if (pCustomShape->IsTextPath())
                        pResourceId = STR_ObjNameSingulFONTWORK;
                    else
                    {
                        if(dynamic_cast<const SdrObjCustomShape*>( pSdrObj) !=  nullptr)
                        {
                            SdrObjCustomShape* pCustomShape = static_cast<SdrObjCustomShape*>(pSdrObj);
                            if(pCustomShape)
                            {
                                if (pCustomShape->IsTextPath())
                                    pResourceId = STR_ObjNameSingulFONTWORK;
                                else
                                {
                                    pResourceId = nullptr;
                                    sName = pCustomShape->GetCustomShapeName();
                                }
                            }
                        }
                        pResourceId = nullptr;
                        sName = pCustomShape->GetCustomShapeName();
                    }
                }
                break;
            }
            break;
        case DRAWING_TEXT:
            pResourceId = STR_ObjNameSingulTEXT;
            break;
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 6d099d6..cb0c3d1f 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -168,10 +168,7 @@

    if(mbModify)
    {
        if(!mpClone)
        {
            mpClone = maOriginal.getFullDragClone();
        }
        mpClone = maOriginal.getFullDragClone();

        // apply original transformation, implemented at the DragMethods
        rDragMethod.applyCurrentTransformationToSdrObject(*mpClone);
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 7dc05bc..a53725c 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -2098,11 +2098,7 @@
                    pActual->Touch();
                }

                if(pNew)
                {
                    pNew->Touch();
                }

                pNew->Touch();
            }
        }
    }
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 41158c7..6f27206 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -788,7 +788,8 @@

void SdrPageView::LeaveOneGroup()
{
    if(!GetCurrentGroup())
    SdrObject* pLastGroup = GetCurrentGroup();
    if (!pLastGroup)
        return;

    bool bGlueInvalidate = GetView().ImpIsGlueVisible();
@@ -796,8 +797,7 @@
    if(bGlueInvalidate)
        GetView().GlueInvalidate();

    SdrObject* pLastGroup = GetCurrentGroup();
    SdrObject* pParentGroup = GetCurrentGroup()->getParentSdrObjectFromSdrObject();
    SdrObject* pParentGroup = pLastGroup->getParentSdrObjectFromSdrObject();
    SdrObjList* pParentList = GetPage();

    if(pParentGroup)
@@ -810,9 +810,8 @@
    SetCurrentGroupAndList(pParentGroup, pParentList);

    // select the group we just left
    if(pLastGroup)
        if(GetView().GetSdrPageView())
            GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
    if (GetView().GetSdrPageView())
        GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());

    GetView().AdjustMarkHdl();

@@ -825,15 +824,13 @@

void SdrPageView::LeaveAllGroup()
{
    if(GetCurrentGroup())
    if (SdrObject* pLastGroup = GetCurrentGroup())
    {
        bool bGlueInvalidate = GetView().ImpIsGlueVisible();

        if(bGlueInvalidate)
            GetView().GlueInvalidate();

        SdrObject* pLastGroup = GetCurrentGroup();

        // deselect everything
        GetView().UnmarkAll();

@@ -841,14 +838,11 @@
        SetCurrentGroupAndList(nullptr, GetPage());

        // find and select uppermost group
        if(pLastGroup)
        {
            while(pLastGroup->getParentSdrObjectFromSdrObject())
                pLastGroup = pLastGroup->getParentSdrObjectFromSdrObject();
        while (pLastGroup->getParentSdrObjectFromSdrObject())
            pLastGroup = pLastGroup->getParentSdrObjectFromSdrObject();

            if(GetView().GetSdrPageView())
                GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
        }
        if (GetView().GetSdrPageView())
            GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());

        GetView().AdjustMarkHdl();

diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 187f52a..b800c7a 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -1169,46 +1169,43 @@
    // get vertical edge number and check for a hit
    const bool bRTL = (GetWritingMode() == WritingMode_RL_TB);
    bool bVrtHit = false;
    if( nX >= 0 )
    if( !bRTL )
    {
        if( !bRTL )
        while( rnX <= nColCount )
        {
            while( rnX <= nColCount )
            if( nX - aTol <= 0 )
            {
                if( nX - aTol <= 0 )
                {
                    bVrtHit = true;
                    break;
                }

                if( rnX == nColCount )
                    break;

                nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
                if( nX < 0 )
                    break;
                rnX++;
                bVrtHit = true;
                break;
            }

            if( rnX == nColCount )
                break;

            nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
            if( nX < 0 )
                break;
            rnX++;
        }
        else
    }
    else
    {
        rnX = nColCount;
        while( rnX >= 0 )
        {
            rnX = nColCount;
            while( rnX >= 0 )
            if( nX - aTol <= 0 )
            {
                if( nX - aTol <= 0 )
                {
                    bVrtHit = true;
                    break;
                }

                if( rnX == 0 )
                    break;

                rnX--;
                nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
                if( nX < 0 )
                    break;
                bVrtHit = true;
                break;
            }

            if( rnX == 0 )
                break;

            rnX--;
            nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
            if( nX < 0 )
                break;
        }
    }

@@ -1216,24 +1213,21 @@

    // get vertical edge number and check for a hit
    bool bHrzHit = false;
    if( nY >= 0 )
    while( rnY <= nRowCount )
    {
        while( rnY <= nRowCount )
        if( nY - aTol <= 0 )
        {
            if( nY - aTol <= 0 )
            {
                bHrzHit = true;
                break;
            }

            if( rnY == nRowCount )
                break;

            nY -= mpImpl->mpLayouter->getRowHeight(rnY);
            if( nY < 0 )
                break;
            rnY++;
            bHrzHit = true;
            break;
        }

        if( rnY == nRowCount )
            break;

        nY -= mpImpl->mpLayouter->getRowHeight(rnY);
        if( nY < 0 )
            break;
        rnY++;
    }

    // rnY is now the edge number above the pointer, if it was hit bVrtHit is also true
diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx
index c35463b..1b934d7 100644
--- a/svx/source/table/tablemodel.cxx
+++ b/svx/source/table/tablemodel.cxx
@@ -979,7 +979,7 @@

            if( bEmpty )
            {
                if( nCol > 0 ) try
                try
                {
                    const OUString sWidth("Width");
                    sal_Int32 nWidth1 = 0, nWidth2 = 0;
@@ -1016,7 +1016,7 @@

            if( bEmpty )
            {
                if( nRow > 0 ) try
                try
                {
                    const OUString sHeight("Height");
                    sal_Int32 nHeight1 = 0, nHeight2 = 0;
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index 2d5871e0..571a1d74 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -126,9 +126,7 @@
    if( dynamic_cast<const E3dObject* >(pSdrShape) !=  nullptr )
    {
        GetSdrObject()->GetSubList()->NbcInsertObject( pSdrShape );

        if(pShape)
            pShape->Create( pSdrShape, mxPage.get()  );
        pShape->Create(pSdrShape, mxPage.get());
    }
    else
    {
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 4dffab0..287d2bd 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -206,12 +206,9 @@
            mpText = pTextObj->getText( 0 );
    }

    if( mpModel )
        StartListening( *mpModel );
    if( mpView )
        StartListening( *mpView );
    if( mpObject )
        mpObject->AddObjectUser( *this );
    StartListening( *mpModel );
    StartListening( *mpView );
    mpObject->AddObjectUser( *this );

    // Init edit mode state from shape info (IsTextEditActive())
    mbShapeIsEditMode = IsEditMode();
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 74912a9..cafbe88 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -1099,14 +1099,14 @@

        sal_uInt32 nCount, nSurrogate;

        const SfxItemPool* pPool1 = &pModel->GetItemPool();
        if( !aUniqueName.isEmpty() && pPool1 )
        const SfxItemPool& rPool1 = pModel->GetItemPool();
        if (!aUniqueName.isEmpty())
        {
            nCount = pPool1->GetItemCount2( XATTR_LINESTART );
            nCount = rPool1.GetItemCount2(XATTR_LINESTART);

            for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
            {
                const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
                const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate);

                if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
                {
@@ -1124,11 +1124,11 @@

            if( !bForceNew )
            {
                nCount = pPool1->GetItemCount2( XATTR_LINEEND );
                nCount = rPool1.GetItemCount2(XATTR_LINEEND);

                for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
                {
                    const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
                    const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate);

                    if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
                    {
@@ -1200,53 +1200,50 @@
            sal_Int32 nUserIndex = 1;
            const OUString aUser(SvxResId(RID_SVXSTR_LINEEND));

            if( pPool1 )
            nCount = rPool1.GetItemCount2(XATTR_LINESTART);
            sal_uInt32 nSurrogate2;

            for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++)
            {
                nCount = pPool1->GetItemCount2( XATTR_LINESTART );
                sal_uInt32 nSurrogate2;
                const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate2);

                for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
                if (pItem && !pItem->GetName().isEmpty())
                {
                    const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );

                    if( pItem && !pItem->GetName().isEmpty() )
                    if (!bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue())
                    {
                        if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() )
                        {
                            aUniqueName = pItem->GetName();
                            bFoundExisting = true;
                            break;
                        }
                        aUniqueName = pItem->GetName();
                        bFoundExisting = true;
                        break;
                    }

                        if( pItem->GetName().startsWith( aUser ) )
                        {
                            sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
                            if( nThisIndex >= nUserIndex )
                                nUserIndex = nThisIndex + 1;
                        }
                    if (pItem->GetName().startsWith(aUser))
                    {
                        sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32();
                        if (nThisIndex >= nUserIndex)
                            nUserIndex = nThisIndex + 1;
                    }
                }
            }

                nCount = pPool1->GetItemCount2( XATTR_LINEEND );
                for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
            nCount = rPool1.GetItemCount2(XATTR_LINEEND);
            for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++)
            {
                const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate2);

                if (pItem && !pItem->GetName().isEmpty())
                {
                    const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );

                    if( pItem && !pItem->GetName().isEmpty() )
                    if (!bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue())
                    {
                        if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() )
                        {
                            aUniqueName = pItem->GetName();
                            bFoundExisting = true;
                            break;
                        }
                        aUniqueName = pItem->GetName();
                        bFoundExisting = true;
                        break;
                    }

                        if( pItem->GetName().startsWith( aUser ) )
                        {
                            sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
                            if( nThisIndex >= nUserIndex )
                                nUserIndex = nThisIndex + 1;
                        }
                    if (pItem->GetName().startsWith(aUser))
                    {
                        sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32();
                        if (nThisIndex >= nUserIndex)
                            nUserIndex = nThisIndex + 1;
                    }
                }
            }
@@ -1353,14 +1350,14 @@

        sal_uInt16 nCount, nSurrogate;

        const SfxItemPool* pPool1 = &pModel->GetItemPool();
        if( !aUniqueName.isEmpty() && pPool1 )
        const SfxItemPool& rPool1 = pModel->GetItemPool();
        if (!aUniqueName.isEmpty())
        {
            nCount = pPool1->GetItemCount2( XATTR_LINESTART );
            nCount = rPool1.GetItemCount2(XATTR_LINESTART);

            for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
            {
                const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
                const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate);

                if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
                {
@@ -1378,11 +1375,11 @@

            if( !bForceNew )
            {
                nCount = pPool1->GetItemCount2( XATTR_LINEEND );
                nCount = rPool1.GetItemCount2(XATTR_LINEEND);

                for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
                {
                    const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
                    const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate);

                    if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
                    {
@@ -1454,53 +1451,50 @@
            sal_Int32 nUserIndex = 1;
            const OUString aUser(SvxResId(RID_SVXSTR_LINEEND));

            if( pPool1 )
            nCount = rPool1.GetItemCount2(XATTR_LINESTART);
            sal_uInt32 nSurrogate2;

            for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++)
            {
                nCount = pPool1->GetItemCount2( XATTR_LINESTART );
                sal_uInt32 nSurrogate2;
                const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate2);

                for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
                if (pItem && !pItem->GetName().isEmpty())
                {
                    const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );

                    if( pItem && !pItem->GetName().isEmpty() )
                    if (!bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue())
                    {
                        if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() )
                        {
                            aUniqueName = pItem->GetName();
                            bFoundExisting = true;
                            break;
                        }
                        aUniqueName = pItem->GetName();
                        bFoundExisting = true;
                        break;
                    }

                        if( pItem->GetName().startsWith( aUser ) )
                        {
                            sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
                            if( nThisIndex >= nUserIndex )
                                nUserIndex = nThisIndex + 1;
                        }
                    if (pItem->GetName().startsWith(aUser))
                    {
                        sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32();
                        if (nThisIndex >= nUserIndex)
                            nUserIndex = nThisIndex + 1;
                    }
                }
            }

                nCount = pPool1->GetItemCount2( XATTR_LINEEND );
                for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
            nCount = rPool1.GetItemCount2(XATTR_LINEEND);
            for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++)
            {
                const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate2);

                if (pItem && !pItem->GetName().isEmpty())
                {
                    const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );

                    if( pItem && !pItem->GetName().isEmpty() )
                    if (!bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue())
                    {
                        if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() )
                        {
                            aUniqueName = pItem->GetName();
                            bFoundExisting = true;
                            break;
                        }
                        aUniqueName = pItem->GetName();
                        bFoundExisting = true;
                        break;
                    }

                        if( pItem->GetName().startsWith( aUser ) )
                        {
                            sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
                            if( nThisIndex >= nUserIndex )
                                nUserIndex = nThisIndex + 1;
                        }
                    if (pItem->GetName().startsWith(aUser))
                    {
                        sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32();
                        if (nThisIndex >= nUserIndex)
                            nUserIndex = nThisIndex + 1;
                    }
                }
            }
diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx
index c8dc42b..3bf103d 100644
--- a/svx/source/xoutdev/xattr2.cxx
+++ b/svx/source/xoutdev/xattr2.cxx
@@ -252,9 +252,7 @@
bool XLineCapItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreUnit*/,
                                                     MapUnit /*ePresUnit*/, OUString& rText, const IntlWrapper&) const
{
    rText.clear();

    const char* pId = nullptr;
    const char* pId;

    switch( GetValue() )
    {
@@ -271,8 +269,7 @@
        break;
    }

    if (pId)
        rText = SvxResId(pId);
    rText = SvxResId(pId);

    return true;
}
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index ae0ff38..865907a 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -377,8 +377,7 @@
                                            RES_PAGEDESC, false, &pItem ) &&
                nullptr != ( pPgDesc = static_cast<const SwFormatPageDesc*>(pItem)->GetPageDesc()) )
            {
                if( !tmpSet )
                    tmpSet.reset( new SfxItemSet( *this ));
                tmpSet.reset(new SfxItemSet(*this));

                SwPageDesc* pDstPgDesc = pDstDoc->FindPageDesc(pPgDesc->GetName());
                if( !pDstPgDesc )
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 4b7fef9..1103e50 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -843,7 +843,7 @@
    {
        maNm = OUString();
        maFltr = OUString();
        rGrfNd.GetFileFilterNms( maNm ? &*maNm : nullptr, maFltr ? &*maFltr : nullptr );
        rGrfNd.GetFileFilterNms(&*maNm, &*maFltr);
        pGrf.reset();
    }
    else
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 8758457..0b2064c 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -652,274 +652,264 @@
    if (!pTableFormat || !pUnoCursor)
        throw lang::IllegalArgumentException();

    if(pTableFormat)
    SwTable* pTable = SwTable::FindTable(pTableFormat);
    if (pTable->IsTableComplex())
        return xRes; // we can't handle this thus returning an empty references

    // get a character map in the size of the table to mark
    // all the ranges to use in
    sal_Int32 nRows = pTable->GetTabLines().size();
    sal_Int32 nCols = pTable->GetTabLines().front()->GetTabBoxes().size();
    std::vector<std::vector<sal_Char>> aMap(nRows);
    for (sal_Int32 i = 0; i < nRows; ++i)
        aMap[i].resize(nCols);

    // iterate over subranges and mark used cells in above map
    //!! by proceeding this way we automatically get rid of
    //!! multiple listed or overlapping cell ranges which should
    //!! just be ignored silently
    sal_Int32 nSubRanges = aSubRanges.getLength();
    for (sal_Int32 i = 0; i < nSubRanges; ++i)
    {
        SwTable* pTable = SwTable::FindTable( pTableFormat );
        if(pTable->IsTableComplex())
            return xRes;    // we can't handle this thus returning an empty references
        else
        OUString aTableName, aStartCell, aEndCell;
        bool bOk2 = GetTableAndCellsFromRangeRep(
                            pSubRanges[i], aTableName, aStartCell, aEndCell );
        OSL_ENSURE(bOk2, "failed to get table and start/end cells");

        sal_Int32 nStartRow, nStartCol, nEndRow, nEndCol;
        SwXTextTable::GetCellPosition(aStartCell, nStartCol, nStartRow);
        SwXTextTable::GetCellPosition(aEndCell, nEndCol, nEndRow);
        OSL_ENSURE( nStartRow <= nEndRow && nStartCol <= nEndCol,
                "cell range not normalized");

        // test if the ranges span more than the available cells
        if( nStartRow < 0 || nEndRow >= nRows ||
            nStartCol < 0 || nEndCol >= nCols )
        {
            // get a character map in the size of the table to mark
            // all the ranges to use in
            sal_Int32 nRows = pTable->GetTabLines().size();
            sal_Int32 nCols = pTable->GetTabLines().front()->GetTabBoxes().size();
            std::vector< std::vector< sal_Char > > aMap( nRows );
            for (sal_Int32 i = 0;  i < nRows;  ++i)
                aMap[i].resize( nCols );

            // iterate over subranges and mark used cells in above map
            //!! by proceeding this way we automatically get rid of
            //!! multiple listed or overlapping cell ranges which should
            //!! just be ignored silently
            sal_Int32 nSubRanges = aSubRanges.getLength();
            for (sal_Int32 i = 0;  i < nSubRanges;  ++i)
            {
                OUString aTableName, aStartCell, aEndCell;
                bool bOk2 = GetTableAndCellsFromRangeRep(
                                    pSubRanges[i], aTableName, aStartCell, aEndCell );
                OSL_ENSURE( bOk2, "failed to get table and start/end cells" );

                sal_Int32 nStartRow, nStartCol, nEndRow, nEndCol;
                SwXTextTable::GetCellPosition( aStartCell, nStartCol, nStartRow );
                SwXTextTable::GetCellPosition( aEndCell,   nEndCol,   nEndRow );
                OSL_ENSURE( nStartRow <= nEndRow && nStartCol <= nEndCol,
                        "cell range not normalized");

                // test if the ranges span more than the available cells
                if( nStartRow < 0 || nEndRow >= nRows ||
                    nStartCol < 0 || nEndCol >= nCols )
                {
                    throw lang::IllegalArgumentException();
                }
                for (sal_Int32 k1 = nStartRow;  k1 <= nEndRow;  ++k1)
                {
                    for (sal_Int32 k2 = nStartCol;  k2 <= nEndCol;  ++k2)
                        aMap[k1][k2] = 'x';
                }
            }

            // find label and data sequences to use

            sal_Int32 oi;  // outer index (slower changing index)
            sal_Int32 ii;  // inner index (faster changing index)
            sal_Int32 oiEnd = bDtaSrcIsColumns ? nCols : nRows;
            sal_Int32 iiEnd = bDtaSrcIsColumns ? nRows : nCols;
            std::vector< sal_Int32 > aLabelIdx( oiEnd );
            std::vector< sal_Int32 > aDataStartIdx( oiEnd );
            std::vector< sal_Int32 > aDataLen( oiEnd );
            for (oi = 0;  oi < oiEnd;  ++oi)
            {
                aLabelIdx[oi]       = -1;
                aDataStartIdx[oi]   = -1;
                aDataLen[oi]        = 0;
            }

            for (oi = 0;  oi < oiEnd;  ++oi)
            {
                ii = 0;
                while (ii < iiEnd)
                {
                    sal_Char &rChar = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii];

                    // label should be used but is not yet found?
                    if (rChar == 'x' && bFirstIsLabel && aLabelIdx[oi] == -1)
                    {
                        aLabelIdx[oi] = ii;
                        rChar = 'L';    // setting a different char for labels here
                                        // makes the test for the data sequence below
                                        // easier
                    }

                    // find data sequence
                    if (rChar == 'x' && aDataStartIdx[oi] == -1)
                    {
                        aDataStartIdx[oi] = ii;

                        // get length of data sequence
                        sal_Int32 nL = 0;
                        sal_Char c;
                        while (ii< iiEnd && 'x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
                        {
                            ++nL;   ++ii;
                        }
                        aDataLen[oi] = nL;

                        // check that there is no other separate sequence of data
                        // to be found because that is not supported
                        while (ii < iiEnd)
                        {
                            if ('x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
                                throw lang::IllegalArgumentException();
                            ++ii;
                        }
                    }
                    else
                        ++ii;
                }
            }

            // make some other consistency checks while calculating
            // the number of XLabeledDataSequence to build:
            // - labels should always be used or not at all
            // - the data sequences should have equal non-zero length
            sal_Int32 nNumLDS = 0;
            if (oiEnd > 0)
            {
                sal_Int32 nFirstSeqLen = 0;
                sal_Int32 nFirstSeqLabelIdx = -1;
                bool bFirstFound = false;
                for (oi = 0;  oi < oiEnd;  ++oi)
                {
                    // row/col used at all?
                    if (aDataStartIdx[oi] != -1 &&
                        (!bFirstIsLabel || aLabelIdx[oi] != -1))
                    {
                        ++nNumLDS;
                        if (!bFirstFound)
                        {
                            nFirstSeqLen        = aDataLen[oi];
                            nFirstSeqLabelIdx   = aLabelIdx[oi];
                            bFirstFound = true;
                        }
                        else
                        {
                            if (nFirstSeqLen != aDataLen[oi] ||
                                nFirstSeqLabelIdx != aLabelIdx[oi])
                                throw lang::IllegalArgumentException();
                        }
                    }
                }
            }
            if (nNumLDS == 0)
                throw lang::IllegalArgumentException();

            // now we should have all necessary data to build a proper DataSource
            // thus if we came this far there should be no further problem
            if (bTestOnly)
                return xRes;    // have createDataSourcePossible return true

            // create data source from found label and data sequences
            uno::Sequence< uno::Reference< chart2::data::XDataSequence > > aLabelSeqs( nNumLDS );
            uno::Reference< chart2::data::XDataSequence > *pLabelSeqs = aLabelSeqs.getArray();
            uno::Sequence< uno::Reference< chart2::data::XDataSequence > > aDataSeqs( nNumLDS );
            uno::Reference< chart2::data::XDataSequence > *pDataSeqs = aDataSeqs.getArray();
            sal_Int32 nSeqsIdx = 0;
            for (oi = 0;  oi < oiEnd;  ++oi)
            {
                // row/col not used? (see if-statement above where nNumLDS was counted)
                if (!(aDataStartIdx[oi] != -1 &&
                        (!bFirstIsLabel || aLabelIdx[oi] != -1)))
                    continue;

                // get cell ranges for label and data

                SwRangeDescriptor aLabelDesc;
                SwRangeDescriptor aDataDesc;
                if (bDtaSrcIsColumns)   // use columns
                {
                    aLabelDesc.nTop     = aLabelIdx[oi];
                    aLabelDesc.nLeft    = oi;
                    aLabelDesc.nBottom  = aLabelDesc.nTop;
                    aLabelDesc.nRight   = oi;

                    aDataDesc.nTop      = aDataStartIdx[oi];
                    aDataDesc.nLeft     = oi;
                    aDataDesc.nBottom   = aDataDesc.nTop + aDataLen[oi] - 1;
                    aDataDesc.nRight    = oi;
                }
                else    // use rows
                {
                    aLabelDesc.nTop     = oi;
                    aLabelDesc.nLeft    = aLabelIdx[oi];
                    aLabelDesc.nBottom  = oi;
                    aLabelDesc.nRight   = aLabelDesc.nLeft;

                    aDataDesc.nTop      = oi;
                    aDataDesc.nLeft     = aDataStartIdx[oi];
                    aDataDesc.nBottom   = oi;
                    aDataDesc.nRight    = aDataDesc.nLeft + aDataLen[oi] - 1;
                }
                const OUString aBaseName =  pTableFormat->GetName() + ".";

                OUString aLabelRange;
                if (aLabelIdx[oi] != -1)
                {
                    aLabelRange = aBaseName
                        + sw_GetCellName( aLabelDesc.nLeft, aLabelDesc.nTop )
                        + ":" + sw_GetCellName( aLabelDesc.nRight, aLabelDesc.nBottom );
                }

                OUString aDataRange;
                if (aDataStartIdx[oi] != -1)
                {
                    aDataRange = aBaseName
                        + sw_GetCellName( aDataDesc.nLeft, aDataDesc.nTop )
                        + ":" + sw_GetCellName( aDataDesc.nRight, aDataDesc.nBottom );
                }

                // get cursors spanning the cell ranges for label and data
                std::shared_ptr<SwUnoCursor> pLabelUnoCursor;
                std::shared_ptr<SwUnoCursor> pDataUnoCursor;
                GetFormatAndCreateCursorFromRangeRep( pDoc, aLabelRange, &pTableFormat, pLabelUnoCursor);
                GetFormatAndCreateCursorFromRangeRep( pDoc, aDataRange,  &pTableFormat, pDataUnoCursor);

                // create XDataSequence's from cursors
                if (pLabelUnoCursor)
                    pLabelSeqs[ nSeqsIdx ] = new SwChartDataSequence( *this, *pTableFormat, pLabelUnoCursor );
                OSL_ENSURE( pDataUnoCursor, "pointer to data sequence missing" );
                if (pDataUnoCursor)
                    pDataSeqs [ nSeqsIdx ] = new SwChartDataSequence( *this, *pTableFormat, pDataUnoCursor );
                if (pLabelUnoCursor || pDataUnoCursor)
                    ++nSeqsIdx;
            }
            OSL_ENSURE( nSeqsIdx == nNumLDS, "mismatch between sequence size and num,ber of entries" );

            // build data source from data and label sequences
            uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aLDS( nNumLDS );
            uno::Reference< chart2::data::XLabeledDataSequence > *pLDS = aLDS.getArray();
            for (sal_Int32 i = 0;  i < nNumLDS;  ++i)
            {
                SwChartLabeledDataSequence *pLabeledDtaSeq = new SwChartLabeledDataSequence;
                pLabeledDtaSeq->setLabel( pLabelSeqs[i] );
                pLabeledDtaSeq->setValues( pDataSeqs[i] );
                pLDS[i] = pLabeledDtaSeq;
            }

            // apply 'SequenceMapping' if it was provided
            sal_Int32 nSequenceMappingLen = aSequenceMapping.getLength();
            if (nSequenceMappingLen)
            {
                sal_Int32 *pSequenceMapping = aSequenceMapping.getArray();
                uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aOld_LDS( aLDS );
                uno::Reference< chart2::data::XLabeledDataSequence > *pOld_LDS = aOld_LDS.getArray();

                sal_Int32 nNewCnt = 0;
                for (sal_Int32 i = 0;  i < nSequenceMappingLen;  ++i)
                {
                    // check that index to be used is valid
                    // and has not yet been used
                    sal_Int32 nIdx = pSequenceMapping[i];
                    if (0 <= nIdx && nIdx < nNumLDS && pOld_LDS[nIdx].is())
                    {
                        pLDS[nNewCnt++] = pOld_LDS[nIdx];

                        // mark index as being used already (avoids duplicate entries)
                        pOld_LDS[nIdx].clear();
                    }
                }
                // add not yet used 'old' sequences to new one
                for (sal_Int32 i = 0;  i < nNumLDS;  ++i)
                {
                    if (pOld_LDS[i].is())
                        pLDS[nNewCnt++] = pOld_LDS[i];
                }
                OSL_ENSURE( nNewCnt == nNumLDS, "unexpected size of resulting sequence" );
            }

            xRes = new SwChartDataSource( aLDS );
            throw lang::IllegalArgumentException();
        }
        for (sal_Int32 k1 = nStartRow;  k1 <= nEndRow;  ++k1)
        {
            for (sal_Int32 k2 = nStartCol;  k2 <= nEndCol;  ++k2)
                aMap[k1][k2] = 'x';
        }
    }

    // find label and data sequences to use

    sal_Int32 oi;  // outer index (slower changing index)
    sal_Int32 ii;  // inner index (faster changing index)
    sal_Int32 oiEnd = bDtaSrcIsColumns ? nCols : nRows;
    sal_Int32 iiEnd = bDtaSrcIsColumns ? nRows : nCols;
    std::vector<sal_Int32> aLabelIdx(oiEnd);
    std::vector<sal_Int32> aDataStartIdx(oiEnd);
    std::vector<sal_Int32> aDataLen(oiEnd);
    for (oi = 0; oi < oiEnd; ++oi)
    {
        aLabelIdx[oi]       = -1;
        aDataStartIdx[oi]   = -1;
        aDataLen[oi]        = 0;
    }

    for (oi = 0; oi < oiEnd; ++oi)
    {
        ii = 0;
        while (ii < iiEnd)
        {
            sal_Char &rChar = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii];

            // label should be used but is not yet found?
            if (rChar == 'x' && bFirstIsLabel && aLabelIdx[oi] == -1)
            {
                aLabelIdx[oi] = ii;
                rChar = 'L';    // setting a different char for labels here
                                // makes the test for the data sequence below
                                // easier
            }

            // find data sequence
            if (rChar == 'x' && aDataStartIdx[oi] == -1)
            {
                aDataStartIdx[oi] = ii;

                // get length of data sequence
                sal_Int32 nL = 0;
                sal_Char c;
                while (ii< iiEnd && 'x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
                {
                    ++nL;   ++ii;
                }
                aDataLen[oi] = nL;

                // check that there is no other separate sequence of data
                // to be found because that is not supported
                while (ii < iiEnd)
                {
                    if ('x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
                        throw lang::IllegalArgumentException();
                    ++ii;
                }
            }
            else
                ++ii;
        }
    }

    // make some other consistency checks while calculating
    // the number of XLabeledDataSequence to build:
    // - labels should always be used or not at all
    // - the data sequences should have equal non-zero length
    sal_Int32 nNumLDS = 0;
    if (oiEnd > 0)
    {
        sal_Int32 nFirstSeqLen = 0;
        sal_Int32 nFirstSeqLabelIdx = -1;
        bool bFirstFound = false;
        for (oi = 0; oi < oiEnd; ++oi)
        {
            // row/col used at all?
            if (aDataStartIdx[oi] != -1 &&
                (!bFirstIsLabel || aLabelIdx[oi] != -1))
            {
                ++nNumLDS;
                if (!bFirstFound)
                {
                    nFirstSeqLen        = aDataLen[oi];
                    nFirstSeqLabelIdx   = aLabelIdx[oi];
                    bFirstFound = true;
                }
                else
                {
                    if (nFirstSeqLen != aDataLen[oi] ||
                        nFirstSeqLabelIdx != aLabelIdx[oi])
                        throw lang::IllegalArgumentException();
                }
            }
        }
    }
    if (nNumLDS == 0)
        throw lang::IllegalArgumentException();

    // now we should have all necessary data to build a proper DataSource
    // thus if we came this far there should be no further problem
    if (bTestOnly)
        return xRes;    // have createDataSourcePossible return true

    // create data source from found label and data sequences
    uno::Sequence<uno::Reference<chart2::data::XDataSequence>> aLabelSeqs(nNumLDS);
    uno::Reference<chart2::data::XDataSequence>* pLabelSeqs = aLabelSeqs.getArray();
    uno::Sequence<uno::Reference<chart2::data::XDataSequence>> aDataSeqs(nNumLDS);
    uno::Reference<chart2::data::XDataSequence>* pDataSeqs = aDataSeqs.getArray();
    sal_Int32 nSeqsIdx = 0;
    for (oi = 0; oi < oiEnd; ++oi)
    {
        // row/col not used? (see if-statement above where nNumLDS was counted)
        if (!(aDataStartIdx[oi] != -1 &&
                (!bFirstIsLabel || aLabelIdx[oi] != -1)))
            continue;

        // get cell ranges for label and data

        SwRangeDescriptor aLabelDesc;
        SwRangeDescriptor aDataDesc;
        if (bDtaSrcIsColumns)   // use columns
        {
            aLabelDesc.nTop     = aLabelIdx[oi];
            aLabelDesc.nLeft    = oi;
            aLabelDesc.nBottom  = aLabelDesc.nTop;
            aLabelDesc.nRight   = oi;

            aDataDesc.nTop      = aDataStartIdx[oi];
            aDataDesc.nLeft     = oi;
            aDataDesc.nBottom   = aDataDesc.nTop + aDataLen[oi] - 1;
            aDataDesc.nRight    = oi;
        }
        else    // use rows
        {
            aLabelDesc.nTop     = oi;
            aLabelDesc.nLeft    = aLabelIdx[oi];
            aLabelDesc.nBottom  = oi;
            aLabelDesc.nRight   = aLabelDesc.nLeft;

            aDataDesc.nTop      = oi;
            aDataDesc.nLeft     = aDataStartIdx[oi];
            aDataDesc.nBottom   = oi;
            aDataDesc.nRight    = aDataDesc.nLeft + aDataLen[oi] - 1;
        }
        const OUString aBaseName = pTableFormat->GetName() + ".";

        OUString aLabelRange;
        if (aLabelIdx[oi] != -1)
        {
            aLabelRange = aBaseName
                + sw_GetCellName( aLabelDesc.nLeft, aLabelDesc.nTop )
                + ":" + sw_GetCellName( aLabelDesc.nRight, aLabelDesc.nBottom );
        }

        OUString aDataRange = aBaseName
            + sw_GetCellName( aDataDesc.nLeft, aDataDesc.nTop )
            + ":" + sw_GetCellName( aDataDesc.nRight, aDataDesc.nBottom );

        // get cursors spanning the cell ranges for label and data
        std::shared_ptr<SwUnoCursor> pLabelUnoCursor;
        std::shared_ptr<SwUnoCursor> pDataUnoCursor;
        GetFormatAndCreateCursorFromRangeRep(pDoc, aLabelRange, &pTableFormat, pLabelUnoCursor);
        GetFormatAndCreateCursorFromRangeRep(pDoc, aDataRange, &pTableFormat, pDataUnoCursor);

        // create XDataSequence's from cursors
        if (pLabelUnoCursor)
            pLabelSeqs[nSeqsIdx] = new SwChartDataSequence(*this, *pTableFormat, pLabelUnoCursor);
        OSL_ENSURE(pDataUnoCursor, "pointer to data sequence missing");
        if (pDataUnoCursor)
            pDataSeqs[nSeqsIdx] = new SwChartDataSequence(*this, *pTableFormat, pDataUnoCursor);
        if (pLabelUnoCursor || pDataUnoCursor)
            ++nSeqsIdx;
    }
    OSL_ENSURE(nSeqsIdx == nNumLDS, "mismatch between sequence size and num,ber of entries");

    // build data source from data and label sequences
    uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence>> aLDS(nNumLDS);
    uno::Reference<chart2::data::XLabeledDataSequence>* pLDS = aLDS.getArray();
    for (sal_Int32 i = 0; i < nNumLDS; ++i)
    {
        SwChartLabeledDataSequence* pLabeledDtaSeq = new SwChartLabeledDataSequence;
        pLabeledDtaSeq->setLabel(pLabelSeqs[i]);
        pLabeledDtaSeq->setValues(pDataSeqs[i]);
        pLDS[i] = pLabeledDtaSeq;
    }

    // apply 'SequenceMapping' if it was provided
    sal_Int32 nSequenceMappingLen = aSequenceMapping.getLength();
    if (nSequenceMappingLen)
    {
        sal_Int32 *pSequenceMapping = aSequenceMapping.getArray();
        uno::Sequence<uno::Reference<chart2::data::XLabeledDataSequence>> aOld_LDS(aLDS);
        uno::Reference<chart2::data::XLabeledDataSequence>* pOld_LDS = aOld_LDS.getArray();

        sal_Int32 nNewCnt = 0;
        for (sal_Int32 i = 0; i < nSequenceMappingLen; ++i)
        {
            // check that index to be used is valid
            // and has not yet been used
            sal_Int32 nIdx = pSequenceMapping[i];
            if (0 <= nIdx && nIdx < nNumLDS && pOld_LDS[nIdx].is())
            {
                pLDS[nNewCnt++] = pOld_LDS[nIdx];

                // mark index as being used already (avoids duplicate entries)
                pOld_LDS[nIdx].clear();
            }
        }
        // add not yet used 'old' sequences to new one
        for (sal_Int32 i = 0; i < nNumLDS; ++i)
        {
            if (pOld_LDS[i].is())
                pLDS[nNewCnt++] = pOld_LDS[i];
        }
        OSL_ENSURE(nNewCnt == nNumLDS, "unexpected size of resulting sequence");
    }

    xRes = new SwChartDataSource(aLDS);
    return xRes;
}

diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index fa903d7..e2d61dc 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -760,37 +760,32 @@
            const SdrMarkList& rMarkList = pPage->PreGroup(xShapes);
            if ( rMarkList.GetMarkCount() > 1 )
            {
                bool bFlyInCnt = false;
                for ( size_t i = 0; !bFlyInCnt && i < rMarkList.GetMarkCount(); ++i )
                for (size_t i = 0; i < rMarkList.GetMarkCount(); ++i)
                {
                    const SdrObject *pObj = rMarkList.GetMark( i )->GetMarkedSdrObj();
                    if (RndStdIds::FLY_AS_CHAR == ::FindFrameFormat(const_cast<SdrObject*>(
                                            pObj))->GetAnchor().GetAnchorId())
                    {
                        bFlyInCnt = true;
                        throw uno::RuntimeException(); // FlyInCnt!
                    }
                }
                if( bFlyInCnt )
                    throw uno::RuntimeException();
                if( !bFlyInCnt )

                UnoActionContext aContext(pDoc);
                pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );

                SwDrawContact* pContact = pDoc->GroupSelection( *pPage->GetDrawView() );
                pDoc->ChgAnchor(
                    pPage->GetDrawView()->GetMarkedObjectList(),
                    RndStdIds::FLY_AT_PARA,
                    true, false );

                pPage->GetDrawView()->UnmarkAll();
                if(pContact)
                {
                    UnoActionContext aContext(pDoc);
                    pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::START, nullptr );

                    SwDrawContact* pContact = pDoc->GroupSelection( *pPage->GetDrawView() );
                    pDoc->ChgAnchor(
                        pPage->GetDrawView()->GetMarkedObjectList(),
                        RndStdIds::FLY_AT_PARA,
                        true, false );

                    pPage->GetDrawView()->UnmarkAll();
                    if(pContact)
                    {
                        uno::Reference< uno::XInterface >  xInt = SwFmDrawPage::GetInterface( pContact->GetMaster() );
                        xRet.set(xInt, uno::UNO_QUERY);
                    }
                    pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
                    uno::Reference< uno::XInterface >  xInt = SwFmDrawPage::GetInterface( pContact->GetMaster() );
                    xRet.set(xInt, uno::UNO_QUERY);
                }
                pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr );
            }
            pPage->RemovePageView();
        }
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 6275e31..86f9ead 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -222,155 +222,152 @@
    OSL_ENSURE( pUnoCursor, "UNO cursor missing" );
    if (!pUnoCursor)
        return;
    if(pUnoCursor)
    switch(rEntry.nWID)
    {
        switch(rEntry.nWID)
        case FN_UNO_TEXT_PORTION_TYPE:
        {
            case FN_UNO_TEXT_PORTION_TYPE:
            const char* pRet;
            switch (m_ePortionType)
            {
                const char* pRet;
                switch (m_ePortionType)
                {
                case PORTION_TEXT:          pRet = "Text";break;
                case PORTION_FIELD:         pRet = "TextField";break;
                case PORTION_FRAME:         pRet = "Frame";break;
                case PORTION_FOOTNOTE:      pRet = "Footnote";break;
                case PORTION_REFMARK_START:
                case PORTION_REFMARK_END:   pRet = UNO_NAME_REFERENCE_MARK;break;
                case PORTION_TOXMARK_START:
                case PORTION_TOXMARK_END:   pRet = UNO_NAME_DOCUMENT_INDEX_MARK;break;
                case PORTION_BOOKMARK_START :
                case PORTION_BOOKMARK_END : pRet = UNO_NAME_BOOKMARK;break;
                case PORTION_REDLINE_START:
                case PORTION_REDLINE_END:   pRet = "Redline";break;
                case PORTION_RUBY_START:
                case PORTION_RUBY_END:      pRet = "Ruby";break;
                case PORTION_SOFT_PAGEBREAK:pRet = "SoftPageBreak";break;
                case PORTION_META:          pRet = UNO_NAME_META; break;
                case PORTION_FIELD_START:pRet = "TextFieldStart";break;
                case PORTION_FIELD_END:pRet = "TextFieldEnd";break;
                case PORTION_FIELD_START_END:pRet = "TextFieldStartEnd";break;
                case PORTION_ANNOTATION:
                    pRet = "Annotation";
                    break;
                case PORTION_ANNOTATION_END:
                    pRet = "AnnotationEnd";
                    break;
                default:
                    pRet = nullptr;
                }

                OUString sRet;
                if( pRet )
                    sRet = OUString::createFromAscii( pRet );
                rVal <<= sRet;
            }
            break;
            case FN_UNO_CONTROL_CHARACTER: // obsolete!
            break;
            case FN_UNO_DOCUMENT_INDEX_MARK:
                rVal <<= m_xTOXMark;
            break;
            case FN_UNO_REFERENCE_MARK:
                rVal <<= m_xRefMark;
            break;
            case FN_UNO_BOOKMARK:
                rVal <<= m_xBookmark;
            break;
            case FN_UNO_FOOTNOTE:
                rVal <<= m_xFootnote;
            break;
            case FN_UNO_TEXT_FIELD:
                rVal <<= m_xTextField;
            break;
            case FN_UNO_META:
                rVal <<= m_xMeta;
            break;
            case FN_UNO_IS_COLLAPSED:
            {
                switch (m_ePortionType)
                {
                    case PORTION_REFMARK_START:
                    case PORTION_BOOKMARK_START :
                    case PORTION_TOXMARK_START:
                    case PORTION_REFMARK_END:
                    case PORTION_TOXMARK_END:
                    case PORTION_BOOKMARK_END :
                    case PORTION_REDLINE_START :
                    case PORTION_REDLINE_END :
                    case PORTION_RUBY_START:
                    case PORTION_RUBY_END:
                    case PORTION_FIELD_START:
                    case PORTION_FIELD_END:
                        rVal <<= m_bIsCollapsed;
                    break;
                    default:
                    break;
                }
            }
            break;
            case FN_UNO_IS_START:
            {
                bool bStart = true, bPut = true;
                switch (m_ePortionType)
                {
                    case PORTION_REFMARK_START:
                    case PORTION_BOOKMARK_START:
                    case PORTION_TOXMARK_START:
                    case PORTION_REDLINE_START:
                    case PORTION_RUBY_START:
                    case PORTION_FIELD_START:
                    break;

                    case PORTION_REFMARK_END:
                    case PORTION_TOXMARK_END:
                    case PORTION_BOOKMARK_END:
                    case PORTION_REDLINE_END:
                    case PORTION_RUBY_END:
                    case PORTION_FIELD_END:
                        bStart = false;
                    break;
                    default:
                        bPut = false;
                }
                if(bPut)
                    rVal <<= bStart;
            }
            break;
            case RES_TXTATR_CJK_RUBY:
            {
                const uno::Any* pToSet = nullptr;
                switch(rEntry.nMemberId)
                {
                    case MID_RUBY_TEXT :    pToSet = m_pRubyText.get();   break;
                    case MID_RUBY_ADJUST :  pToSet = m_pRubyAdjust.get(); break;
                    case MID_RUBY_CHARSTYLE:pToSet = m_pRubyStyle.get();  break;
                    case MID_RUBY_ABOVE :   pToSet = m_pRubyIsAbove.get();break;
                    case MID_RUBY_POSITION: pToSet = m_pRubyPosition.get();break;
                }
                if(pToSet)
                    rVal = *pToSet;
            }
            break;
            case PORTION_TEXT:          pRet = "Text";break;
            case PORTION_FIELD:         pRet = "TextField";break;
            case PORTION_FRAME:         pRet = "Frame";break;
            case PORTION_FOOTNOTE:      pRet = "Footnote";break;
            case PORTION_REFMARK_START:
            case PORTION_REFMARK_END:   pRet = UNO_NAME_REFERENCE_MARK;break;
            case PORTION_TOXMARK_START:
            case PORTION_TOXMARK_END:   pRet = UNO_NAME_DOCUMENT_INDEX_MARK;break;
            case PORTION_BOOKMARK_START :
            case PORTION_BOOKMARK_END : pRet = UNO_NAME_BOOKMARK;break;
            case PORTION_REDLINE_START:
            case PORTION_REDLINE_END:   pRet = "Redline";break;
            case PORTION_RUBY_START:
            case PORTION_RUBY_END:      pRet = "Ruby";break;
            case PORTION_SOFT_PAGEBREAK:pRet = "SoftPageBreak";break;
            case PORTION_META:          pRet = UNO_NAME_META; break;
            case PORTION_FIELD_START:pRet = "TextFieldStart";break;
            case PORTION_FIELD_END:pRet = "TextFieldEnd";break;
            case PORTION_FIELD_START_END:pRet = "TextFieldStartEnd";break;
            case PORTION_ANNOTATION:
                pRet = "Annotation";
                break;
            case PORTION_ANNOTATION_END:
                pRet = "AnnotationEnd";
                break;
            default:
                beans::PropertyState eTemp;
                bool bDone = SwUnoCursorHelper::getCursorPropertyValue(
                                    rEntry, *pUnoCursor, &rVal, eTemp );
                if(!bDone)
                {
                    if(!pSet)
                    {
                        pSet = o3tl::make_unique<SfxItemSet>(
                            pUnoCursor->GetDoc()->GetAttrPool(),
                            svl::Items<
                                RES_CHRATR_BEGIN, RES_FRMATR_END - 1,
                                RES_UNKNOWNATR_CONTAINER,
                                    RES_UNKNOWNATR_CONTAINER>{});
                        SwUnoCursorHelper::GetCursorAttr(*pUnoCursor, *pSet);
                    }
                    m_pPropSet->getPropertyValue(rEntry, *pSet, rVal);
                }
                pRet = nullptr;
            }

            OUString sRet;
            if( pRet )
                sRet = OUString::createFromAscii( pRet );
            rVal <<= sRet;
        }
        break;
        case FN_UNO_CONTROL_CHARACTER: // obsolete!
        break;
        case FN_UNO_DOCUMENT_INDEX_MARK:
            rVal <<= m_xTOXMark;
        break;
        case FN_UNO_REFERENCE_MARK:
            rVal <<= m_xRefMark;
        break;
        case FN_UNO_BOOKMARK:
            rVal <<= m_xBookmark;
        break;
        case FN_UNO_FOOTNOTE:
            rVal <<= m_xFootnote;
        break;
        case FN_UNO_TEXT_FIELD:
            rVal <<= m_xTextField;
        break;
        case FN_UNO_META:
            rVal <<= m_xMeta;
        break;
        case FN_UNO_IS_COLLAPSED:
        {
            switch (m_ePortionType)
            {
                case PORTION_REFMARK_START:
                case PORTION_BOOKMARK_START :
                case PORTION_TOXMARK_START:
                case PORTION_REFMARK_END:
                case PORTION_TOXMARK_END:
                case PORTION_BOOKMARK_END :
                case PORTION_REDLINE_START :
                case PORTION_REDLINE_END :
                case PORTION_RUBY_START:
                case PORTION_RUBY_END:
                case PORTION_FIELD_START:
                case PORTION_FIELD_END:
                    rVal <<= m_bIsCollapsed;
                break;
                default:
                break;
            }
        }
        break;
        case FN_UNO_IS_START:
        {
            bool bStart = true, bPut = true;
            switch (m_ePortionType)
            {
                case PORTION_REFMARK_START:
                case PORTION_BOOKMARK_START:
                case PORTION_TOXMARK_START:
                case PORTION_REDLINE_START:
                case PORTION_RUBY_START:
                case PORTION_FIELD_START:
                break;

                case PORTION_REFMARK_END:
                case PORTION_TOXMARK_END:
                case PORTION_BOOKMARK_END:
                case PORTION_REDLINE_END:
                case PORTION_RUBY_END:
                case PORTION_FIELD_END:
                    bStart = false;
                break;
                default:
                    bPut = false;
            }
            if(bPut)
                rVal <<= bStart;
        }
        break;
        case RES_TXTATR_CJK_RUBY:
        {
            const uno::Any* pToSet = nullptr;
            switch(rEntry.nMemberId)
            {
                case MID_RUBY_TEXT :    pToSet = m_pRubyText.get();   break;
                case MID_RUBY_ADJUST :  pToSet = m_pRubyAdjust.get(); break;
                case MID_RUBY_CHARSTYLE:pToSet = m_pRubyStyle.get();  break;
                case MID_RUBY_ABOVE :   pToSet = m_pRubyIsAbove.get();break;
                case MID_RUBY_POSITION: pToSet = m_pRubyPosition.get();break;
            }
            if(pToSet)
                rVal = *pToSet;
        }
        break;
        default:
            beans::PropertyState eTemp;
            bool bDone = SwUnoCursorHelper::getCursorPropertyValue(
                                rEntry, *pUnoCursor, &rVal, eTemp );
            if(!bDone)
            {
                if(!pSet)
                {
                    pSet = o3tl::make_unique<SfxItemSet>(
                        pUnoCursor->GetDoc()->GetAttrPool(),
                        svl::Items<
                            RES_CHRATR_BEGIN, RES_FRMATR_END - 1,
                            RES_UNKNOWNATR_CONTAINER,
                                RES_UNKNOWNATR_CONTAINER>{});
                    SwUnoCursorHelper::GetCursorAttr(*pUnoCursor, *pSet);
                }
                m_pPropSet->getPropertyValue(rEntry, *pSet, rVal);
            }
    }
}

diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 55500a7..1fc47bd 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -723,9 +723,9 @@
        {
            const sal_Int32 nAutoFormat = nIndex / rTableTemplateMap.size();
            const sal_Int32 nBoxFormat = rTableTemplateMap[nIndex % rTableTemplateMap.size()];
            const SwTableAutoFormat* pTableFormat = &rAutoFormats[nAutoFormat];
            if (pTableFormat)
                *pString = pTableFormat->GetName() + pTableFormat->GetTableTemplateCellSubName(pTableFormat->GetBoxFormat(nBoxFormat));
            const SwTableAutoFormat& rTableFormat = rAutoFormats[nAutoFormat];
            *pString = rTableFormat.GetName()
                  + rTableFormat.GetTableTemplateCellSubName(rTableFormat.GetBoxFormat(nBoxFormat));
        }
        else
            *pString = rDoc.GetCellStyles()[nIndex-nUsedCellStylesCount].GetName();
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index e27630e..0657f7b 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2462,8 +2462,7 @@
            : m_pHeadFootFormat(&rHeadFootFormat)
            , m_bIsHeader(bIsHeader)
        {
            if(m_pHeadFootFormat)
                StartListening(m_pHeadFootFormat->GetNotifier());
            StartListening(m_pHeadFootFormat->GetNotifier());
        }

        SwFrameFormat* GetHeadFootFormat() const {
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 2b59e5e..1fd3f82 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1460,13 +1460,7 @@
    if( pCurRedline )
    {
        const SwPosition* pEnd = pCurRedline->End();
        if( pEnd->nNode == rNd &&
            pEnd->nContent.GetIndex() <= nPos )
        {
            pCurRedline = nullptr;
            ++nCurRedlinePos;
        }
        else
        if (!(pEnd->nNode == rNd && pEnd->nContent.GetIndex() <= nPos))
        {
            switch( pCurRedline->GetType() )
            {
@@ -1479,57 +1473,55 @@
                default:
                    break;
            }
            pCurRedline = nullptr;
            ++nCurRedlinePos;
        }
        pCurRedline = nullptr;
        ++nCurRedlinePos;
    }

    if( !pCurRedline )
    assert(!pCurRedline);
    // search next Redline
    for( ; nCurRedlinePos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size();
            ++nCurRedlinePos )
    {
        // search next Redline
        for( ; nCurRedlinePos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size();
                ++nCurRedlinePos )
        const SwRangeRedline* pRedl = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nCurRedlinePos ];

        const SwPosition* pStt = pRedl->Start();
        const SwPosition* pEnd = pStt == pRedl->GetPoint()
                                    ? pRedl->GetMark()
                                    : pRedl->GetPoint();

        if( pStt->nNode == rNd )
        {
            const SwRangeRedline* pRedl = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nCurRedlinePos ];

            const SwPosition* pStt = pRedl->Start();
            const SwPosition* pEnd = pStt == pRedl->GetPoint()
                                        ? pRedl->GetMark()
                                        : pRedl->GetPoint();

            if( pStt->nNode == rNd )
            if( pStt->nContent.GetIndex() >= nPos )
            {
                if( pStt->nContent.GetIndex() >= nPos )
                if( pStt->nContent.GetIndex() == nPos )
                {
                    if( pStt->nContent.GetIndex() == nPos )
                    {
                            switch( pRedl->GetType() )
                            {
                                case nsRedlineType_t::REDLINE_INSERT:
                                case nsRedlineType_t::REDLINE_DELETE:
                                case nsRedlineType_t::REDLINE_FORMAT:
                                    // write data of this redline
                                    pCurRedline = pRedl;
                                    return &( pCurRedline->GetRedlineData() );
                                    break;
                                default:
                                    break;
                            }
                    }
                    break;
                        switch( pRedl->GetType() )
                        {
                            case nsRedlineType_t::REDLINE_INSERT:
                            case nsRedlineType_t::REDLINE_DELETE:
                            case nsRedlineType_t::REDLINE_FORMAT:
                                // write data of this redline
                                pCurRedline = pRedl;
                                return &( pCurRedline->GetRedlineData() );
                                break;
                            default:
                                break;
                        }
                }
            }
            else
            {
                break;
            }
        }
        else
        {
            break;
        }

            if( pEnd->nNode == rNd &&
                pEnd->nContent.GetIndex() < nPos )
            {
                pCurRedline = pRedl;
                break;
            }
        if( pEnd->nNode == rNd &&
            pEnd->nContent.GetIndex() < nPos )
        {
            pCurRedline = pRedl;
            break;
        }
    }
    return nullptr;
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 09740c9..e674c23e 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1057,12 +1057,6 @@
    if ( !pPd )
        pPd = &rDoc.GetPageDesc( 0 );

    if ( !pPd )
    {
        OSL_ENSURE( pPd, "totally impossible" );
        return 1;
    }

    const SfxItemSet &rSet = pPd->GetMaster().GetAttrSet();
    SfxItemSet aSet( *rSet.GetPool(), svl::Items<RES_COL, RES_COL>{} );
    aSet.SetParent( &rSet );
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index 251588a..c5c2b03 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -390,17 +390,9 @@
                              ? rFrame.GetContent()->GetGrfNode() : nullptr;
    if ( pGrfNd && pGrfNd->IsLinkedFile() )
    {
        OUString sStr( FieldString(ww::eINCLUDEPICTURE) );
        sStr += " \"";
        {
            if ( pGrfNd )
            {
                OUString aFileURL;
                pGrfNd->GetFileFilterNms( &aFileURL, nullptr );
                sStr += aFileURL;
            }
        }
        sStr += "\" \\d";
        OUString sStr;
        pGrfNd->GetFileFilterNms(&sStr, nullptr);
        sStr = FieldString(ww::eINCLUDEPICTURE) + " \"" + sStr + "\" \\d";

        OutputField( nullptr, ww::eINCLUDEPICTURE, sStr,
                   FieldFlags::Start | FieldFlags::CmdStart | FieldFlags::CmdEnd );
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 317a4ef..9fba22d 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4709,8 +4709,8 @@
void WW8AttributeOutput::ParaAdjust( const SvxAdjustItem& rAdjust )
{
    // sprmPJc
    sal_uInt8 nAdj = 255;
    sal_uInt8 nAdjBiDi = 255;
    sal_uInt8 nAdj;
    sal_uInt8 nAdjBiDi;
    switch ( rAdjust.GetAdjust() )
    {
        case SvxAdjust::Left:
@@ -4732,46 +4732,43 @@
            return;    // not a supported Attribute
    }

    if ( 255 != nAdj )        // supported Attribute?
    m_rWW8Export.InsUInt16(NS_sprm::sprmPJc80);
    m_rWW8Export.pO->push_back(nAdj);

    /*
    Sadly for left to right paragraphs both these values are the same,
    for right to left paragraphs the bidi one is the reverse of the
    normal one.
    */
    m_rWW8Export.InsUInt16(NS_sprm::sprmPJc); //bidi version ?
    bool bBiDiSwap = false;
    if (m_rWW8Export.m_pOutFormatNode)
    {
        m_rWW8Export.InsUInt16( NS_sprm::sprmPJc80 );
        m_rWW8Export.pO->push_back( nAdj );

        /*
        Sadly for left to right paragraphs both these values are the same,
        for right to left paragraphs the bidi one is the reverse of the
        normal one.
        */
        m_rWW8Export.InsUInt16( NS_sprm::sprmPJc ); //bidi version ?
        bool bBiDiSwap = false;
        if ( m_rWW8Export.m_pOutFormatNode )
        SvxFrameDirection nDirection = SvxFrameDirection::Horizontal_LR_TB;
        if (dynamic_cast<const SwTextNode*>(m_rWW8Export.m_pOutFormatNode) != nullptr)
        {
            SvxFrameDirection nDirection = SvxFrameDirection::Horizontal_LR_TB;
            if ( dynamic_cast< const SwTextNode *>( m_rWW8Export.m_pOutFormatNode )  != nullptr )
            {
                SwPosition aPos(*static_cast<const SwContentNode*>(m_rWW8Export.m_pOutFormatNode));
                nDirection = m_rWW8Export.m_pDoc->GetTextDirection(aPos);
            }
            else if ( dynamic_cast< const SwTextFormatColl *>( m_rWW8Export.m_pOutFormatNode ) != nullptr  )
            {
                const SwTextFormatColl* pC =
                    static_cast<const SwTextFormatColl*>(m_rWW8Export.m_pOutFormatNode);
                const SvxFrameDirectionItem &rItem =
                    ItemGet<SvxFrameDirectionItem>(*pC, RES_FRAMEDIR);
                nDirection = rItem.GetValue();
            }
            if ( ( nDirection == SvxFrameDirection::Horizontal_RL_TB ) ||
                 ( nDirection == SvxFrameDirection::Environment && AllSettings::GetLayoutRTL() ) )
            {
                bBiDiSwap = true;
            }
            SwPosition aPos(*static_cast<const SwContentNode*>(m_rWW8Export.m_pOutFormatNode));
            nDirection = m_rWW8Export.m_pDoc->GetTextDirection(aPos);
        }

        if ( bBiDiSwap )
            m_rWW8Export.pO->push_back( nAdjBiDi );
        else
            m_rWW8Export.pO->push_back( nAdj );
        else if (dynamic_cast<const SwTextFormatColl*>(m_rWW8Export.m_pOutFormatNode) != nullptr)
        {
            const SwTextFormatColl* pC =
                static_cast<const SwTextFormatColl*>(m_rWW8Export.m_pOutFormatNode);
            const SvxFrameDirectionItem &rItem =
                ItemGet<SvxFrameDirectionItem>(*pC, RES_FRAMEDIR);
            nDirection = rItem.GetValue();
        }
        if ( ( nDirection == SvxFrameDirection::Horizontal_RL_TB ) ||
             ( nDirection == SvxFrameDirection::Environment && AllSettings::GetLayoutRTL() ) )
        {
            bBiDiSwap = true;
        }
    }

    if (bBiDiSwap)
        m_rWW8Export.pO->push_back(nAdjBiDi);
    else
        m_rWW8Export.pO->push_back(nAdj);
}

void WW8AttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDirection )
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 20be4b7..2bb992a 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -3201,8 +3201,8 @@
    m_pTabLine->GetFrameFormat()->SetFormatAttr(SwFormatRowSplit(!bSetCantSplit));

    //  if table is only a single row, and row is set as don't split, set the same value for the whole table.
    if( bSetCantSplit && m_pTabLines->size() == 1 )
        m_pTable->GetFrameFormat()->SetFormatAttr(SwFormatLayoutSplit( !bSetCantSplit ));
    if (bSetCantSplit && m_pTabLines->size() == 1)
        m_pTable->GetFrameFormat()->SetFormatAttr(SwFormatLayoutSplit(false));

    short i;    // SW-Index
    short j;    // WW-Index
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 34bca3e5..53d5016 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -870,14 +870,12 @@
        lcl_CopyGreaterEight(sPrefix, sNumString, 0, nFirstNoIndex);

        //Next number appears at
        if (nUpperLevel)
        {
            sal_uInt8 nOneBasedNextNoIndex = aOfsNumsXCH[nUpperLevel-1];
            const sal_Int32 nNextNoIndex =
                nOneBasedNextNoIndex > 0 ? nOneBasedNextNoIndex : SAL_MAX_INT32;
            if (sNumString.getLength() > nNextNoIndex)
                lcl_CopyGreaterEight(sPostfix, sNumString, nNextNoIndex);
        }
        assert(nUpperLevel > 0);
        sal_uInt8 nOneBasedNextNoIndex = aOfsNumsXCH[nUpperLevel-1];
        const sal_Int32 nNextNoIndex =
            nOneBasedNextNoIndex > 0 ? nOneBasedNextNoIndex : SAL_MAX_INT32;
        if (sNumString.getLength() > nNextNoIndex)
            lcl_CopyGreaterEight(sPostfix, sNumString, nNextNoIndex);

        /*
         We use lcl_CopyGreaterEight because once if we have removed unused
@@ -2014,9 +2012,9 @@

            m_nLFOPosition = USHRT_MAX;
        }
        else
        else // nData in (0..0x7FFF]
        {
            m_nLFOPosition = static_cast<sal_uInt16>(nData)-1;
            m_nLFOPosition = static_cast<sal_uInt16>(nData)-1; // m_nLFOPosition in [0..0x7FFF)
            /*
            If we are a ww8+ style with ww7- style lists then there is a
            bizarre broken word bug where when the list is removed from a para
@@ -2028,27 +2026,24 @@
                m_vColl[m_nCurrentColl].m_bHasBrokenWW6List = true;

            // here the stream data is 1-based, we subtract ONE
            if (USHRT_MAX > m_nLFOPosition)
            if (m_nLFOPosition != 2047-1) //Normal ww8+ list behaviour
            {
                if (m_nLFOPosition != 2047-1) //Normal ww8+ list behaviour
                if (WW8ListManager::nMaxLevel == m_nListLevel)
                    m_nListLevel = 0;
                if (WW8ListManager::nMaxLevel > m_nListLevel)
                {
                    if (WW8ListManager::nMaxLevel == m_nListLevel)
                        m_nListLevel = 0;
                    if (WW8ListManager::nMaxLevel > m_nListLevel)
                    {
                        RegisterNumFormat(m_nLFOPosition, m_nListLevel);
                        m_nLFOPosition = USHRT_MAX;
                        m_nListLevel = WW8ListManager::nMaxLevel;
                    }
                    RegisterNumFormat(m_nLFOPosition, m_nListLevel);
                    m_nLFOPosition = USHRT_MAX;
                    m_nListLevel = WW8ListManager::nMaxLevel;
                }
                else if (m_xPlcxMan && m_xPlcxMan->HasParaSprm(NS_sprm::LN_PAnld).pSprm)
                {
                    /*
                     #i8114# Horrific backwards compatible ww7- lists in ww8+
                     docs
                    */
                    Read_ANLevelNo(13 /*equiv ww7- sprm no*/, &m_nListLevel, 1);
                }
            }
            else if (m_xPlcxMan && m_xPlcxMan->HasParaSprm(NS_sprm::LN_PAnld).pSprm)
            {
                /*
                 #i8114# Horrific backwards compatible ww7- lists in ww8+
                 docs
                */
                Read_ANLevelNo(13 /*equiv ww7- sprm no*/, &m_nListLevel, 1);
            }
        }
    }
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index b422202..671bbb9 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -673,9 +673,6 @@
    if (!pPage)
        pPage = &mrReader.m_rDoc.GetPageDesc(0);

    if (!pPage)
        return nullptr;

    SwSectionFormat *pFormat = rSection.mpSection->GetFormat();
    OSL_ENSURE(pFormat, "impossible");
    if (!pFormat)
@@ -4261,7 +4258,7 @@
    {
        long n = nSpace * 10 / 24;  // WW: 240 = 100%, SW: 100 = 100%

        if( n>SAL_MAX_UINT16 ) n = SAL_MAX_UINT16;
        // here n is in [0..13653]
        aLSpc.SetPropLineSpace( static_cast<sal_uInt16>(n) );
        const SvxFontHeightItem* pH = static_cast<const SvxFontHeightItem*>(
            GetFormatAttr( RES_CHRATR_FONTSIZE ));
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 5354cbb..643601e 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2174,10 +2174,10 @@
    }

    // Search from beginning?
    if( (1 > nIdx) || (nP < pPLCF_PosArray[ nIdx-1 ]) )
    if ((nIdx < 1) || (nP < pPLCF_PosArray[nIdx - 1]))
        nIdx = 1;

    long nI   = nIdx ? nIdx : 1;
    long nI   = nIdx;
    long nEnd = nIMax;

    for(int n = (1==nIdx ? 1 : 2); n; --n )
@@ -2447,10 +2447,10 @@
    }

    // Search from beginning?
    if( (1 > nIdx) || (nP < pPLCF_PosArray[ nIdx-1 ]) )
    if ((nIdx < 1) || (nP < pPLCF_PosArray[nIdx - 1]))
        nIdx = 1;

    sal_Int32 nI   = nIdx ? nIdx : 1;
    sal_Int32 nI   = nIdx;
    sal_Int32 nEnd = nIMax;

    for(int n = (1==nIdx ? 1 : 2); n; --n )
@@ -2542,10 +2542,10 @@
        return false;       // not found: nPos less than smallest entry
    }
    // Search from beginning?
    if( (1 > nIdx) || (nP < rPLCF.pPLCF_PosArray[ nIdx-1 ]) )
    if ((nIdx < 1) || (nP < rPLCF.pPLCF_PosArray[nIdx - 1]))
        nIdx = 1;

    long nI   = nIdx ? nIdx : 1;
    long nI   = nIdx;
    long nEnd = rPLCF.nIMax;

    for(int n = (1==nIdx ? 1 : 2); n; --n )
@@ -2654,13 +2654,7 @@
        }

        unsigned int nOfs = maRawData[nRawDataOffset] * 2;

        //clip to available data, corrupt fkp
        if (nOfs >= 511)
        {
            mnIMax = mnIdx;
            break;
        }
        // nOfs in [0..0xff*2=510]

        Entry aEntry(Get_Long(pStart));

@@ -2894,10 +2888,10 @@
    }

    // Search from beginning?
    if ((1 > mnIdx) || (nFc < maEntries[mnIdx-1].mnFC))
    if ((mnIdx < 1) || (nFc < maEntries[mnIdx - 1].mnFC))
        mnIdx = 1;

    sal_uInt8 nI   = mnIdx ? mnIdx : 1;
    sal_uInt8 nI   = mnIdx;
    sal_uInt8 nEnd = mnIMax;

    for(sal_uInt8 n = (1==mnIdx ? 1 : 2); n; --n )
@@ -8314,9 +8308,7 @@

    if (ww::IsSevenMinus(meVersion))
    {
        nId = *pSp;
        if (0x0100 < nId)
            nId = 0;
        nId = *pSp; // [0..0xff]
    }
    else
    {
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 5fa4446..2a42029 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1329,18 +1329,9 @@
                    aLongLR.SetRight(rPageRect.Right() - aRect.Right());
                }
            }
            if( nWhich == SID_ATTR_LONG_LRSPACE )
                rSet.Put( aLongLR );
            else
            {
                SvxLRSpaceItem aLR( aLongLR.GetLeft(),
                                    aLongLR.GetRight(),
                                    0, 0,
                                    nWhich);
                rSet.Put(aLR);
            }
            break;
            rSet.Put( aLongLR );
        }
        break;

        // provide left and right margins of current page style
        case SID_ATTR_PAGE_LRSPACE:
@@ -1387,17 +1378,9 @@
                aLongUL.SetUpper(rPagePrtRect.Top());
                aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom());
            }
            if( nWhich == SID_ATTR_LONG_ULSPACE )
                rSet.Put( aLongUL );
            else
            {
                SvxULSpaceItem aULTmp(static_cast<sal_uInt16>(aLongUL.GetUpper()),
                                      static_cast<sal_uInt16>(aLongUL.GetLower()),
                                      nWhich);
                rSet.Put(aULTmp);
            }
            break;
            rSet.Put( aLongUL );
        }
        break;

        // provide top and bottom margins of current page style
        case SID_ATTR_PAGE_ULSPACE:
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 9324c70..4cb1bd3 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3007,18 +3007,13 @@
            {
                // the view shell should be SwView for documents PDF export
                // or SwPagePreview for PDF export of the page preview
                //!! (check for SwView first as in GuessViewShell) !!
                OSL_ENSURE( pView, "!! view missing !!" );
                SwViewShell* pVwSh = nullptr;
                if (pView)
                {
                    // TODO/mba: we really need a generic way to get the SwViewShell!
                    SwView* pSwView = dynamic_cast<SwView*>( pView );
                    if ( pSwView )
                        pVwSh = pSwView->GetWrtShellPtr();
                    else
                        pVwSh = static_cast<SwPagePreview*>(pView)->GetViewShell();
                }
                // TODO/mba: we really need a generic way to get the SwViewShell!
                const SwView* pSwView = dynamic_cast<const SwView*>(pView);
                if (pSwView)
                    pVwSh = pSwView->GetWrtShellPtr();
                else
                    pVwSh = static_cast<SwPagePreview*>(pView)->GetViewShell();

                // get output device to use
                VclPtr< OutputDevice > pOut = lcl_GetOutputDevice( *m_pPrintUIOptions );
@@ -3029,8 +3024,8 @@
                    const bool bFirstPage           = m_pPrintUIOptions->getBoolValue( "IsFirstPage" );
                    bool bIsSkipEmptyPages          = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );

                    OSL_ENSURE(( dynamic_cast< const SwView *>( pView ) !=  nullptr &&  m_pRenderData->IsViewOptionAdjust())
                            || (dynamic_cast< const SwView *>( pView ) ==  nullptr && !m_pRenderData->IsViewOptionAdjust()),
                    OSL_ENSURE((pSwView && m_pRenderData->IsViewOptionAdjust())
                            || (!pSwView && !m_pRenderData->IsViewOptionAdjust()),
                            "SwView / SwViewOptionAdjust_Impl availability mismatch" );

                    // since printing now also use the API for PDF export this option
@@ -3043,9 +3038,7 @@
                    // During this process, additional information required for tagging
                    // the pdf file are collected, which are evaulated during painting.

                    SwWrtShell* pWrtShell = dynamic_cast< const SwView *>( pView ) !=  nullptr ?
                                            static_cast<SwView*>(pView)->GetWrtShellPtr() :
                                            nullptr;
                    SwWrtShell* pWrtShell = pSwView ? pSwView->GetWrtShellPtr() : nullptr;

                    SwPrintData const& rSwPrtOptions =
                        *m_pRenderData->GetSwPrtOptions();
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx
index 154d9d7..aa679eb 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -230,7 +230,7 @@
void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc )
{
    SwFrameFormat& rMaster = rPageDesc.GetMaster();
    int nFirstShare = -1;
    bool bFirstShare = false;

    // Transfer all general frame attributes
    rMaster.SetFormatAttr(rSet);
@@ -278,12 +278,9 @@
            ::FillHdFt(pHeaderFormat, rHeaderSet);

            rPageDesc.ChgHeaderShare(rHeaderSet.Get(SID_ATTR_PAGE_SHARED).GetValue());
            if (nFirstShare < 0)
            {
                rPageDesc.ChgFirstShare(static_cast<const SfxBoolItem&>(
            rPageDesc.ChgFirstShare(static_cast<const SfxBoolItem&>(
                            rHeaderSet.Get(SID_ATTR_PAGE_SHARED_FIRST)).GetValue());
                nFirstShare = rPageDesc.IsFirstShared() ? 1 : 0;
            }
            bFirstShare = true;
        }
        else
        {
@@ -317,7 +314,7 @@
            ::FillHdFt(pFooterFormat, rFooterSet);

            rPageDesc.ChgFooterShare(rFooterSet.Get(SID_ATTR_PAGE_SHARED).GetValue());
            if (nFirstShare < 0)
            if (!bFirstShare)
            {
                rPageDesc.ChgFirstShare(static_cast<const SfxBoolItem&>(
                            rFooterSet.Get(SID_ATTR_PAGE_SHARED_FIRST)).GetValue());
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index fd38f24..a8fe348 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -2000,25 +2000,21 @@
                                    break;
                                case PORTIONKIND_TAB:
                                    // for HideSelection() only Range, pSelection = 0.
                                    if ( pSelStart )
                                    if ( pSelStart ) // also implies pSelEnd
                                    {
                                        const tools::Rectangle aTabArea( aTmpPos, Point( aTmpPos.X()+nTxtWidth, aTmpPos.Y()+mnCharHeight-1 ) );
                                        bool bDone = false;
                                        if ( pSelStart )
                                        // is the Tab in the Selection???
                                        const TextPaM aTextStart(nPara, nIndex);
                                        const TextPaM aTextEnd(nPara, nIndex + 1);
                                        if ((aTextStart < *pSelEnd) && (aTextEnd > *pSelStart))
                                        {
                                            // is the Tab in the Selection???
                                            const TextPaM aTextStart( nPara, nIndex );
                                            const TextPaM aTextEnd( nPara, nIndex+1 );
                                            if ( ( aTextStart < *pSelEnd ) && ( aTextEnd > *pSelStart ) )
                                            {
                                                const Color aOldColor = pOutDev->GetFillColor();
                                                pOutDev->SetFillColor( rStyleSettings.GetHighlightColor() );
                                                pOutDev->DrawRect( aTabArea );
                                                pOutDev->SetFillColor( aOldColor );
                                                bDone = true;
                                            }
                                            const Color aOldColor = pOutDev->GetFillColor();
                                            pOutDev->SetFillColor(
                                                rStyleSettings.GetHighlightColor());
                                            pOutDev->DrawRect(aTabArea);
                                            pOutDev->SetFillColor(aOldColor);
                                        }
                                        if ( !bDone )
                                        else
                                        {
                                            pOutDev->Erase( aTabArea );
                                        }
diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index 5b37c1b..a70b99f 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -2188,7 +2188,7 @@
                if( IsExpandable() && !pView->IsExpanded( pCursor ) )
                    pView->Expand( pCursor );
            }
            else if ( bIsCellFocusEnabled && pCursor )
            else if (bIsCellFocusEnabled)
            {
                if ( nCurTabPos < ( pView->TabCount() - 1 /*!2*/ ) )
                {
@@ -2219,7 +2219,7 @@

        case KEY_LEFT:
        {
            if ( bIsCellFocusEnabled && pCursor )
            if (bIsCellFocusEnabled)
            {
                if ( nCurTabPos > FIRST_ENTRY_TAB )
                {
@@ -2394,24 +2394,19 @@
            break;

        case KEY_ADD:
            if( pCursor )
            if (!pView->IsExpanded(pCursor))
                pView->Expand(pCursor);
            if (bMod1)
            {
                if( !pView->IsExpanded(pCursor))
                    pView->Expand( pCursor );
                if( bMod1 )
                sal_uInt16 nRefDepth = pTree->GetDepth(pCursor);
                SvTreeListEntry* pCur = pTree->Next(pCursor);
                while (pCur && pTree->GetDepth(pCur) > nRefDepth)
                {
                    sal_uInt16 nRefDepth = pTree->GetDepth( pCursor );
                    SvTreeListEntry* pCur = pTree->Next( pCursor );
                    while( pCur && pTree->GetDepth(pCur) > nRefDepth )
                    {
                        if( pCur->HasChildren() && !pView->IsExpanded(pCur))
                            pView->Expand( pCur );
                        pCur = pTree->Next( pCur );
                    }
                    if (pCur->HasChildren() && !pView->IsExpanded(pCur))
                        pView->Expand(pCur);
                    pCur = pTree->Next(pCur);
                }
            }
            else
                bKeyUsed = false;
            break;

        case KEY_A:
@@ -2422,46 +2417,41 @@
            break;

        case KEY_SUBTRACT:
            if( pCursor )
            if (pView->IsExpanded(pCursor))
                pView->Collapse(pCursor);
            if (bMod1)
            {
                if( pView->IsExpanded(pCursor))
                    pView->Collapse( pCursor );
                if( bMod1 )
                // collapse all parents until we get to the root
                SvTreeListEntry* pParentToCollapse = pTree->GetRootLevelParent(pCursor);
                if (pParentToCollapse)
                {
                    // collapse all parents until we get to the root
                    SvTreeListEntry* pParentToCollapse = pTree->GetRootLevelParent(pCursor);
                    if( pParentToCollapse )
                    sal_uInt16 nRefDepth;
                    // special case explorer: if the root only has a single
                    // entry, don't collapse the root entry
                    if (pTree->GetChildList(nullptr).size() < 2)
                    {
                        sal_uInt16 nRefDepth;
                        // special case explorer: if the root only has a single
                        // entry, don't collapse the root entry
                        if (pTree->GetChildList(nullptr).size() < 2)
                        nRefDepth = 1;
                        pParentToCollapse = pCursor;
                        while (pTree->GetParent(pParentToCollapse)
                               && pTree->GetDepth(pTree->GetParent(pParentToCollapse)) > 0)
                        {
                            nRefDepth = 1;
                            pParentToCollapse = pCursor;
                            while( pTree->GetParent(pParentToCollapse) &&
                                   pTree->GetDepth( pTree->GetParent(pParentToCollapse)) > 0)
                            {
                                pParentToCollapse = pTree->GetParent(pParentToCollapse);
                            }
                            pParentToCollapse = pTree->GetParent(pParentToCollapse);
                        }
                        else
                            nRefDepth = 0;
                    }
                    else
                        nRefDepth = 0;

                        if( pView->IsExpanded(pParentToCollapse) )
                            pView->Collapse( pParentToCollapse );
                        SvTreeListEntry* pCur = pTree->Next( pParentToCollapse );
                        while( pCur && pTree->GetDepth(pCur) > nRefDepth )
                        {
                            if( pCur->HasChildren() && pView->IsExpanded(pCur) )
                                pView->Collapse( pCur );
                            pCur = pTree->Next( pCur );
                        }
                    if (pView->IsExpanded(pParentToCollapse))
                        pView->Collapse(pParentToCollapse);
                    SvTreeListEntry* pCur = pTree->Next(pParentToCollapse);
                    while (pCur && pTree->GetDepth(pCur) > nRefDepth)
                    {
                        if (pCur->HasChildren() && pView->IsExpanded(pCur))
                            pView->Collapse(pCur);
                        pCur = pTree->Next(pCur);
                    }
                }
            }
            else
                bKeyUsed = false;
            break;

        case KEY_DIVIDE :
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index dccdbda..667503b 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -2674,17 +2674,17 @@

    SvViewDataEntry* pViewDataEntry = GetViewDataEntry( &rEntry );

    sal_uInt16 nTabCount = aTabs.size();
    sal_uInt16 nItemCount = rEntry.ItemCount();
    sal_uInt16 nCurTab = 0;
    sal_uInt16 nCurItem = 0;
    const size_t nTabCount = aTabs.size();
    const size_t nItemCount = rEntry.ItemCount();
    size_t nCurTab = 0;
    size_t nCurItem = 0;

    while (nCurTab < nTabCount && nCurItem < nItemCount)
    {
        SvLBoxTab* pTab = aTabs[nCurTab].get();
        sal_uInt16 nNextTab = nCurTab + 1;
        const size_t nNextTab = nCurTab + 1;
        SvLBoxTab* pNextTab = nNextTab < nTabCount ? aTabs[nNextTab].get() : nullptr;
        SvLBoxItem* pItem = nCurItem < nItemCount ? &rEntry.GetItem(nCurItem) : nullptr;
        SvLBoxItem& rItem = rEntry.GetItem(nCurItem);

        SvLBoxTabFlags nFlags = pTab->nFlags;
        Size aSize(SvLBoxItem::GetSize(pViewDataEntry, nCurItem));
@@ -2715,7 +2715,7 @@
        Wallpaper aWallpaper = rRenderContext.GetBackground();

        bool bSelTab = bool(nFlags & SvLBoxTabFlags::SHOW_SELECTION);
        SvLBoxItemType nItemType = pItem->GetType();
        SvLBoxItemType nItemType = rItem.GetType();

        if (pViewDataEntry->IsHighlighted() && bSelTab)
        {
@@ -2811,10 +2811,10 @@
        aEntryPos.AdjustY((nTempEntryHeight - aSize.Height()) / 2 );
        pViewDataEntry->SetPaintRectangle(aRect);

        pItem->Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, rEntry);
        rItem.Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, rEntry);

        // division line between tabs
        if (pNextTab && pItem->GetType() == SvLBoxItemType::String &&
        if (pNextTab && rItem.GetType() == SvLBoxItemType::String &&
            // not at the right edge of the window!
            aRect.Right() < nMaxRight)
        {
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 1567865..46a875a 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1506,9 +1506,8 @@
        {
            uno::Reference< beans::XPropertySet > xDocProperties;
            xDocProperties.set( rDM_Impl.GetTextDocument(), uno::UNO_QUERY_THROW );
            bool bSquaredPageMode = false;
            Insert( PROP_GRID_STANDARD_MODE, uno::makeAny( !bSquaredPageMode ) );
            xDocProperties->setPropertyValue( "DefaultPageMode", uno::makeAny( bSquaredPageMode ) );
            Insert(PROP_GRID_STANDARD_MODE, uno::makeAny(true));
            xDocProperties->setPropertyValue("DefaultPageMode", uno::makeAny(false));
        }
        catch ( const uno::Exception& )
        {
@@ -1592,7 +1591,7 @@

                if (0 <= m_nPageNumber)
                {
                    sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
                    sal_Int16 nPageNumber = static_cast< sal_Int16 >(m_nPageNumber);
                    xRangeProperties->setPropertyValue(getPropertyName(PROP_PAGE_NUMBER_OFFSET),
                        uno::makeAny(nPageNumber));
                }
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 001e22b..833b38d 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -748,7 +748,7 @@
        break;
        case RTF_SECTUNLOCKED:
        {
            auto pValue = new RTFValue(int(!nParam));
            auto pValue = new RTFValue(0);
            m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_formProt, pValue);
        }
        break;
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 6704100..9a7b980 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -476,19 +476,11 @@
                    // The coordinates are in an (x,y) form.
                    aToken = aToken.copy(1, aToken.getLength() - 2);
                    sal_Int32 nI = 0;
                    boost::optional<sal_Int32> oX;
                    boost::optional<sal_Int32> oY;
                    do
                    {
                        OUString aPoint = aToken.getToken(0, ',', nI);
                        if (!oX)
                            oX = aPoint.toInt32();
                        else
                            oY = aPoint.toInt32();
                    } while (nI >= 0);
                    sal_Int32 nX = aToken.getToken(0, ',', nI).toInt32();
                    sal_Int32 nY = (nI >= 0) ? aToken.getToken(0, ',', nI).toInt32() : 0;
                    drawing::EnhancedCustomShapeParameterPair aPair;
                    aPair.First.Value <<= *oX;
                    aPair.Second.Value <<= *oY;
                    aPair.First.Value <<= nX;
                    aPair.Second.Value <<= nY;
                    aCoordinates.push_back(aPair);
                }
            } while (nCharIndex >= 0);
@@ -829,19 +821,11 @@
                    // The coordinates are in an (x,y) form.
                    aToken = aToken.copy(1, aToken.getLength() - 2);
                    sal_Int32 nI = 0;
                    boost::optional<sal_Int32> oX;
                    boost::optional<sal_Int32> oY;
                    do
                    {
                        OUString aPoint = aToken.getToken(0, ',', nI);
                        if (!oX)
                            oX = aPoint.toInt32();
                        else
                            oY = aPoint.toInt32();
                    } while (nI >= 0);
                    sal_Int32 nX = aToken.getToken(0, ',', nI).toInt32();
                    sal_Int32 nY = (nI >= 0) ? aToken.getToken(0, ',', nI).toInt32() : 0;
                    RTFSprms aPathAttributes;
                    aPathAttributes.set(NS_ooxml::LN_CT_Point2D_x, new RTFValue(*oX));
                    aPathAttributes.set(NS_ooxml::LN_CT_Point2D_y, new RTFValue(*oY));
                    aPathAttributes.set(NS_ooxml::LN_CT_Point2D_x, new RTFValue(nX));
                    aPathAttributes.set(NS_ooxml::LN_CT_Point2D_y, new RTFValue(nY));
                    aPolygonSprms.set(NS_ooxml::LN_CT_WrapPath_lineTo,
                                      new RTFValue(aPathAttributes), RTFOverwrite::NO_APPEND);
                }
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
index 14ffebb..4a40287 100644
--- a/xmloff/source/style/xmlnumfe.cxx
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -17,6 +17,7 @@
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#include <comphelper/sequence.hxx>
#include <comphelper/string.hxx>
#include <svl/zforlist.hxx>
#include <svl/zformat.hxx>
@@ -187,17 +188,7 @@

uno::Sequence<sal_Int32> SvXMLNumUsedList_Impl::GetWasUsed()
{
    uno::Sequence<sal_Int32> ret(nWasUsedCount);
    sal_Int32* pWasUsed = ret.getArray();
    if (pWasUsed)
    {
        for (const auto nWasUsed : aWasUsed)
        {
            *pWasUsed = nWasUsed;
            ++pWasUsed;
        }
    }
    return ret;
    return comphelper::containerToSequence<sal_Int32>(aWasUsed);
}

void SvXMLNumUsedList_Impl::SetWasUsed(const uno::Sequence<sal_Int32>& rWasUsed)