summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPalenik Mihály <palenik.mihaly@gmail.com>2015-01-25 01:03:57 +0100
committerAndras Timar <andras.timar@collabora.com>2015-01-25 16:11:05 +0000
commit148e489e33a34c6345326c9beaf248ac91f8cd01 (patch)
tree3677b1849ab70dfb59b7439ab46bc5c5a1fd1c82
parent164903c0441a2cd79bc06708fe7e69780bb85a09 (diff)
fdo#84592 Improve SvTreeListBox class with alternating rows.
It is possible to set alternating rows. Expert Configuration dialog use it. This bug was fixed earlier, but after this feature didn't work. Change-Id: I3602a6b03db32d6f43ec163de2427f4a018c7779 Reviewed-on: https://gerrit.libreoffice.org/14164 Reviewed-by: Andras Timar <andras.timar@collabora.com> Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--include/vcl/settings.hxx3
-rw-r--r--svtools/source/contnr/treelistbox.cxx23
-rw-r--r--svtools/source/contnr/treelistentry.cxx2
-rw-r--r--vcl/source/app/settings.cxx16
4 files changed, 14 insertions, 30 deletions
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index a65712774b00..c701654770dd 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -351,9 +351,6 @@ public:
void SetInactiveTabColor( const Color& rColor );
const Color& GetInactiveTabColor() const;
- void SetRowColor( const Color& rColor );
- const Color& GetRowColor() const;
-
void SetAlternatingRowColor( const Color& rColor );
const Color& GetAlternatingRowColor() const;
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 707b7bbd74ff..aadadd673070 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -470,12 +470,14 @@ IMPL_LINK_INLINE_END( SvTreeListBox, CloneHdl_Impl, SvTreeListEntry*, pEntry )
sal_uLong SvTreeListBox::Insert( SvTreeListEntry* pEntry, SvTreeListEntry* pParent, sal_uLong nPos )
{
sal_uLong nInsPos = pModel->Insert( pEntry, pParent, nPos );
+ pEntry->SetBackColor( GetBackground().GetColor() );
if(mbAlternatingRowColors)
{
if(nPos == TREELIST_APPEND)
- pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetRowColor() ?
- GetSettings().GetStyleSettings().GetAlternatingRowColor() :
- GetSettings().GetStyleSettings().GetRowColor() );
+ {
+ if(Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetBackground().GetColor())
+ pEntry->SetBackColor( GetSettings().GetStyleSettings().GetAlternatingRowColor() );
+ }
else
SetAlternatingRowColors( true );
}
@@ -485,12 +487,14 @@ sal_uLong SvTreeListBox::Insert( SvTreeListEntry* pEntry, SvTreeListEntry* pPare
sal_uLong SvTreeListBox::Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos )
{
sal_uLong nInsPos = pModel->Insert( pEntry, nRootPos );
+ pEntry->SetBackColor( GetBackground().GetColor() );
if(mbAlternatingRowColors)
{
if(nRootPos == TREELIST_APPEND)
- pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetRowColor() ?
- GetSettings().GetStyleSettings().GetAlternatingRowColor() :
- GetSettings().GetStyleSettings().GetRowColor() );
+ {
+ if(Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetBackground().GetColor())
+ pEntry->SetBackColor( GetSettings().GetStyleSettings().GetAlternatingRowColor() );
+ }
else
SetAlternatingRowColors( true );
}
@@ -3020,6 +3024,8 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry,long nLine,sal_uInt16 nT
SetTextColor( aBackupTextColor );
Control::SetFont( aBackupFont );
}
+ else
+ aWallpaper.SetColor( pEntry->GetBackColor() );
}
// draw background
@@ -3414,14 +3420,13 @@ void SvTreeListBox::SetAlternatingRowColors( bool bEnable )
SvTreeListEntry* pEntry = pModel->First();
for(size_t i = 0; pEntry; ++i)
{
- pEntry->SetBackColor( i % 2 == 0 ? GetSettings().GetStyleSettings().GetRowColor() :
- GetSettings().GetStyleSettings().GetAlternatingRowColor());
+ pEntry->SetBackColor( i % 2 == 0 ? GetBackground().GetColor() : GetSettings().GetStyleSettings().GetAlternatingRowColor());
pEntry = pModel->Next(pEntry);
}
}
else
for(SvTreeListEntry* pEntry = pModel->First(); pEntry; pEntry = pModel->Next(pEntry))
- pEntry->SetBackColor( GetSettings().GetStyleSettings().GetRowColor() );
+ pEntry->SetBackColor( GetBackground().GetColor() );
pImp->UpdateAll();
}
diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx
index e8bf2de05e5f..aa0ce3c2f434 100644
--- a/svtools/source/contnr/treelistentry.cxx
+++ b/svtools/source/contnr/treelistentry.cxx
@@ -57,7 +57,6 @@ SvTreeListEntry::SvTreeListEntry()
, bIsMarked(false)
, pUserData(NULL)
, nEntryFlags(0)
- , maBackColor(Application::GetSettings().GetStyleSettings().GetRowColor())
{
}
@@ -68,7 +67,6 @@ SvTreeListEntry::SvTreeListEntry(const SvTreeListEntry& r)
, bIsMarked(r.bIsMarked)
, pUserData(r.pUserData)
, nEntryFlags(r.nEntryFlags)
- , maBackColor(Application::GetSettings().GetStyleSettings().GetRowColor())
{
SvTreeListEntries::const_iterator it = r.maChildren.begin(), itEnd = r.maChildren.end();
for (; it != itEnd; ++it)
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 95308ef0686a..57377ff3fb27 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -91,7 +91,6 @@ struct ImplStyleData
Color maActiveBorderColor;
Color maActiveColor;
Color maActiveTextColor;
- Color maRowColor;
Color maAlternatingRowColor;
Color maButtonTextColor;
Color maButtonRolloverTextColor;
@@ -563,7 +562,6 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
maActiveBorderColor( rData.maActiveBorderColor ),
maActiveColor( rData.maActiveColor ),
maActiveTextColor( rData.maActiveTextColor ),
- maRowColor( rData.maRowColor ),
maAlternatingRowColor( rData.maAlternatingRowColor ),
maButtonTextColor( rData.maButtonTextColor ),
maButtonRolloverTextColor( rData.maButtonRolloverTextColor ),
@@ -742,7 +740,6 @@ void ImplStyleData::SetStandardStyles()
maVisitedLinkColor = Color( 0x00, 0x00, 0xCC );
maHighlightLinkColor = Color( COL_LIGHTBLUE );
maFontColor = Color( COL_BLACK );
- maRowColor = Color( COL_WHITE );
maAlternatingRowColor = Color( 0xEE, 0xEE, 0xEE );
mnBorderSize = 1;
@@ -1361,19 +1358,6 @@ StyleSettings::GetInactiveTabColor() const
}
void
-StyleSettings::SetRowColor( const Color& rColor )
-{
- CopyData();
- mpData->maRowColor = rColor;
-}
-
-const Color&
-StyleSettings::GetRowColor() const
-{
- return mpData->maRowColor;
-}
-
-void
StyleSettings::SetAlternatingRowColor( const Color& rColor )
{
CopyData();