[Libreoffice-commits] .: 2 commits - framework/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Sep 22 03:48:35 PDT 2012


 framework/source/services/backingwindow.cxx |   52 +++++++++++++++++++++-------
 framework/source/services/backingwindow.hxx |    2 -
 2 files changed, 41 insertions(+), 13 deletions(-)

New commits:
commit 1b034ebe04ba36d8738b3445ce5615f1492868eb
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Thu Sep 20 21:28:25 2012 +0400

    fdo#41440, fdo#50296: start center: force black text color
    
    Change-Id: I13834d3c0385e1a75d2d66d1622a966c66b9aab2

diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx
index 008f463..34c2585 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -405,14 +405,22 @@ void BackingWindow::prepareRecentFileMenu()
     maOpenButton.SetPopupMenu( mpRecentMenu );
 }
 
+namespace
+{
+static void lcl_SetBlackButtonTextColor( PushButton& rButton )
+{
+    AllSettings aSettings = rButton.GetSettings();
+    StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+    aStyleSettings.SetButtonTextColor( Color(COL_BLACK) );
+    aSettings.SetStyleSettings( aStyleSettings );
+    rButton.SetSettings( aSettings );
+}
+}
+
 void BackingWindow::initBackground()
 {
     SetBackground();
 
-    bool bDark = GetSettings().GetStyleSettings().GetHighContrastMode();
-
-    Color aTextBGColor( bDark ? COL_BLACK : COL_WHITE );
-
     // select image set
     ImageContainerRes aRes( FwkResId( RES_BACKING_IMAGES ) );
 
@@ -456,6 +464,16 @@ void BackingWindow::initBackground()
     maOpenButton.SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
     maOpenButton.SetSelectHdl( LINK( this, BackingWindow, SelectHdl ) );
     maOpenButton.SetActivateHdl( LINK( this, BackingWindow, ActivateHdl ) );
+
+    // fdo#41440: force black text color, since the background image is white.
+    lcl_SetBlackButtonTextColor( maWriterButton );
+    lcl_SetBlackButtonTextColor( maCalcButton );
+    lcl_SetBlackButtonTextColor( maImpressButton );
+    lcl_SetBlackButtonTextColor( maOpenButton );
+    lcl_SetBlackButtonTextColor( maDrawButton );
+    lcl_SetBlackButtonTextColor( maDBButton );
+    lcl_SetBlackButtonTextColor( maMathButton );
+    lcl_SetBlackButtonTextColor( maTemplateButton );
 }
 
 void BackingWindow::initControls()
commit b40f95f9159c3868a059b33fb524ccc7ed182272
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Thu Sep 20 21:18:11 2012 +0400

    fdo#34392: request button size after vcl has updated its settings
    
    Change-Id: I1810562a2c0c09404271be5b910f5811fce3e465

diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx
index cc67aab..008f463 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -193,6 +193,10 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
     // clean up resource stack
     FreeResource();
 
+    // fdo#34392: we do the layout dynamically, the layout depends on the font,
+    // so we should handle data changed events (font changing) of the last child
+    // control, at this point all the controls have updated settings (i.e. font).
+    maToolbox.AddEventListener( LINK( this, BackingWindow, WindowEventListener ) );
     EnableChildTransparentMode();
 
     SetStyle( GetStyle() | WB_DIALOGCONTROL );
@@ -249,6 +253,7 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
 
 BackingWindow::~BackingWindow()
 {
+    maToolbox.RemoveEventListener( LINK( this, BackingWindow, WindowEventListener ) );
     delete mpRecentMenu;
     delete mpAccExec;
 }
@@ -267,17 +272,22 @@ class ImageContainerRes : public Resource
     ~ImageContainerRes() { FreeResource(); }
 };
 
-void BackingWindow::DataChanged( const DataChangedEvent& rDCEvt )
+IMPL_LINK( BackingWindow, WindowEventListener, VclSimpleEvent*, pEvent )
 {
-    Window::DataChanged( rDCEvt );
-
-    if ( rDCEvt.GetFlags() & SETTINGS_STYLE )
+    VclWindowEvent* pWinEvent = dynamic_cast<VclWindowEvent*>( pEvent );
+    if ( pWinEvent && pWinEvent->GetId() == VCLEVENT_WINDOW_DATACHANGED )
     {
-        initBackground();
-        Invalidate();
-        // fdo#34392: Resize buttons to match the new text size.
-        Resize();
+        DataChangedEvent* pDCEvt =
+            static_cast<DataChangedEvent*>( pWinEvent->GetData() );
+        if ( pDCEvt->GetFlags() & SETTINGS_STYLE )
+        {
+            initBackground();
+            Invalidate();
+            // fdo#34392: Resize buttons to match the new text size.
+            Resize();
+        }
     }
+    return 0;
 }
 
 void BackingWindow::prepareRecentFileMenu()
diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx
index 071b8e0..75a45bb 100644
--- a/framework/source/services/backingwindow.hxx
+++ b/framework/source/services/backingwindow.hxx
@@ -154,6 +154,7 @@ namespace framework
         DECL_LINK( SelectHdl, Button* );
         DECL_LINK( ActivateHdl, Button* );
         DECL_LINK( ToolboxHdl, void* );
+        DECL_LINK( WindowEventListener, VclSimpleEvent* );
 
         void initControls();
         void initBackground();
@@ -165,7 +166,6 @@ namespace framework
         virtual void        Paint( const Rectangle& rRect );
         virtual void        Resize();
         virtual long        Notify( NotifyEvent& rNEvt );
-        virtual void        DataChanged( const DataChangedEvent& rDCEvt );
         virtual void        GetFocus();
 
         void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame );


More information about the Libreoffice-commits mailing list