diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-16 20:45:53 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-12-17 22:54:34 +0100 |
commit | 19d9a4d0d6fcfc2b5b5c6d8b983817f94c0c1e1a (patch) | |
tree | 733173ee6d32d181ec6a026e8fcfccf8f93ff0d5 /cui/source | |
parent | f956d81ac75450710629ee883bc2193f13dd6091 (diff) |
Port FontFeaturesDialog to new weld::Grid API
See previous commit
Change-Id: I67f5ea16b5108e8359820850f0815e34db439ef1
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Mon Dec 16 11:02:00 2024 +0100
weld: Add weld::Grid to handle grid child positions
for more background.
To trigger dialog:
* open context menu for paragraph in Writer
* select "Character" -> "Character" to open the "Character" dialog
* in the "Font" tab, click on the "Features" button
Change-Id: I9b87a82c65c59b5d02ddf44df96ca85113f7ffc3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178613
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/dialogs/FontFeaturesDialog.cxx | 12 | ||||
-rw-r--r-- | cui/source/inc/FontFeaturesDialog.hxx | 14 |
2 files changed, 15 insertions, 11 deletions
diff --git a/cui/source/dialogs/FontFeaturesDialog.cxx b/cui/source/dialogs/FontFeaturesDialog.cxx index feb7f401025c..dd036c37bb28 100644 --- a/cui/source/dialogs/FontFeaturesDialog.cxx +++ b/cui/source/dialogs/FontFeaturesDialog.cxx @@ -25,11 +25,11 @@ FontFeaturesDialog::FontFeaturesDialog(weld::Window* pParent, OUString aFontName , m_sFontName(std::move(aFontName)) , m_xContentWindow(m_xBuilder->weld_scrolled_window(u"contentWindow"_ustr)) , m_xContentBox(m_xBuilder->weld_container(u"contentBox"_ustr)) - , m_xContentGrid(m_xBuilder->weld_container(u"contentGrid"_ustr)) + , m_xContentGrid(m_xBuilder->weld_grid(u"contentGrid"_ustr)) , m_xStylisticSetsBox(m_xBuilder->weld_container(u"stylisticSetsBox"_ustr)) - , m_xStylisticSetsGrid(m_xBuilder->weld_container(u"stylisticSetsGrid"_ustr)) + , m_xStylisticSetsGrid(m_xBuilder->weld_grid(u"stylisticSetsGrid"_ustr)) , m_xCharacterVariantsBox(m_xBuilder->weld_container(u"characterVariantsBox"_ustr)) - , m_xCharacterVariantsGrid(m_xBuilder->weld_container(u"characterVariantsGrid"_ustr)) + , m_xCharacterVariantsGrid(m_xBuilder->weld_grid(u"characterVariantsGrid"_ustr)) , m_xPreviewWindow(new weld::CustomWeld(*m_xBuilder, u"preview"_ustr, m_aPreviewWindow)) { initialize(); @@ -139,8 +139,10 @@ int FontFeaturesDialog::fillGrid(std::vector<vcl::font::Feature> const& rFontFea sal_Int32 nGridPositionX = (nIdx % 2) * 2; sal_Int32 nGridPositionY = nIdx / 2; - aCurrentItem.m_xContainer->set_grid_left_attach(nGridPositionX); - aCurrentItem.m_xContainer->set_grid_top_attach(nGridPositionY); + aCurrentItem.m_pParentGrid->set_child_left_attach(*aCurrentItem.m_xContainer, + nGridPositionX); + aCurrentItem.m_pParentGrid->set_child_top_attach(*aCurrentItem.m_xContainer, + nGridPositionY); Link<weld::ComboBox&, void> aComboBoxSelectHandler = LINK(this, FontFeaturesDialog, ComboBoxSelectedHdl); diff --git a/cui/source/inc/FontFeaturesDialog.hxx b/cui/source/inc/FontFeaturesDialog.hxx index e1c8d9d97163..00551fca3ac1 100644 --- a/cui/source/inc/FontFeaturesDialog.hxx +++ b/cui/source/inc/FontFeaturesDialog.hxx @@ -20,10 +20,11 @@ namespace cui { struct FontFeatureItem { - FontFeatureItem(weld::Widget* pParent) - : m_aFeatureCode(0) + FontFeatureItem(weld::Grid* pParentGrid) + : m_pParentGrid(pParentGrid) + , m_aFeatureCode(0) , m_nDefault(-1) - , m_xBuilder(Application::CreateBuilder(pParent, u"cui/ui/fontfragment.ui"_ustr)) + , m_xBuilder(Application::CreateBuilder(pParentGrid, u"cui/ui/fontfragment.ui"_ustr)) , m_xContainer(m_xBuilder->weld_widget(u"fontentry"_ustr)) , m_xText(m_xBuilder->weld_label(u"label"_ustr)) , m_xCombo(m_xBuilder->weld_combo_box(u"combo"_ustr)) @@ -32,6 +33,7 @@ struct FontFeatureItem m_xCheck->connect_toggled(LINK(this, FontFeatureItem, CheckBoxToggledHdl)); } + weld::Grid* m_pParentGrid; sal_uInt32 m_aFeatureCode; sal_Int32 m_nDefault; weld::TriStateEnabled m_aTriStateEnabled; @@ -56,11 +58,11 @@ private: SvxFontPrevWindow m_aPreviewWindow; std::unique_ptr<weld::ScrolledWindow> m_xContentWindow; std::unique_ptr<weld::Container> m_xContentBox; - std::unique_ptr<weld::Container> m_xContentGrid; + std::unique_ptr<weld::Grid> m_xContentGrid; std::unique_ptr<weld::Container> m_xStylisticSetsBox; - std::unique_ptr<weld::Container> m_xStylisticSetsGrid; + std::unique_ptr<weld::Grid> m_xStylisticSetsGrid; std::unique_ptr<weld::Container> m_xCharacterVariantsBox; - std::unique_ptr<weld::Container> m_xCharacterVariantsGrid; + std::unique_ptr<weld::Grid> m_xCharacterVariantsGrid; std::unique_ptr<weld::CustomWeld> m_xPreviewWindow; void initialize(); |