diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-16 10:44:32 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-16 21:11:26 +0200 |
commit | 6703b806a7d33f27bdec53d5c897beac94308fd9 (patch) | |
tree | c6fe38d86f4d7d997607e57ae0fcaa4adf4477f2 /vcl | |
parent | b3846685e52f06f7c7a6c293e6ce6849ee795ac6 (diff) |
weld SwInsFootNoteDlg
Change-Id: I54849e2336d093e9044d4b32275387fa04e3bab9
Reviewed-on: https://gerrit.libreoffice.org/52963
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/gtk/gtkinst.hxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 10 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 84 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 5 |
4 files changed, 100 insertions, 1 deletions
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index b6f00a0752d7..e4cf68981392 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -43,6 +43,8 @@ class GtkPrintWrapper; } } +vcl::Font pango_to_vcl(const PangoFontDescription* font, const css::lang::Locale& rLocale); + class GenPspGraphics; class GtkYieldMutex : public SalYieldMutex { diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index d06590dace91..c478974f9482 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1065,6 +1065,16 @@ public: m_xEntry->SetReadOnly(!bEditable); } + virtual vcl::Font get_font() override + { + return m_xEntry->GetFont(); + } + + virtual void set_font(const vcl::Font& rFont) override + { + m_xEntry->SetFont(rFont); + } + virtual ~SalInstanceEntry() override { m_xEntry->SetTextFilter(nullptr); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 3eded538f3cb..5ce77bea39fa 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2675,6 +2675,88 @@ public: g_signal_handler_unblock(m_pEntry, m_nInsertTextSignalId); } + virtual vcl::Font get_font() override + { + PangoContext* pContext = gtk_widget_get_pango_context(m_pWidget); + return pango_to_vcl(pango_context_get_font_description(pContext), + Application::GetSettings().GetUILanguageTag().getLocale()); + } + + virtual void set_font(const vcl::Font& rFont) override + { + PangoAttrList* pAttrList = pango_attr_list_new(); + pango_attr_list_insert(pAttrList, pango_attr_family_new(OUStringToOString(rFont.GetFamilyName(), RTL_TEXTENCODING_UTF8).getStr())); + pango_attr_list_insert(pAttrList, pango_attr_size_new(rFont.GetFontSize().Height() * PANGO_SCALE)); + switch (rFont.GetItalic()) + { + case ITALIC_NONE: + pango_attr_list_insert(pAttrList, pango_attr_style_new(PANGO_STYLE_NORMAL)); + break; + case ITALIC_NORMAL: + pango_attr_list_insert(pAttrList, pango_attr_style_new(PANGO_STYLE_ITALIC)); + break; + case ITALIC_OBLIQUE: + pango_attr_list_insert(pAttrList, pango_attr_style_new(PANGO_STYLE_OBLIQUE)); + break; + default: + break; + } + switch (rFont.GetWeight()) + { + case WEIGHT_ULTRALIGHT: + pango_attr_list_insert(pAttrList, pango_attr_weight_new(PANGO_WEIGHT_ULTRALIGHT)); + break; + case WEIGHT_LIGHT: + pango_attr_list_insert(pAttrList, pango_attr_weight_new(PANGO_WEIGHT_LIGHT)); + break; + case WEIGHT_NORMAL: + pango_attr_list_insert(pAttrList, pango_attr_weight_new(PANGO_WEIGHT_NORMAL)); + break; + case WEIGHT_BOLD: + pango_attr_list_insert(pAttrList, pango_attr_weight_new(PANGO_WEIGHT_BOLD)); + break; + case WEIGHT_ULTRABOLD: + pango_attr_list_insert(pAttrList, pango_attr_weight_new(PANGO_WEIGHT_ULTRABOLD)); + break; + default: + break; + } + switch (rFont.GetWidthType()) + { + case WIDTH_ULTRA_CONDENSED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_ULTRA_CONDENSED)); + break; + case WIDTH_EXTRA_CONDENSED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_EXTRA_CONDENSED)); + break; + case WIDTH_CONDENSED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_CONDENSED)); + break; + case WIDTH_SEMI_CONDENSED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_SEMI_CONDENSED)); + break; + case WIDTH_NORMAL: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_NORMAL)); + break; + case WIDTH_SEMI_EXPANDED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_SEMI_EXPANDED)); + break; + case WIDTH_EXPANDED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_EXPANDED)); + break; + case WIDTH_EXTRA_EXPANDED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_EXTRA_EXPANDED)); + break; + case WIDTH_ULTRA_EXPANDED: + pango_attr_list_insert(pAttrList, pango_attr_stretch_new(PANGO_STRETCH_ULTRA_EXPANDED)); + break; + default: + break; + } + gtk_entry_set_attributes(m_pEntry, pAttrList); + pango_attr_list_unref(pAttrList); + } + virtual ~GtkInstanceEntry() override { g_signal_handler_disconnect(m_pEntry, m_nInsertTextSignalId); @@ -3722,7 +3804,7 @@ public: { m_xSorter.reset(new comphelper::string::NaturalStringSorter( ::comphelper::getProcessComponentContext(), - Application::GetSettings().GetLanguageTag().getLocale())); + Application::GetSettings().GetUILanguageTag().getLocale())); GtkTreeModel* pModel = gtk_combo_box_get_model(GTK_COMBO_BOX(m_pComboBoxText)); GtkTreeSortable* pSortable = GTK_TREE_SORTABLE(pModel); gtk_tree_sortable_set_sort_func(pSortable, 0, sort_func, m_xSorter.get(), nullptr); diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx index 5ea9cbcde7bd..04f5ac181c05 100644 --- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx @@ -2775,6 +2775,11 @@ static inline ::Color getColor( const GdkRGBA& rCol ) static vcl::Font getFont(GtkStyleContext* pStyle, const css::lang::Locale& rLocale) { const PangoFontDescription* font = gtk_style_context_get_font(pStyle, gtk_style_context_get_state(pStyle)); + return pango_to_vcl(font, rLocale); +} + +vcl::Font pango_to_vcl(const PangoFontDescription* font, const css::lang::Locale& rLocale) +{ OString aFamily = pango_font_description_get_family( font ); int nPangoHeight = pango_font_description_get_size( font ); PangoStyle eStyle = pango_font_description_get_style( font ); |