diff options
Diffstat (limited to 'configmgr2')
-rw-r--r-- | configmgr2/source/access.cxx | 62 | ||||
-rw-r--r-- | configmgr2/source/access.hxx | 20 | ||||
-rw-r--r-- | configmgr2/source/data.cxx | 12 |
3 files changed, 70 insertions, 24 deletions
diff --git a/configmgr2/source/access.cxx b/configmgr2/source/access.cxx index 234eb75b8f8c..8432cf215a67 100644 --- a/configmgr2/source/access.cxx +++ b/configmgr2/source/access.cxx @@ -34,6 +34,7 @@ #include "com/sun/star/beans/Property.hpp" #include "com/sun/star/beans/PropertyAttribute.hpp" +#include "com/sun/star/beans/PropertyChangeEvent.hpp" #include "com/sun/star/beans/PropertyVetoException.hpp" #include "com/sun/star/beans/UnknownPropertyException.hpp" #include "com/sun/star/beans/XPropertiesChangeListener.hpp" @@ -130,7 +131,10 @@ css::uno::Any Access::queryInterface(css::uno::Type const & aType) "com.sun.beans.XHierarchicalPropertySet")) || aType.getTypeName().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( - "com.sun.beans.XMultiHierarchicalPropertySet"))) + "com.sun.beans.XMultiHierarchicalPropertySet")) || + aType.getTypeName().equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM( + "com.sun.beans.XHierarchicalPropertySetInfo"))) { if (getNode()->kind() != Node::KIND_GROUP) { res.clear(); @@ -631,8 +635,6 @@ void Access::setName(rtl::OUString const & aName) checkLocalizedPropertyAccess(); checkFinalized(); switch (getNode()->kind()) { - case Node::KIND_LOCALIZED_PROPERTY: - if(true)abort();*(char*)0=0;throw 0;//TODO case Node::KIND_GROUP: case Node::KIND_SET: { @@ -666,12 +668,16 @@ void Access::setName(rtl::OUString const & aName) } } } - throw css::uno::RuntimeException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "configmgr setName inappropriate node")), - static_cast< cppu::OWeakObject * >(this)); } + // fall through + case Node::KIND_LOCALIZED_PROPERTY: + // renaming a property could only work for an extension property, but a + // localized property is never an extension property + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "configmgr setName inappropriate node")), + static_cast< cppu::OWeakObject * >(this)); default: OSL_ASSERT(false); // this cannot happen break; @@ -841,7 +847,7 @@ css::uno::Sequence< css::uno::Any > Access::getPropertyValues( } void Access::addPropertiesChangeListener( - css::uno::Sequence< rtl::OUString > const & /*aPropertyNames*/, //TODO + css::uno::Sequence< rtl::OUString > const &, css::uno::Reference< css::beans::XPropertiesChangeListener > const & xListener) throw (css::uno::RuntimeException) @@ -864,19 +870,26 @@ void Access::removePropertiesChangeListener( } void Access::firePropertiesChangeEvent( - css::uno::Sequence< rtl::OUString > const & /*aPropertyNames*/, + css::uno::Sequence< rtl::OUString > const & aPropertyNames, css::uno::Reference< css::beans::XPropertiesChangeListener > const & - /*xListener*/) + xListener) throw (css::uno::RuntimeException) { OSL_ASSERT(thisIs(IS_GROUP)); - if(true)abort();*(char*)0=0;throw 0;//TODO + css::uno::Sequence< css::beans::PropertyChangeEvent > events( + aPropertyNames.getLength()); + for (sal_Int32 i = 0; i < events.getLength(); ++i) { + events[i].PropertyName = aPropertyNames[i]; + events[i].Further = false; + events[i].PropertyHandle = -1; + } + xListener->propertiesChange(events); } css::uno::Reference< css::beans::XHierarchicalPropertySetInfo > Access::getHierarchicalPropertySetInfo() throw (css::uno::RuntimeException) { OSL_ASSERT(thisIs(IS_GROUP)); - if(true)abort();*(char*)0=0;throw 0;//TODO + return this; } void Access::setHierarchicalPropertyValue( @@ -991,6 +1004,29 @@ css::uno::Sequence< css::uno::Any > Access::getHierarchicalPropertyValues( return vals; } +css::beans::Property Access::getPropertyByHierarchicalName( + rtl::OUString const & aHierarchicalName) + throw (css::beans::UnknownPropertyException, css::uno::RuntimeException) +{ + OSL_ASSERT(thisIs(IS_GROUP)); + osl::MutexGuard g(lock); + rtl::Reference< ChildAccess > child(getSubChild(aHierarchicalName)); + if (!child.is()) { + throw css::beans::UnknownPropertyException( + aHierarchicalName, static_cast< cppu::OWeakObject * >(this)); + } + return child->asProperty(); +} + +sal_Bool Access::hasPropertyByHierarchicalName( + rtl::OUString const & aHierarchicalName) + throw (css::uno::RuntimeException) +{ + OSL_ASSERT(thisIs(IS_GROUP)); + osl::MutexGuard g(lock); + return getSubChild(aHierarchicalName).is(); +} + void Access::replaceByName( rtl::OUString const & aName, css::uno::Any const & aElement) throw ( diff --git a/configmgr2/source/access.hxx b/configmgr2/source/access.hxx index 0a1b91549c5d..6af7e71e31a9 100644 --- a/configmgr2/source/access.hxx +++ b/configmgr2/source/access.hxx @@ -40,6 +40,7 @@ #include "com/sun/star/beans/UnknownPropertyException.hpp" #include "com/sun/star/beans/XExactName.hpp" #include "com/sun/star/beans/XHierarchicalPropertySet.hpp" +#include "com/sun/star/beans/XHierarchicalPropertySetInfo.hpp" #include "com/sun/star/beans/XMultiHierarchicalPropertySet.hpp" #include "com/sun/star/beans/XMultiPropertySet.hpp" #include "com/sun/star/beans/XProperty.hpp" @@ -66,9 +67,9 @@ #include "type.hxx" -#if !defined INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_14 -#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_14 -#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 14 +#if !defined INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_15 +#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_15 +#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 15 #include "comphelper/implbase_var.hxx" #undef COMPHELPER_IMPLBASE_INTERFACE_NUMBER #endif @@ -99,7 +100,7 @@ class Node; class RootAccess; typedef - comphelper::WeakComponentImplHelper14< + comphelper::WeakComponentImplHelper15< com::sun::star::lang::XServiceInfo, com::sun::star::container::XHierarchicalNameAccess, com::sun::star::container::XContainer, @@ -112,6 +113,7 @@ typedef com::sun::star::beans::XMultiPropertySet, com::sun::star::beans::XHierarchicalPropertySet, com::sun::star::beans::XMultiHierarchicalPropertySet, + com::sun::star::beans::XHierarchicalPropertySetInfo, com::sun::star::container::XNameContainer, com::sun::star::lang::XSingleServiceFactory > AccessBase; @@ -404,6 +406,16 @@ private: com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException); + virtual com::sun::star::beans::Property SAL_CALL + getPropertyByHierarchicalName(rtl::OUString const & aHierarchicalName) + throw ( + com::sun::star::beans::UnknownPropertyException, + com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasPropertyByHierarchicalName( + rtl::OUString const & aHierarchicalName) + throw (com::sun::star::uno::RuntimeException); + virtual void SAL_CALL replaceByName( rtl::OUString const & aName, com::sun::star::uno::Any const & aElement) throw ( diff --git a/configmgr2/source/data.cxx b/configmgr2/source/data.cxx index 2491d09825ea..7e329ddfcbcf 100644 --- a/configmgr2/source/data.cxx +++ b/configmgr2/source/data.cxx @@ -268,8 +268,11 @@ rtl::Reference< Node > Data::resolvePath( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad path ")) + path, css::uno::Reference< css::uno::XInterface >()); } + // For backwards compatibility, allow set members to be accessed with + // simple path segments, like group members: + p = p->getMember(seg); if (setElement) { - switch (p->kind()) { + switch (par->kind()) { case Node::KIND_LOCALIZED_PROPERTY: if (templateName.getLength() != 0) { throw css::uno::RuntimeException( @@ -281,7 +284,7 @@ rtl::Reference< Node > Data::resolvePath( break; case Node::KIND_SET: if (templateName.getLength() != 0 && - !dynamic_cast< SetNode * >(p.get())->isValidTemplate( + !dynamic_cast< SetNode * >(par.get())->isValidTemplate( templateName)) { throw css::uno::RuntimeException( @@ -297,7 +300,6 @@ rtl::Reference< Node > Data::resolvePath( path), css::uno::Reference< css::uno::XInterface >()); } - p = p->getMember(seg); if (templateName.getLength() != 0 && p != 0) { rtl::OUString name(p->getTemplateName()); OSL_ASSERT(name.getLength() != 0); @@ -309,10 +311,6 @@ rtl::Reference< Node > Data::resolvePath( css::uno::Reference< css::uno::XInterface >()); } } - } else { - // For backwards compatibility, allow set members to be accessed - // with simple path segments, like group members: - p = p->getMember(seg); } } } |