From cc065c4937433f944cd7f6e4332f599d5346a5e9 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 25 Oct 2010 13:41:57 +0200 Subject: sb132: #i112107# getImplementationName should not throw --- configmgr/source/access.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'configmgr/source/access.cxx') diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index eda60e6d612a..3602f3cd73c5 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -909,11 +909,8 @@ rtl::OUString Access::getImplementationName() throw (css::uno::RuntimeException) OSL_ASSERT(thisIs(IS_ANY)); osl::MutexGuard g(lock); checkLocalizedPropertyAccess(); - throw css::uno::RuntimeException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "configmgr Access has no service implementation name")), - static_cast< cppu::OWeakObject * >(this)); + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("org.openoffice-configmgr::Access")); } sal_Bool Access::supportsService(rtl::OUString const & ServiceName) -- cgit From de8fef0d3ff128ca58c1da252f3a1a44931bd9ba Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 3 Nov 2010 16:15:15 +0100 Subject: sb132: #i112107# handle configmgr::Access::asProperty being called on an access w/o parent --- configmgr/source/access.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'configmgr/source/access.cxx') diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 3602f3cd73c5..933a414d331c 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -2089,7 +2089,8 @@ css::beans::Property Access::asProperty() { default: type = cppu::UnoType< css::uno::XInterface >::get(); //TODO: correct? nillable = false; - removable = getParentNode()->kind() == Node::KIND_SET; + rtl::Reference< Node > parent(getParentNode()); + removable = parent.is() && parent->kind() == Node::KIND_SET; break; } return css::beans::Property( -- cgit From 93f059dfb6d817afaff56694f242dba3a1897c3b Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 10 Jan 2011 16:45:42 +0100 Subject: sb139: #i116391# for backwards compatibility, allow absolute paths in configmgr getByHierarchicalName et al --- configmgr/source/access.cxx | 100 ++++++++++++++++++++++++++++++-------------- 1 file changed, 69 insertions(+), 31 deletions(-) (limited to 'configmgr/source/access.cxx') diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index 933a414d331c..2548643c7ce1 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -1993,45 +1993,83 @@ rtl::Reference< ChildAccess > Access::getUnmodifiedChild( } rtl::Reference< ChildAccess > Access::getSubChild(rtl::OUString const & path) { - rtl::OUString name; - bool setElement; - rtl::OUString templateName; - sal_Int32 i = Data::parseSegment( - path, 0, &name, &setElement, &templateName); - if (i == -1 || (i != path.getLength() && path[i] != '/')) { - return rtl::Reference< ChildAccess >(); - } - rtl::Reference< ChildAccess > child(getChild(name)); - if (!child.is()) { - return rtl::Reference< ChildAccess >(); - } - if (setElement) { - rtl::Reference< Node > p(getNode()); - switch (p->kind()) { - case Node::KIND_LOCALIZED_PROPERTY: - if (!Components::allLocales(getRootAccess()->getLocale()) || - templateName.getLength() != 0) - { + sal_Int32 i = 0; + // For backwards compatibility, allow absolute paths where meaningful: + if (path.getLength() != 0 && path[0] == '/') { + ++i; + 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] != '/')) { return rtl::Reference< ChildAccess >(); } - break; - case Node::KIND_SET: - if (templateName.getLength() != 0 && - !dynamic_cast< SetNode * >(p.get())->isValidTemplate( - templateName)) + 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 >(); } - break; - default: + 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()) { + return rtl::Reference< ChildAccess >(); + } + if (setElement) { + rtl::Reference< Node > p(parent->getNode()); + switch (p->kind()) { + case Node::KIND_LOCALIZED_PROPERTY: + if (!Components::allLocales(getRootAccess()->getLocale()) || + templateName.getLength() != 0) + { + return rtl::Reference< ChildAccess >(); + } + break; + case Node::KIND_SET: + if (templateName.getLength() != 0 && + !dynamic_cast< SetNode * >(p.get())->isValidTemplate( + templateName)) + { + return rtl::Reference< ChildAccess >(); + } + break; + default: + return rtl::Reference< ChildAccess >(); + } + } + // For backwards compatibility, ignore a final slash after non-value + // nodes: + if (child->isValue()) { + return i == path.getLength() + ? child : rtl::Reference< ChildAccess >(); + } else if (i >= path.getLength() - 1) { + return child; + } + ++i; + parent = child.get(); } - // For backwards compatibility, ignore a final slash after non-value nodes: - return child->isValue() - ? (i == path.getLength() ? child : rtl::Reference< ChildAccess >()) - : (i >= path.getLength() - 1 - ? child : child->getSubChild(path.copy(i + 1))); } bool Access::setChildProperty( -- cgit