[Libreoffice] Create a "dynamic" dropdown menu with uno and python

Günter Heinendirk guenter.heinendirk at googlemail.com
Sat Apr 30 04:56:51 PDT 2011

Hi list,

as described in a previous mail, I try to dive into Python with UNO to 
create an extension to deal with custom slide shows.

Just to repeat: I'm not a skilled programmer but already made several 
Tools with Python for my own.

So the first thing I figured out when starting my extension with Python 
and UNO is, that the documentation is very hard to understand for me or 
not existing.

That brings me to the idea to use my small project as a challenge to 
create documentation for all that stuff I stumbled over.

Actually I have the needed function working in Python with UNO. The next 
step is to create the LibreOffice Extension and to add the needed GUI 
elements in Impress.

And here my "real" problems started:
I want to have a dropdown element in the toolbar, which allows to choose 
between the available custom slide shows. Since I didn't know, which 
custom slide shows are existing, I need to fill the dropdown element 
"dynamically" during loading of the presentation. Then I need to get 
back an event, when the user select a custom slide show.
I know, how to add a simple button and call my functions by pressing it 
but the dynamic dropdown element seems to work in different manner.

I spent so many hours to find informations about how to add a "dynamic" 
dropdown element using Python and was not really successful.
It seems, that I need a popup menu controller and I found the page 
but I do not understand most of the informations there (maybe one reason 
is, that it is based on C++ and not on Python).

Then I'm a bit confused about some other informations I found. Somewhere 
you can read, that you need to adapt a file "Controller.xcu", in other 
pages is written you need to adapt "Addons.xcu".

I was also searching for an extension which uses a dynamic dropdown and 
is programmed in Python to be able to have a look in there, but I was 
not successful.

Is anyone there, who can give me hints what to do?

Thanks a lot for answer such "Newbie" questions ...


More information about the LibreOffice mailing list