summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-11-07 17:17:30 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-11-08 09:18:05 +0100
commit1e0b50c17b80146e4840994703369bae904b2207 (patch)
treec25613320bb1f804e9b38427febbe1ea86796abb
parenta4c8f05c760328177bb6056750aab53432a3a506 (diff)
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>
-rw-r--r--include/svtools/ctrlbox.hxx3
-rw-r--r--svtools/source/control/ctrlbox.cxx40
2 files changed, 6 insertions, 37 deletions
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index 180fb64bfac6..f0427d2d5f1d 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 4ce41da23721..20fe74bf4bb5 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);