[Libreoffice-commits] core.git: cui/source include/svtools include/vcl svtools/source vcl/source

Samuel Mehrbrodt s.mehrbrodt at gmail.com
Wed Oct 1 15:59:52 PDT 2014


 cui/source/options/optaboutconfig.cxx   |    2 -
 include/svtools/treelistbox.hxx         |    6 ++---
 include/vcl/settings.hxx                |    6 ++---
 svtools/source/contnr/treelistbox.cxx   |   35 ++++++++++++++++----------------
 svtools/source/contnr/treelistentry.cxx |    7 ++++--
 vcl/source/app/settings.cxx             |   24 ++++++++++-----------
 6 files changed, 42 insertions(+), 38 deletions(-)

New commits:
commit 0c2b43b70776ea49655a7f18c6c11dc64a5f25b2
Author: Samuel Mehrbrodt <s.mehrbrodt at gmail.com>
Date:   Thu Oct 2 00:58:08 2014 +0200

    Improved striped rows implementation
    
    Some renaming, use variable for row background when not striped
    
    Change-Id: I5b36fc751aa163dbb127406d7aefad01974fa371

diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 7b3c0d6..d66a369 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -157,7 +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 );
+    m_pPrefBox->SetAlternatingRowColors( 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 f54f324..fb69656 100644
--- a/include/svtools/treelistbox.hxx
+++ b/include/svtools/treelistbox.hxx
@@ -236,7 +236,7 @@ class SVT_DLLPUBLIC SvTreeListBox
     sal_uInt16      nLastSelTab;
     long mnCheckboxItemWidth;
     bool mbContextBmpExpanded;
-    bool mbAlternatingRowColor;
+    bool mbAlternatingRowColors;
 
     SvTreeListEntry*    pHdlEntry;
     SvLBoxItem*     pHdlItem;
@@ -780,8 +780,8 @@ public:
 
     virtual Size GetOptimalSize() const SAL_OVERRIDE;
 
-    void SetAlternatingRow( const bool bEnable );
-    bool IsRowAlternating() const { return mbAlternatingRowColor; }
+    void SetAlternatingRowColors( const bool bEnable );
+    bool IsAlternatingRowColors() const { return mbAlternatingRowColors; }
 };
 
 #define SV_LBOX_DD_FORMAT "SV_LBOX_DD_FORMAT"
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index bb454a3..9650828 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -358,12 +358,12 @@ 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;
 
-    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 c7d610c..b991693 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -380,7 +380,7 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, WinBits nWinStyle) :
     DragSourceHelper(this),
     mpImpl(new SvTreeListBoxImpl(*this)),
     mbContextBmpExpanded(false),
-    mbAlternatingRowColor(false),
+    mbAlternatingRowColors(false),
     eSelMode(NO_SELECTION),
     nMinWidthInChars(0)
 {
@@ -410,7 +410,7 @@ SvTreeListBox::SvTreeListBox(vcl::Window* pParent, const ResId& rResId) :
     DragSourceHelper(this),
     mpImpl(new SvTreeListBoxImpl(*this)),
     mbContextBmpExpanded(false),
-    mbAlternatingRowColor(false),
+    mbAlternatingRowColors(false),
     eSelMode(NO_SELECTION),
     nMinWidthInChars(0)
 {
@@ -470,14 +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 );
-    if(mbAlternatingRowColor)
+    if(mbAlternatingRowColors)
     {
         if(nPos == TREELIST_APPEND)
-            pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetAlternatingRowColor() ?
-                                    GetSettings().GetStyleSettings().GetAlternatingRowColor2() :
-                                    GetSettings().GetStyleSettings().GetAlternatingRowColor() );
+            pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetRowColor() ?
+                                    GetSettings().GetStyleSettings().GetAlternatingRowColor() :
+                                    GetSettings().GetStyleSettings().GetRowColor() );
         else
-            SetAlternatingRow( true );
+            SetAlternatingRowColors( true );
     }
     return nInsPos;
 }
@@ -485,14 +485,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 );
-    if(mbAlternatingRowColor)
+    if(mbAlternatingRowColors)
     {
         if(nRootPos == TREELIST_APPEND)
-            pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetAlternatingRowColor() ?
-                                    GetSettings().GetStyleSettings().GetAlternatingRowColor2() :
-                                    GetSettings().GetStyleSettings().GetAlternatingRowColor() );
+            pEntry->SetBackColor( Prev(pEntry) && Prev(pEntry)->GetBackColor() == GetSettings().GetStyleSettings().GetRowColor() ?
+                                    GetSettings().GetStyleSettings().GetAlternatingRowColor() :
+                                    GetSettings().GetStyleSettings().GetRowColor() );
         else
-            SetAlternatingRow( true );
+            SetAlternatingRowColors( true );
     }
     return nInsPos;
 }
@@ -3410,21 +3410,22 @@ Size SvTreeListBox::GetOptimalSize() const
     return aRet;
 }
 
