include/vcl/builder.hxx | 3 +++ vcl/source/window/builder.cxx | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-)
New commits: commit 281a006bbabc9c2c67820c25d08fb69844db5fad Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Sep 20 15:44:44 2024 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sat Sep 21 09:08:31 2024 +0200 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.wegh...@posteo.de> Tested-by: Jenkins diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 3690fdefe82d..8adf844c55e4 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -189,6 +189,9 @@ private: void mungeModel(ComboBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId); void mungeModel(SvTabListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId); + void insertComboBoxOrListBoxItems(vcl::Window *pWindow, VclBuilder::stringmap &rMap, + const std::vector<ComboBoxTextItem>& rItems); + static void mungeTextBuffer(VclMultiLineEdit &rTarget, const TextBuffer &rTextBuffer); static void mungeAdjustment(NumericFormatter &rTarget, const Adjustment &rAdjustment); 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());