21#include <osl/diagnose.h> 
   23#include <com/sun/star/script/CannotConvertException.hpp> 
   24#include <com/sun/star/script/XInvocation2.hpp> 
   28using com::sun::star::uno::Any;
 
   29using com::sun::star::uno::RuntimeException;
 
   30using com::sun::star::script::XInvocation2;
 
   36struct PyUNO_callable_Internals
 
   55    me = 
reinterpret_cast<PyUNO_callable*
>(self);
 
   61    PyObject* self, PyObject* args, SAL_UNUSED_PARAMETER PyObject*)
 
   71    me = 
reinterpret_cast<PyUNO_callable*
>(self);
 
   80        if (any_params.getValueTypeClass () == css::uno::TypeClass_SEQUENCE)
 
   82            any_params >>= aParams;
 
   86            aParams = { any_params };
 
   96                         me->members->methodName, aParams );
 
  100            ret_value = me->members->xInvocation->invoke (
 
  101                me->members->methodName, aParams, aOutParamIndex, aOutParam);
 
  107                          me->members->methodName, ret_value, aOutParam);
 
  113        if( aOutParam.getLength() )
 
  115            PyRef return_list( PyTuple_New (1+aOutParam.getLength()), SAL_NO_ACQUIRE, 
NOT_NULL );
 
  120            for( 
i = 1 ; 
i < 1+aOutParam.getLength() ; 
i ++ )
 
  122                Py_INCREF( Py_None );
 
  123                PyTuple_SetItem( return_list.
get() , 
i , Py_None );
 
  126            for( 
i = 0 ; 
i < aOutParam.getLength() ; 
i ++ )
 
  138    catch( 
const css::reflection::InvocationTargetException & e )
 
  144                          me->members->methodName, e.TargetException.getValue(), e.TargetException.getValueTypeRef());
 
  148    catch( 
const css::script::CannotConvertException &e )
 
  153                          me->members->methodName, &e, 
cppu::UnoType<
decltype(e)>::get().getTypeLibType());
 
  157    catch( 
const css::lang::IllegalArgumentException &e )
 
  162                          me->members->methodName, &e, 
cppu::UnoType<
decltype(e)>::get().getTypeLibType());
 
  166    catch (
const css::uno::RuntimeException &e)
 
  171                          me->members->methodName, &e, 
cppu::UnoType<
decltype(e)>::get().getTypeLibType());
 
  182    PyVarObject_HEAD_INIT( &PyType_Type, 0 )
 
  184    sizeof (PyUNO_callable),
 
  187#
if PY_VERSION_HEX >= 0x03080000
 
  233#
if PY_VERSION_HEX >= 0x03040000
 
  235#
if PY_VERSION_HEX >= 0x03080000
 
  237#
if PY_VERSION_HEX < 0x03090000
 
  239#pragma clang diagnostic push
 
  240#pragma clang diagnostic ignored 
"-Wdeprecated-declarations" 
  244#pragma clang diagnostic pop
 
  256    PyUNO_callable* self;
 
  258    OSL_ENSURE (my_inv.is(), 
"XInvocation must be valid");
 
  264    self->members = 
new PyUNO_callable_Internals;
 
  265    self->members->xInvocation = my_inv;
 
  267    self->members->mode = 
mode;
 
  269    return PyRef( 
reinterpret_cast<PyObject*
>(self), SAL_NO_ACQUIRE );
 
Helper class for keeping references to python objects.
 
PyObject * get() const noexcept
 
PyObject * getAcquired() const
 
helper class for detaching the current thread from the python runtime to do some blocking,...
 
The pyuno::Runtime class keeps the internal state of the python UNO bridge for the currently in use p...
 
css::uno::Any pyObject2Any(const PyRef &source, enum ConversionMode mode=REJECT_UNO_ANY) const
converts a Python object to a UNO any
 
PyRef any2PyObject(const css::uno::Any &source) const
converts something contained in a UNO Any to a Python object
 
RuntimeImpl * getImpl() const
Returns the internal handle.
 
bool isLog(RuntimeCargo const *cargo, sal_Int32 loglevel)
 
void logCall(RuntimeCargo *cargo, const char *intro, void *ptr, std::u16string_view aFunctionName, const css::uno::Sequence< css::uno::Any > &args)
 
static PyObject * PyUNO_callable_call(PyObject *self, PyObject *args, SAL_UNUSED_PARAMETER PyObject *)
 
static PyTypeObject PyUNO_callable_Type
 
void raisePyExceptionWithAny(const css::uno::Any &anyExc)
 
void logException(RuntimeCargo *cargo, const char *intro, void *ptr, std::u16string_view aFunctionName, const void *data, const css::uno::Type &type)
 
@ NOT_NULL
definition of a no acquire enum for ctors
 
static void PyUNO_callable_del(PyObject *self)
 
PyRef PyUNO_callable_new(const Reference< XInvocation2 > &my_inv, const OUString &methodName, enum ConversionMode mode)
 
void logReply(RuntimeCargo *cargo, const char *intro, void *ptr, std::u16string_view aFunctionName, const css::uno::Any &returnValue, const css::uno::Sequence< css::uno::Any > &args)
 
PyObject_HEAD PyUNO_callable_Internals * members
 
Reference< XInvocation2 > xInvocation
 
css::uno::Reference< css::lang::XSingleServiceFactory > xInvocation
 
PyObject_HEAD struct RuntimeCargo * cargo