sb139: #i116391# for backwards compatibility, allow absolute paths in configmgr getByHierarchicalName et al
This commit is contained in:
parent
d64c1529ac
commit
93f059dfb6
@ -1993,20 +1993,52 @@ rtl::Reference< ChildAccess > Access::getUnmodifiedChild(
|
|||||||
}
|
}
|
||||||
|
|
||||||
rtl::Reference< ChildAccess > Access::getSubChild(rtl::OUString const & path) {
|
rtl::Reference< ChildAccess > Access::getSubChild(rtl::OUString const & path) {
|
||||||
rtl::OUString name;
|
sal_Int32 i = 0;
|
||||||
bool setElement;
|
// For backwards compatibility, allow absolute paths where meaningful:
|
||||||
rtl::OUString templateName;
|
if (path.getLength() != 0 && path[0] == '/') {
|
||||||
sal_Int32 i = Data::parseSegment(
|
++i;
|
||||||
path, 0, &name, &setElement, &templateName);
|
if (!getRootAccess().is()) {
|
||||||
|
return rtl::Reference< ChildAccess >();
|
||||||
|
}
|
||||||
|
Path abs(getAbsolutePath());
|
||||||
|
for (Path::iterator j(abs.begin()); j != abs.end(); ++j) {
|
||||||
|
rtl::OUString name1;
|
||||||
|
bool setElement1;
|
||||||
|
rtl::OUString templateName1;
|
||||||
|
i = Data::parseSegment(
|
||||||
|
path, i, &name1, &setElement1, &templateName1);
|
||||||
if (i == -1 || (i != path.getLength() && path[i] != '/')) {
|
if (i == -1 || (i != path.getLength() && path[i] != '/')) {
|
||||||
return rtl::Reference< ChildAccess >();
|
return rtl::Reference< ChildAccess >();
|
||||||
}
|
}
|
||||||
rtl::Reference< ChildAccess > child(getChild(name));
|
rtl::OUString name2;
|
||||||
|
bool setElement2;
|
||||||
|
rtl::OUString templateName2;
|
||||||
|
Data::parseSegment(*j, 0, &name2, &setElement2, &templateName2);
|
||||||
|
if (name1 != name2 || setElement1 != setElement2 ||
|
||||||
|
(setElement1 &&
|
||||||
|
!Data::equalTemplateNames(templateName1, templateName2)))
|
||||||
|
{
|
||||||
|
return rtl::Reference< ChildAccess >();
|
||||||
|
}
|
||||||
|
if (i != path.getLength()) {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (rtl::Reference< Access > parent(this);;) {
|
||||||
|
rtl::OUString name;
|
||||||
|
bool setElement;
|
||||||
|
rtl::OUString templateName;
|
||||||
|
i = Data::parseSegment(path, i, &name, &setElement, &templateName);
|
||||||
|
if (i == -1 || (i != path.getLength() && path[i] != '/')) {
|
||||||
|
return rtl::Reference< ChildAccess >();
|
||||||
|
}
|
||||||
|
rtl::Reference< ChildAccess > child(parent->getChild(name));
|
||||||
if (!child.is()) {
|
if (!child.is()) {
|
||||||
return rtl::Reference< ChildAccess >();
|
return rtl::Reference< ChildAccess >();
|
||||||
}
|
}
|
||||||
if (setElement) {
|
if (setElement) {
|
||||||
rtl::Reference< Node > p(getNode());
|
rtl::Reference< Node > p(parent->getNode());
|
||||||
switch (p->kind()) {
|
switch (p->kind()) {
|
||||||
case Node::KIND_LOCALIZED_PROPERTY:
|
case Node::KIND_LOCALIZED_PROPERTY:
|
||||||
if (!Components::allLocales(getRootAccess()->getLocale()) ||
|
if (!Components::allLocales(getRootAccess()->getLocale()) ||
|
||||||
@ -2027,11 +2059,17 @@ rtl::Reference< ChildAccess > Access::getSubChild(rtl::OUString const & path) {
|
|||||||
return rtl::Reference< ChildAccess >();
|
return rtl::Reference< ChildAccess >();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// For backwards compatibility, ignore a final slash after non-value nodes:
|
// For backwards compatibility, ignore a final slash after non-value
|
||||||
return child->isValue()
|
// nodes:
|
||||||
? (i == path.getLength() ? child : rtl::Reference< ChildAccess >())
|
if (child->isValue()) {
|
||||||
: (i >= path.getLength() - 1
|
return i == path.getLength()
|
||||||
? child : child->getSubChild(path.copy(i + 1)));
|
? child : rtl::Reference< ChildAccess >();
|
||||||
|
} else if (i >= path.getLength() - 1) {
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
parent = child.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Access::setChildProperty(
|
bool Access::setChildProperty(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user