summaryrefslogtreecommitdiff
path: root/cui/source/options/fontsubs.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-02-03 12:56:40 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-02-03 18:20:35 +0100
commit49d8e5fb744534f4af7e5c7f08dee7a95bcc6ed5 (patch)
treeade9535ad15b1fab0402ba9cf4bfa8dbe8991343 /cui/source/options/fontsubs.cxx
parentfac86a90db33e4e6d38af134c55f1f6416c928f8 (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>
Diffstat (limited to 'cui/source/options/fontsubs.cxx')
-rw-r--r--cui/source/options/fontsubs.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index 5db165ccfa6a..d9d4debec894 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()
{
}