Resolves: tdf#117178 distinguish between pressed vs unpressed rollover

Change-Id: If7964c6584d83609ad08dca7e669b85dfadf036e
Reviewed-on: https://gerrit.libreoffice.org/53563
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index b8cc012..491831e 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -276,6 +276,9 @@ public:
    void                            SetButtonRolloverTextColor( const Color& rColor );
    const Color&                    GetButtonRolloverTextColor() const;

    void                            SetButtonPressedRolloverTextColor( const Color& rColor );
    const Color&                    GetButtonPressedRolloverTextColor() const;

    void                            SetRadioCheckTextColor( const Color& rColor );
    const Color&                    GetRadioCheckTextColor() const;

diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index f9eaf47..3c5d150 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -94,6 +94,7 @@ struct ImplStyleData
    Color                           maAlternatingRowColor;
    Color                           maButtonTextColor;
    Color                           maButtonRolloverTextColor;
    Color                           maButtonPressedRolloverTextColor;
    Color                           maCheckedColor;
    Color                           maDarkShadowColor;
    Color                           maDeactiveBorderColor;
@@ -562,6 +563,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
    maAlternatingRowColor( rData.maAlternatingRowColor ),
    maButtonTextColor( rData.maButtonTextColor ),
    maButtonRolloverTextColor( rData.maButtonRolloverTextColor ),
    maButtonPressedRolloverTextColor( rData.maButtonPressedRolloverTextColor ),
    maCheckedColor( rData.maCheckedColor ),
    maDarkShadowColor( rData.maDarkShadowColor ),
    maDeactiveBorderColor( rData.maDeactiveBorderColor ),
@@ -703,6 +705,7 @@ void ImplStyleData::SetStandardStyles()
    maDarkShadowColor           = COL_BLACK;
    maButtonTextColor           = COL_BLACK;
    maButtonRolloverTextColor   = COL_BLACK;
    maButtonPressedRolloverTextColor = COL_BLACK;
    maRadioCheckTextColor       = COL_BLACK;
    maGroupTextColor            = COL_BLACK;
    maLabelTextColor            = COL_BLACK;
@@ -876,6 +879,19 @@ StyleSettings::GetButtonRolloverTextColor() const
}

void
StyleSettings::SetButtonPressedRolloverTextColor( const Color& rColor )
{
    CopyData();
    mxData->maButtonPressedRolloverTextColor = rColor;
}

const Color&
StyleSettings::GetButtonPressedRolloverTextColor() const
{
    return mxData->maButtonPressedRolloverTextColor;
}

