29#ifndef Py_TPFLAGS_HAVE_ITER
30# define Py_TPFLAGS_HAVE_ITER 0
32#ifndef Py_TPFLAGS_HAVE_RICHCOMPARE
33# define Py_TPFLAGS_HAVE_RICHCOMPARE 0
35#ifndef Py_TPFLAGS_HAVE_SEQUENCE_IN
36# define Py_TPFLAGS_HAVE_SEQUENCE_IN 0
42#include <unordered_map>
43#include <unordered_set>
45#include <com/sun/star/container/XIndexAccess.hpp>
46#include <com/sun/star/lang/XUnoTunnel.hpp>
47#include <com/sun/star/script/XInvocation.hpp>
52#include <osl/module.hxx>
79void log(
RuntimeCargo *cargo, sal_Int32 level, std::u16string_view logString );
82 void * ptr, std::u16string_view aFunctionName,
83 const css::uno::Sequence< css::uno::Any > & args );
85 void * ptr, std::u16string_view aFunctionName,
86 const css::uno::Any &returnValue,
87 const css::uno::Sequence< css::uno::Any > & args );
89 void * ptr, std::u16string_view aFunctionName,
90 const void * data,
const css::uno::Type & type );
96typedef std::unordered_map
99 css::uno::WeakReference< css::script::XInvocation >,
104typedef std::unordered_map
110typedef std::unordered_map
113 css::uno::Sequence< sal_Int16 >
116typedef std::unordered_set< PyRef , PyRef::Hash >
ClassSet;
122 const css::uno::Any & targetInterface,
123 const css::uno::Reference<css::lang::XSingleServiceFactory> & ssf );
126 const css::uno::Any &targetInterface,
127 const css::uno::Reference<css::lang::XSingleServiceFactory> &ssf );
142 const css::uno::Reference<css::container::XEnumeration>& xEnumeration);
156 const css::uno::Reference<css::container::XIndexAccess> &xIndexAccess);
179 const css::uno::Reference<css::script::XInvocation2> &xInv,
196PyObject *
PyUNO_invoke( PyObject *
object,
const char *name , PyObject *args );
216 css::uno::Reference< css::lang::XSingleServiceFactory >
xInvocation;
218 css::uno::Reference< css::uno::XComponentContext >
xContext;
220 css::uno::Reference< css::container::XHierarchicalNameAccess >
xTdMgr;
240 static void del( PyObject *self );
244 const css::uno::Reference< css::uno::XComponentContext > & xContext );
249 css::script::XInvocation, css::lang::XUnoTunnel >
253 css::uno::Sequence< css::uno::Type >
mTypes;
257 css::uno::Sequence< sal_Int16 >
getOutIndexes(
const OUString & functionName );
262 const css::uno::Sequence< css::uno::Type > & types );
270 virtual css::uno::Reference< css::beans::XIntrospectionAccess >
272 virtual css::uno::Any SAL_CALL
invoke(
273 const OUString& aFunctionName,
274 const css::uno::Sequence< css::uno::Any >& aParams,
275 css::uno::Sequence< sal_Int16 >& aOutParamIndex,
276 css::uno::Sequence< css::uno::Any >& aOutParam )
override;
279 const OUString& aPropertyName,
280 const css::uno::Any& aValue )
override;
282 virtual css::uno::Any SAL_CALL
getValue(
const OUString& aPropertyName )
override;
288 const css::uno::Sequence< sal_Int8 >& aIdentifier )
override;
const PyRef & getWrappedObject() const
virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection() override
Adapter(PyRef obj, const css::uno::Sequence< css::uno::Type > &types)
MethodOutIndexMap m_methodOutIndexMap
virtual css::uno::Any SAL_CALL getValue(const OUString &aPropertyName) override
virtual ~Adapter() override
virtual void SAL_CALL setValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual sal_Bool SAL_CALL hasProperty(const OUString &aName) override
css::uno::Sequence< sal_Int16 > getOutIndexes(const OUString &functionName)
virtual css::uno::Any SAL_CALL invoke(const OUString &aFunctionName, const css::uno::Sequence< css::uno::Any > &aParams, css::uno::Sequence< sal_Int16 > &aOutParamIndex, css::uno::Sequence< css::uno::Any > &aOutParam) override
virtual sal_Bool SAL_CALL hasMethod(const OUString &aName) override
PyInterpreterState * mInterpreter
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
const css::uno::Sequence< css::uno::Type > & getWrappedTypes() const
css::uno::Sequence< css::uno::Type > mTypes
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Helper class for keeping references to python objects.
The pyuno::Runtime class keeps the internal state of the python UNO bridge for the currently in use p...
void log(RuntimeCargo *cargo, sal_Int32 level, std::u16string_view logString)
void raiseInvocationTargetExceptionWhenNeeded(const Runtime &runtime)
PyObject * PyUNO_Type_new(const char *typeName, css::uno::TypeClass t, const Runtime &r)
bool isLog(RuntimeCargo const *cargo, sal_Int32 loglevel)
bool isInstanceOfStructOrException(PyObject *obj)
void logCall(RuntimeCargo *cargo, const char *intro, void *ptr, std::u16string_view aFunctionName, const css::uno::Sequence< css::uno::Any > &args)
PyObject * PyUNO_list_iterator_new(const css::uno::Reference< css::container::XIndexAccess > &xIndexAccess)
std::unordered_map< PyRef, css::uno::WeakReference< css::script::XInvocation >, PyRef::Hash > PyRef2Adapter
PyRef PyUNO_new(const Any &targetInterface, const Reference< XSingleServiceFactory > &ssf)
const sal_Int32 VAL2STR_MODE_DEEP
PyRef getCharClass(const Runtime &)
PyRef getPyUnoStructClass()
PyObject * PyUNO_ByteSequence_new(const css::uno::Sequence< sal_Int8 > &, const Runtime &r)
PyObject * PyUNO_char_new(sal_Unicode c, const Runtime &r)
int PyUNOStruct_initType()
PyRef ustring2PyString(std::u16string_view source)
const char * typeClassToString(css::uno::TypeClass t)
std::unordered_map< OUString, css::uno::Sequence< sal_Int16 > > MethodOutIndexMap
sal_Unicode PyChar2Unicode(PyObject *o)
void decreaseRefCount(PyInterpreterState *interpreter, PyObject *object)
releases a refcount on the interpreter object and on another given python object.
PyObject * PyUNO_Enum_new(const char *enumBase, const char *enumValue, const Runtime &r)
void raisePyExceptionWithAny(const css::uno::Any &anyExc)
PyRef getTypeClass(const Runtime &)
PyObject * PyUNO_iterator_new(const css::uno::Reference< css::container::XEnumeration > &xEnumeration)
PyRef getEnumClass(const Runtime &)
std::unordered_set< PyRef, PyRef::Hash > ClassSet
css::uno::Type PyType2Type(PyObject *o)
bool isInterfaceClass(const Runtime &runtime, PyObject *obj)
OUString val2str(const void *pVal, typelib_TypeDescriptionReference *pTypeRef, sal_Int32 mode)
PyRef getByteSequenceClass(const Runtime &)
void logException(RuntimeCargo *cargo, const char *intro, void *ptr, std::u16string_view aFunctionName, const void *data, const css::uno::Type &type)
OUString pyString2ustring(PyObject *str)
PyObject * PyUNO_invoke(PyObject *object, const char *name, PyObject *args)
PyRef PyUNO_callable_new(const Reference< XInvocation2 > &my_inv, const OUString &methodName, enum ConversionMode mode)
std::unordered_map< OUString, PyRef > ExceptionClassMap
PyRef getObjectFromUnoModule(const Runtime &runtime, const char *object)
PyRef ustring2PyUnicode(const OUString &source)
PyRef getClass(const OUString &name, const Runtime &runtime)
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)
css::uno::Any PyEnum2Enum(PyObject *obj)
PyRef getAnyClass(const Runtime &)
PyRef PyUNOStruct_new(const css::uno::Any &targetInterface, const css::uno::Reference< css::lang::XSingleServiceFactory > &ssf)
const sal_Int32 VAL2STR_MODE_SHALLOW
css::uno::Any wrappedObject
css::uno::Reference< css::script::XInvocation2 > xInvocation
css::uno::Reference< css::container::XEnumeration > xEnumeration
PyObject_HEAD PyUNO_iterator_Internals * members
css::uno::Reference< css::container::XIndexAccess > xIndexAccess
PyObject_HEAD PyUNO_list_iterator_Internals * members
PyObject_HEAD PyUNOInternals * members
css::uno::Reference< css::script::XTypeConverter > xTypeConverter
css::uno::Reference< css::reflection::XIdlReflection > xCoreReflection
css::uno::Reference< css::lang::XSingleServiceFactory > xInvocation
css::uno::Reference< css::container::XHierarchicalNameAccess > xTdMgr
PyRef const & getUnoModule()
PyRef2Adapter mappedObjects
css::uno::Reference< css::beans::XIntrospection > xIntrospection
css::uno::Reference< css::script::XInvocationAdapterFactory2 > xAdapterFactory
ExceptionClassMap exceptionMap
css::uno::Reference< css::uno::XComponentContext > xContext
static PyRef create(const css::uno::Reference< css::uno::XComponentContext > &xContext)
PyObject_HEAD struct RuntimeCargo * cargo
static void del(PyObject *self)