Related: tdf#150273 just take the color direct from the current entry

no need for the indirection, which is out by one anyway, perhaps
from some time that the "none" entry was in the list vs a separate
widget as it is now

Change-Id: I028e03260f500473b42847ee748d7af8a4791ccd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142397
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index 180fb64..f0427d2 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -263,9 +263,6 @@ private:
    {
        return maPaintCol;
    }
    Color   GetColorLine1( sal_Int32  nPos );
    Color   GetColorLine2( sal_Int32  nPos );
    Color   GetColorDist( sal_Int32  nPos );

    void UpdatePreview();

diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 4ce41da..20fe74b 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1532,8 +1532,10 @@ void SvtLineListBox::UpdateEntries()
    // Remove the old entries
    m_xLineSet->Clear();

    // Add the new entries based on the defined width
    const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
    Color aFieldColor = rSettings.GetFieldColor();

    // Add the new entries based on the defined width
    sal_uInt16 n = 0;
    sal_uInt16 nCount = m_vLineList.size( );
    while ( n < nCount )
@@ -1543,9 +1545,9 @@ void SvtLineListBox::UpdateEntries()
        ImpGetLine( pData->GetLine1ForWidth( m_nWidth ),
                pData->GetLine2ForWidth( m_nWidth ),
                pData->GetDistForWidth( m_nWidth ),
                GetColorLine1(m_xLineSet->GetItemCount()),
                GetColorLine2(m_xLineSet->GetItemCount()),
                GetColorDist(m_xLineSet->GetItemCount()),
                pData->GetColorLine1(aColor),
                pData->GetColorLine2(aColor),
                pData->GetColorDist(aColor, aFieldColor),
                pData->GetStyle(), aBmp );
        sal_Int16 nItemId = static_cast<sal_Int16>(pData->GetStyle()) + 1;
        m_xLineSet->InsertItem(nItemId, Image(aBmp), GetLineStyleName(pData->GetStyle()));
@@ -1557,36 +1559,6 @@ void SvtLineListBox::UpdateEntries()
    m_xLineSet->SetOptimalSize();
}

Color SvtLineListBox::GetColorLine1( sal_Int32 nPos )
{
    sal_Int32 nStyle = GetStylePos( nPos );
    if (nStyle == -1)
        return GetPaintColor( );
    auto& pData = m_vLineList[ nStyle ];
    return pData->GetColorLine1( GetColor( ) );
}

Color SvtLineListBox::GetColorLine2( sal_Int32 nPos )
{
    sal_Int32 nStyle = GetStylePos(nPos);
    if (nStyle == -1)
        return GetPaintColor( );
    auto& pData = m_vLineList[ nStyle ];
    return pData->GetColorLine2( GetColor( ) );
}

Color SvtLineListBox::GetColorDist( sal_Int32 nPos )
{
    const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
    Color rResult = rSettings.GetFieldColor();

    sal_Int32 nStyle = GetStylePos( nPos );
    if (nStyle == -1)
        return rResult;
    auto& pData = m_vLineList[ nStyle ];
    return pData->GetColorDist( GetColor( ), rResult );
}

IMPL_LINK_NOARG(SvtLineListBox, ValueSelectHdl, ValueSet*, void)
{
    maSelectHdl.Call(*this);