diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-01-30 18:13:26 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-01-30 18:13:26 +0100 |
commit | bd2c4e8dc42c04eb05adfa32a0d5ce9c72bcfd5d (patch) | |
tree | c84f3f248f97104dabf072ac65a63a3a7cc7621b /pyuno/source/module/pyuno_module.cxx | |
parent | 2356a480fea6cac8cccaae85c9a2b6a312a9048c (diff) |
Adapt PyUNO getConstantByName to previous TypeDescriptionMgr API CHANGE
Change-Id: I5a91c6c6dce103a8e4daa1572a638e1968a48fd8
Diffstat (limited to 'pyuno/source/module/pyuno_module.cxx')
-rw-r--r-- | pyuno/source/module/pyuno_module.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx index bd73c0bda544..1638abaf1787 100644 --- a/pyuno/source/module/pyuno_module.cxx +++ b/pyuno/source/module/pyuno_module.cxx @@ -37,6 +37,7 @@ #include <uno/current_context.hxx> #include <cppuhelper/bootstrap.hxx> +#include <com/sun/star/reflection/XConstantTypeDescription.hpp> #include <com/sun/star/reflection/XIdlReflection.hpp> #include <com/sun/star/reflection/XIdlClass.hpp> #include <com/sun/star/registry/InvalidRegistryException.hpp> @@ -477,18 +478,17 @@ static PyObject *getConstantByName( { OUString typeName ( OUString::createFromAscii( name ) ); Runtime runtime; - Any a = runtime.getImpl()->cargo->xTdMgr->getByHierarchicalName(typeName); - if( a.getValueType().getTypeClass() == - com::sun::star::uno::TypeClass_INTERFACE ) + css::uno::Reference< css::reflection::XConstantTypeDescription > td; + if (!(runtime.getImpl()->cargo->xTdMgr->getByHierarchicalName( + typeName) + >>= td)) { - // a idl constant cannot be an instance of an uno-object, thus - // this cannot be a constant OUStringBuffer buf; buf.appendAscii( "pyuno.getConstantByName: " ).append( typeName ); buf.appendAscii( "is not a constant" ); throw RuntimeException(buf.makeStringAndClear(), Reference< XInterface > () ); } - PyRef constant = runtime.any2PyObject( a ); + PyRef constant = runtime.any2PyObject( td->getConstantValue() ); ret = constant.getAcquired(); } } |