Kaydet (Commit) 148e489e authored tarafından Palenik Mihály's avatar Palenik Mihály Kaydeden (comit) Andras Timar

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/14164Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
Tested-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst 164903c0
...@@ -351,9 +351,6 @@ public: ...@@ -351,9 +351,6 @@ public:
void SetInactiveTabColor( const Color& rColor ); void SetInactiveTabColor( const Color& rColor );
const Color& GetInactiveTabColor() const; const Color& GetInactiveTabColor() const;
void SetRowColor( const Color& rColor );
const Color& GetRowColor() const;
void SetAlternatingRowColor( const Color& rColor ); void SetAlternatingRowColor( const Color& rColor );
const Color& GetAlternatingRowColor() const; const Color& GetAlternatingRowColor() const;
......
...@@ -470,12 +470,14 @@ IMPL_LINK_INLINE_END( SvTreeListBox, CloneHdl_Impl, SvTreeListEntry*, pEntry ) ...@@ -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 SvTreeListBox::Insert( SvTreeListEntry* pEntry, SvTreeListEntry* pParent, sal_uLong nPos )
{ {
sal_uLong nInsPos = pModel->Insert( pEntry, pParent, nPos ); sal_uLong nInsPos = pModel->Insert( pEntry, pParent, nPos );
pEntry->SetBackColor( GetBackground().GetColor() );
if(mbAlternatingRowColors) if(mbAlternatingRowColors)
{ {
if(nPos == TREELIST_APPEND) if(nPos == TREELIST_APPEND)
pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetRowColor() ? {
GetSettings().GetStyleSettings().GetAlternatingRowColor() : if(Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetBackground().GetColor())
GetSettings().GetStyleSettings().GetRowColor() ); pEntry->SetBackColor( GetSettings().GetStyleSettings().GetAlternatingRowColor() );
}
else else
SetAlternatingRowColors( true ); SetAlternatingRowColors( true );
} }
...@@ -485,12 +487,14 @@ sal_uLong SvTreeListBox::Insert( SvTreeListEntry* pEntry, SvTreeListEntry* pPare ...@@ -485,12 +487,14 @@ sal_uLong SvTreeListBox::Insert( SvTreeListEntry* pEntry, SvTreeListEntry* pPare
sal_uLong SvTreeListBox::Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos ) sal_uLong SvTreeListBox::Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos )
{ {
sal_uLong nInsPos = pModel->Insert( pEntry, nRootPos ); sal_uLong nInsPos = pModel->Insert( pEntry, nRootPos );
pEntry->SetBackColor( GetBackground().GetColor() );
if(mbAlternatingRowColors) if(mbAlternatingRowColors)
{ {
if(nRootPos == TREELIST_APPEND) if(nRootPos == TREELIST_APPEND)
pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetRowColor() ? {
GetSettings().GetStyleSettings().GetAlternatingRowColor() : if(Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetBackground().GetColor())
GetSettings().GetStyleSettings().GetRowColor() ); pEntry->SetBackColor( GetSettings().GetStyleSettings().GetAlternatingRowColor() );
}
else else
SetAlternatingRowColors( true ); SetAlternatingRowColors( true );
} }
...@@ -3020,6 +3024,8 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry,long nLine,sal_uInt16 nT ...@@ -3020,6 +3024,8 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry,long nLine,sal_uInt16 nT
SetTextColor( aBackupTextColor ); SetTextColor( aBackupTextColor );
Control::SetFont( aBackupFont ); Control::SetFont( aBackupFont );
} }
else
aWallpaper.SetColor( pEntry->GetBackColor() );
} }
// draw background // draw background
...@@ -3414,14 +3420,13 @@ void SvTreeListBox::SetAlternatingRowColors( bool bEnable ) ...@@ -3414,14 +3420,13 @@ void SvTreeListBox::SetAlternatingRowColors( bool bEnable )
SvTreeListEntry* pEntry = pModel->First(); SvTreeListEntry* pEntry = pModel->First();
for(size_t i = 0; pEntry; ++i) for(size_t i = 0; pEntry; ++i)
{ {
pEntry->SetBackColor( i % 2 == 0 ? GetSettings().GetStyleSettings().GetRowColor() : pEntry->SetBackColor( i % 2 == 0 ? GetBackground().GetColor() : GetSettings().GetStyleSettings().GetAlternatingRowColor());
GetSettings().GetStyleSettings().GetAlternatingRowColor());
pEntry = pModel->Next(pEntry); pEntry = pModel->Next(pEntry);
} }
} }
else else
for(SvTreeListEntry* pEntry = pModel->First(); pEntry; pEntry = pModel->Next(pEntry)) for(SvTreeListEntry* pEntry = pModel->First(); pEntry; pEntry = pModel->Next(pEntry))
pEntry->SetBackColor( GetSettings().GetStyleSettings().GetRowColor() ); pEntry->SetBackColor( GetBackground().GetColor() );
pImp->UpdateAll(); pImp->UpdateAll();
} }
......
...@@ -57,7 +57,6 @@ SvTreeListEntry::SvTreeListEntry() ...@@ -57,7 +57,6 @@ SvTreeListEntry::SvTreeListEntry()
, bIsMarked(false) , bIsMarked(false)
, pUserData(NULL) , pUserData(NULL)
, nEntryFlags(0) , nEntryFlags(0)
, maBackColor(Application::GetSettings().GetStyleSettings().GetRowColor())
{ {
} }
...@@ -68,7 +67,6 @@ SvTreeListEntry::SvTreeListEntry(const SvTreeListEntry& r) ...@@ -68,7 +67,6 @@ SvTreeListEntry::SvTreeListEntry(const SvTreeListEntry& r)
, bIsMarked(r.bIsMarked) , bIsMarked(r.bIsMarked)
, pUserData(r.pUserData) , pUserData(r.pUserData)
, nEntryFlags(r.nEntryFlags) , nEntryFlags(r.nEntryFlags)
, maBackColor(Application::GetSettings().GetStyleSettings().GetRowColor())
{ {
SvTreeListEntries::const_iterator it = r.maChildren.begin(), itEnd = r.maChildren.end(); SvTreeListEntries::const_iterator it = r.maChildren.begin(), itEnd = r.maChildren.end();
for (; it != itEnd; ++it) for (; it != itEnd; ++it)
......
...@@ -91,7 +91,6 @@ struct ImplStyleData ...@@ -91,7 +91,6 @@ struct ImplStyleData
Color maActiveBorderColor; Color maActiveBorderColor;
Color maActiveColor; Color maActiveColor;
Color maActiveTextColor; Color maActiveTextColor;
Color maRowColor;
Color maAlternatingRowColor; Color maAlternatingRowColor;
Color maButtonTextColor; Color maButtonTextColor;
Color maButtonRolloverTextColor; Color maButtonRolloverTextColor;
...@@ -563,7 +562,6 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : ...@@ -563,7 +562,6 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
maActiveBorderColor( rData.maActiveBorderColor ), maActiveBorderColor( rData.maActiveBorderColor ),
maActiveColor( rData.maActiveColor ), maActiveColor( rData.maActiveColor ),
maActiveTextColor( rData.maActiveTextColor ), maActiveTextColor( rData.maActiveTextColor ),
maRowColor( rData.maRowColor ),
maAlternatingRowColor( rData.maAlternatingRowColor ), maAlternatingRowColor( rData.maAlternatingRowColor ),
maButtonTextColor( rData.maButtonTextColor ), maButtonTextColor( rData.maButtonTextColor ),
maButtonRolloverTextColor( rData.maButtonRolloverTextColor ), maButtonRolloverTextColor( rData.maButtonRolloverTextColor ),
...@@ -742,7 +740,6 @@ void ImplStyleData::SetStandardStyles() ...@@ -742,7 +740,6 @@ void ImplStyleData::SetStandardStyles()
maVisitedLinkColor = Color( 0x00, 0x00, 0xCC ); maVisitedLinkColor = Color( 0x00, 0x00, 0xCC );
maHighlightLinkColor = Color( COL_LIGHTBLUE ); maHighlightLinkColor = Color( COL_LIGHTBLUE );
maFontColor = Color( COL_BLACK ); maFontColor = Color( COL_BLACK );
maRowColor = Color( COL_WHITE );
maAlternatingRowColor = Color( 0xEE, 0xEE, 0xEE ); maAlternatingRowColor = Color( 0xEE, 0xEE, 0xEE );
mnBorderSize = 1; mnBorderSize = 1;
...@@ -1360,19 +1357,6 @@ StyleSettings::GetInactiveTabColor() const ...@@ -1360,19 +1357,6 @@ StyleSettings::GetInactiveTabColor() const
return mpData->maInactiveTabColor; return mpData->maInactiveTabColor;
} }
void
StyleSettings::SetRowColor( const Color& rColor )
{
CopyData();
mpData->maRowColor = rColor;
}
const Color&
StyleSettings::GetRowColor() const
{
return mpData->maRowColor;
}
void void
StyleSettings::SetAlternatingRowColor( const Color& rColor ) StyleSettings::SetAlternatingRowColor( const Color& rColor )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment