include/vcl/toolkit/treelistbox.hxx   |    4 --
 include/vcl/toolkit/treelistentry.hxx |    4 --
 vcl/source/treelist/iconview.cxx      |    4 --
 vcl/source/treelist/treelistbox.cxx   |   48 ----------------------------------
 vcl/source/treelist/treelistentry.cxx |    1 
 5 files changed, 61 deletions(-)

New commits:
commit 52d070f753228cf99e76cb5656f12181fc0a397c
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Feb 8 11:11:19 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Feb 8 14:55:26 2023 +0000

    remove SvTreeListEntry background color
    
    and don't overwrite the rendercontext background, which has the side
    effect that switching dark/light mode or other theme changes gives
    immediate change in visible treeviews. So tools, options, view,
    switching Light/Dark, Apply doesn't show a treeview with the old
    modes background
    
    Change-Id: I9c403beba53f1f1a28464ad8c1c70018be1cf43f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146656
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/vcl/toolkit/treelistentry.hxx 
b/include/vcl/toolkit/treelistentry.hxx
index 7a35e8e0b222..b8bffecefd30 100644
--- a/include/vcl/toolkit/treelistentry.hxx
+++ b/include/vcl/toolkit/treelistentry.hxx
@@ -68,7 +68,6 @@ class VCL_DLLPUBLIC SvTreeListEntry
     ItemsType           m_Items;
     void*               pUserData;
     SvTLEntryFlags      nEntryFlags;
-    Color               maBackColor;
     std::optional<Color> mxTextColor;
 
 private:
@@ -114,9 +113,6 @@ public:
     SvTLEntryFlags GetFlags() const { return nEntryFlags;}
     void SetFlags( SvTLEntryFlags nFlags );
 
-    void SetBackColor( const Color& rColor ) { maBackColor = rColor; }
-    const Color& GetBackColor() const { return maBackColor; }
-
     void SetTextColor( std::optional<Color> xColor ) { mxTextColor = xColor; }
     std::optional<Color> const & GetTextColor() const { return mxTextColor; }
 
diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index b134991784b2..7d6c2683596e 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -151,10 +151,6 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, 
tools::Long nX, tools::Long n
             }
             aWallpaper.SetColor(aNewWallColor);
         }
-        else // no selection
-        {
-            aWallpaper.SetColor(rEntry.GetBackColor());
-        }
 
         Color aBackgroundColor = aWallpaper.GetColor();
         if (aBackgroundColor != COL_TRANSPARENT)
diff --git a/vcl/source/treelist/treelistbox.cxx 
b/vcl/source/treelist/treelistbox.cxx
index 9897f74e1113..25fcfb2ab02e 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -428,14 +428,12 @@ IMPL_LINK( SvTreeListBox, CloneHdl_Impl, 
SvTreeListEntry*, pEntry, SvTreeListEnt
 sal_uInt32 SvTreeListBox::Insert( SvTreeListEntry* pEntry, SvTreeListEntry* 
pParent, sal_uInt32 nPos )
 {
     sal_uInt32 nInsPos = pModel->Insert( pEntry, pParent, nPos );
-    pEntry->SetBackColor( GetBackground().GetColor() );
     return nInsPos;
 }
 
 sal_uInt32 SvTreeListBox::Insert( SvTreeListEntry* pEntry,sal_uInt32 nRootPos )
 {
     sal_uInt32 nInsPos = pModel->Insert( pEntry, nRootPos );
-    pEntry->SetBackColor( GetBackground().GetColor() );
     return nInsPos;
 }
 
@@ -2659,10 +2657,6 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, 
tools::Long nLine, vcl:
                     rRenderContext.SetTextColor(aBackupTextColor);
                 rRenderContext.SetFont(aBackupFont);
             }
-            else
-            {
-                aWallpaper.SetColor(rEntry.GetBackColor());
-            }
         }
 
         // draw background
diff --git a/vcl/source/treelist/treelistentry.cxx 
b/vcl/source/treelist/treelistentry.cxx
index c369b733283b..59f9680d002e 100644
--- a/vcl/source/treelist/treelistentry.cxx
+++ b/vcl/source/treelist/treelistentry.cxx
@@ -54,7 +54,6 @@ SvTreeListEntry::SvTreeListEntry()
     , mnExtraIndent(0)
     , pUserData(nullptr)
     , nEntryFlags(SvTLEntryFlags::NONE)
-    , 
maBackColor(Application::GetSettings().GetStyleSettings().GetWindowColor())
 {
 }
 
commit 4e4717a27ceae2252befd9b3c49cc545fdb82c37
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Feb 8 11:06:23 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Feb 8 14:55:16 2023 +0000

    SetAlternatingRowColors is unused
    
    Change-Id: I0f214bccb28c9894b5c23600ca19b16dd3257cae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146655
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/vcl/toolkit/treelistbox.hxx 
b/include/vcl/toolkit/treelistbox.hxx
index 6ef40eb8d826..1d958e17ceea 100644
--- a/include/vcl/toolkit/treelistbox.hxx
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -211,8 +211,6 @@ class VCL_DLLPUBLIC SvTreeListBox
     sal_uInt16      nLastSelTab;
     tools::Long mnCheckboxItemWidth;
     bool mbContextBmpExpanded;
