diff options
author | Jörg Budischewski <jbu@openoffice.org> | 2003-05-24 22:32:14 +0000 |
---|---|---|
committer | Jörg Budischewski <jbu@openoffice.org> | 2003-05-24 22:32:14 +0000 |
commit | 361111d857df4790eff68ecb747f7529a722228b (patch) | |
tree | a0dc36be211881cd761fa7953d74c8e6747cae52 /pyuno | |
parent | 1e25103fb8b994f2588bf3ac08bd741187c0761f (diff) |
#i12504# added pyuno.invoke
Diffstat (limited to 'pyuno')
-rw-r--r-- | pyuno/source/module/pyuno_module.cxx | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx index 015857160271..5a40cb4a93b7 100644 --- a/pyuno/source/module/pyuno_module.cxx +++ b/pyuno/source/module/pyuno_module.cxx @@ -2,9 +2,9 @@ * * $RCSfile: pyuno_module.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jbu $ $Date: 2003-04-06 17:12:33 $ + * last change: $Author: jbu $ $Date: 2003-05-24 23:32:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -593,6 +593,45 @@ static PyObject * absolutize( PyObject *self, PyObject * args ) return 0; } +static PyObject * invoke ( PyObject *self, PyObject * args ) +{ + PyObject *ret = 0; + if( PyTuple_Check( args ) && PyTuple_Size( args ) == 3 ) + { + PyObject *object = PyTuple_GetItem( args, 0 ); + + if( PyString_Check( PyTuple_GetItem( args, 1 ) ) ) + { + const char *name = PyString_AsString( PyTuple_GetItem( args, 1 ) ); + if( PyTuple_Check( PyTuple_GetItem( args , 2 ))) + { + ret = PyUNO_invoke( object, name , PyTuple_GetItem( args, 2 ) ); + } + else + { + OStringBuffer buf; + buf.append( "uno.invoke expects a tuple as 3rd argument, got " ); + buf.append( PyString_AsString( PyObject_Str( PyTuple_GetItem( args, 2) ) ) ); + PyErr_SetString( PyExc_RuntimeError, buf.makeStringAndClear() ); + } + } + else + { + OStringBuffer buf; + buf.append( "uno.invoke expected a string as 2nd argument, got " ); + buf.append( PyString_AsString( PyObject_Str( PyTuple_GetItem( args, 1) ) ) ); + PyErr_SetString( PyExc_RuntimeError, buf.makeStringAndClear() ); + } + } + else + { + OStringBuffer buf; + buf.append( "uno.invoke expects object, name, (arg1, arg2, ... )\n" ); + PyErr_SetString( PyExc_RuntimeError, buf.makeStringAndClear() ); + } + return ret; +} + } using namespace pyuno; @@ -611,6 +650,7 @@ static struct PyMethodDef PyUNOModule_methods [] = {"fileUrlToSystemPath",fileUrlToSystemPath,1}, {"absolutize",absolutize,2}, {"isInterface",isInterface,1}, + {"invoke",invoke, 2}, {NULL, NULL} }; |