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

Isamu Mogi saturday6c at gmail.com
Fri Mar 28 04:37:04 PDT 2014


 include/vcl/settings.hxx    |    3 +++
 vcl/source/app/settings.cxx |   20 +++++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

New commits:
commit 46142545dea30fe14e829795ad1acca2cc1a6a7a
Author: Isamu Mogi <saturday6c at gmail.com>
Date:   Sat Mar 22 11:48:49 2014 +0900

    fdo#68546 Add menubar's text color of persona to StyleSettings
    
    Change-Id: I376e0b71b71fdbc2eaf2b10adb7792a841cf9098
    Reviewed-on: https://gerrit.libreoffice.org/8711
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index ad47eef..403ca40 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -30,6 +30,7 @@
 #include <i18nlangtag/languagetag.hxx>
 #include <unotools/syslocale.hxx>
 
+#include <boost/optional.hpp>
 #include <boost/shared_ptr.hpp>
 
 class CollatorWrapper;
@@ -521,6 +522,8 @@ public:
 
     const BitmapEx                  GetPersonaHeader() const;
 
+    const boost::optional<Color>&   GetPersonaMenuBarTextColor() const;
+
     // global switch to allow EdgeBlenging; currently possible for ValueSet and ListBox
     // when activated there using Get/SetEdgeBlending; default is true
     void                            SetEdgeBlending(sal_uInt16 nCount);
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index a03645f..b175108 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -204,6 +204,7 @@ struct ImplStyleData
 
     BitmapEx                        maPersonaHeaderBitmap; ///< Cache the header bitmap.
     BitmapEx                        maPersonaFooterBitmap; ///< Cache the footer bitmap.
+    boost::optional<Color>          maPersonaMenuBarTextColor; ///< Cache the menubar color.
 };
 
 
@@ -527,7 +528,8 @@ ImplStyleData::ImplStyleData() :
     mIconThemeSelector(new vcl::IconThemeSelector()),
     maPersonaHeaderFooter(),
     maPersonaHeaderBitmap(),
-    maPersonaFooterBitmap()
+    maPersonaFooterBitmap(),
+    maPersonaMenuBarTextColor()
 {
     mnScrollBarSize             = 16;
     mnMinThumbSize              = 16;
@@ -628,7 +630,8 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
     maFrameStyle( rData.maFrameStyle ),
     maPersonaHeaderFooter( rData.maPersonaHeaderFooter ),
     maPersonaHeaderBitmap( rData.maPersonaHeaderBitmap ),
-    maPersonaFooterBitmap( rData.maPersonaFooterBitmap )
+    maPersonaFooterBitmap( rData.maPersonaFooterBitmap ),
+    maPersonaMenuBarTextColor( rData.maPersonaMenuBarTextColor )
 {
     mnBorderSize                = rData.mnBorderSize;
     mnTitleHeight               = rData.mnTitleHeight;
@@ -2115,7 +2118,7 @@ static BitmapEx readBitmapEx( const OUString& rPath )
 enum WhichPersona { PERSONA_HEADER, PERSONA_FOOTER };
 
 /** Update the setting of the Persona header / footer in ImplStyleData */
-static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFooter, BitmapEx& rHeaderFooterBitmap, Color& maMenuBarTextColor )
+static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFooter, BitmapEx& rHeaderFooterBitmap, boost::optional<Color>& rMenuBarTextColor )
 {
     uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
     if ( !xContext.is() )
@@ -2132,6 +2135,7 @@ static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFoot
 
     rHeaderFooter = aOldValue;
     rHeaderFooterBitmap = BitmapEx();
+    rMenuBarTextColor = boost::none;
 
     // now read the new values and setup bitmaps
     OUString aHeader, aFooter;
@@ -2146,7 +2150,7 @@ static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFoot
         if ( nIndex > 0 )
         {
             OUString aColor = aPersonaSettings.getToken( 0, ';', ++nIndex );
-            maMenuBarTextColor = Color( aColor.toUInt64( 16 ) );
+            rMenuBarTextColor = Color( aColor.toUInt64( 16 ) );
         }
     }
     else if ( aPersona == "default" )
@@ -2185,10 +2189,16 @@ static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFoot
 
 const BitmapEx StyleSettings::GetPersonaHeader() const
 {
-    setupPersonaHeaderFooter( PERSONA_HEADER, mpData->maPersonaHeaderFooter, mpData->maPersonaHeaderBitmap, mpData->maMenuBarTextColor );
+    setupPersonaHeaderFooter( PERSONA_HEADER, mpData->maPersonaHeaderFooter, mpData->maPersonaHeaderBitmap, mpData->maPersonaMenuBarTextColor );
     return mpData->maPersonaHeaderBitmap;
 }
 
+const boost::optional<Color>& StyleSettings::GetPersonaMenuBarTextColor() const
+{
+    GetPersonaHeader();
+    return mpData->maPersonaMenuBarTextColor;
+}
+
 void StyleSettings::SetStandardStyles()
 {
     CopyData();


More information about the Libreoffice-commits mailing list