void
StyleSettings::SetRadioCheckTextColor( const Color& rColor )
{
    CopyData();
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 4bdc10f..ebd5aae 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -836,11 +836,21 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice* pDev, DrawFlags nDrawFl
    if ( nDrawFlags & DrawFlags::Mono )
        aColor = COL_BLACK;
    else if( (nButtonFlags & DrawButtonFlags::Highlight) && IsNativeControlSupported(ControlType::Pushbutton, ControlPart::Entire) )
        aColor = rStyleSettings.GetButtonRolloverTextColor();
    {
        if (nButtonFlags & DrawButtonFlags::Pressed)
            aColor = rStyleSettings.GetButtonPressedRolloverTextColor();
        else
            aColor = rStyleSettings.GetButtonRolloverTextColor();
    }
    else if ( IsControlForeground() )
        aColor = GetControlForeground();
    else if( nButtonFlags & DrawButtonFlags::Highlight )
        aColor = rStyleSettings.GetButtonRolloverTextColor();
    {
        if (nButtonFlags & DrawButtonFlags::Pressed)
            aColor = rStyleSettings.GetButtonPressedRolloverTextColor();
        else
            aColor = rStyleSettings.GetButtonRolloverTextColor();
    }
    else
        aColor = rStyleSettings.GetButtonTextColor();

diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index 11e67cb..2bd434c 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -3815,6 +3815,7 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
    // mouse over text colors
    aTextColor = getColor( pStyle->fg[ GTK_STATE_PRELIGHT ] );
    aStyleSet.SetButtonRolloverTextColor( aTextColor );
    aStyleSet.SetButtonPressedRolloverTextColor( aTextColor );
    aStyleSet.SetFieldRolloverTextColor( aTextColor );

    // background colors
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 04f5ac1..9ed8d7c 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2889,9 +2889,22 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
    style_context_set_state(pStyle, GTK_STATE_FLAG_PRELIGHT);
    gtk_style_context_get_color(pStyle, gtk_style_context_get_state(pStyle), &text_color);
    aTextColor = getColor( text_color );
    aStyleSet.SetButtonRolloverTextColor( aTextColor );
    aStyleSet.SetFieldRolloverTextColor( aTextColor );

    // button mouse over colors
    {
        GdkRGBA normal_button_rollover_text_color, pressed_button_rollover_text_color;
        style_context_set_state(mpButtonStyle, GTK_STATE_FLAG_PRELIGHT);
        gtk_style_context_get_color(mpButtonStyle, gtk_style_context_get_state(mpButtonStyle), &normal_button_rollover_text_color);
        aTextColor = getColor(normal_button_rollover_text_color);
        aStyleSet.SetButtonRolloverTextColor( aTextColor );
        style_context_set_state(mpButtonStyle, static_cast<GtkStateFlags>(GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_ACTIVE));
        gtk_style_context_get_color(mpButtonStyle, gtk_style_context_get_state(mpButtonStyle), &pressed_button_rollover_text_color);
        aTextColor = getColor(pressed_button_rollover_text_color);
        style_context_set_state(mpButtonStyle, GTK_STATE_FLAG_NORMAL);
        aStyleSet.SetButtonPressedRolloverTextColor( aTextColor );
    }

    // tooltip colors
    {
        GtkStyleContext *pCStyle = gtk_style_context_new();
diff --git a/vcl/unx/kde4/KDESalFrame.cxx b/vcl/unx/kde4/KDESalFrame.cxx
index 769e456..7dde568 100644
--- a/vcl/unx/kde4/KDESalFrame.cxx
+++ b/vcl/unx/kde4/KDESalFrame.cxx
@@ -258,6 +258,7 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
    // Buttons
    style.SetButtonTextColor( aButn );
    style.SetButtonRolloverTextColor( aButn );
    style.SetButtonPressedRolloverTextColor( aButn );

    // Tabs
    style.SetTabTextColor( aButn );
diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx
index 61b4113..ab1fc1f 100644
--- a/vcl/unx/kde5/KDE5SalFrame.cxx
+++ b/vcl/unx/kde5/KDE5SalFrame.cxx
@@ -231,6 +231,7 @@ void KDE5SalFrame::UpdateSettings( AllSettings& rSettings )
    // Buttons
    style.SetButtonTextColor( aButn );
    style.SetButtonRolloverTextColor( aButn );
    style.SetButtonPressedRolloverTextColor( aButn );

    // Tabs
    style.SetTabTextColor( aButn );
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 7186fc2..7dfe3c0 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -2607,6 +2607,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
    aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() );
    aStyleSettings.SetButtonTextColor( ImplWinColorToSal( GetSysColor( COLOR_BTNTEXT ) ) );
    aStyleSettings.SetButtonRolloverTextColor( aStyleSettings.GetButtonTextColor() );
    aStyleSettings.SetButtonPressedRolloverTextColor( aStyleSettings.GetButtonTextColor() );
    aStyleSettings.SetTabTextColor( aStyleSettings.GetButtonTextColor() );
    aStyleSettings.SetTabRolloverTextColor( aStyleSettings.GetButtonTextColor() );
    aStyleSettings.SetTabHighlightTextColor( aStyleSettings.GetButtonTextColor() );