summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-02-03 12:56:40 +0000
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2020-02-04 08:35:39 +0100
commit4528c0018cb348ea0cee21ddddad25b02d497e2f (patch)
treeca33b0c5e6fcfdcdbaf393d850eb980c59610406
parent79c1a3c9d7b5857c63e692681f8a4865f99f798d (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>
-rw-r--r--cui/source/options/fontsubs.cxx16
-rw-r--r--cui/source/options/fontsubs.hxx4
-rw-r--r--cui/uiconfig/ui/optfontspage.ui149
3 files changed, 95 insertions, 74 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);
diff --git a/cui/uiconfig/ui/optfontspage.ui b/cui/uiconfig/ui/optfontspage.ui
index 530a5316fa0e..52524bd1a284 100644
--- a/cui/uiconfig/ui/optfontspage.ui
+++ b/cui/uiconfig/ui/optfontspage.ui
@@ -43,6 +43,7 @@
<object class="GtkBox" id="OptFontsPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="vexpand">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
@@ -108,95 +109,107 @@
</packing>
</child>
<child>
- <object class="GtkScrolledWindow" id="checklbscroll">
+ <object class="GtkBox" id="box2">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
+ <property name="can_focus">False</property>
<property name="vexpand">True</property>
- <property name="shadow_type">in</property>
<child>
- <object class="GtkTreeView" id="checklb">
+ <object class="GtkScrolledWindow" id="checklbscroll">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="model">liststore1</property>
- <property name="search_column">0</property>
- <property name="show_expanders">False</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
- </child>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn1">
- <property name="resizable">True</property>
- <property name="spacing">6</property>
+ <object class="GtkTreeView" id="checklb">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="Macro Library List-selection2"/>
+ </child>
<child>
- <object class="GtkCellRendererToggle" id="cellrenderer1"/>
- <attributes>
- <attribute name="visible">6</attribute>
- <attribute name="active">0</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCellRendererToggle" id="cellrenderer1"/>
+ <attributes>
+ <attribute name="visible">6</attribute>
+ <attribute name="active">0</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn4">
- <property name="resizable">True</property>
- <property name="spacing">6</property>
- <property name="title" translatable="yes" context="optfontspage|always">Always</property>
<child>
- <object class="GtkCellRendererToggle" id="cellrenderer5"/>
- <attributes>
- <attribute name="visible">7</attribute>
- <attribute name="active">1</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn4">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="optfontspage|always">Always</property>
+ <child>
+ <object class="GtkCellRendererToggle" id="cellrenderer5"/>
+ <attributes>
+ <attribute name="visible">7</attribute>
+ <attribute name="active">1</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn7">
- <property name="resizable">True</property>
- <property name="spacing">6</property>
- <property name="title" translatable="yes" context="optfontspage|screenonly">Screen only</property>
<child>
- <object class="GtkCellRendererToggle" id="cellrenderer7"/>
- <attributes>
- <attribute name="visible">8</attribute>
- <attribute name="active">2</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn7">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="optfontspage|screenonly">Screen only</property>
+ <child>
+ <object class="GtkCellRendererToggle" id="cellrenderer7"/>
+ <attributes>
+ <attribute name="visible">8</attribute>
+ <attribute name="active">2</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn5">
- <property name="resizable">True</property>
- <property name="spacing">6</property>
- <property name="title" translatable="yes" context="optfontspage|font">Font</property>
- <property name="clickable">True</property>
<child>
- <object class="GtkCellRendererText" id="cellrenderer4"/>
- <attributes>
- <attribute name="text">3</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="optfontspage|font">Font</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer4"/>
+ <attributes>
+ <attribute name="text">3</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn9">
- <property name="resizable">True</property>
- <property name="spacing">6</property>
- <property name="title" translatable="yes" context="optfontspage|replacewith">Replace with</property>
- <property name="clickable">True</property>
<child>
- <object class="GtkCellRendererText" id="cellrenderer9"/>
- <attributes>
- <attribute name="text">4</attribute>
- </attributes>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn9">
+ <property name="resizable">True</property>
+ <property name="spacing">6</property>
+ <property name="title" translatable="yes" context="optfontspage|replacewith">Replace with</property>
+ <property name="clickable">True</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderer9"/>
+ <attributes>
+ <attribute name="text">4</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
</object>
</child>
</object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
</object>
<packing>