tdf#141333 use a vertical step increment of one row height
for font feature scrolled window
Change-Id: I000d53af7128377930644591a096c94366da281b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113465
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/cui/source/dialogs/FontFeaturesDialog.cxx b/cui/source/dialogs/FontFeaturesDialog.cxx
index fae448b..04255cb 100644
--- a/cui/source/dialogs/FontFeaturesDialog.cxx
+++ b/cui/source/dialogs/FontFeaturesDialog.cxx
@@ -73,18 +73,26 @@ void FontFeaturesDialog::initialize()
rFilteredFontFeatures.push_back(rFontFeature);
}
fillGrid(rFilteredFontFeatures);
int nRowHeight = fillGrid(rFilteredFontFeatures);
m_xContentWindow->set_size_request(
-1, std::min(std::max(m_xContentWindow->get_preferred_size().Height(),
m_xContentGrid->get_preferred_size().Height()),
static_cast<tools::Long>(300L)));
if (nRowHeight)
{
// tdf#141333 use row height + the 6 px spacing of contentGrid
m_xContentWindow->vadjustment_set_step_increment(nRowHeight + 6);
}
updateFontPreview();
}
void FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures)
int FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures)
{
int nRowHeight(0);
vcl::font::FeatureParser aParser(m_sFontName);
auto aExistingFeatures = aParser.getFeaturesMap();
@@ -140,8 +148,13 @@ void FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFe
aCurrentItem.m_xCheck->show();
}
nRowHeight
= std::max<int>(nRowHeight, aCurrentItem.m_xContainer->get_preferred_size().Height());
i++;
}
return nRowHeight;
}
void FontFeaturesDialog::updateFontPreview()
diff --git a/cui/source/inc/FontFeaturesDialog.hxx b/cui/source/inc/FontFeaturesDialog.hxx
index 6fd8b9de..337014b 100644
--- a/cui/source/inc/FontFeaturesDialog.hxx
+++ b/cui/source/inc/FontFeaturesDialog.hxx
@@ -55,7 +55,8 @@ private:
void initialize();
OUString createFontNameWithFeatures();
void fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures);
// returns the max height of a row
int fillGrid(std::vector<vcl::font::Feature> const& rFontFeatures);
DECL_LINK(ComboBoxSelectedHdl, weld::ComboBox&, void);
DECL_LINK(CheckBoxToggledHdl, weld::ToggleButton&, void);
diff --git a/cui/uiconfig/ui/fontfeaturesdialog.ui b/cui/uiconfig/ui/fontfeaturesdialog.ui
index fa36d66..585d376 100644
--- a/cui/uiconfig/ui/fontfeaturesdialog.ui
+++ b/cui/uiconfig/ui/fontfeaturesdialog.ui
@@ -96,6 +96,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">start</property>
<property name="row-homogeneous">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="margin">6</property>
diff --git a/cui/uiconfig/ui/fontfragment.ui b/cui/uiconfig/ui/fontfragment.ui
index 140083b..e66cd71 100644
--- a/cui/uiconfig/ui/fontfragment.ui
+++ b/cui/uiconfig/ui/fontfragment.ui
@@ -7,7 +7,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="valign">start</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="column_spacing">6</property>