diff options
author | Matthew J. Francis <mjay.francis@gmail.com> | 2015-07-29 15:22:54 +0800 |
---|---|---|
committer | Matthew Francis <mjay.francis@gmail.com> | 2015-07-30 05:55:32 +0000 |
commit | 2387c2a46e15995686d28dccdfd455012072b4cf (patch) | |
tree | a1470932d9ab5d1aea48576d3de8dcf4df80cc67 /pyuno/source/module/pyuno_runtime.cxx | |
parent | 902255645328efde34ddf62227c8278e8dd61ff0 (diff) |
Give PyUNO structs/exceptions their own separate type
Change-Id: Ie4c42c623fae1cf39c2e4c643825c9655cd28daa
Reviewed-on: https://gerrit.libreoffice.org/17410
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Matthew Francis <mjay.francis@gmail.com>
Diffstat (limited to 'pyuno/source/module/pyuno_runtime.cxx')
-rw-r--r-- | pyuno/source/module/pyuno_runtime.cxx | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index f14b84b4baa7..0219742dcef0 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -481,7 +481,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const case typelib_TypeClass_STRUCT: { PyRef excClass = getClass( a.getValueType().getTypeName(), *this ); - PyRef value = PyUNO_new( a, getImpl()->cargo->xInvocation, false ); + PyRef value = PyUNOStruct_new( a, getImpl()->cargo->xInvocation ); PyRef argsTuple( PyTuple_New( 1 ) , SAL_NO_ACQUIRE, NOT_NULL ); PyTuple_SetItem( argsTuple.get() , 0 , value.getAcquired() ); PyRef ret( PyObject_CallObject( excClass.get() , argsTuple.get() ), SAL_NO_ACQUIRE ); @@ -556,7 +556,7 @@ PyRef Runtime::any2PyObject (const Any &a ) const if (!tmp_interface.is ()) return Py_None; - return PyUNO_new (a, getImpl()->cargo->xInvocation, true); + return PyUNO_new( a, getImpl()->cargo->xInvocation ); } default: { @@ -802,27 +802,21 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con } else if( PyObject_IsInstance( o, getPyUnoClass().get() ) ) { - PyUNO* o_pi; - o_pi = reinterpret_cast<PyUNO*>(o); - if (o_pi->members->wrappedObject.getValueTypeClass () == - com::sun::star::uno::TypeClass_STRUCT || - o_pi->members->wrappedObject.getValueTypeClass () == - com::sun::star::uno::TypeClass_EXCEPTION) - { - Reference<XMaterialHolder> my_mh (o_pi->members->xInvocation, UNO_QUERY); + PyUNO* o_pi = reinterpret_cast<PyUNO*>(o); + a = o_pi->members->wrappedObject; + } + else if( PyObject_IsInstance( o, getPyUnoStructClass().get() ) ) + { + PyUNO* o_pi = reinterpret_cast<PyUNO*>(o); + Reference<XMaterialHolder> my_mh (o_pi->members->xInvocation, UNO_QUERY); - if (!my_mh.is ()) - { - throw RuntimeException( - "struct wrapper does not support XMaterialHolder" ); - } - else - a = my_mh->getMaterial (); - } - else + if (!my_mh.is()) { - a = o_pi->members->wrappedObject; + throw RuntimeException( + "struct wrapper does not support XMaterialHolder" ); } + else + a = my_mh->getMaterial(); } else if( PyObject_IsInstance( o, getCharClass( runtime ).get() ) ) { |