summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-09-17 17:28:23 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-09-18 07:32:32 +0200
commit58fd872ffb4f81e58a764545fcefc93d39adb906 (patch)
tree1b6c56dd24d057d7c63e3d968eaa5ed8a8250610 /vcl
parent3bd4a797724cf432d09a7d8ffe5f4a53a1e7c78d (diff)
tdf#130857 VclBuilder: Move class/id/custom prop extraction to helper
Extract parsing of these attributes from `VclBuilder::handleObject` to a new helper method `BaseBuilder::extractClassAndIdAndCustomProperty` in the base class. Change-Id: I248448407db446fd61bf91bf13c9bc187e0706d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162918 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/builder.cxx27
1 files changed, 17 insertions, 10 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index f597496647b4..2e4c6a20f563 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -3597,12 +3597,9 @@ template<typename T> static bool insertItems(vcl::Window *pWindow, VclBuilder::s
return true;
}
-VclPtr<vcl::Window> VclBuilder::handleObject(vcl::Window *pParent, stringmap *pAtkProps, xmlreader::XmlReader &reader, bool bToolbarItem)
+void BuilderBase::extractClassAndIdAndCustomProperty(xmlreader::XmlReader& reader, OUString& rClass,
+ OUString& rId, OUString& rCustomProperty)
{
- OUString sClass;
- OUString sID;
- OUString sCustomProperty;
-
xmlreader::Span name;
int nsId;
@@ -3611,23 +3608,31 @@ VclPtr<vcl::Window> VclBuilder::handleObject(vcl::Window *pParent, stringmap *pA
if (name == "class")
{
name = reader.getAttributeValue(false);
- sClass = OUString(name.begin, name.length, RTL_TEXTENCODING_UTF8);
+ rClass = OUString(name.begin, name.length, RTL_TEXTENCODING_UTF8);
}
else if (name == "id")
{
name = reader.getAttributeValue(false);
- sID = OUString(name.begin, name.length, RTL_TEXTENCODING_UTF8);
+ rId = OUString(name.begin, name.length, RTL_TEXTENCODING_UTF8);
if (isLegacy())
{
- sal_Int32 nDelim = sID.indexOf(':');
+ sal_Int32 nDelim = rId.indexOf(':');
if (nDelim != -1)
{
- sCustomProperty = sID.subView(nDelim+1);
- sID = sID.copy(0, nDelim);
+ rCustomProperty = rId.subView(nDelim+1);
+ rId = rId.copy(0, nDelim);
}
}
}
}
+}
+
+VclPtr<vcl::Window> VclBuilder::handleObject(vcl::Window *pParent, stringmap *pAtkProps, xmlreader::XmlReader &reader, bool bToolbarItem)
+{
+ OUString sClass;
+ OUString sID;
+ OUString sCustomProperty;
+ extractClassAndIdAndCustomProperty(reader, sClass, sID, sCustomProperty);
if (sClass == "GtkListStore" || sClass == "GtkTreeStore")
{
@@ -3673,6 +3678,8 @@ VclPtr<vcl::Window> VclBuilder::handleObject(vcl::Window *pParent, stringmap *pA
VclPtr<vcl::Window> pCurrentChild;
while(true)
{
+ xmlreader::Span name;
+ int nsId;
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::Text::NONE, &name, &nsId);