-void SvTreeListBox::SetAlternatingRow( bool bEnable )
+void SvTreeListBox::SetAlternatingRowColors( bool bEnable )
 {
-    mbAlternatingRowColor = bEnable;
-    if( mbAlternatingRowColor )
+    mbAlternatingRowColors = bEnable;
+    if( mbAlternatingRowColors )
     {
         SvTreeListEntry* pEntry = pModel->First();
         for(size_t i = 0; pEntry; ++i)
         {
-            pEntry->SetBackColor( i % 2 == 0 ? GetSettings().GetStyleSettings().GetAlternatingRowColor() : GetSettings().GetStyleSettings().GetAlternatingRowColor2());
+            pEntry->SetBackColor( i % 2 == 0 ? GetSettings().GetStyleSettings().GetRowColor() :
+                                               GetSettings().GetStyleSettings().GetAlternatingRowColor());
             pEntry = pModel->Next(pEntry);
         }
     }
     else
         for(SvTreeListEntry* pEntry = pModel->First(); pEntry; pEntry = pModel->Next(pEntry))
-            pEntry->SetBackColor( GetSettings().GetStyleSettings().GetFieldColor() );
+            pEntry->SetBackColor( GetSettings().GetStyleSettings().GetRowColor() );
 
     pImp->UpdateAll();
 }
diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx
index c4c9220..e294b99 100644
--- a/svtools/source/contnr/treelistentry.cxx
+++ b/svtools/source/contnr/treelistentry.cxx
@@ -20,6 +20,9 @@
 #include <svtools/treelistentry.hxx>
 #include <svtools/treelist.hxx>
 
+#include <vcl/svapp.hxx>
+#include <vcl/settings.hxx>
+
 #include <limits>
 
 void SvTreeListEntry::ClearChildren()
@@ -54,7 +57,7 @@ SvTreeListEntry::SvTreeListEntry()
     , bIsMarked(false)
     , pUserData(NULL)
     , nEntryFlags(0)
-    , maBackColor(Color(COL_WHITE))
+    , maBackColor(Application::GetSettings().GetStyleSettings().GetRowColor())
 {
 }
 
@@ -65,7 +68,7 @@ SvTreeListEntry::SvTreeListEntry(const SvTreeListEntry& r)
     , bIsMarked(r.bIsMarked)
     , pUserData(r.pUserData)
     , nEntryFlags(r.nEntryFlags)
-    , maBackColor(Color(COL_WHITE))
+    , 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 0c358eb..a30fd34 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -89,8 +89,8 @@ struct ImplStyleData
     Color                           maActiveColor;
     Color                           maActiveColor2;
     Color                           maActiveTextColor;
+    Color                           maRowColor;
     Color                           maAlternatingRowColor;
-    Color                           maAlternatingRowColor2;
     Color                           maButtonTextColor;
     Color                           maButtonRolloverTextColor;
     Color                           maCheckedColor;
@@ -563,8 +563,8 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
     maActiveColor( rData.maActiveColor ),
     maActiveColor2( rData.maActiveColor2 ),
     maActiveTextColor( rData.maActiveTextColor ),
+    maRowColor( rData.maRowColor ),
     maAlternatingRowColor( rData.maAlternatingRowColor ),
-    maAlternatingRowColor2( rData.maAlternatingRowColor2 ),
     maButtonTextColor( rData.maButtonTextColor ),
     maButtonRolloverTextColor( rData.maButtonRolloverTextColor ),
     maCheckedColor( rData.maCheckedColor ),
@@ -745,8 +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 );
+    maRowColor                  = Color( COL_WHITE );
+    maAlternatingRowColor       = Color( 0xEE, 0xEE, 0xEE );
 
     mnBorderSize                = 1;
     mnTitleHeight               = 18;
@@ -1390,29 +1390,29 @@ StyleSettings::GetInactiveTabColor() const
 }
 
 void
-StyleSettings::SetAlternatingRowColor( const Color& rColor )
+StyleSettings::SetRowColor( const Color& rColor )
 {
     CopyData();
-    mpData->maAlternatingRowColor = rColor;
+    mpData->maRowColor = rColor;
 }
 
 const Color&
-StyleSettings::GetAlternatingRowColor() const
+StyleSettings::GetRowColor() const
 {
-    return mpData->maAlternatingRowColor;
+    return mpData->maRowColor;
 }
 
 void
-StyleSettings::SetAlternatingRowColor2( const Color& rColor )
+StyleSettings::SetAlternatingRowColor( const Color& rColor )
 {
     CopyData();
-    mpData->maAlternatingRowColor2 = rColor;
+    mpData->maAlternatingRowColor = rColor;
 }
 
 const Color&
-StyleSettings::GetAlternatingRowColor2() const
+StyleSettings::GetAlternatingRowColor() const
 {
-    return mpData->maAlternatingRowColor2;
+    return mpData->maAlternatingRowColor;
 }
 
 void


More information about the Libreoffice-commits mailing list