diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-02-03 12:56:40 +0000 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2020-02-04 08:35:39 +0100 |
commit | 4528c0018cb348ea0cee21ddddad25b02d497e2f (patch) | |
tree | ca33b0c5e6fcfdcdbaf393d850eb980c59610406 /cui/source | |
parent | 79c1a3c9d7b5857c63e692681f8a4865f99f798d (diff) |
Resolves: tdf#130364 let font treeview fit to available dialog space
Change-Id: Ia000f4cfa041733fc84b45c955e69251c3ce9bcc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87871
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 49d8e5fb744534f4af7e5c7f08dee7a95bcc6ed5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87946
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/options/fontsubs.cxx | 16 | ||||
-rw-r--r-- | cui/source/options/fontsubs.hxx | 4 |
2 files changed, 14 insertions, 6 deletions
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx index 8db43110dadd..e56543fb1e04 100644 --- a/cui/source/options/fontsubs.cxx +++ b/cui/source/options/fontsubs.cxx @@ -52,12 +52,13 @@ SvxFontSubstTabPage::SvxFontSubstTabPage(weld::Container* pPage, weld::DialogCon m_sAutomatic = m_xFontNameLB->get_text(0); assert(!m_sAutomatic.isEmpty()); - m_xCheckLB->set_size_request(m_xCheckLB->get_approximate_digit_width() * 80, - m_xCheckLB->get_height_rows(10)); + m_xCheckLB->set_size_request(m_xCheckLB->get_approximate_digit_width() * 60, + m_xCheckLB->get_height_rows(8)); m_xCheckLB->set_help_id(HID_OFA_FONT_SUBST_CLB); m_xCheckLB->set_selection_mode(SelectionMode::Multiple); - setColSizes(); + setColSizes(m_xCheckLB->get_size_request()); + m_xCheckLB->connect_size_allocate(LINK(this, SvxFontSubstTabPage, ResizeHdl)); m_xCheckLB->set_centered_column(1); m_xCheckLB->set_centered_column(2); @@ -111,7 +112,7 @@ IMPL_LINK(SvxFontSubstTabPage, HeaderBarClick, int, nColumn, void) } } -void SvxFontSubstTabPage::setColSizes() +void SvxFontSubstTabPage::setColSizes(const Size& rSize) { int nW1 = m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(3)).Width(); int nW2 = m_xCheckLB->get_pixel_size(m_xCheckLB->get_column_title(4)).Width(); @@ -119,7 +120,7 @@ void SvxFontSubstTabPage::setColSizes() int nMin = m_xCheckLB->get_checkbox_column_width(); nMax = std::max(nMax, nMin); const int nDoubleMax = 2*nMax; - const int nRest = m_xCheckLB->get_size_request().Width() - nDoubleMax; + const int nRest = rSize.Width() - nDoubleMax; std::vector<int> aWidths; aWidths.push_back(1); // just abandon the built-in column for checkbuttons and use another aWidths.push_back(nMax); @@ -128,6 +129,11 @@ void SvxFontSubstTabPage::setColSizes() m_xCheckLB->set_column_fixed_widths(aWidths); } +IMPL_LINK(SvxFontSubstTabPage, ResizeHdl, const Size&, rSize, void) +{ + setColSizes(rSize); +} + SvxFontSubstTabPage::~SvxFontSubstTabPage() { } diff --git a/cui/source/options/fontsubs.hxx b/cui/source/options/fontsubs.hxx index b7fed8b8162c..024e4b669bcf 100644 --- a/cui/source/options/fontsubs.hxx +++ b/cui/source/options/fontsubs.hxx @@ -43,10 +43,12 @@ class SvxFontSubstTabPage : public SfxTabPage DECL_LINK(TreeListBoxSelectHdl, weld::TreeView&, void); DECL_LINK(NonPropFontsHdl, weld::ToggleButton&, void); DECL_LINK(HeaderBarClick, int, void); + DECL_LINK(ResizeHdl, const Size&, void); + void SelectHdl(const weld::Widget* pWidget); void CheckEnable(); - void setColSizes(); + void setColSizes(const Size& rSize); public: SvxFontSubstTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); |