-    bool mbAlternatingRowColors;
-    bool mbUpdateAlternatingRows;
     bool mbQuickSearch; // Enables type-ahead search in the check list box.
     bool mbActivateOnSingleClick; // Make single click "activate" a row like a 
double-click normally does
     bool mbHoverSelection; // Make mouse over a row "select" a row like a 
single-click normally does
@@ -659,8 +657,6 @@ public:
 
     virtual Size    GetOptimalSize() const override;
 
-    void            SetAlternatingRowColors( const bool bEnable );
-
     // Enables type-ahead search in the check list box.
     void            SetQuickSearch(bool bEnable) { mbQuickSearch = bEnable; }
 
diff --git a/vcl/source/treelist/treelistbox.cxx 
b/vcl/source/treelist/treelistbox.cxx
index e2f54e56a6f7..9897f74e1113 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -389,8 +389,6 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits 
nWinStyle) :
     DragSourceHelper(this),
     mpImpl(new SvTreeListBoxImpl(*this)),
     mbContextBmpExpanded(false),
-    mbAlternatingRowColors(false),
-    mbUpdateAlternatingRows(false),
     mbQuickSearch(false),
     mbActivateOnSingleClick(false),
     mbHoverSelection(false),
@@ -431,7 +429,6 @@ sal_uInt32 SvTreeListBox::Insert( SvTreeListEntry* pEntry, 
SvTreeListEntry* pPar
 {
     sal_uInt32 nInsPos = pModel->Insert( pEntry, pParent, nPos );
     pEntry->SetBackColor( GetBackground().GetColor() );
-    SetAlternatingRowColors( mbAlternatingRowColors );
     return nInsPos;
 }
 
@@ -439,7 +436,6 @@ sal_uInt32 SvTreeListBox::Insert( SvTreeListEntry* 
pEntry,sal_uInt32 nRootPos )
 {
     sal_uInt32 nInsPos = pModel->Insert( pEntry, nRootPos );
     pEntry->SetBackColor( GetBackground().GetColor() );
-    SetAlternatingRowColors( mbAlternatingRowColors );
     return nInsPos;
 }
 
@@ -2056,7 +2052,6 @@ bool SvTreeListBox::Expand( SvTreeListEntry* pParent )
             pImpl->EntryExpanded( pParent );
             pHdlEntry = pParent;
             ExpandedHdl();
-            SetAlternatingRowColors( mbAlternatingRowColors );
         }
         nFlags = pParent->GetFlags();
         nFlags &= ~SvTLEntryFlags::NO_NODEBMP;
@@ -2093,7 +2088,6 @@ bool SvTreeListBox::Collapse( SvTreeListEntry* pParent )
         pImpl->EntryCollapsed( pParent );
         pHdlEntry = pParent;
         ExpandedHdl();
-        SetAlternatingRowColors( mbAlternatingRowColors );
     }
 
     // #i92103#
@@ -2308,8 +2302,6 @@ void SvTreeListBox::MouseMove( const MouseEvent& rMEvt )
 void SvTreeListBox::SetUpdateMode( bool bUpdate )
 {
     pImpl->SetUpdateMode( bUpdate );
-    mbUpdateAlternatingRows = bUpdate;
-    SetAlternatingRowColors( mbAlternatingRowColors );
 }
 
 void SvTreeListBox::SetSpaceBetweenEntries( short nOffsLogic )
@@ -3127,40 +3119,6 @@ Size SvTreeListBox::GetOptimalSize() const
     return aRet;
 }
 
-void SvTreeListBox::SetAlternatingRowColors( bool bEnable )
-{
-    if( !mbUpdateAlternatingRows )
-    {
-        mbAlternatingRowColors = bEnable;
-        return;
-    }
-
-    if( bEnable )
-    {
-        SvTreeListEntry* pEntry = pModel->First();
-        for(size_t i = 0; pEntry; ++i)
-        {
-            pEntry->SetBackColor( i % 2 == 0 ? GetBackground().GetColor() : 
GetSettings().GetStyleSettings().GetAlternatingRowColor());
-            SvTreeListEntry *pNextEntry = nullptr;
-            if( IsExpanded( pEntry ) )
-                pNextEntry = pModel->FirstChild( pEntry );
-            else
-                pNextEntry = pEntry->NextSibling();
-
-            if( !pNextEntry )
-                pEntry = pModel->Next( pEntry );
-            else
-                pEntry = pNextEntry;
-        }
-    }
-    else if( mbAlternatingRowColors )
-        for(SvTreeListEntry* pEntry = pModel->First(); pEntry; pEntry = 
pModel->Next(pEntry))
-            pEntry->SetBackColor( GetBackground().GetColor() );
-
-    mbAlternatingRowColors = bEnable;
-    pImpl->UpdateAll(true);
-}
-
 void SvTreeListBox::SetForceMakeVisible( bool bEnable )
 {
     pImpl->SetForceMakeVisible(bEnable);

Reply via email to