diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-20 15:44:44 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-09-21 09:08:31 +0200 |
commit | 281a006bbabc9c2c67820c25d08fb69844db5fad (patch) | |
tree | 8fbbc374e746c63d235b41d43065032114e8999e /vcl/source/window | |
parent | fd67141bbfd7a9167f5a7f49441adb41d117e8b3 (diff) |
tdf#130857 VclBuilder: Extract helpers to insert combo/list box items
Extract code to insert items into the VCL implementations
ComboBox and ListBox from VclBuilder::handleObject into a
new helper method VclBuilder::insertComboBoxOrListBoxItems.
This is in preparation of being able to make `handleObject`
reusable for an upcoming QtBuilder, s. WIP Gerrit change [1]
(which still duplicates `handleObject` in current patch set 28).
[1] https://gerrit.libreoffice.org/c/core/+/161831
Change-Id: Ic6d014e6c9886c34a889b70bbf06a979664daba6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173736
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/builder.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 541471a2b5bd..c91fe95bd0f5 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -3767,11 +3767,7 @@ VclPtr<vcl::Window> VclBuilder::handleObject(vcl::Window *pParent, stringmap *pA } if (!aItems.empty()) - { - // try to fill-in the items - if (!insertItems<ComboBox>(pCurrentChild, aProperties, m_aUserData, aItems)) - insertItems<ListBox>(pCurrentChild, aProperties, m_aUserData, aItems); - } + insertComboBoxOrListBoxItems(pCurrentChild, aProperties, aItems); return pCurrentChild; } @@ -4349,6 +4345,14 @@ void VclBuilder::mungeModel(SvTabListBox& rTarget, const ListStore &rStore, sal_ } } +void VclBuilder::insertComboBoxOrListBoxItems(vcl::Window *pWindow, VclBuilder::stringmap &rMap, + const std::vector<ComboBoxTextItem>& rItems) +{ + // try to fill-in the items + if (!insertItems<ComboBox>(pWindow, rMap, m_aUserData, rItems)) + insertItems<ListBox>(pWindow, rMap, m_aUserData, rItems); +} + void VclBuilder::mungeAdjustment(NumericFormatter &rTarget, const Adjustment &rAdjustment) { int nMul = rtl_math_pow10Exp(1, rTarget.GetDecimalDigits()); |