The attached patch contain sthe changes to set the initial colours for split buttons as discussed 
on this list last week.
I also placed some comments as the initials colours are set in up to 3 different places.
Winfried
From 255403dc0b7b5b2cd37703a06628d19767b9933a Mon Sep 17 00:00:00 2001
From: Winfried Donkers <osc@dci-electronics.nl>
Date: Sun, 11 Mar 2012 09:05:02 +0100
Subject: [PATCH] fdo#45671 set initial color for split buttons
---
 svx/source/tbxctrls/tbcontrl.cxx       |   12 ++++++++++++
 svx/source/tbxctrls/tbxcolorupdate.cxx |   14 ++++++++++++--
 sw/source/ui/docvw/edtwin.cxx          |    8 ++++++++
 3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 0ecf87d..b205555f 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2231,6 +2231,14 @@ void SvxColorToolBoxControl::StateChanged(
 //========================================================================
 // class SvxColorExtToolBoxControl ----------------------------------------
 //========================================================================
+/* Note:
+   The initial color shown on the button is set in /core/svx/source/tbxctrls/tbxcolorupdate.cxx
+   (ToolboxButtonColorUpdater::ToolboxButtonColorUpdater()) .
+   The initial color used by the button is set in /core/svx/source/tbxcntrls/tbcontrl.cxx
+   (SvxColorExtToolBoxControl::SvxColorExtToolBoxControl())
+   and in case of writer for text(background)color also in /core/sw/source/ui/docvw/edtwin.cxx
+   (SwEditWin::aTextBackColor and SwEditWin::aTextBackColor)
+ */
 
 SvxColorExtToolBoxControl::SvxColorExtToolBoxControl(
     sal_uInt16 nSlotId,
@@ -2252,11 +2260,13 @@ SvxColorExtToolBoxControl::SvxColorExtToolBoxControl(
         case SID_ATTR_CHAR_COLOR:
             addStatusListener( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Color" )));
             nMode = TBX_UPDATER_MODE_CHAR_COLOR_NEW;
+            mLastColor = COL_RED;
             break;
 
         case SID_ATTR_CHAR_COLOR2:
             addStatusListener( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharColorExt" )));
             nMode = TBX_UPDATER_MODE_CHAR_COLOR_NEW;
+            mLastColor = COL_RED;
             break;
 
         case SID_BACKGROUND_COLOR:
@@ -2264,11 +2274,13 @@ SvxColorExtToolBoxControl::SvxColorExtToolBoxControl(
         default:
             addStatusListener( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CharBackgroundExt" )));
             nMode = TBX_UPDATER_MODE_CHAR_COLOR_NEW;
+            mLastColor = COL_YELLOW;
             break;
 
         case SID_FRAME_LINECOLOR:
             addStatusListener( OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FrameLineColor" )));
             nMode = 0;
+            mLastColor = COL_RED;
             break;
     }
 
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index 1b567d4..7d79f7f 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -44,6 +44,14 @@ namespace svx
     //====================================================================
     //= ToolboxButtonColorUpdater
     //====================================================================
+    /* Note:
+       The initial color shown on the button is set in /core/svx/source/tbxctrls/tbxcolorupdate.cxx
+       (ToolboxButtonColorUpdater::ToolboxButtonColorUpdater()) .
+       The initial color used by the button is set in /core/svx/source/tbxcntrls/tbcontrl.cxx
+       (SvxColorExtToolBoxControl::SvxColorExtToolBoxControl())
+       and in case of writer for text(background)color also in /core/sw/source/ui/docvw/edtwin.cxx
+       (SwEditWin::aTextBackColor and SwEditWin::aTextBackColor)
+     */
 
     ToolboxButtonColorUpdater::ToolboxButtonColorUpdater(
         sal_uInt16 nId,
@@ -64,13 +72,15 @@ namespace svx
         {
             case SID_ATTR_CHAR_COLOR  :
             case SID_ATTR_CHAR_COLOR2 :
-                Update( COL_BLACK );
+            case SID_FRAME_LINECOLOR  :
+                Update( COL_RED );
                 break;
             case SID_ATTR_CHAR_COLOR_BACKGROUND :
+            case SID_BACKGROUND_COLOR :
                 Update( COL_YELLOW );
                 break;
             default :
-                Update( COL_GRAY );
+                Update( COL_TRANSPARENT );
         }
     }
 
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 2613779..1dcf02a 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -176,6 +176,14 @@ QuickHelpData* SwEditWin::pQuickHlpData = 0;
 
 long    SwEditWin::nDDStartPosY = 0;
 long    SwEditWin::nDDStartPosX = 0;
+/* Note:
+   The initial color shown on the button is set in /core/svx/source/tbxctrls/tbxcolorupdate.cxx
+   (ToolboxButtonColorUpdater::ToolboxButtonColorUpdater()) .
+   The initial color used by the button is set in /core/svx/source/tbxcntrls/tbcontrl.cxx
+   (SvxColorExtToolBoxControl::SvxColorExtToolBoxControl())
+   and in case of writer for text(background)color also in /core/sw/source/ui/docvw/edtwin.cxx
+   (SwEditWin::aTextBackColor and SwEditWin::aTextBackColor)
+ */
 Color   SwEditWin::aTextBackColor(COL_YELLOW);
 Color   SwEditWin::aTextColor(COL_RED);
 sal_Bool SwEditWin::bTransparentBackColor = sal_False; // background not transparent
-- 
1.7.7
Context
- [PATCH]fdo45671 set initial colours for split buttons · Winfried Donkers
 
   
 
  Privacy Policy |
  
Impressum (Legal Info) |
  
Copyright information: Unless otherwise specified, all text and images
  on this website are licensed under the
  
Creative Commons Attribution-Share Alike 3.0 License.
  This does not include the source code of LibreOffice, which is
  licensed under the Mozilla Public License (
MPLv2).
  "LibreOffice" and "The Document Foundation" are
  registered trademarks of their corresponding registered owners or are
  in actual use as trademarks in one or more countries. Their respective
  logos and icons are also subject to international copyright laws. Use
  thereof is explained in our 
trademark policy.