Skip to content
Howard edited this page Jan 10, 2017 · 3 revisions

Table of Contents

Setup

First under Tools - Code make sure that the Code item is check marked. This will enable the code generation field (window). Also you might want to choose a programming language there.

Next open the code text field (window) by either pressing Ctrl-H or double right clicking at the right bottom corner of the information text field.

The code text field (window) appears below the main information window (with Properties | Methods | Interfaces | Services) and can be resized by dragging the border.

Pseud Property

If the selected language supports the pseud-property, then the code is generated with a pseud-property call.

Code generation details

Because MRI can be called from UNO components, scripting code, menu entries, etc. it's impossible to know how the generated code will be called. Therefore it's difficult to generate perfect code and so sometimes the generated code is not executable without further modification.

Type introspection details

MRI tries to get value types from both the css.reflection.XMethodIdl interface and the Reflection API, however sometimes there are less-typed values like an "Any" type of UNO.

Also typically, com.sun.star.beans.PropertyValue struct has string Name value, any Value and so on, the value retained by Value element is not well defined by the object.

Sometimes types are defined by the other service like com.sun.star.document.MediaDescriptor etc.

So, you need to check the type of values taken from any type.

The same problems occur with method return values.

And sometimes even numerical values taken as "Any" are miss typed.

Adding a New Code Generator

You can add new code generator.

Open the extension installed directory and goto the pythonpath/mytools_Mri/generators directory. Make a new code generator according to "code_generator.py" file and add new generator definition to "generators.py" file. New generator will be shown in the Tools - Code menu.

Additional informations about code generators:

  • You needs to know type mappings between UNO and your desired language like a listed TypeMappings.
  • Creation on your desired language like structs, enums, services and so on.
Clone this wiki locally