diff options
-rw-r--r-- | cui/source/options/optaboutconfig.cxx | 1 | ||||
-rw-r--r-- | include/svtools/treelistbox.hxx | 4 | ||||
-rw-r--r-- | include/svtools/treelistentry.hxx | 4 | ||||
-rw-r--r-- | include/vcl/settings.hxx | 6 | ||||
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 41 | ||||
-rw-r--r-- | svtools/source/contnr/treelistentry.cxx | 2 | ||||
-rw-r--r-- | vcl/source/app/settings.cxx | 32 |
7 files changed, 90 insertions, 0 deletions
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx index d16723e130b8..7b3c0d69d7c7 100644 --- a/cui/source/options/optaboutconfig.cxx +++ b/cui/source/options/optaboutconfig.cxx @@ -157,6 +157,7 @@ CuiAboutConfigTabPage::CuiAboutConfigTabPage( vcl::Window* pParent/*, const SfxI aTabs[4] = aTabs[3] + fWidth * 8; m_pPrefBox->SetTabs(aTabs, MAP_PIXEL); + m_pPrefBox->SetAlternatingRow( true ); } void CuiAboutConfigTabPage::InsertEntry(const OUString& rProp, const OUString& rStatus, const OUString& rType, const OUString& rValue) diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx index ac8a2812d569..f54f32439d5d 100644 --- a/include/svtools/treelistbox.hxx +++ b/include/svtools/treelistbox.hxx @@ -236,6 +236,7 @@ class SVT_DLLPUBLIC SvTreeListBox sal_uInt16 nLastSelTab; long mnCheckboxItemWidth; bool mbContextBmpExpanded; + bool mbAlternatingRowColor; SvTreeListEntry* pHdlEntry; SvLBoxItem* pHdlItem; @@ -778,6 +779,9 @@ public: long getPreferredDimensions(std::vector<long> &rWidths) const; virtual Size GetOptimalSize() const SAL_OVERRIDE; + + void SetAlternatingRow( const bool bEnable ); + bool IsRowAlternating() const { return mbAlternatingRowColor; } }; #define SV_LBOX_DD_FORMAT "SV_LBOX_DD_FORMAT" diff --git a/include/svtools/treelistentry.hxx b/include/svtools/treelistentry.hxx index 71ff072b3fef..2692becba87e 100644 --- a/include/svtools/treelistentry.hxx +++ b/include/svtools/treelistentry.hxx @@ -56,6 +56,7 @@ class SVT_DLLPUBLIC SvTreeListEntry bool bIsMarked; void* pUserData; sal_uInt16 nEntryFlags; + Color maBackColor; private: void ClearChildren(); @@ -101,6 +102,9 @@ public: bool GetIsMarked() const { return bIsMarked; } void SetMarked( bool IsMarked ) { bIsMarked = IsMarked; } + + void SetBackColor( const Color& aColor ) { maBackColor = aColor; } + Color GetBackColor() const { return maBackColor; } }; #endif diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx index fb16ee3cff06..bb454a366281 100644 --- a/include/vcl/settings.hxx +++ b/include/vcl/settings.hxx @@ -358,6 +358,12 @@ public: void SetInactiveTabColor( const Color& rColor ); const Color& GetInactiveTabColor() const; + void SetAlternatingRowColor( const Color& rColor ); + const Color& GetAlternatingRowColor() const; + + void SetAlternatingRowColor2( const Color& rColor ); + const Color& GetAlternatingRowColor2() const; + void SetHighContrastMode(bool bHighContrast ); bool GetHighContrastMode() const; diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index c0ed007fc611..c7d610c04daf 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -380,6 +380,7 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits nWinStyle) : DragSourceHelper(this), mpImpl(new SvTreeListBoxImpl(*this)), mbContextBmpExpanded(false), + mbAlternatingRowColor(false), eSelMode(NO_SELECTION), nMinWidthInChars(0) { @@ -409,6 +410,7 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, const ResId& rResId) : DragSourceHelper(this), mpImpl(new SvTreeListBoxImpl(*this)), mbContextBmpExpanded(false), + mbAlternatingRowColor(false), eSelMode(NO_SELECTION), nMinWidthInChars(0) { @@ -468,12 +470,30 @@ 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 ); + if(mbAlternatingRowColor) + { + if(nPos == TREELIST_APPEND) + pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetAlternatingRowColor() ? + GetSettings().GetStyleSettings().GetAlternatingRowColor2() : + GetSettings().GetStyleSettings().GetAlternatingRowColor() ); + else + SetAlternatingRow( true ); + } return nInsPos; } sal_uLong SvTreeListBox::Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos ) { sal_uLong nInsPos = pModel->Insert( pEntry, nRootPos ); + if(mbAlternatingRowColor) + { + if(nRootPos == TREELIST_APPEND) + pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetAlternatingRowColor() ? + GetSettings().GetStyleSettings().GetAlternatingRowColor2() : + GetSettings().GetStyleSettings().GetAlternatingRowColor() ); + else + SetAlternatingRow( true ); + } return nInsPos; } @@ -3002,6 +3022,8 @@ long SvTreeListBox::PaintEntry1(SvTreeListEntry* pEntry,long nLine,sal_uInt16 nT SetTextColor( aBackupTextColor ); Control::SetFont( aBackupFont ); } + else + aWallpaper.SetColor( pEntry->GetBackColor() ); } // draw background @@ -3388,6 +3410,25 @@ Size SvTreeListBox::GetOptimalSize() const return aRet; } +void SvTreeListBox::SetAlternatingRow( bool bEnable ) +{ + mbAlternatingRowColor = bEnable; + if( mbAlternatingRowColor ) + { + SvTreeListEntry* pEntry = pModel->First(); + for(size_t i = 0; pEntry; ++i) + { + pEntry->SetBackColor( i % 2 == 0 ? GetSettings().GetStyleSettings().GetAlternatingRowColor() : GetSettings().GetStyleSettings().GetAlternatingRowColor2()); + pEntry = pModel->Next(pEntry); + } + } + else + for(SvTreeListEntry* pEntry = pModel->First(); pEntry; pEntry = pModel->Next(pEntry)) + pEntry->SetBackColor( GetSettings().GetStyleSettings().GetFieldColor() ); + + pImp->UpdateAll(); +} + SvLBoxItem* SvTreeListBox::GetItem(SvTreeListEntry* pEntry,long nX,SvLBoxTab** ppTab) { return GetItem_Impl( pEntry, nX, ppTab, 0 ); diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx index 559a60f2b25d..c4c9220895eb 100644 --- a/svtools/source/contnr/treelistentry.cxx +++ b/svtools/source/contnr/treelistentry.cxx @@ -54,6 +54,7 @@ SvTreeListEntry::SvTreeListEntry() , bIsMarked(false) , pUserData(NULL) , nEntryFlags(0) + , maBackColor(Color(COL_WHITE)) { } @@ -64,6 +65,7 @@ SvTreeListEntry::SvTreeListEntry(const SvTreeListEntry& r) , bIsMarked(r.bIsMarked) , pUserData(r.pUserData) , nEntryFlags(r.nEntryFlags) + , maBackColor(Color(COL_WHITE)) { 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 a4fb97e2c357..0c358eb7f1c1 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -89,6 +89,8 @@ struct ImplStyleData Color maActiveColor; Color maActiveColor2; Color maActiveTextColor; + Color maAlternatingRowColor; + Color maAlternatingRowColor2; Color maButtonTextColor; Color maButtonRolloverTextColor; Color maCheckedColor; @@ -561,6 +563,8 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) : maActiveColor( rData.maActiveColor ), maActiveColor2( rData.maActiveColor2 ), maActiveTextColor( rData.maActiveTextColor ), + maAlternatingRowColor( rData.maAlternatingRowColor ), + maAlternatingRowColor2( rData.maAlternatingRowColor2 ), maButtonTextColor( rData.maButtonTextColor ), maButtonRolloverTextColor( rData.maButtonRolloverTextColor ), maCheckedColor( rData.maCheckedColor ), @@ -741,6 +745,8 @@ void ImplStyleData::SetStandardStyles() maVisitedLinkColor = Color( 0x00, 0x00, 0xCC ); maHighlightLinkColor = Color( COL_LIGHTBLUE ); maFontColor = Color( COL_BLACK ); + maAlternatingRowColor = Color( COL_WHITE ); + maAlternatingRowColor2 = Color( 0xEE, 0xEE, 0xEE ); mnBorderSize = 1; mnTitleHeight = 18; @@ -1384,6 +1390,32 @@ StyleSettings::GetInactiveTabColor() const } void +StyleSettings::SetAlternatingRowColor( const Color& rColor ) +{ + CopyData(); + mpData->maAlternatingRowColor = rColor; +} + +const Color& +StyleSettings::GetAlternatingRowColor() const +{ + return mpData->maAlternatingRowColor; +} + +void +StyleSettings::SetAlternatingRowColor2( const Color& rColor ) +{ + CopyData(); + mpData->maAlternatingRowColor2 = rColor; +} + +const Color& +StyleSettings::GetAlternatingRowColor2() const +{ + return mpData->maAlternatingRowColor2; +} + +void StyleSettings::SetUseSystemUIFonts( bool bUseSystemUIFonts ) { CopyData(); |