[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - 2 commits - sd/source vcl/inc vcl/source vcl/unx

Oliver Specht oliver.specht at cib.de
Fri Feb 12 20:40:10 UTC 2016


 sd/source/ui/app/sdmod2.cxx               |    3 +-
 vcl/inc/unx/gtk/gtkgdi.hxx                |    2 +
 vcl/source/control/fixedhyper.cxx         |    5 ++-
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |   39 +++++++++++++-----------------
 4 files changed, 24 insertions(+), 25 deletions(-)

New commits:
commit 8d3fe0bce57633c9540c58ee05314e15ff51e2b8
Author: Oliver Specht <oliver.specht at cib.de>
Date:   Mon Feb 1 16:06:33 2016 +0100

    tdf#97374: prevent crash while updating SvxPageTitleField
    
    with commit 2970ec843820a72d73a91cc11fc353e5b9fde5fd the check for
    a valid pDoc had been removed
    
    Change-Id: I644ee82a46ec4f047f1a1b6bff68c4b67e96c3d8
    Reviewed-on: https://gerrit.libreoffice.org/22006
    Reviewed-by: Oliver Specht <oliver.specht at cib.de>
    Tested-by: Oliver Specht <oliver.specht at cib.de>
    (cherry picked from commit 90dfa7cbcaf32aab6005b94b393c7c409ff1af8f)
    Reviewed-on: https://gerrit.libreoffice.org/22154
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index f8f2d57..1f51811 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -271,7 +271,8 @@ IMPL_LINK_TYPED(SdModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void)
         }
         else
         {
-            aRepresentation = ( ( pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
+            DocumentType eDocType = pDoc ? pDoc->GetDocumentType() : DOCUMENT_TYPE_IMPRESS;
+            aRepresentation = ( ( eDocType == DOCUMENT_TYPE_IMPRESS )
                                 ? SdResId(STR_FIELD_PLACEHOLDER_SLIDENAME).toString()
                                 : SdResId(STR_FIELD_PLACEHOLDER_PAGENAME).toString() );
         }
commit 8856f425216f581b098ba84c125443c0856b7122
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 12 11:32:53 2016 +0000

    Related: rhbz#1287593 subissue 6, get suitable hyperlink colors for dark theme
    
    (cherry picked from commit 06e8c58acb6ba667f8fd8c5587a3b3037324971a)
    
    Change-Id: Ieb5ed52fa8a9c26b3e839388a58cff295166eed9
    Reviewed-on: https://gerrit.libreoffice.org/22313
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 13ac198..2bb6029 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -36,6 +36,7 @@
 enum class GtkControlPart
 {
     Button,
+    LinkButton,
     CheckButton,
     CheckButtonCheck,
     RadioButton,
@@ -100,6 +101,7 @@ public:
 private:
     GtkWidget       *mpWindow;
     static GtkStyleContext *mpButtonStyle;
+    static GtkStyleContext *mpLinkButtonStyle;
     static GtkStyleContext *mpEntryStyle;
     static GtkStyleContext *mpTextViewStyle;
     static GtkStyleContext *mpVScrollbarStyle;
diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx
index a4ec5e7..3414868 100644
--- a/vcl/source/control/fixedhyper.cxx
+++ b/vcl/source/control/fixedhyper.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <vcl/fixedhyper.hxx>
+#include <vcl/svapp.hxx>
 
 FixedHyperlink::FixedHyperlink(vcl::Window* pParent, WinBits nWinStyle)
     : FixedText(pParent, nWinStyle)
@@ -35,8 +36,8 @@ void FixedHyperlink::Initialize()
     // to underline
     aFont.SetUnderline( UNDERLINE_SINGLE );
     SetControlFont( aFont );
-    // changes the color to light blue
-    SetControlForeground( Color( COL_LIGHTBLUE ) );
+    // changes the color to link color
+    SetControlForeground( Application::GetSettings().GetStyleSettings().GetLinkColor() );
     // calculates text len
     m_nTextLen = GetCtrlTextWidth( GetText() );
 }
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index d7d9a1d..d73a036 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -22,6 +22,7 @@
 #include <boost/optional.hpp>
 
 GtkStyleContext* GtkSalGraphics::mpButtonStyle = nullptr;
+GtkStyleContext* GtkSalGraphics::mpLinkButtonStyle = nullptr;
 GtkStyleContext* GtkSalGraphics::mpEntryStyle = nullptr;
 GtkStyleContext* GtkSalGraphics::mpTextViewStyle = nullptr;
 GtkStyleContext* GtkSalGraphics::mpVScrollbarStyle = nullptr;
@@ -824,6 +825,15 @@ static GtkStyleContext* createStyleContext(GtkControlPart ePart, GtkStyleContext
             gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_BUTTON);
 #endif
             break;
+        case GtkControlPart::LinkButton:
+            gtk_widget_path_append_type(path, GTK_TYPE_BUTTON);
+#if GTK_CHECK_VERSION(3, 19, 2)
+            gtk_widget_path_iter_set_object_name(path, -1, "button");
+#else
+            gtk_widget_path_iter_add_class(path, -1, GTK_STYLE_CLASS_BUTTON);
+#endif
+            gtk_widget_path_iter_add_class(path, -1, "link");
+            break;
         case GtkControlPart::CheckButton:
             gtk_widget_path_append_type(path, GTK_TYPE_CHECK_BUTTON);
 #if GTK_CHECK_VERSION(3, 19, 2)
@@ -1743,11 +1753,6 @@ static inline ::Color getColor( const GdkRGBA& rCol )
     return ::Color( (int)(rCol.red * 0xFFFF) >> 8, (int)(rCol.green * 0xFFFF) >> 8, (int)(rCol.blue * 0xFFFF) >> 8 );
 }
 
-static inline ::Color getColorFromColor( const GdkColor& rCol )
-{
-    return ::Color( rCol.red >> 8, rCol.green >> 8, rCol.blue >> 8 );
-}
-
 void GtkSalGraphics::updateSettings( AllSettings& rSettings )
 {
     GtkStyleContext* pStyle = gtk_widget_get_style_context( mpWindow );
@@ -1998,23 +2003,12 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
     aStyleSet.SetMenuHighlightTextColor( aHighlightTextColor );
 
     // hyperlink colors
-    GdkColor *link_color = nullptr;
-    gtk_style_context_get_style(pStyle,
-                                 "link-color", &link_color,
-                                 NULL);
-    if (link_color) {
-        aStyleSet.SetLinkColor(getColorFromColor(*link_color));
-        gdk_color_free(link_color);
-    }
-
-    link_color = nullptr;
-    gtk_style_context_get_style(pStyle,
-                                "visited-link-color", &link_color,
-                                NULL);
-    if (link_color) {
-        aStyleSet.SetVisitedLinkColor(getColorFromColor(*link_color));
-        gdk_color_free(link_color);
-    }
+    gtk_style_context_set_state(mpLinkButtonStyle, GTK_STATE_FLAG_LINK);
+    gtk_style_context_get_color(mpLinkButtonStyle, gtk_style_context_get_state(mpLinkButtonStyle), &text_color);
+    aStyleSet.SetLinkColor(getColor(text_color));
+    gtk_style_context_set_state(mpLinkButtonStyle, GTK_STATE_FLAG_VISITED);
+    gtk_style_context_get_color(mpLinkButtonStyle, gtk_style_context_get_state(mpLinkButtonStyle), &text_color);
+    aStyleSet.SetVisitedLinkColor(getColor(text_color));
 
 #if GTK_CHECK_VERSION(3, 19, 2)
     {
@@ -2353,6 +2347,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
     getStyleContext(&mpTextViewStyle, gtk_text_view_new());
 
     mpButtonStyle = createStyleContext(GtkControlPart::Button);
+    mpLinkButtonStyle = createStyleContext(GtkControlPart::LinkButton);
 
     GtkWidget* pToolbar = gtk_toolbar_new();
     mpToolbarStyle = gtk_widget_get_style_context(pToolbar);


More information about the Libreoffice-commits mailing list