tdf#130857 VclBuilder: Move extractActive to BuilderBase

Turn this helper function into a static function
in the BuilderBase class, for reuse in QtBuilder
in an upcoming commit.

Change-Id: I68c7e62816ff5fdd1c2a02cf5e42f90b32cff627
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175571
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2024-10-24 18:12:52 +02:00
parent 02692566ad
commit 05a38a2109
2 changed files with 15 additions and 13 deletions

View File

@@ -44,6 +44,8 @@ public:
typedef stringmap Adjustment; typedef stringmap Adjustment;
typedef stringmap TextBuffer; typedef stringmap TextBuffer;
static sal_Int32 extractActive(stringmap& rMap);
protected: protected:
BuilderBase(std::u16string_view sUIDir, const OUString& rUIFile, bool bLegacy); BuilderBase(std::u16string_view sUIDir, const OUString& rUIFile, bool bLegacy);
virtual ~BuilderBase() = default; virtual ~BuilderBase() = default;

View File

@@ -1285,18 +1285,6 @@ bool VclBuilder::extractAdjustmentToMap(const OUString& id, VclBuilder::stringma
namespace namespace
{ {
sal_Int32 extractActive(VclBuilder::stringmap &rMap)
{
sal_Int32 nActiveId = 0;
VclBuilder::stringmap::iterator aFind = rMap.find(u"active"_ustr);
if (aFind != rMap.end())
{
nActiveId = aFind->second.toInt32();
rMap.erase(aFind);
}
return nActiveId;
}
bool extractSelectable(VclBuilder::stringmap &rMap) bool extractSelectable(VclBuilder::stringmap &rMap)
{ {
bool bSelectable = false; bool bSelectable = false;
@@ -3495,7 +3483,7 @@ template<typename T> static bool insertItems(vcl::Window *pWindow, VclBuilder::s
if (!pContainer) if (!pContainer)
return false; return false;
sal_uInt16 nActiveId = extractActive(rMap); sal_uInt16 nActiveId = BuilderBase::extractActive(rMap);
for (auto const& item : rItems) for (auto const& item : rItems)
{ {
sal_Int32 nPos = pContainer->InsertEntry(item.m_sItem); sal_Int32 nPos = pContainer->InsertEntry(item.m_sItem);
@@ -3754,6 +3742,18 @@ bool BuilderBase::hasOrientationVertical(VclBuilder::stringmap &rMap)
return bVertical; return bVertical;
} }
sal_Int32 BuilderBase::extractActive(VclBuilder::stringmap& rMap)
{
sal_Int32 nActiveId = 0;
VclBuilder::stringmap::iterator aFind = rMap.find(u"active"_ustr);
if (aFind != rMap.end())
{
nActiveId = aFind->second.toInt32();
rMap.erase(aFind);
}
return nActiveId;
}
bool BuilderBase::extractEntry(VclBuilder::stringmap &rMap) bool BuilderBase::extractEntry(VclBuilder::stringmap &rMap)
{ {
bool bHasEntry = false; bool bHasEntry = false;